Skip to content

Commit

Permalink
Merge pull request #2350 from KhronosGroup/fix_2349_spot_default
Browse files Browse the repository at this point in the history
Fix #2349 - spot default gltf values
  • Loading branch information
julienduroure committed Sep 12, 2024
2 parents d6c98b8 + 532ae57 commit 5fbd6a3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions addons/io_scene_gltf2/blender/imp/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,12 @@ def create_spot(gltf, light_id):
spot = bpy.data.lights.new(name=pylight['name'], type="SPOT")

# Angles
if 'spot' in pylight.keys() and 'outerConeAngle' in pylight['spot']:
spot.spot_size = BlenderLight.calc_spot_cone_outer(gltf, pylight['spot']['outerConeAngle'])
else:
spot.spot_size = pi / 2
if 'spot' in pylight.keys():
gltf_default_outer_cone_angle = pi / 4
gltf_default_inner_cone_angle = 0.0

if 'spot' in pylight.keys() and 'innerConeAngle' in pylight['spot']:
spot.spot_blend = BlenderLight.calc_spot_cone_inner(gltf, pylight['spot']['outerConeAngle'], pylight['spot']['innerConeAngle'])
else:
spot.spot_blend = 1.0
spot.spot_size = BlenderLight.calc_spot_cone_outer(gltf, pylight['spot'].get('outerConeAngle', gltf_default_outer_cone_angle))
spot.spot_blend = BlenderLight.calc_spot_cone_inner(gltf, pylight['spot'].get('outerConeAngle', gltf_default_outer_cone_angle), pylight['spot'].get('innerConeAngle', gltf_default_inner_cone_angle))

if 'intensity' in pylight.keys():
spot.energy = BlenderLight.calc_energy_pointlike(gltf, pylight['intensity'])
Expand Down

0 comments on commit 5fbd6a3

Please sign in to comment.