Post #427: Hey Roaoao,
📋 Metadata
- Author: Michael_Knubben
- Date: 2016-11-10 06:21:50
- Type:
question - Quality Score: 7/10
- Replies (1): post_00428
🏷️ Tags
macro scripting intermediate unsolved
⚙️ Related PME Features
- Macro Editor
- Python Scripting
💬 Content
Hey Roaoao,
I’ve got a button based on example code you gave me that adds a Simple Deform modifier if there’s none present, and otherwise presents me with the Angle controls, but:
Would it be possible to set some of the Modifier’s settings on creation?
For instance, I’d like to set the type to Bend and the angle to 360 by default.
The script I’m using:
mods = [m for m in C.active_object.modifiers if m.type == ‘SIMPLE_DEFORM’]; m = mods and mods[0]; L.prop(m, “angle”, “angle”) if m else operator(L, “object.modifier_add”, “Add Bend”, ‘ZOOMIN’, type=‘SIMPLE_DEFORM’)
I asked a friend for help, but he couldn’t quite figure it out. He did ask me to make this feature request, to allow conditional loading of external scripts, like this:
mods = [m for m in C.active_object.modifiers if m.type == ‘SIMPLE_DEFORM’]; m = mods and mods[0]; L.prop(m, “angle”, “angle”) if m else execute_script(“scripts/simple_bend.py”)