How to use the translators.utilites.ProjectExportMode 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 / scene.py View on Github external
frame_params = {'resolution': asr.Vector2i(width, height),
                        'camera': "Camera",
                        'filter': asr_scene_props.pixel_filter,
                        'filter_size': asr_scene_props.pixel_filter_size,
                        'denoiser': asr_scene_props.denoise_mode,
                        'noise_seed': noise_seed,
                        'skip_denoised': asr_scene_props.skip_denoised,
                        'random_pixel_order': asr_scene_props.random_pixel_order,
                        'prefilter_spikes': asr_scene_props.prefilter_spikes,
                        'spike_threshold': asr_scene_props.spike_threshold,
                        'patch_distance_threshold': asr_scene_props.patch_distance_threshold,
                        'denoise_scales': asr_scene_props.denoise_scales,
                        'mark_invalid_pixels': asr_scene_props.mark_invalid_pixels}

        if self.__export_mode != ProjectExportMode.PROJECT_EXPORT:
            frame_params['tile_size'] = asr.Vector2i(asr_scene_props.tile_size, asr_scene_props.tile_size)

        return frame_params
github appleseedhq / blenderseed / translators / objects / mesh.py View on Github external
def __object_instance_mesh_name(self, mesh_name):
        if self.__export_mode == ProjectExportMode.PROJECT_EXPORT:
            return f"{mesh_name}.mesh"

        return mesh_name
github appleseedhq / blenderseed / translators / objects / mesh.py View on Github external
logger.debug(f"appleseed: Creating mesh entity for {self.orig_name}")
        self.__mesh_params = self.__get_mesh_params()

        self.__as_mesh = asr.MeshObject(self.orig_name, self.__mesh_params)

        self.__as_mesh_inst_params = self.__get_mesh_inst_params()

        self.__front_materials, self.__back_materials = self.__get_material_mappings()

        eval_object = self._bl_obj.evaluated_get(depsgraph)

        me = eval_object.to_mesh()

        self.__convert_mesh(me)

        if self.__export_mode == ProjectExportMode.PROJECT_EXPORT:
            logger.debug(f"appleseed: Writing mesh file object {self.orig_name}, time = 0")
            self.__write_mesh(self.orig_name)

        eval_object.to_mesh_clear()

        if self.__is_deforming:
            self.__as_mesh.set_motion_segment_count(num_def_times - 1)
