Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inner_angle = (1.0 - self.bl_lamp.data.spot_blend) * outer_angle
intensity = f"{self.appleseed_name}_radiance"
intensity_multiplier = as_lamp_data.radiance_multiplier
if as_lamp_data.radiance_use_tex and as_lamp_data.radiance_tex is not None:
tex_id = as_lamp_data.radiance_tex.name_full
if tex_id not in as__texture_translators:
textures_to_add[tex_id] = TextureTranslator(as_lamp_data.radiance_tex,
self.asset_handler)
intensity = f"{as_lamp_data.radiance_tex.name_full}_inst"
if as_lamp_data.radiance_multiplier_use_tex and as_lamp_data.radiance_multiplier_tex is not None:
tex_id = as_lamp_data.radiance_multiplier_tex.name_full
if tex_id not in as__texture_translators:
textures_to_add[tex_id] = TextureTranslator(as_lamp_data.radiance_multiplier_tex,
self.asset_handler)
intensity_multiplier = f"{as_lamp_data.radiance_multiplier_tex.name_full}_inst"
light_params = {'intensity': intensity,
'intensity_multiplier': intensity_multiplier,
'exposure': as_lamp_data.exposure,
'cast_indirect_light': as_lamp_data.cast_indirect,
'importance_multiplier': as_lamp_data.importance_multiplier,
'exposure_multiplier': as_lamp_data.exposure_multiplier,
'tilt_angle': as_lamp_data.tilt_angle,
'inner_angle': inner_angle,
'outer_angle': outer_angle}
return light_params
textures_to_add = dict()
for obj in bpy.data.objects:
if obj.type == 'LIGHT':
objects_to_add[obj] = LampTranslator(obj, self.__export_mode, self.__asset_handler)
elif obj.type == 'MESH' and len(obj.data.loops) > 0:
objects_to_add[obj] = MeshTranslator(obj, self.__export_mode, self.__asset_handler)
elif obj.type == 'EMPTY' and obj.appleseed.object_export == "archive_assembly":
objects_to_add[obj] = ArchiveAssemblyTranslator(obj, self.__asset_handler)
for mat in bpy.data.materials:
materials_to_add[mat] = MaterialTranslator(mat, self.__asset_handler)
for tex in bpy.data.images:
if tex.users > 0 and tex.name not in ("Render Result", "Viewer Node"):
textures_to_add[tex] = TextureTranslator(tex, self.__asset_handler)
# Create camera, world, material and texture entities
self.__as_camera_translator.create_entities(depsgraph, context, engine)
if self.__as_world_translator is not None:
self.__as_world_translator.create_entities(depsgraph)
for obj, trans in materials_to_add.items():
trans.create_entities(depsgraph, engine)
for obj, trans in textures_to_add.items():
trans.create_entities(depsgraph)
# Set initial position of all objects and lamps
self.__calc_initial_positions(depsgraph, engine, objects_to_add)
# Remove unused translators
def _get_spot_lamp_params(self, textures_to_add, as__texture_translators):
as_lamp_data = self.bl_lamp.data.appleseed
outer_angle = math.degrees(self.bl_lamp.data.spot_size)
inner_angle = (1.0 - self.bl_lamp.data.spot_blend) * outer_angle
intensity = f"{self.appleseed_name}_radiance"
intensity_multiplier = as_lamp_data.radiance_multiplier
if as_lamp_data.radiance_use_tex and as_lamp_data.radiance_tex is not None:
tex_id = as_lamp_data.radiance_tex.name_full
if tex_id not in as__texture_translators:
textures_to_add[tex_id] = TextureTranslator(as_lamp_data.radiance_tex,
self.asset_handler)
intensity = f"{as_lamp_data.radiance_tex.name_full}_inst"
if as_lamp_data.radiance_multiplier_use_tex and as_lamp_data.radiance_multiplier_tex is not None:
tex_id = as_lamp_data.radiance_multiplier_tex.name_full
if tex_id not in as__texture_translators:
textures_to_add[tex_id] = TextureTranslator(as_lamp_data.radiance_multiplier_tex,
self.asset_handler)
intensity_multiplier = f"{as_lamp_data.radiance_multiplier_tex.name_full}_inst"
light_params = {'intensity': intensity,
'intensity_multiplier': intensity_multiplier,
'exposure': as_lamp_data.exposure,
'cast_indirect_light': as_lamp_data.cast_indirect,
'importance_multiplier': as_lamp_data.importance_multiplier,
'exposure_multiplier': as_lamp_data.exposure_multiplier,