Browse Source

Merge pull request #237 from DoobesURU/FirstPersonCam

Add First Person Camera Object
pull/243/head
Adam Johnson 4 years ago committed by GitHub
parent
commit
465c431727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      korman/exporter/camera.py
  2. 3
      korman/properties/prop_camera.py
  3. 6
      korman/ui/ui_camera.py

8
korman/exporter/camera.py

@ -162,6 +162,14 @@ class CameraConverter:
# Done already? # Done already?
return brain return brain
def _export_firstperson_camera(self, so, bo, props):
brain = self._mgr.find_create_object(plCameraBrain1_FirstPerson, so=so)
self._convert_brain(so, bo, props, brain)
# Copy pasta the follow values for FP cam
brain.offset = hsVector3(*props.pos_offset)
return brain
def _export_fixed_camera(self, so, bo, props): def _export_fixed_camera(self, so, bo, props):
if props.anim_enabled: if props.anim_enabled:
self._exporter().animation.convert_object_animations(bo, so) self._exporter().animation.convert_object_animations(bo, so)

3
korman/properties/prop_camera.py

@ -22,7 +22,8 @@ from .. import idprops
camera_types = [("circle", "Circle Camera", "The camera circles a fixed point"), camera_types = [("circle", "Circle Camera", "The camera circles a fixed point"),
("follow", "Follow Camera", "The camera follows an object"), ("follow", "Follow Camera", "The camera follows an object"),
("fixed", "Fixed Camera", "The camera is fixed in one location"), ("fixed", "Fixed Camera", "The camera is fixed in one location"),
("rail", "Rail Camera", "The camera follows an object by moving along a line")] ("rail", "Rail Camera", "The camera follows an object by moving along a line"),
("firstperson", "First Person", "Simulates first person view and disappears avatar")]
class PlasmaTransition(bpy.types.PropertyGroup): class PlasmaTransition(bpy.types.PropertyGroup):
poa_acceleration = FloatProperty(name="PoA Acceleration", poa_acceleration = FloatProperty(name="PoA Acceleration",

6
korman/ui/ui_camera.py

@ -92,7 +92,7 @@ def draw_camera_poa_props(layout, cam_type, props):
col.prop(trans, "poa_deceleration", text="Deceleration") col.prop(trans, "poa_deceleration", text="Deceleration")
col.prop(trans, "poa_velocity", text="Maximum Velocity") col.prop(trans, "poa_velocity", text="Maximum Velocity")
col = col.column() col = col.column()
col.active = cam_type == "follow" col.active = cam_type in {"firstperson", "follow"}
col.prop(trans, "poa_cut", text="Cut Animation") col.prop(trans, "poa_cut", text="Cut Animation")
# PoA Offset # PoA Offset
@ -118,12 +118,12 @@ def draw_camera_pos_props(layout, cam_type, props):
_draw_alert_prop(col, trans, "pos_velocity", cam_type, _draw_alert_prop(col, trans, "pos_velocity", cam_type,
alert_cam="rail", max=10.0, text="Maximum Velocity") alert_cam="rail", max=10.0, text="Maximum Velocity")
col = col.column() col = col.column()
col.active = cam_type == "follow" col.active = cam_type in {"firstperson", "follow"}
col.prop(trans, "pos_cut", text="Cut Animation") col.prop(trans, "pos_cut", text="Cut Animation")
# Position Offsets # Position Offsets
col = split.column() col = split.column()
col.active = cam_type == "follow" col.active = cam_type in {"firstperson", "follow"}
col.label("Position Offset:") col.label("Position Offset:")
col.prop(props, "pos_offset", text="") col.prop(props, "pos_offset", text="")
col.prop(props, "pos_worldspace") col.prop(props, "pos_worldspace")

Loading…
Cancel
Save