Skip to main content
Became Hot Network Question
Tweeted twitter.com/StackBlender/status/1537495241120522240
edited title
Link
Gorgious
  • 33.3k
  • 2
  • 54
  • 107

Python: use Blender's internal enums How can I copy builtin enum items in a new property? (Addon development)

Source Link

Python: use Blender's internal enums? (Addon development)

A problem I often encounter when making a custom operator is that I must create properties that mirror properties already in Blender. If these properties are floats or ints or strings, it's no big deal, but if they are enums, it's a pain (literally, I've got arthritis).

For example, if I want to create a cube and then add a bevel modifier, the bevel modifier has an "offset_type" property, which is an enum.

I can of course create an enum that mirrors the options in the native enum, but is it possible to somehow to access the enum that must already exist somewhere in Blender? I would have an "register/undo" properties panel populated by a draw function.

# in my draw function, # instead of this: layout.prop(self, 'my_offset_enum') # I'd like to do something like: layout.prop(bpy.some_class_in_blender, "blenders_offset_enum")