Fix: glTF: Fix crash in animation pointer when no SpecularColorFactor can be found
This commit is contained in:
@@ -5,7 +5,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": (4, 5, 21),
|
||||
"version": (4, 5, 22),
|
||||
'blender': (4, 4, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
||||
@@ -346,11 +346,20 @@ def material_nodetree_caching(data, action_name, slot_identifier, frame, export_
|
||||
"/",
|
||||
1)[0] and export_settings['KHR_animation_pointer']['materials'][mat]['paths'][i]['path'].rsplit(
|
||||
"/",
|
||||
1)[1] == "specularColorFactor"][0]
|
||||
val_colorfactor = blender_material.path_resolve(colorfactor_path)
|
||||
1)[1] == "specularColorFactor"]
|
||||
if len(colorfactor_path) == 0:
|
||||
# No specularColorFactor, so using default value
|
||||
val_colorfactor = [1.0, 1.0, 1.0]
|
||||
else:
|
||||
val_colorfactor = blender_material.path_resolve(colorfactor_path[0])
|
||||
colorfactor_path = colorfactor_path[0]
|
||||
if fac > 1.0:
|
||||
val_colorfactor = [i * fac for i in val_colorfactor]
|
||||
data[key1][key2][key3][key4][colorfactor_path][frame] = val_colorfactor
|
||||
if len(colorfactor_path) == 0:
|
||||
export_settings['log'].warning(
|
||||
"SpecularFactor is greater than 1.0, but no specularColorFactor found. Using default value for specularColorFactor.")
|
||||
if len(colorfactor_path) != 0:
|
||||
data[key1][key2][key3][key4][colorfactor_path][frame] = val_colorfactor
|
||||
elif export_settings['KHR_animation_pointer']['materials'][mat]['paths'][path]['path'] == "/materials/XXX/extensions/KHR_materials_specular/specularColorFactor":
|
||||
# Already handled by specularFactor
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user