Post #266: Mighty Pea:
π Metadata
- Author: roaoao
- Date: 2016-08-04 06:21:05
- Type:
answer - Quality Score: 9/10
- Reply to: post_00265
π·οΈ Tags
βοΈ Related PME Features
- Macro Editor
- Python Scripting
π¬ Content
Mighty Pea:
Would it be possible to set it up so tools that only work in a certain mode can automatically enable said mode?
For example, flip normals in object mode would automatically go to edit mode, or deleting a modifier (which canβt be done in edit mode) would take you into object mode.
Possibly it would even take you back to the mode you were in before, so it wouldnβt interrupt your workflow at all?
Yes its possible. You need to modify your command using this template:
obj_mode = C.active_object.mode; O.object.mode_set(mode='REQUIRED_OBJECT_MODE'); YOUR_COMMAND; O.object.mode_set(mode=obj_mode)
Flip Normals:
obj_mode = C.active_object.mode; O.object.mode_set(mode='EDIT'); O.mesh.flip_normals(); O.object.mode_set(mode=obj_mode)
Delete Modifier:
obj_mode = C.active_object.mode; O.object.mode_set(mode='OBJECT'); O.object.modifier_remove(modifier="Subsurf"); O.object.mode_set(mode=obj_mode)
You can find other object modes here.