2
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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"
    )
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.