I am trying to specify an enum property within a class but it always fails when I register the class.
import bpy
class cls_rParticle(bpy.types.PropertyGroup):
size = bpy.props.FloatProperty(name="size", description="The current size of this particle.")
display_type = bpy.props.EnumProperty(name="display_type", items=('NONE','POINT','LINE','ICON','RENDERED'), default='NONE')
alive_state = bpy.props.EnumProperty(name="alive_state", items=('DEAD','UNBORN','ALIVE','DYING'), default='DEAD')
bpy.utils.register_class(cls_rParticle)
NOTE: If I comment the EnumProperty lines of code the class does register. If I don’t register the class and leave the EnumProperty lines uncommented I do not get a syntax error.
I’m not sure why it does not work. Some kind of language barrier?
Aren’t you supposed to affect a list of three items tuples in the ‘items’ property of the enum ?
items = [(‘NONE’, “nothing”, “this is just nothing”), (‘POINT’, “single point”, "this is a point),…]
The first item of the tuple is the value of the property, the second one is what will be displayed at the screen and the third one is a small description that appears in some help pop-ups. Is it a good idea to make those three items equal to each other ?
I think in my case it might be OK if they are all the same value. I don’t plan on displaying them. I was just trying to emulate the internal API in a class.