From d999a7ba1fc72b9f906dd19d41e9d7cdcdccb99c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 24 Oct 2019 23:21:18 -0400 Subject: [PATCH] Improve camera tracking UI and export. Previously, Korman exported cameras without the "Maintain LOS" flag applied, allowing cameras to swing through geometry. In the token of better defaults and easier to understand objects, all the tracking options have been audited for clarity and their exporting to the correct camera type. --- korman/exporter/camera.py | 13 +++++++------ korman/properties/modifiers/physics.py | 2 +- korman/properties/prop_camera.py | 5 +++-- korman/ui/ui_camera.py | 12 ++++++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/korman/exporter/camera.py b/korman/exporter/camera.py index fd47497..164f302 100644 --- a/korman/exporter/camera.py +++ b/korman/exporter/camera.py @@ -52,23 +52,24 @@ class CameraConverter: if isinstance(brain, plCameraBrain1_Avatar): brain.setFlags(plCameraBrain1.kCutPos, trans_props.pos_cut) brain.setFlags(plCameraBrain1.kCutPOA, trans_props.poa_cut) + if camera_props.poa_type != "none": + if camera_props.maintain_los: + brain.setFlags(plCameraBrain1.kMaintainLOS, True) + if camera_props.fall_vertical: + brain.setFlags(plCameraBrain1.kVerticalWhenFalling, True) + if camera_props.fast_run: + brain.setFlags(plCameraBrain1.kSpeedUpWhenRunning, True) else: brain.setFlags(plCameraBrain1.kCutPos, True) brain.setFlags(plCameraBrain1.kCutPOA, True) if camera_props.poa_type == "avatar": brain.setFlags(plCameraBrain1.kFollowLocalAvatar, True) - if camera_props.maintain_los: - brain.setFlags(plCameraBrain1.kMaintainLOS, True) if camera_props.poa_worldspace: brain.setFlags(plCameraBrain1.kWorldspacePOA, True) if camera_props.pos_worldspace: brain.setFlags(plCameraBrain1.kWorldspacePos, True) if camera_props.ignore_subworld: brain.setFlags(plCameraBrain1.kIgnoreSubworldMovement, True) - if camera_props.fall_vertical: - brain.setFlags(plCameraBrain1.kVerticalWhenFalling, True) - if camera_props.fast_run: - brain.setFlags(plCameraBrain1.kSpeedUpWhenRunning, True) def export_camera(self, so, bo, camera_type, camera_props, camera_trans=[]): brain = getattr(self, "_export_{}_camera".format(camera_type))(so, bo, camera_props) diff --git a/korman/properties/modifiers/physics.py b/korman/properties/modifiers/physics.py index e84c699..c665de2 100644 --- a/korman/properties/modifiers/physics.py +++ b/korman/properties/modifiers/physics.py @@ -49,7 +49,7 @@ class PlasmaCollider(PlasmaModifierProperties): bounds = EnumProperty(name="Bounds Type", description="", items=bounds_types, default="hull") avatar_blocker = BoolProperty(name="Blocks Avatars", description="Object blocks avatars", default=True) - camera_blocker = BoolProperty(name="Blocks Camera", description="Object blocks the camera", default=True) + camera_blocker = BoolProperty(name="Blocks Camera LOS", description="Object blocks camera line-of-sight", default=True) friction = FloatProperty(name="Friction", min=0.0, default=0.5) restitution = FloatProperty(name="Restitution", description="Coefficient of collision elasticity", min=0.0, max=1.0) diff --git a/korman/properties/prop_camera.py b/korman/properties/prop_camera.py index d09bbec..28923eb 100644 --- a/korman/properties/prop_camera.py +++ b/korman/properties/prop_camera.py @@ -149,13 +149,14 @@ class PlasmaCameraProperties(bpy.types.PropertyGroup): # Miscellaneous Movement Props maintain_los = BoolProperty(name="Maintain LOS", - description="The camera should maintain line-of-sight with the object it's tracking", + description="The camera should move to maintain line-of-sight with the object it's tracking", + default=True, options=set()) fall_vertical = BoolProperty(name="Fall Camera", description="The camera will orient itself vertically when the local player begins falling", options=set()) fast_run = BoolProperty(name="Faster When Falling", - description="The camera's velocity will have a floor when the local player is falling", + description="The camera's velocity will be increased when the local player is falling", options=set()) ignore_subworld = BoolProperty(name="Ignore Subworld Movement", description="The camera will not be parented to any subworlds", diff --git a/korman/ui/ui_camera.py b/korman/ui/ui_camera.py index d0533fc..88c022f 100644 --- a/korman/ui/ui_camera.py +++ b/korman/ui/ui_camera.py @@ -72,10 +72,14 @@ def draw_camera_mode_props(layout, cam_type, props): # Miscellaneous col = split.column() col.label("Tracking Settings:") - col.prop(props, "maintain_los") - col.prop(props, "fall_vertical") - col.prop(props, "fast_run") - col.prop(props, "ignore_subworld") + col_follow = col.column() + col_follow.active = cam_type == "follow" + col_follow.prop(props, "maintain_los") + col_follow.prop(props, "fall_vertical") + col_follow.prop(props, "fast_run") + col_target = col.column() + col_target.active = props.poa_type != "none" + col_target.prop(props, "ignore_subworld") def draw_camera_poa_props(layout, cam_type, props): trans = props.transition