Browse Source

Merge pull request #347 from DoobesURU/xSitCamMod

Add xSitCam.py functionality to Sitting Modifier
pull/351/head
Adam Johnson 2 years ago committed by GitHub
parent
commit
e49712c799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      korman/properties/modifiers/avatar.py
  2. 3
      korman/ui/modifiers/avatar.py

24
korman/properties/modifiers/avatar.py

@ -78,6 +78,16 @@ class PlasmaLadderModifier(PlasmaModifierProperties):
return True
# Use xSitCam.py for when we want a camera to pop up
sitting_pfm = {
"filename": "xSitCam.py",
"attribs": (
{ 'id': 1, 'type': "ptAttribActivator", 'name': "sitAct" },
{ 'id': 2, 'type': "ptAttribSceneobject", 'name': "sitCam" },
)
}
sitting_approach_flags = [("kApproachFront", "Front", "Approach from the font"),
("kApproachLeft", "Left", "Approach from the left"),
("kApproachRight", "Right", "Approach from the right"),
@ -111,6 +121,11 @@ class PlasmaSittingBehavior(idprops.IDPropObjectMixin, PlasmaModifierProperties,
facing_degrees = IntProperty(name="Tolerance",
description="How far away we will tolerate the avatar facing the clickable",
min=-180, max=180, default=45)
sitting_camera = PointerProperty(name="Camera",
description="Activate a specific camera when sitting down",
type=bpy.types.Object,
poll=idprops.poll_camera_objects,
options=set())
def harvest_actors(self):
if self.facing_enabled:
@ -123,6 +138,15 @@ class PlasmaSittingBehavior(idprops.IDPropObjectMixin, PlasmaModifierProperties,
sittingmod = nodes.new("PlasmaSittingBehaviorNode")
sittingmod.approach = self.approach
sittingmod.name = "SittingBeh"
# xSitCam.py PythonFileMod
if self.sitting_camera is not None:
sittingpynode = self._create_python_file_node(tree, sitting_pfm["filename"], sitting_pfm["attribs"])
sittingmod.link_output(sittingpynode, "satisfies", "sitAct")
# Camera Object
cameraobj = nodes.new("PlasmaAttribObjectNode")
cameraobj.link_output(sittingnode, "pfm", "sitCam")
cameraobj.target_object = self.sitting_camera
# Clickable
clickable = nodes.new("PlasmaClickableNode")

3
korman/ui/modifiers/avatar.py

@ -41,6 +41,9 @@ def sittingmod(modifier, layout, context):
if region is not None:
col.prop(region, "bounds")
col = layout.column()
col.prop(modifier, "sitting_camera", icon="CAMERA_DATA")
split = layout.split()
split.column().prop(modifier, "facing_enabled")
col = split.column()

Loading…
Cancel
Save