X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fscene.py;h=e4f31067cd8a910e48b842e6b66d04cde1f0259f;hb=a9b6dba74b595361df3d9c934e479ccf83ad91a1;hp=7532f48ccdd82d88de86cafcef2b4fc9237d40d8;hpb=7d8c187f036a7c91f9073ca0071a20807c0f1aa5;p=libs%2Fgl.git diff --git a/blender/io_mspgl/scene.py b/blender/io_mspgl/scene.py index 7532f48c..e4f31067 100644 --- a/blender/io_mspgl/scene.py +++ b/blender/io_mspgl/scene.py @@ -13,25 +13,28 @@ class Instance: self.name = obj.name self.matrix_world = obj.matrix_world self.rotation_mode = obj.rotation_mode - self.prototype = prototype.name + self.prototype = prototype class Scene: def __init__(self, scene, obj_filter=None): self.name = scene.name - self.scene_type = scene.scene_type self.export_disposition = scene.export_disposition self.background_set = None self.camera = scene.camera self.prototypes = [] self.instances = [] + self.blended_instances = [] self.lights = [] + self.realtime_sky = False + self.sun_light = None self.ambient_light = mathutils.Color((0.0, 0.0, 0.0)) self.exposure = scene.view_settings.exposure - self.use_hdr = False + self.use_hdr = scene.use_hdr + self.use_ao = scene.eevee.use_gtao + self.ao_distance = scene.eevee.gtao_distance + self.ao_samples = scene.ao_samples 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 @@ -42,6 +45,12 @@ class Scene: s = surface_node.inputs["Strength"].default_value self.ambient_light = mathutils.Color(c[:3])*s + self.use_sky = scene.world.use_sky and scene.world.sun_light + self.sun_light = scene.world.sun_light + + self.use_shadow = False + self.use_ibl = False + objects = scene.objects[:] objects.sort(key=lambda o:o.name) if obj_filter: @@ -55,11 +64,20 @@ class Scene: if o.type=='MESH': clones = [c for c in objects if is_same_object(o, c)] self.prototypes.append(o) + instance_list = self.instances + if o.material_slots and o.material_slots[0].material: + mat = o.material_slots[0].material + if mat.blend_method=='BLEND': + instance_list = self.blended_instances + if mat.image_based_lighting: + self.use_ibl = True for c in clones: - self.instances.append(Instance(c, o)) + instance_list.append(Instance(c, o)) processed.add(c.name) elif o.type=='LIGHT': self.lights.append(o) + if o.data.use_shadow: + self.use_shadow = True def get_chain(self): result = []