2
$\begingroup$

I was trying to call this function as a modal through code but unfortunately when I execute bpy.ops.mesh.transform.resize(long list of values here), it applies the function directly and I want this as a modal just like when I press the "S" key triggered through code.

$\endgroup$
4
  • $\begingroup$ I haven't worked with modal operators yet, but there are some modal script templates shipped with blender that might be a source of seeing how it works. $\endgroup$ Jun 24, 2017 at 1:24
  • $\begingroup$ I know how to make custom modal functions, but how do I access the existing modals like the resize(face,vert,edge), knife tool,etc ? $\endgroup$
    – Retrax
    Jun 24, 2017 at 1:28
  • $\begingroup$ To adjust the properties used by an operator, which is referred to "redoing" the operator, you can use the operator panel at the bottom of the toolbar or press F6. $\endgroup$
    – sambler
    Jun 24, 2017 at 7:02
  • $\begingroup$ No, this isnt what I'm asking, I'm asking how do I execute the existing modal functions like the resize, scale, knife tool.etc through code. $\endgroup$
    – Retrax
    Jun 24, 2017 at 13:50

1 Answer 1

3
$\begingroup$

You can achieve the behavior you desire ( user interaction ) by explicitly passing the execution context (INVOKE_DEFAULT) as the first argument.

bpy.ops.mesh.transform.resize('INVOKE_DEFAULT', ......)

The default execution context is 'EXEC_DEFAULT' and is implicit for all operators. In such a case just the execute() method defined for the operator is called using the default or passed operator properties. But in case an operator defines an invoke/modal method and 'INVOKE_DEFAULT' is the execution context, either an operator properties user interface can be used to execute the operator or can be run modally or both.

Further details can be found at the links below:

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .