diff --git a/korman/exporter/manager.py b/korman/exporter/manager.py
index f737464..f77afc1 100644
--- a/korman/exporter/manager.py
+++ b/korman/exporter/manager.py
@@ -61,11 +61,13 @@ class ExportManager:
self._age_info = info
self.mgr.AddAge(info)
- def add_object(self, pl, name=None, bl=None, loc=None):
+ def add_object(self, pl, name=None, bl=None, loc=None, so=None):
"""Automates adding a converted Blender object to our Plasma Resource Manager"""
- assert (bl or loc)
- if loc:
+ assert (bl or loc or so)
+ if loc is not None:
location = loc
+ elif so is not None:
+ location = so.key.location
else:
location = self._pages[bl.plasma_object.page]
@@ -87,11 +89,13 @@ class ExportManager:
elif pl.ClassIndex() in _pool_types:
node.addPoolObject(pl.key)
- # Make life easier for folks creating ObjInterfaces
- if isinstance(pl, plObjInterface) and bl is not None:
- so = self.find_key(bl, plSceneObject)
- if so is not None:
- pl.owner = so
+ if isinstance(pl, plObjInterface):
+ if so is None:
+ pl.owner = self.find_key(bl, plSceneObject)
+ else:
+ pl.owner = so.key
+ elif isinstance(pl, plModifier):
+ so.addModifier(pl.key)
# And we're done!
return pl
@@ -100,10 +104,9 @@ class ExportManager:
# BuiltIn.prp
if bpy.context.scene.world.plasma_age.age_sdl:
builtin = self.create_page(age, "BuiltIn", -2, True)
- pfm = self.add_object(plPythonFileMod, name="VeryVerySpecialPythonFileMod", loc=builtin)
- pfm.filename = age
sdl = self.add_object(plSceneObject, name="AgeSDLHook", loc=builtin)
- sdl.addModifier(pfm.key)
+ pfm = self.add_object(plPythonFileMod, name="VeryVerySpecialPythonFileMod", so=sdl)
+ pfm.filename = age
# Textures.prp
if textures:
@@ -196,7 +199,7 @@ class ExportManager:
# This object is in the default page... Init that.
for loc in self._pages.values():
if not loc.page:
- self.mgr._pages[""] = loc
+ self._pages[""] = loc
break
else:
# need to create default page
diff --git a/korman/properties/modifiers/__init__.py b/korman/properties/modifiers/__init__.py
index c0cef55..ff03ec3 100644
--- a/korman/properties/modifiers/__init__.py
+++ b/korman/properties/modifiers/__init__.py
@@ -19,6 +19,7 @@ import inspect
from .base import PlasmaModifierProperties
from .logic import *
from .physics import *
+from .region import *
class PlasmaModifiers(bpy.types.PropertyGroup):
def determine_next_id(self):
diff --git a/korman/properties/modifiers/logic.py b/korman/properties/modifiers/logic.py
index 1e512e7..e1c3965 100644
--- a/korman/properties/modifiers/logic.py
+++ b/korman/properties/modifiers/logic.py
@@ -31,8 +31,7 @@ class PlasmaSpawnPoint(PlasmaModifierProperties):
def export(self, exporter, bo, so):
# Not much to this modifier... It's basically a flag that tells the engine, "hey, this is a
# place the avatar can show up." Nice to have a simple one to get started with.
- spawn = exporter.mgr.add_object(pl=plSpawnModifier, bl=bo, name=self.display_name)
- so.addModifier(spawn.key)
+ spawn = exporter.mgr.add_object(pl=plSpawnModifier, so=so, name=self.display_name)
@property
def requires_actor(self):
diff --git a/korman/properties/modifiers/region.py b/korman/properties/modifiers/region.py
new file mode 100644
index 0000000..899a6c5
--- /dev/null
+++ b/korman/properties/modifiers/region.py
@@ -0,0 +1,58 @@
+# This file is part of Korman.
+#
+# Korman is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Korman is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Korman. If not, see .
+
+import bpy
+from bpy.props import *
+from PyHSPlasma import *
+
+from .base import PlasmaModifierProperties
+
+class PlasmaPanicLinkRegion(PlasmaModifierProperties):
+ pl_id = "paniclink"
+
+ bl_category = "Region"
+ bl_label = "Panic Link"
+ bl_description = "Panic Link Region"
+
+ play_anim = BoolProperty(name="Play Animation",
+ description="Play the link-out animation when panic linking",
+ default=True)
+ exact_bounds = BoolProperty(name="Exact Bounds",
+ description="Use exact (triangle mesh) bounds -- only use if your mesh is not convex",
+ default=False)
+
+ def created(self, obj):
+ self.display_name = "{}_PanicLinkRgn".format(obj.name)
+
+ def export(self, exporter, bo, so):
+ # Generate the base physical object
+ simIface, physical = exporter.physics.generate_physical(bo, so, self.display_name)
+ if self.exact_bounds:
+ bounds = "trimesh"
+ else:
+ bounds = "hull"
+ exporter.physics.export(bo, physical, bounds)
+
+ # Now setup the region detector properties
+ physical.memberGroup = plSimDefs.kGroupDetector
+ physical.reportGroup = 1 << plSimDefs.kGroupAvatar
+
+ # Finally, the panic link region proper
+ reg = exporter.mgr.add_object(plPanicLinkRegion, name=self.display_name, so=so)
+ reg.playLinkOutAnim = self.play_anim
+
+ @property
+ def requires_actor(self):
+ return True
diff --git a/korman/ui/modifiers/__init__.py b/korman/ui/modifiers/__init__.py
index 2facd58..83edafa 100644
--- a/korman/ui/modifiers/__init__.py
+++ b/korman/ui/modifiers/__init__.py
@@ -15,3 +15,4 @@
from .logic import *
from .physics import *
+from .region import *
diff --git a/korman/ui/modifiers/region.py b/korman/ui/modifiers/region.py
new file mode 100644
index 0000000..111967d
--- /dev/null
+++ b/korman/ui/modifiers/region.py
@@ -0,0 +1,22 @@
+# This file is part of Korman.
+#
+# Korman is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Korman is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Korman. If not, see .
+
+def paniclink(modifier, layout, context):
+ split = layout.split()
+ col = split.column()
+
+ col.prop(modifier, "exact_bounds")
+ col = split.column()
+ col.prop(modifier, "play_anim")