PropertyGroup(bpy_struct)

Custom Properties

PropertyGroups are the base class for dynamically defined sets of properties.

They can be used to extend existing blender data with your own types which can be animated, accessed from the user interface and from python.

Note

The values assigned to blender data are saved to disk but the class definitions are not, this means whenever you load blender the class needs to be registered too.

This is best done by creating an add-on which loads on startup and registers your properties.

Note

PropertyGroups must be registered before assigning them to blender data.

See also

Property types used in class declarations are all in bpy.props

import bpy


class MyPropertyGroup(bpy.types.PropertyGroup):
    custom_1: bpy.props.FloatProperty(name="My Float")
    custom_2: bpy.props.IntProperty(name="My Int")


bpy.utils.register_class(MyPropertyGroup)

bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)


# test this worked
bpy.data.objects[0].my_prop_grp.custom_1 = 22.0

base class — bpy_struct

subclasses — OperatorFileListElement, OperatorMousePath, OperatorStrokeElement, SelectedUvElement

class bpy.types.PropertyGroup.PropertyGroup(bpy_struct)

Group of ID properties

name

Unique name used in the code and scripting

Type

string, default “”, (never None)

classmethod bl_rna_get_subclass(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The RNA type or default when not found.

Return type

bpy.types.Struct subclass

classmethod bl_rna_get_subclass_py(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The class or default when not found.

Return type

type

Inherited Properties

  • bpy_struct.id_data

Inherited Functions

  • bpy_struct.as_pointer

  • bpy_struct.driver_add

  • bpy_struct.driver_remove

  • bpy_struct.get

  • bpy_struct.is_property_hidden

  • bpy_struct.is_property_overridable_library

  • bpy_struct.is_property_readonly

  • bpy_struct.is_property_set

  • bpy_struct.items

  • bpy_struct.keyframe_delete

  • bpy_struct.keyframe_insert

  • bpy_struct.keys

  • bpy_struct.path_from_id

  • bpy_struct.path_resolve

  • bpy_struct.pop

  • bpy_struct.property_overridable_library_set

  • bpy_struct.property_unset

  • bpy_struct.type_recast

  • bpy_struct.values

References

  • CompositorNodeCustomGroup.interface

  • CompositorNodeGroup.interface

  • NodeCustomGroup.interface

  • NodeGroup.interface

  • NodeGroupInput.interface

  • NodeGroupOutput.interface

  • PropertyGroupItem.collection

  • PropertyGroupItem.group

  • PropertyGroupItem.idp_array

  • ShaderNodeCustomGroup.interface

  • ShaderNodeGroup.interface

  • SimulationNodeGroup.interface

  • TextureNodeGroup.interface