[Bf-extensions-cvs] [61ff4faf] blender-v3.4-release: glTF: Fix Traceback in Variant UI

Julien Duroure noreply at git.blender.org
Mon Nov 14 16:03:37 CET 2022


Commit: 61ff4faf8c7d01fa8e12717f0242faea94e0ccf6
Author: Julien Duroure
Date:   Mon Nov 14 16:03:27 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBA61ff4faf8c7d01fa8e12717f0242faea94e0ccf6

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 1fa35ea0..e917f535 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, 4, 45),
+    "version": (3, 4, 46),
     '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 0788bbbc..efec00a3 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