Browse Source

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.
pull/161/head
Adam Johnson 5 years ago
parent
commit
d999a7ba1f
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 13
      korman/exporter/camera.py
  2. 2
      korman/properties/modifiers/physics.py
  3. 5
      korman/properties/prop_camera.py
  4. 12
      korman/ui/ui_camera.py

13
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)

2
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)

5
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",

12
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

Loading…
Cancel
Save