AnimCupboard: ID Management Pie #127

Merged
Demeter Dzadik merged 11 commits from Mets/blender-studio-pipeline:AnimCupboard-relationship-viewer into main 2023-07-19 14:43:14 +02:00
Showing only changes of commit b7fc968c95 - Show all commits

View File

@ -300,6 +300,13 @@ class OUTLINER_OT_remap_users(bpy.types.Operator):
source_id = get_id(self.id_name_source, self.id_type, self.library_path_source)
target_id = get_id(self.id_name_target, self.id_type, self.library_path)
if not target_id:
self.report(
{'ERROR'},
f'Failed to find ID: {self.id_name_target}, {self.id_type}, lib: {self.library_path}',
)
return {'CANCELLED'}
source_id.user_remap(target_id)
return {'FINISHED'}
@ -406,9 +413,9 @@ def get_id_storage(id_type) -> "bpy.data.something":
return getattr(bpy.data, storage)
def get_id(id_name: str, id_type: str, lib_path=""):
def get_id(id_name: str, id_type: str, lib_path="") -> bpy.types.ID:
storage = get_id_storage(id_type)
if lib_path:
if lib_path and lib_path != 'Local Data':
return storage.get((id_name, lib_path))
return storage.get((id_name, None))