0
$\begingroup$

When you use UILayout().operator(), it returns an OperatorProperties() object to which you can assign default properties with which to invoke the operator.

E.G:

def draw(self, context):
    op = self.layout.operator('object.some_operator')
    op.setting = 5
    op.value = "Seven"

Is it possible to access these settings from the .poll() method of the operator, to selectively grey out operator buttons depending on settings?

$\endgroup$
1
  • $\begingroup$ Can get the defaults of the properties from the __annotations__ property of class passed to poll class method. Suggest the draw method above is assigning values to the properties as opposed to being the default defined to the property. Could be a candidate for an operator enum, where populating items based on context, is akin to polling. $\endgroup$
    – batFINGER
    Jun 14 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.