0

When I run this code, group property shows up. However self property doesn't show up. Maybe the property path is wrong. Can you help me please :)

import bpy

class PropertyAsGroup(bpy.types.PropertyGroup):
    group_property = bpy.props.FloatVectorProperty()
    # ...etc ..

class AddonPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "Hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = 'Tools'
    self_property = bpy.props.FloatVectorProperty()

    def draw(self, context):
        layout = self.layout
        scn = context.scene

        # ui
        col = layout.column()
        row = col.row(align=True)
        row.prop(scn.my_addon, 'group_property', text='group')
        row.prop(self, 'self_property', text='self')

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.my_addon = bpy.props.PointerProperty(type=PropertyAsGroup)

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.my_addon

if __name__ == '__main__':
    register()
  • You already answered your own question. Adding custom properties to a panel class is not supported (for scope reasons), see: https://docs.blender.org/api/blender_python_api_current/bpy.props.html and https://blender.stackexchange.com/a/57332/31447 – brockmann Jun 04 '18 at 12:29
  • Thank you, both links are very helpful. I was struggling to find documentation. – Muhammed Kadir TAN Jun 05 '18 at 13:38

0 Answers0