Skip to content

Commit

Permalink
feat: added support for DSS PATH3 format (depending on the server)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Mar 6, 2024
1 parent a8eb6e9 commit 953a74b
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/addons/ui_skybrush_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
DetachMaterialsFromDroneTemplateOperator,
DrotekExportOperator,
DSSPathExportOperator,
DSSPath3ExportOperator,
DuplicateLightEffectOperator,
FixConstraintOrderingOperator,
AddMarkersFromQRCodeOperator,
Expand Down Expand Up @@ -206,6 +207,7 @@
DACExportOperator,
DrotekExportOperator,
DSSPathExportOperator,
DSSPath3ExportOperator,
LitebeeExportOperator,
UseSelectedVertexGroupForFormationOperator,
GetFormationStatisticsOperator,
Expand Down
2 changes: 2 additions & 0 deletions src/modules/sbstudio/model/file_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class FileFormat(Enum):
CSV = "csv"
PDF = "pdf"
DSS = "dss"
DSS3 = "dss3"
DAC = "dac"
DROTEK = "drotek"
LITEBEE = "litebee"
Expand Down Expand Up @@ -44,6 +45,7 @@ def update_supported_file_formats_from_limits(limits: Limits) -> None:
formats.append(FileFormat.DAC)
elif feature == "export:dss":
formats.append(FileFormat.DSS)
formats.append(FileFormat.DSS3)
elif feature == "export:drotek":
formats.append(FileFormat.DROTEK)
elif feature == "export:litebee":
Expand Down
3 changes: 2 additions & 1 deletion src/modules/sbstudio/plugin/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .duplicate_light_effect import DuplicateLightEffectOperator
from .export_to_csv import SkybrushCSVExportOperator
from .export_to_dac import DACExportOperator
from .export_to_dss import DSSPathExportOperator
from .export_to_dss import DSSPathExportOperator, DSSPath3ExportOperator
from .export_to_drotek import DrotekExportOperator
from .export_to_litebee import LitebeeExportOperator
from .export_to_skyc import SkybrushExportOperator
Expand Down Expand Up @@ -64,6 +64,7 @@
"DetachMaterialsFromDroneTemplateOperator",
"DrotekExportOperator",
"DSSPathExportOperator",
"DSSPath3ExportOperator",
"DuplicateLightEffectOperator",
"FixConstraintOrderingOperator",
"AddMarkersFromQRCodeOperator",
Expand Down
50 changes: 44 additions & 6 deletions src/modules/sbstudio/plugin/operators/export_to_dss.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
from typing import Any, Dict

from bpy.props import StringProperty
from bpy.props import IntProperty, StringProperty

from sbstudio.model.file_formats import FileFormat

from .base import ExportOperator

__all__ = ("DSSPathExportOperator",)
__all__ = ("DSSPathExportOperator", "DSSPath3ExportOperator")


#############################################################################
# Operator that allows the user to invoke the .dac export operation
#############################################################################
####################################################################################
# Operator that allows the user to invoke the DSS .path and .path3 export operations
####################################################################################


class DSSPathExportOperator(ExportOperator):
"""Export object trajectories and light animation into DSS PATH format."""

bl_idname = "export_scene.dss_path"
bl_label = "Export DSS"
bl_label = "Export DSS PATH"
bl_options = {"REGISTER"}

# List of file extensions that correspond to DSS PATH files
Expand All @@ -33,3 +33,41 @@ def get_operator_name(self) -> str:

def get_settings(self) -> Dict[str, Any]:
return {}


class DSSPath3ExportOperator(ExportOperator):
"""Export object trajectories and light animation into DSS PATH3 format."""

bl_idname = "export_scene.dss_path3"
bl_label = "Export DSS PATH3"
bl_options = {"REGISTER"}

# List of file extensions that correspond to DSS PATH3 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.DSS3

def get_operator_name(self) -> str:
return "DSS PATH3 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 @@ -370,6 +370,14 @@ def export_show_to_file_using_api(
elif format is FileFormat.DSS:
log.info("Exporting show to DSS PATH format")
renderer = "dss"
elif format is FileFormat.DSS3:
log.info("Exporting show to DSS PATH3 format")
renderer = "dss3"
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
4 changes: 4 additions & 0 deletions src/modules/sbstudio/plugin/panels/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
DACExportOperator,
DrotekExportOperator,
DSSPathExportOperator,
DSSPath3ExportOperator,
LitebeeExportOperator,
RefreshFileFormatsOperator,
SkybrushExportOperator,
Expand Down Expand Up @@ -59,6 +60,9 @@ def draw(self, context):
layout.operator(
DSSPathExportOperator.bl_idname, text="Export to DSS PATH format"
)
layout.operator(
DSSPath3ExportOperator.bl_idname, text="Export to DSS PATH3 format"
)
elif format is FileFormat.LITEBEE:
layout.operator(
LitebeeExportOperator.bl_idname, text="Export to Litebee format"
Expand Down

0 comments on commit 953a74b

Please sign in to comment.