|
|
@ -74,9 +74,8 @@ class PlasmaClickableNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.types.N |
|
|
|
if clickable_bo is None: |
|
|
|
if clickable_bo is None: |
|
|
|
clickable_bo = parent_bo |
|
|
|
clickable_bo = parent_bo |
|
|
|
|
|
|
|
|
|
|
|
name = self.key_name |
|
|
|
interface = self._find_create_object(plInterfaceInfoModifier, exporter, bl=clickable_bo, so=clickable_so) |
|
|
|
interface = exporter.mgr.find_create_key(plInterfaceInfoModifier, name=name, so=clickable_so).object |
|
|
|
logicmod = self._find_create_key(plLogicModifier, exporter, bl=clickable_bo, so=clickable_so) |
|
|
|
logicmod = exporter.mgr.find_create_key(plLogicModifier, name=name, so=clickable_so) |
|
|
|
|
|
|
|
interface.addIntfKey(logicmod) |
|
|
|
interface.addIntfKey(logicmod) |
|
|
|
# Matches data seen in Cyan's PRPs... |
|
|
|
# Matches data seen in Cyan's PRPs... |
|
|
|
interface.addIntfKey(logicmod) |
|
|
|
interface.addIntfKey(logicmod) |
|
|
@ -105,11 +104,11 @@ class PlasmaClickableNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.types.N |
|
|
|
physical.LOSDBs |= plSimDefs.kLOSDBUIItems |
|
|
|
physical.LOSDBs |= plSimDefs.kLOSDBUIItems |
|
|
|
|
|
|
|
|
|
|
|
# Picking Detector -- detect when the physical is clicked |
|
|
|
# Picking Detector -- detect when the physical is clicked |
|
|
|
detector = exporter.mgr.find_create_key(plPickingDetector, name=name, so=clickable_so).object |
|
|
|
detector = self._find_create_object(plPickingDetector, exporter, bl=clickable_bo, so=clickable_so) |
|
|
|
detector.addReceiver(logicmod.key) |
|
|
|
detector.addReceiver(logicmod.key) |
|
|
|
|
|
|
|
|
|
|
|
# Clickable |
|
|
|
# Clickable |
|
|
|
activator = exporter.mgr.find_create_key(plActivatorConditionalObject, name=name, so=clickable_so).object |
|
|
|
activator = self._find_create_object(plActivatorConditionalObject, exporter, bl=clickable_bo, so=clickable_so) |
|
|
|
activator.addActivator(detector.key) |
|
|
|
activator.addActivator(detector.key) |
|
|
|
logicmod.addCondition(activator.key) |
|
|
|
logicmod.addCondition(activator.key) |
|
|
|
logicmod.setLogicFlag(plLogicModifier.kLocalElement, True) |
|
|
|
logicmod.setLogicFlag(plLogicModifier.kLocalElement, True) |
|
|
@ -125,10 +124,14 @@ class PlasmaClickableNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.types.N |
|
|
|
face_target = self.find_input_socket("facing") |
|
|
|
face_target = self.find_input_socket("facing") |
|
|
|
face_target.convert_subcondition(exporter, clickable_bo, clickable_so, logicmod) |
|
|
|
face_target.convert_subcondition(exporter, clickable_bo, clickable_so, logicmod) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
|
|
def export_once(self): |
|
|
|
|
|
|
|
return self.clickable_object is not None |
|
|
|
|
|
|
|
|
|
|
|
def get_key(self, exporter, parent_so): |
|
|
|
def get_key(self, exporter, parent_so): |
|
|
|
# careful... we really make lots of keys... |
|
|
|
# careful... we really make lots of keys... |
|
|
|
clickable_bo, clickable_so = self._get_objects(exporter, parent_so) |
|
|
|
clickable_bo, clickable_so = self._get_objects(exporter, parent_so) |
|
|
|
key = exporter.mgr.find_create_key(plLogicModifier, name=self.key_name, so=clickable_so) |
|
|
|
key = self._find_create_key(plLogicModifier, exporter, bl=clickable_bo, so=clickable_so) |
|
|
|
return key |
|
|
|
return key |
|
|
|
|
|
|
|
|
|
|
|
def _get_objects(self, exporter, parent_so): |
|
|
|
def _get_objects(self, exporter, parent_so): |
|
|
@ -185,7 +188,7 @@ class PlasmaClickableRegionNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.t |
|
|
|
region_bo = self.region_object |
|
|
|
region_bo = self.region_object |
|
|
|
if region_bo is None: |
|
|
|
if region_bo is None: |
|
|
|
self.raise_error("invalid Region") |
|
|
|
self.raise_error("invalid Region") |
|
|
|
region_so = exporter.mgr.find_create_key(plSceneObject, bl=region_bo).object |
|
|
|
region_so = exporter.mgr.find_create_object(plSceneObject, bl=region_bo) |
|
|
|
|
|
|
|
|
|
|
|
# Try to figure out the appropriate bounds type for the region.... |
|
|
|
# Try to figure out the appropriate bounds type for the region.... |
|
|
|
phys_mod = region_bo.plasma_modifiers.collision |
|
|
|
phys_mod = region_bo.plasma_modifiers.collision |
|
|
@ -202,15 +205,13 @@ class PlasmaClickableRegionNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.t |
|
|
|
# one detector for many unrelated logic mods. However, LogicMods and Conditions appear to |
|
|
|
# one detector for many unrelated logic mods. However, LogicMods and Conditions appear to |
|
|
|
# assume they pwn each other... so we need a unique detector. This detector must be attached |
|
|
|
# assume they pwn each other... so we need a unique detector. This detector must be attached |
|
|
|
# as a modifier to the region's SO however. |
|
|
|
# as a modifier to the region's SO however. |
|
|
|
name = self.key_name |
|
|
|
detector = self._find_create_object(plObjectInVolumeDetector, exporter, bl=region_bo, so=region_so) |
|
|
|
detector_key = exporter.mgr.find_create_key(plObjectInVolumeDetector, name=name, so=region_so) |
|
|
|
|
|
|
|
detector = detector_key.object |
|
|
|
|
|
|
|
detector.addReceiver(logicmod.key) |
|
|
|
detector.addReceiver(logicmod.key) |
|
|
|
detector.type = plObjectInVolumeDetector.kTypeAny |
|
|
|
detector.type = plObjectInVolumeDetector.kTypeAny |
|
|
|
|
|
|
|
|
|
|
|
# Now, the conditional object. At this point, these seem very silly. At least it's not a plModifier. |
|
|
|
# Now, the conditional object. At this point, these seem very silly. At least it's not a plModifier. |
|
|
|
# All they really do is hold a satisfied boolean... |
|
|
|
# All they really do is hold a satisfied boolean... |
|
|
|
objinbox_key = exporter.mgr.find_create_key(plObjectInBoxConditionalObject, name=name, so=parent_so) |
|
|
|
objinbox_key = self._find_create_key(plObjectInBoxConditionalObject, exporter, bl=region_bo, so=parent_so) |
|
|
|
objinbox_key.object.satisfied = True |
|
|
|
objinbox_key.object.satisfied = True |
|
|
|
logicmod.addCondition(objinbox_key) |
|
|
|
logicmod.addCondition(objinbox_key) |
|
|
|
|
|
|
|
|
|
|
@ -270,19 +271,18 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): |
|
|
|
|
|
|
|
|
|
|
|
# First, gather the schtuff from the appropriate blah blah blah |
|
|
|
# First, gather the schtuff from the appropriate blah blah blah |
|
|
|
if self.simple_mode: |
|
|
|
if self.simple_mode: |
|
|
|
|
|
|
|
node = self.node |
|
|
|
directional = True |
|
|
|
directional = True |
|
|
|
tolerance = 45 |
|
|
|
tolerance = 45 |
|
|
|
name = "{}_SimpleFacing".format(self.node.key_name) |
|
|
|
|
|
|
|
elif self.is_linked: |
|
|
|
elif self.is_linked: |
|
|
|
node = self.links[0].from_node |
|
|
|
node = self.links[0].from_node |
|
|
|
directional = node.directional |
|
|
|
directional = node.directional |
|
|
|
tolerance = node.tolerance |
|
|
|
tolerance = node.tolerance |
|
|
|
name = node.key_name |
|
|
|
|
|
|
|
else: |
|
|
|
else: |
|
|
|
# This is a programmer failure, so we need a traceback. |
|
|
|
# This is a programmer failure, so we need a traceback. |
|
|
|
raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") |
|
|
|
raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") |
|
|
|
|
|
|
|
|
|
|
|
facing_key = exporter.mgr.find_create_key(plFacingConditionalObject, name=name, so=so) |
|
|
|
facing_key = node._find_create_key(plFacingConditionalObject, exporter, bl=bo, so=so) |
|
|
|
facing = facing_key.object |
|
|
|
facing = facing_key.object |
|
|
|
facing.directional = directional |
|
|
|
facing.directional = directional |
|
|
|
facing.satisfied = True |
|
|
|
facing.satisfied = True |
|
|
@ -395,13 +395,12 @@ class PlasmaVolumeSensorNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.type |
|
|
|
self.raise_error("Region cannot be empty") |
|
|
|
self.raise_error("Region cannot be empty") |
|
|
|
so = exporter.mgr.find_create_object(plSceneObject, bl=bo) |
|
|
|
so = exporter.mgr.find_create_object(plSceneObject, bl=bo) |
|
|
|
rgn_enter, rgn_exit = None, None |
|
|
|
rgn_enter, rgn_exit = None, None |
|
|
|
|
|
|
|
parent_key = parent_so.key |
|
|
|
|
|
|
|
|
|
|
|
if self.report_enters: |
|
|
|
if self.report_enters: |
|
|
|
theName = "{}_{}_Enter".format(self.id_data.name, self.name) |
|
|
|
rgn_enter = self._find_create_key(plLogicModifier, exporter, suffix="Enter", bl=bo, so=so) |
|
|
|
rgn_enter = exporter.mgr.find_create_key(plLogicModifier, name=theName, so=so) |
|
|
|
|
|
|
|
if self.report_exits: |
|
|
|
if self.report_exits: |
|
|
|
theName = "{}_{}_Exit".format(self.id_data.name, self.name) |
|
|
|
rgn_exit = self._find_create_key(plLogicModifier, exporter, suffix="Exit", bl=bo, so=so) |
|
|
|
rgn_exit = exporter.mgr.find_create_key(plLogicModifier, name=theName, so=so) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if rgn_enter is None: |
|
|
|
if rgn_enter is None: |
|
|
|
return rgn_exit |
|
|
|
return rgn_exit |
|
|
@ -415,12 +414,12 @@ class PlasmaVolumeSensorNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.type |
|
|
|
return (rgn_enter, rgn_exit) |
|
|
|
return (rgn_enter, rgn_exit) |
|
|
|
|
|
|
|
|
|
|
|
def export(self, exporter, bo, parent_so): |
|
|
|
def export(self, exporter, bo, parent_so): |
|
|
|
# We need to ensure we export to the correct SO |
|
|
|
|
|
|
|
region_bo = self.region_object |
|
|
|
region_bo = self.region_object |
|
|
|
if region_bo is None: |
|
|
|
if region_bo is None: |
|
|
|
self.raise_error("Region cannot be empty") |
|
|
|
self.raise_error("Region cannot be empty") |
|
|
|
|
|
|
|
|
|
|
|
region_so = exporter.mgr.find_create_object(plSceneObject, bl=region_bo) |
|
|
|
region_so = exporter.mgr.find_create_object(plSceneObject, bl=region_bo) |
|
|
|
interface = exporter.mgr.find_create_object(plInterfaceInfoModifier, name=self.key_name, so=region_so) |
|
|
|
interface = self._find_create_object(plInterfaceInfoModifier, exporter, bl=region_bo, so=region_so) |
|
|
|
|
|
|
|
|
|
|
|
# Region Enters |
|
|
|
# Region Enters |
|
|
|
enter_simple = self.find_input_socket("enter").allow |
|
|
|
enter_simple = self.find_input_socket("enter").allow |
|
|
@ -452,20 +451,15 @@ class PlasmaVolumeSensorNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.type |
|
|
|
else: |
|
|
|
else: |
|
|
|
suffix = "Exit" |
|
|
|
suffix = "Exit" |
|
|
|
|
|
|
|
|
|
|
|
theName = "{}_{}_{}".format(self.id_data.name, self.name, suffix) |
|
|
|
logicKey = self._find_create_key(plLogicModifier, exporter, suffix=suffix, bl=bo, so=so) |
|
|
|
exporter.report.msg("[LogicModifier '{}']", theName, indent=2) |
|
|
|
|
|
|
|
logicKey = exporter.mgr.find_create_key(plLogicModifier, name=theName, so=so) |
|
|
|
|
|
|
|
logicmod = logicKey.object |
|
|
|
logicmod = logicKey.object |
|
|
|
logicmod.setLogicFlag(plLogicModifier.kMultiTrigger, True) |
|
|
|
logicmod.setLogicFlag(plLogicModifier.kMultiTrigger, True) |
|
|
|
logicmod.notify = self.generate_notify_msg(exporter, so, "satisfies") |
|
|
|
logicmod.notify = self.generate_notify_msg(exporter, so, "satisfies") |
|
|
|
|
|
|
|
|
|
|
|
# Now, the detector objects |
|
|
|
# Now, the detector objects |
|
|
|
exporter.report.msg("[ObjectInVolumeDetector '{}']", theName, indent=2) |
|
|
|
det = self._find_create_object(plObjectInVolumeDetector, exporter, suffix=suffix, bl=bo, so=so) |
|
|
|
detKey = exporter.mgr.find_create_key(plObjectInVolumeDetector, name=theName, so=so) |
|
|
|
|
|
|
|
det = detKey.object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exporter.report.msg("[VolumeSensorConditionalObject '{}']", theName, indent=2) |
|
|
|
volKey = self._find_create_key(plVolumeSensorConditionalObject, exporter, suffix=suffix, bl=bo, so=so) |
|
|
|
volKey = exporter.mgr.find_create_key(plVolumeSensorConditionalObject, name=theName, so=so) |
|
|
|
|
|
|
|
volsens = volKey.object |
|
|
|
volsens = volKey.object |
|
|
|
|
|
|
|
|
|
|
|
volsens.type = event |
|
|
|
volsens.type = event |
|
|
@ -483,6 +477,10 @@ class PlasmaVolumeSensorNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.type |
|
|
|
logicmod.addCondition(volKey) |
|
|
|
logicmod.addCondition(volKey) |
|
|
|
return logicKey |
|
|
|
return logicKey |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
|
|
def export_once(self): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
|
def _idprop_mapping(cls): |
|
|
|
def _idprop_mapping(cls): |
|
|
|
return {"region_object": "region"} |
|
|
|
return {"region_object": "region"} |
|
|
|