Setting operator parameters features

When you make a button in a custom UI to call the operator with passing the necessary parameters to it, pay attention that only the parameters specified explicitly will be sent to the operator. Other operator parameters will remain with default values.

For example, we need to execute the “transform_apply” operator – applying object transformations with applying just the scale.

If we call the operator as follows:

But all transformation (scale, rotation, and position) will still be applied to the object.

This happens because the “transform_apply” operator has all the parameters set to “True” by default, and the additional “scale = True” does not change anything in the statement. It is still called as:

To execute this operator only for applying scale, it must be defined as follows:

In this case, only the scale will be applied when calling the operator.

Nikita

Author: Nikita

Blender add-ons developer and articles writer.