2
$\begingroup$

I am experiencing a problem with adding Custom properties to bpy.types.VertexGroup

I have added custom properties to various types before, Object, Material, etc.

>>> C.active_object.niftools_constraint
bpy.data.objects['Cube'].niftools_constraint

However looking at the one for the VertexGroup I get the following and am unable to see the defined properties of the Property group

>>> C.active_object.vertex_groups.active.niftools_skin_data
(<built-in function PointerProperty>, 
{'description': 'Additional vertex group properties used by the Nif File Format', 
'name': 'Niftools Vertex Group Property', 
'type': <class '__main__.VertexGroupProperty'>})

The sample code show a working custom Object property and the non-working VertexGroup property.

import bpy
from bpy.types import PropertyGroup
from bpy.props import (PointerProperty,

class ObjectCollision(PropertyGroup):
    @classmethod
    def register(cls):
        bpy.types.Object.niftools_constraint = PointerProperty(
                        name='Constraint Property',
                        description='Additional constraint properties used by the Nif File Format',
                        type = cls
                        )

        cls.LHMaxFriction = FloatProperty(
                        name='LHMaxFriction',
                        description='Havok limited hinge max friction.',
                        )
        cls.tau = FloatProperty(
                        name='tau',
                        description='Havok limited hinge max friction.',
                        )
        cls.damping = FloatProperty(
                        name='damping',
                        description='Havok limited hinge max friction.',
                        )

    @classmethod
    def unregister(cls):
        del bpy.types.Object.niftools_constraint

class VertexGroupProperty(PropertyGroup):
    @classmethod
    def register(cls):
        bpy.types.VertexGroup.niftools_skin_data = PointerProperty(
                        name='Niftools Vertex Group Property',
                        description='Additional vertex group properties used by the Nif File Format',
                        type = cls
                        )

        cls.blah = BoolProperty(
                        name=('bonedata'), 
                        description='None',
                        default = False
                        )

    @classmethod
    def unregister(cls):
        del bpy.types.VertexGroup.niftools_skin_data


def register():
    bpy.utils.register_class(ObjectCollision)

    bpy.utils.register_class(VertexGroupProperty)

def unregister():
    bpy.utils.unregister_class(ObjectCollision)
    bpy.utils.unregister_class(VertexGroupProperty)

if __name__ == "__main__":
    register()
$\endgroup$

1 Answer 1

4
$\begingroup$

Quote from the api documentation:

Custom properties can be added to any subclass of an ID, Bone and PoseBone.

VertexGroup does not inherit from ID.

$\endgroup$
1

You must log in to answer this question.

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