Implementing for ptsl in progress
This commit is contained in:
@@ -1,52 +1,40 @@
|
||||
from bpy_extras.io_utils import ExportHelper
|
||||
from bpy.props import StringProperty, BoolProperty, FloatProperty, IntProperty
|
||||
from bpy.types import Operator
|
||||
import bpy
|
||||
|
||||
from .intern.generate_adm import generate_adm
|
||||
from .intern import pro_tools
|
||||
|
||||
def filter_speakers(objs: list[bpy.types.Object]) -> list[bpy.types.Object]:
|
||||
return [s for s in objs if s.type == 'SPEAKER']
|
||||
|
||||
class ProToolsExport(Operator, ExportHelper):
|
||||
"""
|
||||
Export audio objects to a Pro Tools session
|
||||
"""
|
||||
bl_idname = "export.pro_tools_live" # important since its how
|
||||
class SendToProTools(bpy.types.Operator):
|
||||
"Send Audio Objects to Pro Tools"
|
||||
|
||||
bl_idname = "object.pro_tools_live"
|
||||
bl_label = "Send Audio Objects to Pro Tools"
|
||||
filepath: str
|
||||
filename_ext = ".wav"
|
||||
|
||||
filter_glob = StringProperty(
|
||||
default="*.wav",
|
||||
options={'HIDDEN'},
|
||||
maxlen=255, # Max internal buffer length, longer would be clamped.
|
||||
)
|
||||
|
||||
room_size = FloatProperty(
|
||||
default=1.0,
|
||||
room_size: bpy.props.FloatProperty(
|
||||
name="Room Size",
|
||||
description="Distance from the lens to the front room boundary",
|
||||
default=1.0,
|
||||
min=0.001,
|
||||
step=1,
|
||||
unit='LENGTH'
|
||||
)
|
||||
)
|
||||
|
||||
max_objects = IntProperty(
|
||||
name="Max Objects",
|
||||
description="Maximum number of object tracks to create",
|
||||
default=24,
|
||||
min=0,
|
||||
max=118
|
||||
)
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return len(filter_speakers(context.selected_objects)) > 0 and \
|
||||
bpy.app.online_access
|
||||
|
||||
create_bed = BoolProperty(
|
||||
name="Create 7.1 Bed",
|
||||
description="Create a bed for all sounds not included on object "
|
||||
"tracks",
|
||||
default=False,
|
||||
options={'HIDDEN'}
|
||||
)
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
return wm.invoke_props_dialog(self, confirm_text="Send to Pro Tools")
|
||||
|
||||
def execute(self, context) -> set:
|
||||
assert self.create_bed is False, "Create Bed is not supported"
|
||||
|
||||
return generate_adm(context, self.filepath, self.room_size,
|
||||
self.max_objects)
|
||||
if pro_tools.send_to_pro_tools(
|
||||
filter_speakers(context.selected_objects),
|
||||
self.room_size):
|
||||
self.report({'INFO'}, "Speaker objects sent to Pro Tools")
|
||||
return {'FINISHED'}
|
||||
else:
|
||||
self.report({'ERROR'}, "Could not connect to Pro Tools")
|
||||
return {'FINISHED'}
|
||||
|
||||
Reference in New Issue
Block a user