2

I want to register a collection of my custom CurveObjects. Every CurveObject has a collection of CurvePoints. I'm trying to make a CurveObject with a collection of CurvePoints. But i fail to register CurveObject.

Here is my code:

class MR_CurvePoint(bpy.types.PropertyGroup):
    y = BoolProperty(
        name="y",
        description="y...",
        default=False
    )


class MR_CurveObject(bpy.types.PropertyGroup):
    x = CollectionProperty(
        name="x",
        description="x...",
        type = MR_CurvePoint,
        default=None
    )

...

def register():
    bpy.types.Scene.my_curve_object = CollectionProperty(
        name="Mira Tool Variables",
        type=MR_CurveObject,
        description="Mira Curve"
    )

My log when i try to register:

Traceback (most recent call last): File "C:\mifth\blender\2.73\scripts\modules\bpy\utils.py", line 600, in register_module register_class(cls) ValueError: bpy_struct "MR_CurveObject" registration error: x could not register

Is it possible to register Collection inside of Collection?

Thanks.

mifth
  • 2,341
  • 28
  • 36

1 Answers1

2

Ahhhh! It seems I had to remove Default value from CollectionProperty. It was my mistake. Here is working code:

class MR_CurvePoint(bpy.types.PropertyGroup):
    y = BoolProperty(
        name="y",
        description="y...",
        default=False
    )


class MR_CurveObject(bpy.types.PropertyGroup):
    x = CollectionProperty(
        name="x",
        description="x...",
        type = MR_CurvePoint,
    )

...

def register():
    bpy.types.Scene.my_curve_object = CollectionProperty(
        name="Mira Tool Variables",
        type=MR_CurveObject,
        description="Mira Curve"
    )
mifth
  • 2,341
  • 28
  • 36