github appleseedhq / blenderseed / translators / scene.py View on Github external
'max_samples': asr_scene_props.adaptive_max_samples,
                                                            'file_path': realpath(asr_scene_props.texture_sampler_filepath)},
                      'use_embree': asr_scene_props.use_embree,
                      'pixel_renderer': pixel_renderer,
                      'lighting_engine': lighting_engine,
                      'tile_renderer': tile_renderer,
                      'passes': asr_scene_props.renderer_passes,
                      'generic_frame_renderer': {'tile_ordering': asr_scene_props.tile_ordering},
                      'progressive_frame_renderer': {'max_average_spp': asr_scene_props.interactive_max_samples,
                                                     'max_fps': asr_scene_props.interactive_max_fps,
                                                     'time_limit': asr_scene_props.interactive_max_time},
                      'light_sampler': {'algorithm': asr_scene_props.light_sampler,
                                        'enable_light_importance_sampling': asr_scene_props.enable_light_importance_sampling},
                      'shading_result_framebuffer': "permanent" if asr_scene_props.renderer_passes > 1 else "ephemeral"}

        if self.__export_mode != ProjectExportMode.PROJECT_EXPORT:
            if self.__export_mode == ProjectExportMode.INTERACTIVE_RENDER:
                render_threads = -1
            else:
                render_threads = asr_scene_props.threads if not asr_scene_props.threads_auto else 'auto'
            parameters['rendering_threads'] = render_threads
            parameters['texture_store'] = {'max_size': asr_scene_props.tex_cache * 1024 * 1024}

        if lighting_engine == 'pt':
            parameters['pt'] = {'enable_ibl': True if asr_scene_props.enable_ibl else False,
                                'enable_dl': True if asr_scene_props.enable_dl else False,
                                'enable_caustics': True if scene.appleseed.enable_caustics else False,
                                'clamp_roughness': True if scene.appleseed.enable_clamp_roughness else False,
                                'record_light_paths': True if scene.appleseed.record_light_paths else False,
                                'next_event_estimation': True,
                                'rr_min_path_length': asr_scene_props.rr_start,
                                'optimize_for_lights_outside_volumes': asr_scene_props.optimize_for_lights_outside_volumes,
github appleseedhq / blenderseed / translators / objects / mesh.py View on Github external
self.__mesh_params = str()

        self.__instance_lib = asr.BlTransformLibrary()

        self.__as_mesh = None
        self.__as_mesh_inst = None
        self.__as_mesh_inst_params = dict()
        self.__front_materials = dict()
        self.__back_materials = dict()

        self.__obj_inst_name = None
        self.__ass_name = str()
        self.__ass = None

        self.__geom_dir = self._asset_handler.geometry_dir if export_mode == ProjectExportMode.PROJECT_EXPORT else None

        self.__mesh_filenames = list()

        self.__is_deforming = bl_obj.appleseed.use_deformation_blur and is_object_deforming(bl_obj)

        self._bl_obj.appleseed.obj_name = self._bl_obj.name_full
github appleseedhq / blenderseed / translators / objects / lamp.py View on Github external
def flush_entities(self, as_scene, as_main_assembly, as_project):
        logger.debug(f"appleseed: Flushing lamp entity for {self.orig_name} to project")
        self.__instance_lib.optimize_xforms()
        
        needs_assembly = self.__export_mode == ProjectExportMode.INTERACTIVE_RENDER or self.__instance_lib.needs_assembly()

        if self.__lamp_model != 'area_lamp':
            radiance_name = self.__as_lamp_radiance.get_name()
            as_main_assembly.colors().insert(self.__as_lamp_radiance)
            self.__as_lamp_radiance = as_main_assembly.colors().get_by_name(radiance_name)

            if needs_assembly:
                self.__ass_name = f"{self.orig_name}_ass"
                self.__ass = asr.Assembly(self.__ass_name)

                self.__ass.lights().insert(self.__as_lamp)
                self.__as_lamp = self.__ass.lights().get_by_name(self.orig_name)

                as_main_assembly.assemblies().insert(self.__ass)
                self.__ass = as_main_assembly.assemblies().get_by_name(self.__ass_name)
github appleseedhq / blenderseed / translators / scene.py View on Github external
'file_path': realpath(asr_scene_props.texture_sampler_filepath)},
                      'use_embree': asr_scene_props.use_embree,
                      'pixel_renderer': pixel_renderer,
                      'lighting_engine': lighting_engine,
                      'tile_renderer': tile_renderer,
                      'passes': asr_scene_props.renderer_passes,
                      'generic_frame_renderer': {'tile_ordering': asr_scene_props.tile_ordering},
                      'progressive_frame_renderer': {'max_average_spp': asr_scene_props.interactive_max_samples,
                                                     'max_fps': asr_scene_props.interactive_max_fps,
                                                     'time_limit': asr_scene_props.interactive_max_time},
                      'light_sampler': {'algorithm': asr_scene_props.light_sampler,
                                        'enable_light_importance_sampling': asr_scene_props.enable_light_importance_sampling},
                      'shading_result_framebuffer': "permanent" if asr_scene_props.renderer_passes > 1 else "ephemeral"}

        if self.__export_mode != ProjectExportMode.PROJECT_EXPORT:
            if self.__export_mode == ProjectExportMode.INTERACTIVE_RENDER:
                render_threads = -1
            else:
                render_threads = asr_scene_props.threads if not asr_scene_props.threads_auto else 'auto'
            parameters['rendering_threads'] = render_threads
            parameters['texture_store'] = {'max_size': asr_scene_props.tex_cache * 1024 * 1024}

        if lighting_engine == 'pt':
            parameters['pt'] = {'enable_ibl': True if asr_scene_props.enable_ibl else False,
                                'enable_dl': True if asr_scene_props.enable_dl else False,
                                'enable_caustics': True if scene.appleseed.enable_caustics else False,
                                'clamp_roughness': True if scene.appleseed.enable_clamp_roughness else False,
                                'record_light_paths': True if scene.appleseed.record_light_paths else False,
                                'next_event_estimation': True,
                                'rr_min_path_length': asr_scene_props.rr_start,
                                'optimize_for_lights_outside_volumes': asr_scene_props.optimize_for_lights_outside_volumes,
                                'volume_distance_samples': asr_scene_props.volume_distance_samples,
github appleseedhq / blenderseed / translators / scene.py View on Github external
logger.debug("Creating texture and geometry directories in %s", project_dir)

        geometry_dir = os.path.join(project_dir, "_geometry")
        textures_dir = os.path.join(project_dir, "_textures")

        if not os.path.exists(geometry_dir):
            os.makedirs(geometry_dir)

        if not os.path.exists(textures_dir):
            os.makedirs(textures_dir)

        logger.debug("Creating project export scene translator, filename: %s", depsgraph.scene_eval.appleseed.export_path)

        asset_handler = CopyAssetsAssetHandler(project_dir, geometry_dir, textures_dir, depsgraph)

        return cls(export_mode=ProjectExportMode.PROJECT_EXPORT,
                   selected_only=depsgraph.scene.appleseed.export_selected,
                   asset_handler=asset_handler)