diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 5e13560136b..57ac8ff7e2d 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -42,13 +42,10 @@ class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel): arm = context.armature space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif arm: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py index 33dcd8d4c7c..d13232ca2e1 100644 --- a/release/scripts/ui/properties_data_curve.py +++ b/release/scripts/ui/properties_data_curve.py @@ -59,14 +59,10 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel): curve = context.curve space = context.space_data - split = layout.split(percentage=0.65) - if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif curve: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") # XXX: broken class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 4814d067436..52ac88ba168 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -70,13 +70,10 @@ class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel): mesh = context.mesh space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif mesh: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py index 6cb58cb4939..115a20682a9 100644 --- a/release/scripts/ui/properties_data_metaball.py +++ b/release/scripts/ui/properties_data_metaball.py @@ -42,13 +42,10 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel): mball = context.meta_ball space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif mball: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index d0184c2d0af..c16dc052b86 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -36,11 +36,11 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel): space = context.space_data ob = context.object - row = layout.row() - row.label(text="", icon='OBJECT_DATA') if space.use_pin_id: - row.template_ID(space, "pin_id") + layout.template_ID(space, "pin_id", unlink="None") else: + row = layout.row() + row.label(text="", icon='OBJECT_DATA') row.prop(ob, "name", text="") diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0c917f29623..b034ddf7827 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -292,6 +292,35 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } } +static const char *template_id_browse_tip(StructRNA *type) +{ + if(type) { + switch(RNA_type_to_ID_code(type)) { + case ID_SCE: return "Browse Scene to be linked"; + case ID_OB: return "Browse Object to be linked"; + case ID_ME: return "Browse Mesh Data to be linked"; + case ID_CU: return "Browse Curve Data to be linked"; + case ID_MB: return "Browse MetaBall Data to be linked"; + case ID_MA: return "Browse Material to be linked"; + case ID_TE: return "Browse Texture to be linked"; + case ID_IM: return "Browse Image to be linked"; + case ID_LA: return "Browse Lattice Data to be linked"; + case ID_CA: return "Browse Camera Data to be linked"; + case ID_WO: return "Browse World Settings to be linked"; + case ID_SCR: return "Choose Screen lay-out"; + case ID_TXT: return "Browse Text to be linked"; + case ID_SO: return "Browse Sound to be linked"; + case ID_AR: return "Browse Armature data to be linked"; + case ID_AC: return "Browse Action to be linked"; + case ID_NT: return "Browse Node Tree to be linked"; + case ID_BR: return "Browse Brush to be linked"; + case ID_PA: return "Browse Particle System to be linked"; + case ID_GD: return "Browse Grease Pencil Data to be linked"; + } + } + return "Browse ID data to be linked"; +} + static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop) { uiBut *but; @@ -313,7 +342,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(flag & UI_ID_PREVIEWS) { - but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, "Browse ID data"); + but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, template_id_browse_tip(type)); if(type) { but->icon= RNA_struct_ui_icon(type); if (id) but->icon = ui_id_icon_get(C, id, 1); @@ -327,7 +356,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else if(flag & UI_ID_BROWSE) { - but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, "Browse ID data"); + but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, template_id_browse_tip(type)); if(type) { but->icon= RNA_struct_ui_icon(type); /* default dragging of icon for id browse buttons */ @@ -428,7 +457,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetNFunc(but, NULL, MEM_dupallocN(template), 0); } else { - but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock, Shift + Click to force removal on save"); + but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock. Shift + Click to set users to zero, data gets not saved"); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) @@ -465,7 +494,9 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const flag |= UI_ID_ADD_NEW; if(openop) flag |= UI_ID_OPEN; - + if(unlinkop && strcmp(unlinkop, "None") == 0) + flag &= ~UI_ID_DELETE; + type= RNA_property_pointer_type(ptr, prop); template->idlb= which_libbase(CTX_data_main(C), RNA_type_to_ID_code(type));