I'm trying to create a drop-down menu in a custom panel in my add-on.
I created an operator housing just the enumerator:
class RENDER_PT_render_finish_mode(bpy.types.Operator):
"""Select a mode"""
bl_label = "Render Finish Mode"
bl_idname = "render.finish_mode"
bl_options = {'REGISTER', 'UNDO'}
rf_enum : bpy.props.EnumProperty(
name= "Render Finish Mode:",
description = "Choose what to do when render has finished.",
items = [
('OP1', "Shutdown", "Shuts down when finished"),
('OP2', "Hibernate", "Hibernates when finished")
]
)
And later on, within my panel I did this:
[Panel intro, other items...]
[draw code]
row.scale_y = 1.0
layout.prop(RENDER_PT_render_finish_mode, "rf_enum")
[rest of panel...]
What should this say instead of RENDER_PT_render_finish_mode
?
That's presumably the bit that's incorrect, but how do I reference the operator class containing my enum?
I'd already tried having the enumerator done entirely in the panel class, but couldn't get that to work either. Maybe that would be the better way to do it if I knew how.
bpy.types.Scene
because this mostly stays consistent in a projet, or you have to define your operator withop = layout.operator("render.finish_mode")
and THEN access the propertyop.rf_enum = ...
$\endgroup$invoke
method instead. See docs.blender.org/api/current/… and stackoverflow.com/q/51135822 $\endgroup$op = layout.operator("render.finish_mode")
) Would it go in my Panel class, the global space or somewhere else? $\endgroup$