Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __get_blender_mesh(self, scene):
settings = 'RENDER' if self.__export_mode != ProjectExportMode.INTERACTIVE_RENDER else 'PREVIEW'
me = self.bl_obj.to_mesh(
scene,
apply_modifiers=True,
settings=settings,
calc_tessface=False)
bm = bmesh.new()
bm.from_mesh(me)
bmesh.ops.triangulate(bm, faces=bm.faces)
bm.to_mesh(me)
bm.free()
return me
shape_params['height'] = self.bl_lamp.data.size
if lamp_data.shape == 'RECTANGLE':
shape_params['height'] = self.bl_lamp.data.size_y
elif as_lamp_data.area_shape == 'disk':
shape_params['radius'] = self.bl_lamp.data.size / 2
else:
shape_params['radius'] = self.bl_lamp.data.size / 2
shape_params['resolution_u'] = 4
shape_params['resolution_v'] = 4
mesh_name = self.bl_lamp.name + "_mesh"
if self.__export_mode == ProjectExportMode.PROJECT_EXPORT:
self.__as_area_mesh = asr.MeshObject(mesh_name, shape_params)
else:
self.__as_area_mesh = asr.create_primitive_mesh(mesh_name, shape_params)
# Create area light object instance, set visibility flags
lamp_inst_params = {'visibility': {'camera': False}} if not as_lamp_data.area_visibility else {}
self.__as_area_mesh_inst = asr.ObjectInstance(self.bl_lamp.name + '_inst', lamp_inst_params, mesh_name,
self._convert_matrix(self.bl_lamp.matrix_world),
{"default": lamp_data.name + "_mat"}, {"default": "__null_material"})
# Emit basic lamp shader group
if lamp_data.appleseed.osl_node_tree is None:
self.__create_material(as_lamp_data, lamp_data)
def __init__(self, obj, export_mode, asset_handler):
super(MeshTranslator, self).__init__(obj, asset_handler)
self.__export_mode = export_mode
if self.__export_mode == ProjectExportMode.PROJECT_EXPORT:
self.__geom_dir = self.asset_handler.geometry_dir
self.__mesh_filenames = []
# Motion blur
self.__key_index = 0
self.__deforming = obj.appleseed.use_deformation_blur and is_object_deforming(obj)
# Materials
self.__front_materials = {}
self.__back_materials = {}
self.__alpha_tex = None
self.__alpha_tex_inst = None
def __object_instance_mesh_name(self, mesh_name):
if self.__export_mode == ProjectExportMode.PROJECT_EXPORT:
return mesh_name + ".mesh"
return mesh_name
def __init__(self, dupli, export_mode, asset_handler):
super(DupliTranslator, self).__init__(dupli, asset_handler)
self.__export_mode = export_mode
self.__settings = 'VIEWPORT' if self.__export_mode == ProjectExportMode.INTERACTIVE_RENDER else 'RENDER'
self.__object_translators = []
self.__material_translators = {}
self.__datablock_to_translator = {}