From 97305ee3e9c4e6d6d4bb760164a3193b3b33d8f2 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 15 Aug 2018 18:46:34 -0400 Subject: [PATCH] Clarify camera transitions/cutting What was previously marked as transition cuts would really only cut goal and POA tracking. Transition cutting requires the addition of a transition ovveride. The engine supports cutting transitions on plCameraMsg receipt by the virtual camera. The option looked sloppy on regions (and should probably be controlled in the transitions), but it has been added to camera message nodes for more control. --- korman/exporter/camera.py | 6 ++++-- korman/nodes/node_messages.py | 5 +++++ korman/properties/modifiers/region.py | 3 +-- korman/properties/prop_camera.py | 6 +++--- korman/ui/ui_camera.py | 16 ++++++++++------ 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/korman/exporter/camera.py b/korman/exporter/camera.py index 4b1d907..fd47497 100644 --- a/korman/exporter/camera.py +++ b/korman/exporter/camera.py @@ -49,9 +49,11 @@ class CameraConverter: brain.poaDeceleration = trans_props.poa_deceleration brain.poaVelocity = trans_props.poa_velocity - if trans_props.pos_cut: + if isinstance(brain, plCameraBrain1_Avatar): + brain.setFlags(plCameraBrain1.kCutPos, trans_props.pos_cut) + brain.setFlags(plCameraBrain1.kCutPOA, trans_props.poa_cut) + else: brain.setFlags(plCameraBrain1.kCutPos, True) - if trans_props.poa_cut: brain.setFlags(plCameraBrain1.kCutPOA, True) if camera_props.poa_type == "avatar": brain.setFlags(plCameraBrain1.kFollowLocalAvatar, True) diff --git a/korman/nodes/node_messages.py b/korman/nodes/node_messages.py index 7f0fab8..6c90411 100644 --- a/korman/nodes/node_messages.py +++ b/korman/nodes/node_messages.py @@ -316,6 +316,9 @@ class PlasmaCameraMsgNode(PlasmaMessageNode, bpy.types.Node): type=bpy.types.Object, poll=idprops.poll_camera_objects, options=set()) + cut = BoolProperty(name="Cut Transition", + description="Immediately swap over to the new camera without a transition animation", + options=set()) def convert_message(self, exporter, so): msg = plCameraMsg() @@ -329,6 +332,7 @@ class PlasmaCameraMsgNode(PlasmaMessageNode, bpy.types.Node): msg.setCmd(plCameraMsg.kRegionPushCamera, True) msg.setCmd(plCameraMsg.kSetAsPrimary, self.camera is None or self.camera.data.plasma_camera.settings.primary_camera) + msg.setCmd(plCameraMsg.kCut, self.cut) elif self.cmd == "disablefp": msg.setCmd(plCameraMsg.kResponderSetThirdPerson) elif self.cmd == "enablefp": @@ -341,6 +345,7 @@ class PlasmaCameraMsgNode(PlasmaMessageNode, bpy.types.Node): layout.prop(self, "cmd") if self.cmd in {"push", "pop"}: layout.prop(self, "camera") + layout.prop(self, "cut") class PlasmaEnableMsgNode(PlasmaMessageNode, bpy.types.Node): diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py index 2c1ce42..cf60c4c 100644 --- a/korman/properties/modifiers/region.py +++ b/korman/properties/modifiers/region.py @@ -107,8 +107,7 @@ class PlasmaCameraRegion(PlasmaModifierProperties): msg = plCameraMsg() msg.BCastFlags |= plMessage.kLocalPropagate | plMessage.kBCastByType msg.setCmd(plCameraMsg.kRegionPushCamera) - if camera_props.primary_camera: - msg.setCmd(plCameraMsg.kSetAsPrimary) + msg.setCmd(plCameraMsg.kSetAsPrimary, camera_props.primary_camera) msg.newCam = camera_so_key region = exporter.mgr.find_create_object(plCameraRegionDetector, so=so) diff --git a/korman/properties/prop_camera.py b/korman/properties/prop_camera.py index 7420e95..cb80608 100644 --- a/korman/properties/prop_camera.py +++ b/korman/properties/prop_camera.py @@ -37,7 +37,7 @@ class PlasmaTransition(bpy.types.PropertyGroup): description="Maximum velocity of the camera's Point of Attention tracking", min=-100.0, max=100.0, precision=0, default=60.0, unit="VELOCITY", options=set()) - poa_cut = BoolProperty(name="Cut Transition", + poa_cut = BoolProperty(name="Cut", description="The camera immediately begins tracking the Point of Attention", options=set()) @@ -53,14 +53,14 @@ class PlasmaTransition(bpy.types.PropertyGroup): description="Maximum positional velocity of the camera", min=-100.0, max=100.0, precision=0, default=60.0, unit="VELOCITY", options=set()) - pos_cut = BoolProperty(name="Cut Transition", + pos_cut = BoolProperty(name="Cut", description="The camera immediately moves to its new position", options=set()) class PlasmaManualTransition(bpy.types.PropertyGroup): camera = PointerProperty(name="Camera", - description="Camera to transition to", + description="The camera from which this transition is intended", type=bpy.types.Object, poll=idprops.poll_camera_objects, options=set()) diff --git a/korman/ui/ui_camera.py b/korman/ui/ui_camera.py index 15d8fc9..d0533fc 100644 --- a/korman/ui/ui_camera.py +++ b/korman/ui/ui_camera.py @@ -87,7 +87,9 @@ def draw_camera_poa_props(layout, cam_type, props): col.prop(trans, "poa_acceleration", text="Acceleration") col.prop(trans, "poa_deceleration", text="Deceleration") col.prop(trans, "poa_velocity", text="Maximum Velocity") - col.prop(trans, "poa_cut") + col = col.column() + col.active = cam_type == "follow" + col.prop(trans, "poa_cut", text="Cut Animation") # PoA Offset col = split.column() @@ -111,7 +113,9 @@ def draw_camera_pos_props(layout, cam_type, props): alert_cam="rail", max=10.0, text="Deceleration") _draw_alert_prop(col, trans, "pos_velocity", cam_type, alert_cam="rail", max=10.0, text="Maximum Velocity") - col.prop(trans, "pos_cut") + col = col.column() + col.active = cam_type == "follow" + col.prop(trans, "pos_cut", text="Cut Animation") # Position Offsets col = split.column() @@ -222,7 +226,7 @@ class PlasmaCameraViewPanel(CameraButtonsPanel, bpy.types.Panel): class TransitionListUI(bpy.types.UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_property, index=0, flt_flag=0): if item.camera is None: - layout.label("[Default Camera]") + layout.label("[Default Transition]") else: layout.label(item.camera.name, icon="CAMERA_DATA") layout.prop(item, "enabled", text="") @@ -246,7 +250,7 @@ class PlasmaCameraTransitionPanel(CameraButtonsPanel, bpy.types.Panel): else: layout.separator() box = layout.box() - box.prop(item, "camera") + box.prop(item, "camera", text="Transition From") box.prop(item, "mode") box.separator() @@ -258,11 +262,11 @@ class PlasmaCameraTransitionPanel(CameraButtonsPanel, bpy.types.Panel): col.prop(trans, "poa_acceleration", text="Acceleration") col.prop(trans, "poa_deceleration", text="Deceleration") col.prop(trans, "poa_velocity", text="Maximum Velocity") - col.prop(trans, "poa_cut") + col.prop(trans, "poa_cut", text="Cut Transition") col = split.column() col.label("Position Transition:") col.prop(trans, "pos_acceleration", text="Acceleration") col.prop(trans, "pos_deceleration", text="Deceleration") col.prop(trans, "pos_velocity", text="Maximum Velocity") - col.prop(trans, "pos_cut") + col.prop(trans, "pos_cut", text="Cut Transition")