1
$\begingroup$

I already created a custom t panel and use the custom properties often, was hoping to add them to the panel, but do not know how to grab the custom properties panel and copy it to my t panel. Any help is appreciated.

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Here is the answer from Custom properties on an action, any place for UI visibility?

Add a custom property panel to the Action Editor, much the same way as it is added to other parts of the UI. Import the rna_prop_ui.PropertyPanel class and set the path from context to "object.animation_data.action" and the type to bpy.types.Action.

The default bl_label if not defined is "Custom Properties".

enter image description here

import bpy

from bpy.types import Panel
from rna_prop_ui import PropertyPanel


class ACTION_PT_custom_props(PropertyPanel, Panel):
    bl_label = "Action Properties"
    bl_idname = "ACTION_PT_custom_props"
    bl_space_type = 'DOPESHEET_EDITOR'
    bl_region_type = 'UI'
    # required for PropertyPanel
    #COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
    _context_path = "object.animation_data.action"
    _property_type = bpy.types.Action

    @classmethod
    def poll(self, context):
        obj = getattr(context, "object", None)
        ad = getattr(obj, "animation_data", None)
        action = getattr(ad, "action", None)
        return action is not None

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

def unregister():
    bpy.utils.unregister_class(ACTION_PT_custom_props)

if __name__ == "__main__":  # only for live edit.
    register()

Note this example is for actions. For object

    _context_path = "object"
    _property_type = bpy.types.Object
$\endgroup$
1
  • 1
    $\begingroup$ You are the best. Thank you so much!! $\endgroup$
    – Nburgess
    Apr 16, 2019 at 18:30

You must log in to answer this question.

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