mirror of
https://github.com/deepseek-ai/DreamCraft3D.git
synced 2025-02-23 14:28:55 -05:00
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
|
from dataclasses import dataclass
|
||
|
|
||
|
import threestudio
|
||
|
from threestudio.models.background.base import BaseBackground
|
||
|
from threestudio.models.geometry.base import BaseImplicitGeometry
|
||
|
from threestudio.models.materials.base import BaseMaterial
|
||
|
from threestudio.utils.base import BaseObject
|
||
|
from threestudio.utils.typing import *
|
||
|
|
||
|
|
||
|
@dataclass
|
||
|
class ExporterOutput:
|
||
|
save_name: str
|
||
|
save_type: str
|
||
|
params: Dict[str, Any]
|
||
|
|
||
|
|
||
|
class Exporter(BaseObject):
|
||
|
@dataclass
|
||
|
class Config(BaseObject.Config):
|
||
|
save_video: bool = False
|
||
|
|
||
|
cfg: Config
|
||
|
|
||
|
def configure(
|
||
|
self,
|
||
|
geometry: BaseImplicitGeometry,
|
||
|
material: BaseMaterial,
|
||
|
background: BaseBackground,
|
||
|
) -> None:
|
||
|
@dataclass
|
||
|
class SubModules:
|
||
|
geometry: BaseImplicitGeometry
|
||
|
material: BaseMaterial
|
||
|
background: BaseBackground
|
||
|
|
||
|
self.sub_modules = SubModules(geometry, material, background)
|
||
|
|
||
|
@property
|
||
|
def geometry(self) -> BaseImplicitGeometry:
|
||
|
return self.sub_modules.geometry
|
||
|
|
||
|
@property
|
||
|
def material(self) -> BaseMaterial:
|
||
|
return self.sub_modules.material
|
||
|
|
||
|
@property
|
||
|
def background(self) -> BaseBackground:
|
||
|
return self.sub_modules.background
|
||
|
|
||
|
def __call__(self, *args, **kwargs) -> List[ExporterOutput]:
|
||
|
raise NotImplementedError
|
||
|
|
||
|
|
||
|
@threestudio.register("dummy-exporter")
|
||
|
class DummyExporter(Exporter):
|
||
|
def __call__(self, *args, **kwargs) -> List[ExporterOutput]:
|
||
|
# DummyExporter does not export anything
|
||
|
return []
|