Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason van Gumster <fweeb@monsterjavaguns.com>2021-10-07 14:45:59 +0300
committerJason van Gumster <fweeb@monsterjavaguns.com>2021-10-07 14:45:59 +0300
commite9f83053149def0f561ca5769f8bc4f5bc335247 (patch)
tree6a5f247fb850e0889962192c172330f27e13fb4b /object_edit_linked.py
parente45804a3bb753006b6aeeef78327359fc724633c (diff)
Edit Linked Library: Added support for more library types.
In particular, this commit adds support for override libraries on objects. In the past, if you made an override, Edit Linked Library lost the reference to the original library. That's fixed now. Also, in linked Node Groups, this commit also adds support for linked Sverchok group nodes.
Diffstat (limited to 'object_edit_linked.py')
-rw-r--r--object_edit_linked.py52
1 files changed, 40 insertions, 12 deletions
diff --git a/object_edit_linked.py b/object_edit_linked.py
index 95b4ec52..9299a575 100644
--- a/object_edit_linked.py
+++ b/object_edit_linked.py
@@ -83,7 +83,9 @@ class OBJECT_OT_EditLinked(bpy.types.Operator):
context.active_object.instance_collection.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 or
+ (context.active_object.override_library and
+ context.active_object.override_library.reference.library is not None))
def execute(self, context: bpy.context):
target = context.active_object
@@ -98,6 +100,10 @@ class OBJECT_OT_EditLinked(bpy.types.Operator):
target = target.proxy
targetpath = target.library.filepath
settings["linked_objects"].append(target.name)
+ elif target.override_library:
+ target = target.override_library.reference
+ targetpath = target.library.filepath
+ settings["linked_objects"].append(target.name)
if targetpath:
logger.debug(target.name + " is linked to " + targetpath)
@@ -149,12 +155,18 @@ class NODE_OT_EditLinked(bpy.types.Operator):
@classmethod
def poll(cls, context: bpy.context):
return settings["original_file"] == "" and context.active_node is not None and (
- context.active_node.type == 'GROUP' and
+ (context.active_node.type == 'GROUP' and
hasattr(context.active_node.node_tree, "library") and
- context.active_node.node_tree.library is not None)
+ context.active_node.node_tree.library is not None) or
+ (hasattr(context.active_node, "monad") and
+ context.active_node.monad.library is not None))
def execute(self, context: bpy.context):
- target = context.active_node.node_tree
+ target = context.active_node
+ if (target.type == "GROUP"):
+ target = target.node_tree
+ else:
+ target = target.monad
targetpath = target.library.filepath
settings["linked_nodes"].append(target.name)
@@ -255,23 +267,31 @@ class VIEW3D_PT_PanelLinkedEdit(bpy.types.Panel):
if settings["original_file"] == "" and (
(target and
target.library is not None) or
- context.active_object.library is not None):
+ context.active_object.library is not None or
+ (context.active_object.override_library is not None and
+ context.active_object.override_library.reference is not None)):
if (target is not None):
props = layout.operator("object.edit_linked", icon="LINK_BLEND",
text="Edit Library: %s" % target.name)
- else:
+ elif (context.active_object.library):
props = layout.operator("object.edit_linked", icon="LINK_BLEND",
text="Edit Library: %s" % context.active_object.name)
+ else:
+ props = layout.operator("object.edit_linked", icon="LINK_BLEND",
+ text="Edit Override Library: %s" % context.active_object.override_library.reference.name)
self.draw_common(scene, layout, props)
if (target is not None):
layout.label(text="Path: %s" %
target.library.filepath)
- else:
+ elif (context.active_object.library):
layout.label(text="Path: %s" %
context.active_object.library.filepath)
+ else:
+ layout.label(text="Path: %s" %
+ context.active_object.override_library.reference.library.filepath)
elif settings["original_file"] != "":
@@ -341,15 +361,23 @@ class NODE_PT_PanelLinkedEdit(bpy.types.Panel):
target = context.active_node
if settings["original_file"] == "" and (
- target.type == 'GROUP' and hasattr(target.node_tree, "library") and
- target.node_tree.library is not None):
+ (target.type == 'GROUP' and hasattr(target.node_tree, "library") and
+ target.node_tree.library is not None) or
+ (hasattr(target, "monad") and target.monad.library is not None)):
- props = layout.operator("node.edit_linked", icon="LINK_BLEND",
- text="Edit Library: %s" % target.name)
+ if (target.type == "GROUP"):
+ props = layout.operator("node.edit_linked", icon="LINK_BLEND",
+ text="Edit Library: %s" % target.name)
+ else:
+ props = layout.operator("node.edit_linked", icon="LINK_BLEND",
+ text="Edit Library: %s" % target.monad.name)
self.draw_common(scene, layout, props)
- layout.label(text="Path: %s" % target.node_tree.library.filepath)
+ if (target.type == "GROUP"):
+ layout.label(text="Path: %s" % target.node_tree.library.filepath)
+ else:
+ layout.label(text="Path: %s" % target.monad.library.filepath)
elif settings["original_file"] != "":