Skip to content

Commit

Permalink
feat: added export button for EVSKY format
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Sep 17, 2024
1 parent 83219de commit fe962bb
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/sbstudio/model/file_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FileFormat(Enum):
DSS3 = "dss3"
DAC = "dac"
DROTEK = "drotek"
EVSKY = "evsky"
LITEBEE = "litebee"


Expand Down Expand Up @@ -48,6 +49,8 @@ def update_supported_file_formats_from_limits(limits: Limits) -> None:
formats.append(FileFormat.DSS3)
elif feature == "export:drotek":
formats.append(FileFormat.DROTEK)
elif feature == "export:evsky":
formats.append(FileFormat.EVSKY)
elif feature == "export:litebee":
formats.append(FileFormat.LITEBEE)
elif feature == "export:plot":
Expand Down
2 changes: 2 additions & 0 deletions src/modules/sbstudio/plugin/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .export_to_csv import SkybrushCSVExportOperator
from .export_to_dac import DACExportOperator
from .export_to_dss import DSSPathExportOperator, DSSPath3ExportOperator
from .export_to_evsky import EVSKYExportOperator
from .export_to_drotek import DrotekExportOperator
from .export_to_litebee import LitebeeExportOperator
from .export_to_skyc import SkybrushExportOperator
Expand Down Expand Up @@ -67,6 +68,7 @@
"DSSPathExportOperator",
"DSSPath3ExportOperator",
"DuplicateLightEffectOperator",
"EVSKYExportOperator",
"FixConstraintOrderingOperator",
"AddMarkersFromQRCodeOperator",
"GetFormationStatisticsOperator",
Expand Down
52 changes: 52 additions & 0 deletions src/modules/sbstudio/plugin/operators/export_to_evsky.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from typing import Any, Dict

from bpy.props import IntProperty, StringProperty

from sbstudio.model.file_formats import FileFormat

from .base import ExportOperator

__all__ = ("EVSKYExportOperator",)


####################################################################################
# Operator that allows the user to invoke the EVSKY export operation
####################################################################################


class EVSKYExportOperator(ExportOperator):
"""Export object trajectories and light animation into EVSKY format."""

bl_idname = "export_scene.evsky"
bl_label = "Export EVSKY format"
bl_options = {"REGISTER"}

# List of file extensions that correspond to EVSKY files
filter_glob = StringProperty(default="*.zip", options={"HIDDEN"})
filename_ext = ".zip"

# output trajectory frame rate
output_fps = IntProperty(
name="Trajectory FPS",
default=4,
description="Number of samples to take from trajectories per second",
)

# output light program frame rate
light_output_fps = IntProperty(
name="Light FPS",
default=24,
description="Number of samples to take from light programs per second",
)

def get_format(self) -> FileFormat:
return FileFormat.EVSKY

def get_operator_name(self) -> str:
return "EVSKY exporter"

def get_settings(self) -> Dict[str, Any]:
return {
"output_fps": self.output_fps,
"light_output_fps": self.light_output_fps,
}
8 changes: 8 additions & 0 deletions src/modules/sbstudio/plugin/operators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,14 @@ def export_show_to_file_using_api(
"fps": settings["output_fps"],
"light_fps": settings["light_output_fps"],
}
elif format is FileFormat.EVSKY:
log.info("Exporting show to EVSKY format")
renderer = "evsky"
renderer_params = {
**renderer_params,
"fps": settings["output_fps"],
"light_fps": settings["light_output_fps"],
}
elif format is FileFormat.LITEBEE:
log.info("Exporting show to Litebee format")
renderer = "litebee"
Expand Down
5 changes: 5 additions & 0 deletions src/modules/sbstudio/plugin/panels/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
DrotekExportOperator,
DSSPathExportOperator,
DSSPath3ExportOperator,
EVSKYExportOperator,
LitebeeExportOperator,
RefreshFileFormatsOperator,
SkybrushExportOperator,
Expand Down Expand Up @@ -63,6 +64,10 @@ def draw(self, context):
layout.operator(
DSSPath3ExportOperator.bl_idname, text="Export to DSS PATH3 format"
)
elif format is FileFormat.EVSKY:
layout.operator(
EVSKYExportOperator.bl_idname, text="Export to EVSKY format"
)
elif format is FileFormat.LITEBEE:
layout.operator(
LitebeeExportOperator.bl_idname, text="Export to Litebee format"
Expand Down

0 comments on commit fe962bb

Please sign in to comment.