Hi and thanks for any help in advance.
I have two dropdowns. On the change of the first dropdown, I want to repopulate the options of the second dropdown. Here is some demo code, but in my real world use my first dropdown is used to select the “Asset Type” (prop, character etc) and then the second dropdown would be for the actual “Asset Name” (Rock, Chair, Plant, Tree).
class ADDONAME_OT_TemplateOperator(bpy.types.Operator):
bl_label = "Template Operator"
bl_idname = "wm.template_operator"
def changed_dropdown_one(self, context):
print('Dropdown one changed')
# My problem is below, dropdown_two.items here error's out
# I tried using "self" and "context" but I don't understand how to get to
dropdown_two.items = [(
('option_3', 'Changed', 'tool tip'),
('option_4', 'Them', 'tool tip'),
)]
dropdown_one: bpy.props.EnumProperty(
name="awd",
description="",
items=[
('option_1', 'First', 'tool tip'),
('option_2', 'Second', 'tool tip'),
],
update=changed_dropdown_one
)
dropdown_two: bpy.props.EnumProperty(
name="",
description="",
items=[
('option_1', 'First', 'tool tip'),
('option_2', 'Second', 'tool tip'),
]
)
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self)
def draw(self, context):
layout = self.layout
layout.prop(self, "dropdown_one")
layout.prop(self, "dropdown_two")
def execute(self, context):
return {'FINISHED'}
Thanks