Fix #130705: importing/exporting FBX with lights fails

This commit is contained in:
Campbell Barton
2024-11-25 13:19:25 +11:00
committed by Thomas Dinges
parent 647c337ce5
commit 780d22597a
2 changed files with 4 additions and 3 deletions
@@ -588,11 +588,12 @@ def fbx_data_light_elements(root, lamp, scene_data):
light_key = scene_data.data_lights[lamp]
do_light = True
do_shadow = False
# NOTE: this was removed from lamps, always write black.
shadow_color = Vector((0.0, 0.0, 0.0))
if lamp.type not in {'HEMI'}:
do_light = True
do_shadow = lamp.use_shadow
shadow_color = lamp.shadow_color
# `shadow_color = lamp.shadow_color`: now removed.
light = elem_data_single_int64(root, b"NodeAttribute", get_fbx_uuid_from_key(light_key))
light.add_string(fbx_name_class(lamp.name.encode(), b"NodeAttribute"))
@@ -2233,8 +2233,8 @@ def blen_read_light(fbx_tmpl, fbx_obj, settings):
lamp.use_shadow = elem_props_get_bool(fbx_props, b'CastShadow', True)
if hasattr(lamp, "cycles"):
lamp.cycles.cast_shadow = lamp.use_shadow
# Keeping this for now, but this is not used nor exposed anymore afaik...
lamp.shadow_color = elem_props_get_color_rgb(fbx_props, b'ShadowColor', (0.0, 0.0, 0.0))
# Removed but could be restored if the value can be applied.
# `lamp.shadow_color = elem_props_get_color_rgb(fbx_props, b'ShadowColor', (0.0, 0.0, 0.0))`
if settings.use_custom_props:
blen_read_custom_properties(fbx_obj, lamp, settings)