I could not run the command
object.modifier_add
as explained here. What's up with this?
1 Answer
The string you type in the shortcut configuration screen is not Python code. It just happens to look somewhat similar to it. To run the operator as Python code, prefix it with bpy.ops
, so bpy.ops.object.modifier_add()
.
However, it's better to not use operators at all, and use a regular Python function instead:
bpy.context.active_object.modifiers.new('operatorname', 'BEVEL')
See the documentation for more info on all the operator type names. This function returns the new modifier, so you can set properties on it directly.
-
$\begingroup$ have voted your answer. it seems i find the solution,thkyou $\endgroup$ May 7, 2018 at 22:26
-
$\begingroup$ cause i am a new guys.why i cant write another answer instead of my last deleted one by moderator??...........So I cant past the answer here.emmmm............... $\endgroup$ May 7, 2018 at 22:30
object.modifier_add
in python console? Be like putting milk in your petrol tank and wondering why your car wont start. Add it in the keymap editor $\endgroup$