AnimCupboard: ID Management Pie #127
@ -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)
|
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)
|
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)
|
source_id.user_remap(target_id)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
@ -406,9 +413,9 @@ def get_id_storage(id_type) -> "bpy.data.something":
|
|||||||
return getattr(bpy.data, storage)
|
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)
|
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, lib_path))
|
||||||
return storage.get((id_name, None))
|
return storage.get((id_name, None))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user