Closed Ialdabaoth closed 4 years ago
It can already be done. When KSP adds a model to a part, it just instantiates it and throws it in the hierarchy so you can reference it just like anything else. You just need to figure out what the actual name of the object ends up being. Sarbian's DebugStuff plugin is great for this. It usually ends up as something like Path/To/Model(Clone)
.
Does that work for your purposes?
Alas, no. :(
Sometimes I want model1 and model2 to actually be the exact same model, which is why naming the MODEL nodes is so great in stock
Also I want to be able to turn on or off the whole model, regardless of how many transforms it has.
Look at how the stock switcher works.
Basically, we need a new field.
transform = Foo turns on all transforms named 'foo', regardless of which model node they're in
model = Zug should turn on all transforms in the model named 'zug', regardless of what their names are, and not touch transforms in other models even if they have the same name.
This is how ModulePartVariants works, for example. Note that ksp supplies MODEL {} nodes with a default name equal to the model filename (minus the path and the .mu extension), unless that filename has an underscore. But naming the node replaces that, so you can load the same model twice and access each one separately.
Nevermind! There was a modulemanager config bug causing the unexpected behavior. It was in a weird place so it took forever to debug.
Sometimes I want to do this: PART { name = fooWidget MODEL { name = size1 model = MyMod/Assets/model_01 scale = 1, 1, 0.8 } MODEL { name = size2 model = MyMod/Assets/model_02 scale = 0.5, 0.5, 1.2 } MODULE { name = ModuleB9PartSwitch SUBTYPE { name = stubby model = size1 } SUBTYPE { name = skinny model = size2 } } }
Obviously, ModulePartVariants manages this with its GAMEOBJECTS shenanigans. Can B9PartSwitch do the same thing? That way ModulePartVariants can manage textures, and B9PartSwitch can manage meshes, without having to dive into someone else's .my files (which wouldn't work anyways in the case I gave above).
Thanks!