Skip to content

Instantly share code, notes, and snippets.

@IARI
Last active June 16, 2018 09:06
Show Gist options
  • Save IARI/95d71a08fc767eb166023f3128ff90ec to your computer and use it in GitHub Desktop.
Save IARI/95d71a08fc767eb166023f3128ff90ec to your computer and use it in GitHub Desktop.
Blender Pointerproperty Test
bl_info = {"name": "PointerProperty Test Addon", "category": "User"}
import bpy
class PointerPropertyPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "PointerProperty TestPanel"
bl_idname = "OBJECT_PT_pointerPropTest"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_context = "object"
@classmethod
def poll(cls, context):
return context.object is not None
def draw(self, context):
self.layout.prop(context.object, 'test_pointerproperty')
self.layout.prop(context.object.test_pointerproperty_group, 'test')
class PointerPropertyTestGroup(bpy.types.PropertyGroup):
test = bpy.props.PointerProperty(type=bpy.types.Object, name="NestedPointer")
def register():
bpy.utils.register_class(PointerPropertyPanel)
bpy.utils.register_class(PointerPropertyTestGroup)
bpy.types.Object.test_pointerproperty = bpy.props.PointerProperty(type=bpy.types.Object)
bpy.types.Object.test_pointerproperty_group = bpy.props.PointerProperty(type=PointerPropertyTestGroup)
def unregister():
bpy.utils.unregister_class(PointerPropertyPanel)
bpy.utils.unregister_class(PointerPropertyTestGroup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment