glTF exporter: cleanup user warnings

This commit is contained in:
Julien Duroure 2024-05-24 09:30:37 +02:00
parent ac97907841
commit f8b8a1a5b6
3 changed files with 20 additions and 12 deletions

@ -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, 2, 35),
"version": (4, 2, 36),
'blender': (4, 2, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@ -1190,6 +1190,8 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
path_to_uri(os.path.splitext(os.path.basename(self.filepath))[0] + '.bin')
)
export_settings['warning_joint_weight_exceed_already_displayed'] = False
user_extensions = []
pre_export_callbacks = []
post_export_callbacks = []

@ -554,7 +554,9 @@ def __get_blender_actions(obj_uuid: str,
# Multi-strip tracks do not export correctly yet (they need to be baked),
# so skip them for now and only write single-strip tracks.
non_muted_strips = [strip for strip in track.strips if strip.action is not None and strip.mute is False]
if track.strips is None or len(non_muted_strips) != 1:
if track.strips is None or len(non_muted_strips) > 1:
# Warning if multiple strips are found, then ignore this track
# Ignore without warning if no strip
export_settings['log'].warning(
"NLA track '{}' has {} strips, but only single-strip tracks are supported in 'actions' mode.".format(
track.name, len(

@ -78,11 +78,13 @@ def __gather_skins(blender_primitive, export_settings):
# Warning for the case where we are in the same group, will be done later
# (for example, 3 weights needed, but 2 wanted by user)
if max_bone_set_index > wanted_max_bone_set_index:
export_settings['log'].warning(
"There are more than {} joint vertex influences."
"The {} with highest weight will be used (and normalized).".format(
export_settings['gltf_vertex_influences_nb'],
export_settings['gltf_vertex_influences_nb']))
if export_settings['warning_joint_weight_exceed_already_displayed'] is False:
export_settings['log'].warning(
"There are more than {} joint vertex influences."
"The {} with highest weight will be used (and normalized).".format(
export_settings['gltf_vertex_influences_nb'],
export_settings['gltf_vertex_influences_nb']))
export_settings['warning_joint_weight_exceed_already_displayed'] = True
# Take into account only the first set of 4 weights
max_bone_set_index = wanted_max_bone_set_index
@ -107,11 +109,13 @@ def __gather_skins(blender_primitive, export_settings):
idx = 4 - 1 - i
if not all(weight[:, idx]):
if warning_done is False:
export_settings['log'].warning(
"There are more than {} joint vertex influences."
"The {} with highest weight will be used (and normalized).".format(
export_settings['gltf_vertex_influences_nb'],
export_settings['gltf_vertex_influences_nb']))
if export_settings['warning_joint_weight_exceed_already_displayed'] is False:
export_settings['log'].warning(
"There are more than {} joint vertex influences."
"The {} with highest weight will be used (and normalized).".format(
export_settings['gltf_vertex_influences_nb'],
export_settings['gltf_vertex_influences_nb']))
export_settings['warning_joint_weight_exceed_already_displayed'] = True
warning_done = True
weight[:, idx] = 0.0