How to use the translators.assethandlers.AssetType function in translators

To help you get started, we’ve selected a few translators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appleseedhq / blenderseed / translators / assethandlers.py View on Github external
def process_path(self, filename, asset_type, sub_texture=False):
        archive_asset = bpy.path.abspath(filename)

        if '%' in archive_asset:
            archive_asset = self._convert_frame_number(archive_asset)

        if asset_type == AssetType.SHADER_ASSET:
            dir_name, file_name = os.path.split(archive_asset)
            self._searchpaths.append(dir_name)
            archive_asset = os.path.splitext(file_name)[0]

        if asset_type == AssetType.TEXTURE_ASSET and sub_texture:
            base_filename = os.path.splitext(archive_asset)[0]
            archive_asset = f"{base_filename}.tx"

        if asset_type == AssetType.ARCHIVE_ASSET:
            archive_dir, archive = os.path.split(archive_asset)
            self._searchpaths.append(archive_dir)
            archive_asset = archive

        return archive_asset
github appleseedhq / blenderseed / translators / objects / archive_assembly.py View on Github external
def create_entities(self, bl_scene, context=None):
        logger.debug(f"appleseed: Creating archive asset entity for {self.orig_name}")
        self.__ass_name = f"{self.orig_name}_ass"

        file_path = self._asset_handler.process_path(self._bl_obj.appleseed.archive_path,
                                                     AssetType.ARCHIVE_ASSET)

        ass_options = {'filename': file_path}

        self.__ass = asr.Assembly("archive_assembly", self.__ass_name, ass_options)