diff options
author | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
commit | e83f88c951e26b01893acee4f24b40a46062a41c (patch) | |
tree | 09f60bf7d4fc2ae1ef50668823e416fc675b252e /rigify/generate.py | |
parent | ec84e3294593e2e26475f18c81e847bf00dc201e (diff) | |
parent | 0cd92169d40ae1c7e103ff269e850eaf1b901646 (diff) |
Merge branch 'master' into xr-devxr-dev
Diffstat (limited to 'rigify/generate.py')
-rw-r--r-- | rigify/generate.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rigify/generate.py b/rigify/generate.py index 3acc2e40..8a2aa942 100644 --- a/rigify/generate.py +++ b/rigify/generate.py @@ -65,7 +65,9 @@ class Generator(base_generate.BaseGenerator): target_rig = meta_data.rigify_target_rig if not target_rig: - if "metarig" in self.metarig.name: + if meta_data.rigify_rig_basename: + rig_new_name = meta_data.rigify_rig_basename + elif "metarig" in self.metarig.name: rig_new_name = self.metarig.name.replace("metarig", "rig") elif "META" in self.metarig.name: rig_new_name = self.metarig.name.replace("META", "RIG") @@ -76,7 +78,7 @@ class Generator(base_generate.BaseGenerator): target_rig.display_type = 'WIRE' # If the object is already added to the scene, switch to its collection - if target_rig.name in self.context.scene.collection.all_objects: + if target_rig in list(self.context.scene.collection.all_objects): self.__switch_to_usable_collection(target_rig) else: # Otherwise, add to the selected collection or the metarig collection if unusable @@ -117,11 +119,14 @@ class Generator(base_generate.BaseGenerator): wgts_group_name = "WGTS_" + self.obj.name old_collection = bpy.data.collections.get(wgts_group_name) + if old_collection and old_collection.library: + old_collection = None + if not old_collection: # Update the old 'Widgets' collection legacy_collection = bpy.data.collections.get('Widgets') - if legacy_collection and wgts_group_name in legacy_collection.objects: + if legacy_collection and wgts_group_name in legacy_collection.objects and not legacy_collection.library: legacy_collection.name = wgts_group_name old_collection = legacy_collection |