3
$\begingroup$

I'm having a bit of a weird situation. I have one Property Group which I am successfully registering, and another seemingly identical one that fails to register. I have no idea why.

These are my two Property Groups - the Shared one is working, but the UiState isn't.

class Props:

    class UiState(bpy.types.PropertyGroup):
        """These props are just used for temporary UI state"""
        prompt_to_restart_blender : bpy.props.BoolProperty(name="Finished Syncing Presets", default=False)

    class Shared(bpy.types.PropertyGroup):
        """These are normal global properties"""
        default_wall_height : bpy.props.FloatProperty(name= "Default Height (feet)", soft_min=0,soft_max=10,  default=8)
        wall_dimension_format : bpy.props.EnumProperty(
            name="Wall Dimension Format",
            description="What is the text format of wall measurements?",
            items={
                ("FEET_AND_INCHES", "feet_and_inches", "Feet & Inches"),
                ("INCHES", "inches", "Inches")
            },
            default="FEET_AND_INCHES"
        )

As you can see here, I am registering these in the same way:

def register():
    bpy.types.Scene.shared_props = bpy.props.PointerProperty(type=Props.Shared)
    bpy.types.Scene.ui_state_props = bpy.props.PointerProperty(type=Props.UiState)

I'm getting this error:

TypeError: PointerProperty(...) expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

[traceback elided]

bpy.types.Scene.ui_state_props = bpy.props.PointerProperty(type=Props.UiState) ValueError: bpy_struct "Scene" registration error: ui_state_props could not register

What am I doing wrong?

$\endgroup$
2
  • $\begingroup$ @MartyFouts Ahh thanks $\endgroup$ Commented Oct 29, 2021 at 21:24
  • $\begingroup$ Feel free to leave an answer saying that I forgot to register it. $\endgroup$ Commented Oct 29, 2021 at 21:24

1 Answer 1

3
$\begingroup$

The problem is in the first line of the error message:

TypeError: PointerProperty(...) expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

You have to register before you can assign it as a pointer property

$\endgroup$
1
  • $\begingroup$ >>> bpy.utils.register_class(PointerProperty) Traceback (most recent call last): File "<blender_console>", line 1, in <module> ValueError: register_class(...): expected a class argument, not 'builtin_function_or_method' $\endgroup$
    – Phil
    Commented Jun 5, 2022 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .