Paste Code
Paste Blends
Paste Images
# create two classes
class DummyLayer(bpy.types.IDPropertyGroup):
pass

class DummyEngine(bpy.types.IDPropertyGroup):
pass

# register first, only then add properties (for now)
bpy.types.register(DummyLayer)
bpy.types.register(DummyEngine)

# add properties to DummyEngine
DummyEngine.EnumProperty(attr="option", items=(("OPTION_A", "Option A", "Description of option A."), ("OPTION_B", "Option B", "Description of option B.")), name="Option", description="", default="OPTION_B")
DummyEngine.CollectionProperty(attr="layers", type=DummyLayer, name="Layers", description="")

# add property to Scene
Scene = bpy.types.Scene
Scene.PointerProperty(attr="dummy", type=DummyEngine, name="Dummy", description="")

# collection manipulation, assuming we have a scene pointer
scene.dummy.layers.add()
scene.dummy.layers.remove(0)

# button layout
dummy = scene.dummy
layout.itemR(dummy, "option", expand=True)
layout.itemR(dummy, "layers")
  1. # create two classes
  2. class DummyLayer(bpy.types.IDPropertyGroup):
  3.     pass
  4.  
  5. class DummyEngine(bpy.types.IDPropertyGroup):
  6.     pass
  7.  
  8. # register first, only then add properties (for now)
  9. bpy.types.register(DummyLayer)
  10. bpy.types.register(DummyEngine)
  11.  
  12. # add properties to DummyEngine
  13. DummyEngine.EnumProperty(attr="option", items=(("OPTION_A", "Option A", "Description of option A."), ("OPTION_B", "Option B", "Description of option B.")), name="Option", description="", default="OPTION_B")
  14. DummyEngine.CollectionProperty(attr="layers", type=DummyLayer, name="Layers", description="")
  15.  
  16. # add property to Scene
  17. Scene = bpy.types.Scene
  18. Scene.PointerProperty(attr="dummy", type=DummyEngine, name="Dummy", description="")
  19.  
  20. # collection manipulation, assuming we have a scene pointer
  21. scene.dummy.layers.add()
  22. scene.dummy.layers.remove(0)
  23.  
  24. # button layout
  25. dummy = scene.dummy
  26. layout.itemR(dummy, "option", expand=True)
  27. layout.itemR(dummy, "layers")
  28.  
go to heaven