Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __create_dupli_instances(self, obj, scene, settings):
with DupliListBuilder(obj, scene, settings):
for dupli in obj.dupli_list:
# Create translators for dupli instances.
if dupli.object.type == 'MESH':
obj_key = ObjectKey (dupli.object)
mesh_key = ObjectKey(dupli.object.data)
is_modified = dupli.object.is_modified(scene, 'RENDER')
if is_modified == False and mesh_key in self.__datablock_to_translator:
logger.debug("Creating instance translator for object %s, master obj: %s", obj_key, mesh_key)
master_translator = self.__datablock_to_translator[mesh_key]
self.__object_translators.append(InstanceTranslator(dupli.object, master_translator, self.asset_handler))
master_translator.add_instance()
else:
logger.debug("Creating mesh translator for object %s", obj_key)
translator = MeshTranslator(dupli.object,
self.__export_mode,
self.asset_handler)
def __create_dupli_instances(self, obj, scene, settings):
with DupliListBuilder(obj, scene, settings):
for dupli in obj.dupli_list:
# Create translators for dupli instances.
if dupli.object.type == 'MESH':
obj_key = ObjectKey (dupli.object)
mesh_key = ObjectKey(dupli.object.data)
is_modified = dupli.object.is_modified(scene, 'RENDER')
if is_modified == False and mesh_key in self.__datablock_to_translator:
logger.debug("Creating instance translator for object %s, master obj: %s", obj_key, mesh_key)
master_translator = self.__datablock_to_translator[mesh_key]
self.__object_translators.append(InstanceTranslator(dupli.object, master_translator, self.asset_handler))
master_translator.add_instance()
else:
logger.debug("Creating mesh translator for object %s", obj_key)
translator = MeshTranslator(dupli.object,
self.__export_mode,
self.asset_handler)
master_translator = self.__datablock_to_translator[mesh_key]
self.__object_translators.append(InstanceTranslator(dupli.object, master_translator, self.asset_handler))
master_translator.add_instance()
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)