From 64fcec250d2d9450ac64d8314af7092a6922a28b Mon Sep 17 00:00:00 2001
From: Julien Duroure <julien.duroure@gmail.com>
Date: Sat, 6 Nov 2021 09:58:53 +0100
Subject: [PATCH] glTF importer: Fix T92808 change after change on vertex
 groups data now on mesh

---
 io_scene_gltf2/__init__.py                       | 4 ++--
 io_scene_gltf2/blender/imp/gltf2_blender_mesh.py | 6 +++---
 io_scene_gltf2/blender/imp/gltf2_blender_node.py | 5 -----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 3a279780d..3c4022d51 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,8 +15,8 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin SchmithĂĽsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 7, 31),
-    'blender': (2, 91, 0),
+    "version": (1, 7, 32),
+    'blender': (3, 0, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
     'warning': '',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index f05fa7f66..bbff340c6 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -303,9 +303,9 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
     # TODO: this is slow :/
     if num_joint_sets:
         pyskin = gltf.data.skins[skin_idx]
-        for i, _ in enumerate(pyskin.joints):
-            # ob is a temp object, so don't worry about the name.
-            ob.vertex_groups.new(name='X%d' % i)
+        for i, node_idx in enumerate(pyskin.joints):
+            bone = gltf.vnodes[node_idx]
+            ob.vertex_groups.new(name=bone.blender_bone_name)
 
         vgs = list(ob.vertex_groups)
 
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
index 8e0d7cbb1..550bd5a05 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
@@ -241,11 +241,6 @@ class BlenderNode():
 
         # Armature/bones should have already been created.
 
-        # Create vertex groups for each joint
-        for node_idx in pyskin.joints:
-            bone = gltf.vnodes[node_idx]
-            obj.vertex_groups.new(name=bone.blender_bone_name)
-
         # Create an Armature modifier
         first_bone = gltf.vnodes[pyskin.joints[0]]
         arma = gltf.vnodes[first_bone.bone_arma]
-- 
GitLab