Hello I want my button to be disabled when a certain variable from a enum list property has been selected and enabled again when some other variable has been selected. How can I achieve this?
sample code:
def draw(self, context):
layout = self.layout
scene = context.scene
addonPrefs = scene.addon
layout.prop(addonPrefs, "variables")
layout.operator(addonExec.bl_idname, text="SAMPLE", icon="RENDER_RESULT")
#Results I want -> if addonPrefs.variables == "foo": disable operator button; else: enable operator button
pollfunction https://blender.stackexchange.com/questions/19416/what-do-operator-methods-do-poll-invoke-execute-draw-modal – Harry McKenzie Jul 09 '22 at 14:49if/then/elsewith the test returning true if you want enabled. Don't have an else clause if you want to not display. Have an else clause that draws a label instead if you want to show disabled. AFAICTUILayout.operatordoesn't have a 'display disabled' option. – Marty Fouts Jul 09 '22 at 15:48