From 04d1b848495785f12c59a1d6fe24237d854f8150 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 2 Oct 2019 18:36:50 -0400 Subject: [PATCH] Fix MultiModifiers not being added to new SceneObjects. --- korman/exporter/manager.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/korman/exporter/manager.py b/korman/exporter/manager.py index c3051e9..a680921 100644 --- a/korman/exporter/manager.py +++ b/korman/exporter/manager.py @@ -212,7 +212,19 @@ class ExportManager: else: name = so.key.name - return self._keys.get((location, pClass, name), None) + key = self._keys.get((location, pClass, name), None) + if key is not None and so is not None: + # Purposefully not checking for plObjInterface -- they should never be shared. + if isinstance(pClass, plModifier): + if key not in so.modifiers: + # We really shouldn't add plSingleModifiers to multiple objects. This may + # potentially cause URU to crash. I'm uncertain though, so we'll just warn + # for now. + if isinstance(pClass, plSingleModifier): + self._exporter().report.warn("Adding SingleModifier '{}' (type: '{}'') to another SceneObject '{}'", + key.name, pClass.__name__[2:], so.key.name) + so.addModifier(key) + return key def find_create_object(self, pClass, bl=None, name=None, so=None): key = self.find_key(pClass, bl, name, so)