Browse Source

Don't mark lights in a group as `kLPMovable`.

It looks like simply attaching a lamp to a group already has fairly
major implications for how it's exported. If you're adding a lamp into
a group, then you are basically saying, "I only want to affect these
specific objects.", so marking them as movable (meaning, "apply me
to all objects") doesn't really make sense in that context.
pull/278/head
Adam Johnson 3 years ago
parent
commit
db1e088112
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 2
      korman/exporter/rtlight.py
  2. 15
      korman/nodes/node_python.py

2
korman/exporter/rtlight.py

@ -193,7 +193,7 @@ class LightConverter:
# If the lamp has any sort of animation attached, then it needs to be marked movable.
# Otherwise, Plasma may not use it for lighting.
if bo.plasma_object.has_animation_data:
if bo.plasma_object.has_animation_data and not has_lg:
pl_light.setProperty(plLightInfo.kLPMovable, True)
# *Sigh*

15
korman/nodes/node_python.py

@ -260,7 +260,7 @@ class PlasmaPythonFileNode(PlasmaVersionedNode, bpy.types.Node):
# Special PFM-SO handling ahoy - be sure to do it for all objects this PFM is attached to.
# Otherwise, you get non-determinant behavior.
self._export_ancillary_sceneobject(exporter, so)
self._export_ancillary_sceneobject(exporter, bo, so)
# No need to continue if the PFM was already generated.
if pfm.filename:
@ -297,15 +297,16 @@ class PlasmaPythonFileNode(PlasmaVersionedNode, bpy.types.Node):
self._export_key_attrib(exporter, bo, so, i, socket)
pfm.addParameter(param)
def _export_ancillary_sceneobject(self, exporter, so : plSceneObject) -> None:
def _export_ancillary_sceneobject(self, exporter, bo, so: plSceneObject) -> None:
# Danger: Special case evil ahoy...
# If the key is an object that represents a lamp, we have to assume that the reason it's
# being passed to Python is so it can be turned on/off at will. That means it's technically
# an animated lamp.
for light in exporter.mgr.find_interfaces(plLightInfo, so):
exporter.report.msg("Marking RT light '{}' as animated due to usage in a Python File node",
so.key.name, indent=3)
light.setProperty(plLightInfo.kLPMovable, True)
if not bool(bo.users_group):
for light in exporter.mgr.find_interfaces(plLightInfo, so):
exporter.report.msg("Marking RT light '{}' as animated due to usage in a Python File node",
so.key.name, indent=3)
light.setProperty(plLightInfo.kLPMovable, True)
def _export_key_attrib(self, exporter, bo, so : plSceneObject, key : plKey, socket) -> None:
if key is None:
@ -324,7 +325,7 @@ class PlasmaPythonFileNode(PlasmaVersionedNode, bpy.types.Node):
plFactory.ClassName(key.type), indent=3)
if isinstance(key.object, plSceneObject):
self._export_ancillary_sceneobject(exporter, key.object)
self._export_ancillary_sceneobject(exporter, bo, key.object)
def _get_attrib_sockets(self, idx):
for i in self.inputs:

Loading…
Cancel
Save