diff --git a/tool/src/aurora_iconset_builder/assemblicon/context.py b/tool/src/aurora_iconset_builder/assemblicon/context.py index 83f7866..588c168 100644 --- a/tool/src/aurora_iconset_builder/assemblicon/context.py +++ b/tool/src/aurora_iconset_builder/assemblicon/context.py @@ -184,25 +184,51 @@ class AdvancedContext: def __intern_render_svg( self, src: Path, dst: Optional[Path], cfg: SvgConfig ) -> Path: + """ + Internal used function for rendering SVG. + + :return: The path to destination storing render result. + """ if dst is None: dst = self.__allocate_lib_temporary_artifact(".png") artrender.render_svg(src, dst, self.__context.prerequisite.svg_render, cfg) return dst def render_svg( - self, src: Path, dst: Optional[Path], cfg: SvgConfig = _DEFAULT_SVG_CONFIG + self, src: Path, dst: Path, cfg: SvgConfig = _DEFAULT_SVG_CONFIG ) -> None: + """ + Just render given SVG to PNG file. + + :param src: The path to SVG file to be rendered. + :param dst: The path to rendered PNG file. + :param cfg: The configuration when rendering SVG file. Default for vanilla artifact. + """ self.__intern_render_svg(src, dst, cfg) def render_svg_then_load( self, src: Path, dst: Optional[Path], cfg: SvgConfig = _DEFAULT_SVG_CONFIG ) -> Artifact: + """ + Render given SVG to PNG file, then load it directly. + + :param src: The path to SVG file to be rendered. + :param dst: The path to rendered PNG file. + ``None`` if you don't need to store it in temporary or output directory. + :param cfg: The configuration when rendering SVG file. Default for vanilla artifact. + :return: The loaded built PNG file. + """ dst = self.__intern_render_svg(src, dst, cfg) return artio.load_artifact(dst) def __intern_render_blender( self, src: Path, dst: Optional[Path], cfg: BlenderConfig ) -> Path: + """ + Internal used function for rendering Blender composition. + + :return: The path to destination storing render result. + """ temp_script = self.__fetch_const_lib_temporary_artifact("blender.py") if dst is None: dst = self.__allocate_lib_temporary_artifact(".png") @@ -210,13 +236,29 @@ class AdvancedContext: return dst def render_blender( - self, src: Path, dst: Optional[Path], cfg: BlenderConfig = _DEFAULT_BLD_CONFIG + self, src: Path, dst: Path, cfg: BlenderConfig = _DEFAULT_BLD_CONFIG ) -> None: + """ + Just render given Blender composition to PNG file. + + :param src: The path to Blender composition file to be rendered. + :param dst: The path to rendered PNG file. + :param cfg: The configuration when rendering Blender composition file. Default for vanilla artifact. + """ self.__intern_render_blender(src, dst, cfg) def render_blender_then_load( self, src: Path, dst: Optional[Path], cfg: BlenderConfig = _DEFAULT_BLD_CONFIG ) -> Artifact: + """ + Render given Blender composition to PNG file, then load it directly. + + :param src: The path to Blender composition file to be rendered. + :param dst: The path to rendered PNG file. + ``None`` if you don't need to store it in temporary or output directory. + :param cfg: The configuration when rendering Blender composition file. Default for vanilla artifact. + :return: The loaded built PNG file. + """ dst = self.__intern_render_blender(src, dst, cfg) return artio.load_artifact(dst)