doc: add some docstring for assemblicon context
This commit is contained in:
@@ -184,25 +184,51 @@ class AdvancedContext:
|
|||||||
def __intern_render_svg(
|
def __intern_render_svg(
|
||||||
self, src: Path, dst: Optional[Path], cfg: SvgConfig
|
self, src: Path, dst: Optional[Path], cfg: SvgConfig
|
||||||
) -> Path:
|
) -> Path:
|
||||||
|
"""
|
||||||
|
Internal used function for rendering SVG.
|
||||||
|
|
||||||
|
:return: The path to destination storing render result.
|
||||||
|
"""
|
||||||
if dst is None:
|
if dst is None:
|
||||||
dst = self.__allocate_lib_temporary_artifact(".png")
|
dst = self.__allocate_lib_temporary_artifact(".png")
|
||||||
artrender.render_svg(src, dst, self.__context.prerequisite.svg_render, cfg)
|
artrender.render_svg(src, dst, self.__context.prerequisite.svg_render, cfg)
|
||||||
return dst
|
return dst
|
||||||
|
|
||||||
def render_svg(
|
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:
|
) -> 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)
|
self.__intern_render_svg(src, dst, cfg)
|
||||||
|
|
||||||
def render_svg_then_load(
|
def render_svg_then_load(
|
||||||
self, src: Path, dst: Optional[Path], cfg: SvgConfig = _DEFAULT_SVG_CONFIG
|
self, src: Path, dst: Optional[Path], cfg: SvgConfig = _DEFAULT_SVG_CONFIG
|
||||||
) -> Artifact:
|
) -> 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)
|
dst = self.__intern_render_svg(src, dst, cfg)
|
||||||
return artio.load_artifact(dst)
|
return artio.load_artifact(dst)
|
||||||
|
|
||||||
def __intern_render_blender(
|
def __intern_render_blender(
|
||||||
self, src: Path, dst: Optional[Path], cfg: BlenderConfig
|
self, src: Path, dst: Optional[Path], cfg: BlenderConfig
|
||||||
) -> Path:
|
) -> 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")
|
temp_script = self.__fetch_const_lib_temporary_artifact("blender.py")
|
||||||
if dst is None:
|
if dst is None:
|
||||||
dst = self.__allocate_lib_temporary_artifact(".png")
|
dst = self.__allocate_lib_temporary_artifact(".png")
|
||||||
@@ -210,13 +236,29 @@ class AdvancedContext:
|
|||||||
return dst
|
return dst
|
||||||
|
|
||||||
def render_blender(
|
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:
|
) -> 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)
|
self.__intern_render_blender(src, dst, cfg)
|
||||||
|
|
||||||
def render_blender_then_load(
|
def render_blender_then_load(
|
||||||
self, src: Path, dst: Optional[Path], cfg: BlenderConfig = _DEFAULT_BLD_CONFIG
|
self, src: Path, dst: Optional[Path], cfg: BlenderConfig = _DEFAULT_BLD_CONFIG
|
||||||
) -> Artifact:
|
) -> 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)
|
dst = self.__intern_render_blender(src, dst, cfg)
|
||||||
return artio.load_artifact(dst)
|
return artio.load_artifact(dst)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user