mirror of
https://github.com/H-uru/korman.git
synced 2025-07-14 02:27:36 -04:00
Add type hints to the exporter class.
The import statements had to be modified to avoid name collisions with the modules and the type hints.
This commit is contained in:
@ -208,7 +208,7 @@ if(korman_BUILD_HSPLASMA)
|
|||||||
korman_add_external_project(HSPlasma
|
korman_add_external_project(HSPlasma
|
||||||
GIT_REPOSITORY "https://github.com/H-uru/libhsplasma.git"
|
GIT_REPOSITORY "https://github.com/H-uru/libhsplasma.git"
|
||||||
# Be sure to increase this as the feature set used by Korman increases
|
# Be sure to increase this as the feature set used by Korman increases
|
||||||
GIT_TAG 6fa56d979163af8602cd6212449a07400a14b532
|
GIT_TAG 260ccccd464c002d1655c10acdc3335d10e52542
|
||||||
# We can only do shallow checkouts if the above is a branch or tag.
|
# We can only do shallow checkouts if the above is a branch or tag.
|
||||||
GIT_SHALLOW FALSE
|
GIT_SHALLOW FALSE
|
||||||
CMAKE_CACHE_ARGS
|
CMAKE_CACHE_ARGS
|
||||||
|
@ -19,28 +19,47 @@ from collections import defaultdict
|
|||||||
from contextlib import ExitStack
|
from contextlib import ExitStack
|
||||||
import functools
|
import functools
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import *
|
||||||
|
|
||||||
from ..helpers import TemporaryObject
|
from ..helpers import TemporaryObject
|
||||||
from ..korlib import ConsoleToggler
|
from ..korlib import ConsoleToggler
|
||||||
|
|
||||||
from PyHSPlasma import *
|
from PyHSPlasma import *
|
||||||
|
|
||||||
from . import animation
|
from .animation import AnimationConverter
|
||||||
from . import camera
|
from .camera import CameraConverter
|
||||||
from . import decal
|
from .decal import DecalConverter
|
||||||
from . import explosions
|
from . import explosions
|
||||||
from . import etlight
|
from .etlight import LightBaker
|
||||||
from . import image
|
from .image import ImageCache
|
||||||
from . import locman
|
from .locman import LocalizationConverter
|
||||||
from . import logger
|
from . import logger
|
||||||
from . import manager
|
from .manager import ExportManager
|
||||||
from . import mesh
|
from .mesh import MeshConverter
|
||||||
from . import outfile
|
from .outfile import OutputFiles
|
||||||
from . import physics
|
from .physics import PhysicsConverter
|
||||||
from . import rtlight
|
from .rtlight import LightConverter
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
class Exporter:
|
class Exporter:
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
actors: Set[str] = ...
|
||||||
|
want_node_trees: defaultdict[Set[str]] = ...
|
||||||
|
report: logger._ExportLogger = ...
|
||||||
|
exit_stack: ExitStack = ...
|
||||||
|
mgr: ExportManager = ...
|
||||||
|
mesh: MeshConverter = ...
|
||||||
|
physics: PhysicsConverter = ...
|
||||||
|
light: LightConverter = ...
|
||||||
|
animation: AnimationConverter = ...
|
||||||
|
output: OutputFiles = ...
|
||||||
|
camera: CameraConverter = ...
|
||||||
|
image: ImageCache = ...
|
||||||
|
locman: LocalizationConverter = ...
|
||||||
|
decal: DecalConverter = ...
|
||||||
|
oven: LightBaker = ...
|
||||||
|
|
||||||
def __init__(self, op):
|
def __init__(self, op):
|
||||||
self._op = op # Blender export operator
|
self._op = op # Blender export operator
|
||||||
self._objects = []
|
self._objects = []
|
||||||
@ -52,17 +71,17 @@ class Exporter:
|
|||||||
log = logger.ExportVerboseLogger if self._op.verbose else logger.ExportProgressLogger
|
log = logger.ExportVerboseLogger if self._op.verbose else logger.ExportProgressLogger
|
||||||
with ConsoleToggler(self._op.show_console), log(self._op.filepath) as self.report, ExitStack() as self.exit_stack:
|
with ConsoleToggler(self._op.show_console), log(self._op.filepath) as self.report, ExitStack() as self.exit_stack:
|
||||||
# Step 0: Init export resmgr and stuff
|
# Step 0: Init export resmgr and stuff
|
||||||
self.mgr = manager.ExportManager(self)
|
self.mgr = ExportManager(self)
|
||||||
self.mesh = mesh.MeshConverter(self)
|
self.mesh = MeshConverter(self)
|
||||||
self.physics = physics.PhysicsConverter(self)
|
self.physics = PhysicsConverter(self)
|
||||||
self.light = rtlight.LightConverter(self)
|
self.light = LightConverter(self)
|
||||||
self.animation = animation.AnimationConverter(self)
|
self.animation = AnimationConverter(self)
|
||||||
self.output = outfile.OutputFiles(self, self._op.filepath)
|
self.output = OutputFiles(self, self._op.filepath)
|
||||||
self.camera = camera.CameraConverter(self)
|
self.camera = CameraConverter(self)
|
||||||
self.image = image.ImageCache(self)
|
self.image = ImageCache(self)
|
||||||
self.locman = locman.LocalizationConverter(self)
|
self.locman = LocalizationConverter(self)
|
||||||
self.decal = decal.DecalConverter(self)
|
self.decal = DecalConverter(self)
|
||||||
self.oven = etlight.LightBaker(mesh=self.mesh, report=self.report)
|
self.oven = LightBaker(mesh=self.mesh, report=self.report)
|
||||||
|
|
||||||
# Step 0.8: Init the progress mgr
|
# Step 0.8: Init the progress mgr
|
||||||
self.mesh.add_progress_presteps(self.report)
|
self.mesh.add_progress_presteps(self.report)
|
||||||
@ -72,7 +91,7 @@ class Exporter:
|
|||||||
self.report.progress_add_step("Unifying Superstrings")
|
self.report.progress_add_step("Unifying Superstrings")
|
||||||
self.report.progress_add_step("Harvesting Actors")
|
self.report.progress_add_step("Harvesting Actors")
|
||||||
if self._op.lighting_method != "skip":
|
if self._op.lighting_method != "skip":
|
||||||
etlight.LightBaker.add_progress_steps(self.report)
|
LightBaker.add_progress_steps(self.report)
|
||||||
self.report.progress_add_step("Exporting Scene Objects")
|
self.report.progress_add_step("Exporting Scene Objects")
|
||||||
self.report.progress_add_step("Exporting Logic Nodes")
|
self.report.progress_add_step("Exporting Logic Nodes")
|
||||||
self.report.progress_add_step("Finalizing Plasma Logic")
|
self.report.progress_add_step("Finalizing Plasma Logic")
|
||||||
|
Reference in New Issue
Block a user