SSTU - Shadow Space Technologies Unlimited

SSTU - Shadow Space Technologies Unlimited

98.5k Downloads

FXModuleAnimateThrottle breaks in engine clusters

Rodg88 opened this issue ยท 5 comments

commented

I've been making a patch to make a SSTU clustering version of the poodle engine (using Ven's model), and it mostly works, except for the FXModuleAnimateThrottle heat animation.
I can place the part in the editor, and without editing the engine cluster it will work, and the animation works in flight. But if I set the cluster to >1 engines, I get NRE spam in the log, which persists even if I set the cluster back to 1 engine:

[EXC 14:25:34.319] NullReferenceException
UnityEngine.Animation.get_Item (System.String name)
FXModuleAnimateThrottle.FixedUpdate ()

Log:
https://www.dropbox.com/s/bozi886v3eb9ptm/KSPFXMAT.log?dl=0

and the patch I've made (needs ven's stock revamp to work):
https://pastebin.com/jZpLgyTB

commented

And if you launch a craft with a multi-engine cluster with FXModuleAnimateThrottle, it doesn't spam NREs, but only one of the engines will have the animation.

commented

Indeed, don't use the stock module. Most stock modules won't work on complex parts such as these. (can't use stock animation, heat, etc modules, as they have issues with parts with multiple same-named transforms, and even bigger problems with parts that change dynamically)

Use the SSTUAnimateEngineHeat module -- https://github.com/shadowmage45/SSTULabs/blob/master/Plugin/SSTUTools/SSTUTools/Module/SSTUAnimateEngineHeat.cs -- it was written specifically for compatibility with engine clusters, and also to allow for config-based definition of the animation (no need to recompile the part in Unity just to adjust the animation).

Take a look at the other SSTU engine configs for examples on how to set it up.

commented

I've taken a look at the API for the stock FXModuleAnimateThrottle -- it will never work with engine cluster setups like this due to hard-coded limitations in how it works.

Notably it is incapable of handling multiple same-named transforms, or multiple animations of the same name. Both of which are mandatory for supporting engine clusters.

Marking as 'stock bug - won't fix', as this is not something I can solve.

commented

OK, so does SSTUAnimateEngineHeat somehow detect the glow texture/animation? I just can't see anywhere to define the animation.

Edit, tried it, and I guess it does, very clever! lol

commented

It doesn't use the existing emissive animations -- it uses a custom defined emissive created from three curves (one each for red, green, blue).

There is a default 'animation' defined though, so slapping the module onto the parts should 'just work', though the default animation could be lined up to the existing/original one with a bit of effort. The default should be good enough for most cases though; I've never needed anything else for the emissives on my engines.