[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4789] trunk/py/scripts/addons/ object_edit_linked.py: Added support for proxy objects, thanks to a patch from michax (with edits from me).

Jason van Gumster jason at handturkeystudios.com
Tue Oct 8 17:23:20 CEST 2013


Revision: 4789
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4789
Author:   thefallenweeble
Date:     2013-10-08 15:23:20 +0000 (Tue, 08 Oct 2013)
Log Message:
-----------
Added support for proxy objects, thanks to a patch from michax (with edits from me). Thanks!

Modified Paths:
--------------
    trunk/py/scripts/addons/object_edit_linked.py

Modified: trunk/py/scripts/addons/object_edit_linked.py
===================================================================
--- trunk/py/scripts/addons/object_edit_linked.py	2013-10-07 15:29:04 UTC (rev 4788)
+++ trunk/py/scripts/addons/object_edit_linked.py	2013-10-08 15:23:20 UTC (rev 4789)
@@ -20,7 +20,7 @@
 bl_info = {
     "name": "Edit Linked Library",
     "author": "Jason van Gumster (Fweeb), Bassam Kurdali, Pablo Vazquez",
-    "version": (0, 7, 4),
+    "version": (0, 8, 0),
     "blender": (2, 65, 0),
     "location": "View3D > Toolshelf > Edit Linked Library",
     "description": "Allows editing of objects linked from a .blend library.",
@@ -77,6 +77,8 @@
         return settings["original_file"] == "" and context.active_object is not None and (
                 (context.active_object.dupli_group and
                  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)
         #return context.active_object is not None
 
@@ -90,6 +92,10 @@
         elif target.library:
             targetpath = target.library.filepath
             settings["linked_objects"].append(target.name)
+        elif target.proxy:
+            target = target.proxy
+            targetpath = target.library.filepath
+            settings["linked_objects"].append(target.name)
 
         if targetpath:
             print(target.name + " is linked to " + targetpath)
@@ -98,8 +104,6 @@
                 bpy.ops.wm.save_mainfile()
 
             settings["original_file"] = bpy.data.filepath
-
-            # XXX: need to test for proxied rigs
             settings["linked_file"] = bpy.path.abspath(targetpath)
 
             if self.use_instance:
@@ -164,14 +168,21 @@
         scene = context.scene
         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 (
-                (context.active_object.dupli_group and
-                 context.active_object.dupli_group.library is not None) or
+                (target and
+                 target.library is not None) or
                 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",
-                                        text="Edit Library: %s" % context.active_object.dupli_group.name)
+                                        text="Edit Library: %s" % target.name)
             else:
                 props = layout.operator("object.edit_linked", icon="LINK_BLEND",
                                         text="Edit Library: %s" % context.active_object.name)
@@ -181,9 +192,9 @@
             layout.prop(scene, "use_autosave")
             layout.prop(scene, "use_instance")
 
-            if (context.active_object.dupli_group is not None):
+            if (target is not None):
                 layout.label(text="Path: %s" %
-                             context.active_object.dupli_group.library.filepath)
+                             target.library.filepath)
             else:
                 layout.label(text="Path: %s" %
                              context.active_object.library.filepath)



More information about the Bf-extensions-cvs mailing list