Skip to content

Commit

Permalink
Merge branch 'blender-v4.3-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduroure committed Oct 31, 2024
2 parents bd02787 + b491792 commit 9591744
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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, 4, 6),
"version": (4, 4, 7),
'blender': (4, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,31 @@ def gather_data_sampled_keyframes(

if export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel][
'path'] == "/materials/XXX/extensions/KHR_materials_emissive_strength/emissiveStrength":
# We need to retrieve the emissive factor
factor = get_cache_data(
'value',
blender_id,
export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'],
action_name,
frame,
step,
export_settings
)

factor = [f * value for f in factor]
if any([i > 1.0 for i in factor or []]):
# Clamp to range [0,1]
# Official glTF clamp to range [0,1]
# If we are outside, we need to use extension KHR_materials_emissive_strength
value = max(factor)
if export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'] is not None:
factor = get_cache_data(
'value',
blender_id,
export_settings['KHR_animation_pointer']['materials'][blender_id]['paths'][channel]['factor_channel'],
action_name,
frame,
step,
export_settings
)

factor = [f * value for f in factor]
if any([i > 1.0 for i in factor or []]):
# Clamp to range [0,1]
# Official glTF clamp to range [0,1]
# If we are outside, we need to use extension KHR_materials_emissive_strength
value = max(factor)
else:
value = 1.0 # no need to have an emissiveStrength extension for this frame
else:
value = 1.0 # no need to have an emissiveStrength extension for this frame
# No factor exists, so set it as 1.0 / 1.0 / 1.0
# This is because the emission is linked to a texture, without a factor
# No need to change the value
factor = [1.0, 1.0, 1.0]

# For specularFactor and specularColorFactor, we already multiplied it by 2.0, and clamp it to 1.0 (and adapt specularColor accordingly)
# This is done in cache retrieval
Expand Down

0 comments on commit 9591744

Please sign in to comment.