3
$\begingroup$

How to register a single property (not a property group) in blender 2.8?

My attempt

This is what I am doing at the moment inside my addon __init__.py:

# ...
bpy.types.Material.myprop = bpy.props.PointerProperty(type=MyProp)
# ...

with MyProp class:

class MyProp(bpy.types.Property):
    name: "Some name"
    description: "Some description"

The idea is so I can see access this property through:

bpy.data.materials['Material'].myprop

Here's the error I am getting when loading the add-on:

bpy.types.Material.myprop = bpy.props.PointerProperty(type=Myprop)
ValueError: bpy_struct "Material" registration error: myprop could not register
$\endgroup$

1 Answer 1

5
$\begingroup$

Silly me... This is what I was looking for:

bpy.types.Material.myprop = bpy.props.FloatProperty(name="myprop")

Reference:

Assigning property to existing class

$\endgroup$

You must log in to answer this question.

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