42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import bpy
|
|
|
|
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 SendToProTools(bpy.types.Operator):
|
|
"Send Audio Objects to Pro Tools"
|
|
|
|
bl_idname = "object.pro_tools_live"
|
|
bl_label = "Send Audio Objects to Pro Tools"
|
|
|
|
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'
|
|
)
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
return len(filter_speakers(context.selected_objects)) > 0 and \
|
|
bpy.app.online_access
|
|
|
|
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:
|
|
print("Execute called...")
|
|
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'}
|