Преглед изворни кода

fix mode switch importing armature into hidden collection

also v0.12.16
Joseph Brandenburg пре 2 месеци
родитељ
комит
35fd88d2dc
3 измењених фајлова са 6 додато и 2 уклоњено
  1. 1 1
      __init__.py
  2. 1 1
      blender_manifest.toml
  3. 4 0
      utilities.py

+ 1 - 1
__init__.py

@@ -18,7 +18,7 @@ from .utilities import prRed
 
 MANTIS_VERSION_MAJOR=0
 MANTIS_VERSION_MINOR=12
-MANTIS_VERSION_SUB=15
+MANTIS_VERSION_SUB=16
 
 classLists = [module.TellClasses() for module in [
  link_nodes_ui,

+ 1 - 1
blender_manifest.toml

@@ -3,7 +3,7 @@ schema_version = "1.0.0"
 # Example of manifest file for a Blender extension
 # Change the values according to your extension
 id = "mantis"
-version = "0.12.15"
+version = "0.12.16"
 name = "Mantis"
 tagline = "Mantis is a rigging nodes toolkit"
 maintainer = "Nodespaghetti <josephbburg@protonmail.com>"

+ 4 - 0
utilities.py

@@ -462,6 +462,8 @@ def import_metarig_data(metarig_data : dict, ):
         # have to add it to the view layer to switch modes.
         collection = get_default_collection(collection_type="ARMATURE")
         collection.objects.link(armature_object)
+        # we'll do this to ensure it is actually in the scene for the mode switch
+        context.scene.collection.objects.link(armature_object)
         switch_mode('EDIT', objects = [armature_object])
         
         while (children):
@@ -481,6 +483,8 @@ def import_metarig_data(metarig_data : dict, ):
             eb.tail = eb.matrix.decompose()[0] + displacement
             children.extendleft (child_data['children'].copy())
         switch_mode('OBJECT', objects = [armature_object])
+        # and now we can remove it from the scene collection, since it is in the Armature collection
+        context.scene.collection.objects.unlink(armature_object)
     # note that this will not correct if the object exists and is wrong.
     return armature_object