4
$\begingroup$

So if I have this custom panel in the 3D view, is there a way I can take a property from for example the properties window and paste it onto my panel below the "text" prop, without creating a new property?

The reason I do not want to create a new property is because I want them to share all data, such as values, keyframes, drivers etc.

enter image description here

    bl_info = {
    "name": "",
    "description": "",
    "author": "",
    "version": (0, 0, 1),
    "blender": (2, 70, 0),
    "location": "",
    "warning": "", 
    "wiki_url": "",
    "tracker_url": "",
    "category": ""
}

import bpy

from bpy.props import (StringProperty,
                       BoolProperty,
                       IntProperty,
                       FloatProperty,
                       FloatVectorProperty,
                       EnumProperty,
                       PointerProperty,
                       )
from bpy.types import (Panel,
                       Operator,
                       AddonPreferences,
                       PropertyGroup,
                       )


class inouse_Settings(PropertyGroup):

    my_bool = BoolProperty(
        name="Enable or Disable",
        description="A bool property",
        default = False)




class UV_OT_my_panel(Panel):
    bl_space_type = 'VIEW_3D'
    bl_idname = "UV_OT_my_panel"
    bl_label = "Custom"
    bl_category = "Custom"
    bl_region_type = 'TOOLS'

    def draw(self, context):

        scn = context.scene
        mytool = scn.inhouse
        layout = self.layout

        col = layout.column(align=True)
        row = col.row(align = True)
        row.prop(mytool, "my_bool", text="Text")






def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.inhouse = PointerProperty(type=inouse_Settings)

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

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

1 Answer 1

5
$\begingroup$

Of course, you can re-use all python properties at least.

Enable Developer Extras, 'Right-Click' the property and choose Edit Source, this will open up the associated .py file in the Text Editor:

enter image description here

'Resolution' adapted:

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

    layout = self.layout
    row = layout.row()
    sub = row.column(align=True)
    sub.label(text="Resolution:")
    sub.prop(rd, "resolution_x", text="X")
    sub.prop(rd, "resolution_y", text="Y")
    sub.prop(rd, "resolution_percentage", text="")
$\endgroup$
0

You must log in to answer this question.

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