[Bf-extensions-cvs] [1c1b05ef] blender-v3.3-release: glTF: Fix Traceback in Variant UI

Julien Duroure noreply at git.blender.org
Mon Nov 28 15:23:54 CET 2022


Commit: 1c1b05efd36bc245ea4d5292ca93e33dfa6447e8
Author: Julien Duroure
Date:   Mon Nov 14 16:03:27 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rBA1c1b05efd36bc245ea4d5292ca93e33dfa6447e8

glTF: Fix Traceback in Variant UI

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/com/gltf2_blender_ui.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 917a634b..4d6a4542 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -4,7 +4,7 @@
 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": (3, 3, 34),
+    "version": (3, 3, 35),
     'blender': (3, 3, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/com/gltf2_blender_ui.py b/io_scene_gltf2/blender/com/gltf2_blender_ui.py
index 128db592..afad2be8 100644
--- a/io_scene_gltf2/blender/com/gltf2_blender_ui.py
+++ b/io_scene_gltf2/blender/com/gltf2_blender_ui.py
@@ -183,7 +183,7 @@ class SCENE_OT_gltf2_assign_to_variant(bpy.types.Operator):
     @classmethod
     def poll(self, context):
         return len(bpy.data.scenes[0].gltf2_KHR_materials_variants_variants) > 0 \
-            and bpy.context.object.type == "MESH"
+            and bpy.context.object and bpy.context.object.type == "MESH"
 
     def execute(self, context):
         gltf2_active_variant = bpy.data.scenes[0].gltf2_active_variant
@@ -216,7 +216,7 @@ class SCENE_OT_gltf2_reset_to_original(bpy.types.Operator):
 
     @classmethod
     def poll(self, context):
-        return bpy.context.object.type == "MESH" and len(context.object.data.gltf2_variant_default_materials) > 0
+        return bpy.context.object and bpy.context.object.type == "MESH" and len(context.object.data.gltf2_variant_default_materials) > 0
 
     def execute(self, context):
         obj = bpy.context.object
@@ -240,7 +240,7 @@ class SCENE_OT_gltf2_assign_as_original(bpy.types.Operator):
 
     @classmethod
     def poll(self, context):
-        return bpy.context.object.type == "MESH"
+        return bpy.context.object and bpy.context.object.type == "MESH"
 
     def execute(self, context):
         obj = bpy.context.object



More information about the Bf-extensions-cvs mailing list