Skip to content
Snippets Groups Projects
Commit 01ed2d2f authored by Jason van Gumster's avatar Jason van Gumster
Browse files

Added support for proxy objects, thanks to a patch from michax (with edits from me). Thanks!

parent d57fa9e1
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
bl_info = { bl_info = {
"name": "Edit Linked Library", "name": "Edit Linked Library",
"author": "Jason van Gumster (Fweeb), Bassam Kurdali, Pablo Vazquez", "author": "Jason van Gumster (Fweeb), Bassam Kurdali, Pablo Vazquez",
"version": (0, 7, 4), "version": (0, 8, 0),
"blender": (2, 65, 0), "blender": (2, 65, 0),
"location": "View3D > Toolshelf > Edit Linked Library", "location": "View3D > Toolshelf > Edit Linked Library",
"description": "Allows editing of objects linked from a .blend library.", "description": "Allows editing of objects linked from a .blend library.",
...@@ -77,6 +77,8 @@ class EditLinked(bpy.types.Operator): ...@@ -77,6 +77,8 @@ class EditLinked(bpy.types.Operator):
return settings["original_file"] == "" and context.active_object is not None and ( return settings["original_file"] == "" and context.active_object is not None and (
(context.active_object.dupli_group and (context.active_object.dupli_group and
context.active_object.dupli_group.library is not None) or context.active_object.dupli_group.library is not None) or
(context.active_object.proxy and
context.active_object.proxy.library is not None) or
context.active_object.library is not None) context.active_object.library is not None)
#return context.active_object is not None #return context.active_object is not None
...@@ -90,6 +92,10 @@ class EditLinked(bpy.types.Operator): ...@@ -90,6 +92,10 @@ class EditLinked(bpy.types.Operator):
elif target.library: elif target.library:
targetpath = target.library.filepath targetpath = target.library.filepath
settings["linked_objects"].append(target.name) settings["linked_objects"].append(target.name)
elif target.proxy:
target = target.proxy
targetpath = target.library.filepath
settings["linked_objects"].append(target.name)
if targetpath: if targetpath:
print(target.name + " is linked to " + targetpath) print(target.name + " is linked to " + targetpath)
...@@ -98,8 +104,6 @@ class EditLinked(bpy.types.Operator): ...@@ -98,8 +104,6 @@ class EditLinked(bpy.types.Operator):
bpy.ops.wm.save_mainfile() bpy.ops.wm.save_mainfile()
settings["original_file"] = bpy.data.filepath settings["original_file"] = bpy.data.filepath
# XXX: need to test for proxied rigs
settings["linked_file"] = bpy.path.abspath(targetpath) settings["linked_file"] = bpy.path.abspath(targetpath)
if self.use_instance: if self.use_instance:
...@@ -164,14 +168,21 @@ class PanelLinkedEdit(bpy.types.Panel): ...@@ -164,14 +168,21 @@ class PanelLinkedEdit(bpy.types.Panel):
scene = context.scene scene = context.scene
icon = "OUTLINER_DATA_" + context.active_object.type icon = "OUTLINER_DATA_" + context.active_object.type
target = None
if context.active_object.proxy:
target = context.active_object.proxy
else:
target = context.active_object.dupli_group
if settings["original_file"] == "" and ( if settings["original_file"] == "" and (
(context.active_object.dupli_group and (target and
context.active_object.dupli_group.library is not None) or target.library is not None) or
context.active_object.library is not None): context.active_object.library is not None):
if (context.active_object.dupli_group is not None): if (target is not None):
props = layout.operator("object.edit_linked", icon="LINK_BLEND", props = layout.operator("object.edit_linked", icon="LINK_BLEND",
text="Edit Library: %s" % context.active_object.dupli_group.name) text="Edit Library: %s" % target.name)
else: else:
props = layout.operator("object.edit_linked", icon="LINK_BLEND", props = layout.operator("object.edit_linked", icon="LINK_BLEND",
text="Edit Library: %s" % context.active_object.name) text="Edit Library: %s" % context.active_object.name)
...@@ -181,9 +192,9 @@ class PanelLinkedEdit(bpy.types.Panel): ...@@ -181,9 +192,9 @@ class PanelLinkedEdit(bpy.types.Panel):
layout.prop(scene, "use_autosave") layout.prop(scene, "use_autosave")
layout.prop(scene, "use_instance") layout.prop(scene, "use_instance")
if (context.active_object.dupli_group is not None): if (target is not None):
layout.label(text="Path: %s" % layout.label(text="Path: %s" %
context.active_object.dupli_group.library.filepath) target.library.filepath)
else: else:
layout.label(text="Path: %s" % layout.label(text="Path: %s" %
context.active_object.library.filepath) context.active_object.library.filepath)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment