Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2018-11-27 22:59:55 +0300
committerJulien Duroure <julien.duroure@gmail.com>2018-11-27 22:59:55 +0300
commit74dbec774ef5e10f1b3475682efe286da8fed4cc (patch)
tree88ae822fee83f7188deeb0774b131d6300037fa5 /io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py
parenta12a93cbdffe78998b494175d5012fb1a79e2826 (diff)
glTF addon: updates from upstream
* invalidate cache for multiple exports * exporter: support KHR_lights_punctual * fixed lights * disable export all layers * fixed texture slot images stalling export * option to enable exporting more than 4 influences from upsteam commit 26699c476211add92d13df0a284b8df2f08acb3e to upstream commit 7a8f733fc446cfb3880a8c1658bccf94bcfd456c
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py')
-rw-r--r--io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py
new file mode 100644
index 00000000..6b1f95e2
--- /dev/null
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_light_spots.py
@@ -0,0 +1,50 @@
+# Copyright 2018 The glTF-Blender-IO authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import bpy
+from typing import Optional, List, Any
+
+from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
+
+from io_scene_gltf2.io.com import gltf2_io_lights_punctual
+from io_scene_gltf2.io.com import gltf2_io_debug
+
+
+def gather_light_spot(blender_lamp, export_settings) -> Optional[gltf2_io_lights_punctual.LightSpot]:
+
+ if not __filter_light_spot(blender_lamp, export_settings):
+ return None
+
+ spot = gltf2_io_lights_punctual.LightSpot(
+ inner_cone_angle=__gather_inner_cone_angle(blender_lamp, export_settings),
+ outer_cone_angle=__gather_outer_cone_angle(blender_lamp, export_settings)
+ )
+ return spot
+
+
+def __filter_light_spot(blender_lamp, _) -> bool:
+ if blender_lamp.type != "SPOT":
+ return False
+
+ return True
+
+
+def __gather_inner_cone_angle(blender_lamp, _) -> Optional[float]:
+ angle = blender_lamp.spot_size * 0.5
+ return angle - angle * blender_lamp.spot_blend
+
+
+def __gather_outer_cone_angle(blender_lamp, _) -> Optional[float]:
+ return blender_lamp.spot_size * 0.5
+