Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
logger.debug("Creating mesh translator for object %s", obj_key)
translator = MeshTranslator(dupli.object,
self.__export_mode,
self.asset_handler)
self.__object_translators.append(translator)
for slot in dupli.object.material_slots:
mat = slot.material
mat_key = ObjectKey(mat)
if mat_key not in self.__material_translators:
logger.debug("Creating material translator for material %s", mat_key)
mat_translator = MaterialTranslator(mat, self.asset_handler)
self.__material_translators[mat_key] = mat_translator
mat_translator.create_entities(scene)
if not is_modified:
logger.debug("Saving translator for object %s in instance map", obj_key)
self.__datablock_to_translator[mesh_key] = translator
else:
logger.debug("Skipping unsupported dupli source object of type %s", dupli.object.type)
# Create dupli instances entities.
for translator in self.__object_translators:
translator.create_entities(scene)
current_frame = scene.frame_current + scene.frame_subframe
for translator in self.__object_translators:
translator.set_deform_key(scene, current_frame, {current_frame})
def __create_material_translators(self, obj):
for slot in obj.material_slots:
mat = slot.material
mat_key = ObjectKey(mat)
if mat_key not in self._material_translators:
logger.debug("Creating material translator for material %s", mat_key)
translator = MaterialTranslator(mat, self.asset_handler)
self._material_translators[mat_key] = translator
logger.debug("skipping non-selected object %s", obj.name)
continue
obj_key = ObjectKey(obj)
if obj.type == 'LAMP':
logger.debug("Creating lamp translator for object %s of type %s", obj_key, obj.data.type)
if obj.data.type == 'AREA':
self._lamp_translators[obj_key] = AreaLampTranslator(obj, self.export_mode, self.asset_handler)
else:
self._lamp_translators[obj_key] = LampTranslator(obj, self.asset_handler)
if obj.data.appleseed.osl_node_tree is not None:
lamp = obj.data
lamp_key = ObjectKey(lamp)
translator = MaterialTranslator(lamp, self.asset_handler)
self._lamp_material_translators[lamp_key] = translator
elif self.__is_dupli_source(obj):
self.__create_material_translators(obj)
# Sources of duplicated objects are not shown in renders.
logger.debug("Skipping dupli-source object %s", obj_key)
continue
elif obj.type in GroupTranslator.MESH_OBJECTS:
mesh_key = ObjectKey(obj.data)
if obj.is_duplicator:
logger.debug("Creating dupli translator for object %s", obj_key)
self._dupli_translators[obj_key] = DupliTranslator(obj, self.export_mode, self.asset_handler)
if obj.dupli_type == 'NONE':
def _reset(self, mat):
super(MaterialTranslator, self)._reset(mat)
if self.bl_node_tree:
self.__shaders = self.bl_node_tree.nodes
self.__colors = []
self.__volume = None