lighting_name = scene.name+".lightn"
if lighting_name not in resources:
lighting_res = Resource(lighting_name, "lighting")
+ lighting_res.statements.append(Statement("ambient", *tuple(scene.ambient_light)))
for l in lights:
lighting_res.statements.append(lighting_res.create_reference_statement("light", resources[l.name+".light"]))
+import mathutils
+
def is_same_object(obj1, obj2):
if obj1.data.name!=obj2.data.name:
return False
self.prototypes = []
self.instances = []
self.lights = []
+ self.ambient_light = mathutils.Color((0.0, 0.0, 0.0))
self.exposure = scene.view_settings.exposure
self.use_hdr = False
if scene.world:
self.use_hdr = scene.world.use_hdr
+ out_node = next((n for n in scene.world.node_tree.nodes if n.type=='OUTPUT_WORLD'), None)
+ if out_node:
+ from .util import get_linked_node_and_socket
+
+ surface_node, _ = get_linked_node_and_socket(scene.world.node_tree, out_node.inputs["Surface"])
+ if surface_node and surface_node.type=='BACKGROUND':
+ c = surface_node.inputs["Color"].default_value
+ s = surface_node.inputs["Strength"].default_value
+ self.ambient_light = mathutils.Color(c[:3])*s
+
objects = scene.objects[:]
objects.sort(key=lambda o:o.name)
if obj_filter: