protected virtual void setMountModuleFromEditor(String newMountType, bool updateSymmetry) { MountModelData newModule = Array.Find(mountModules, m => m.name == newMountType); currentMountModule.destroyCurrentModel(); currentMountModule = newModule; newModule.setupModel(part, getMountRootTransform(false), ModelOrientation.BOTTOM); currentMountType = newModule.name; if (!currentMountModule.isValidTextureSet(currentMountTexture)) { currentMountTexture = currentMountModule.getDefaultTextureSet(); } currentMountModule.enableTextureSet(currentMountTexture); currentMountModule.updateTextureUIControl(this, "currentMountTexture", currentMountTexture); updateEditorStats(true); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent <SSTUModularFuelTank>().setMountModuleFromEditor(newMountType, false); } } SSTUStockInterop.fireEditorUpdate(); SSTUModInterop.onPartGeometryUpdate(part, true); }
/// <summary> /// Loads or builds the models for the currently selected modules. /// </summary> private void restoreModels() { currentMainTankModule.setupModel(part, getTankRootTransform(true), ModelOrientation.CENTRAL); currentNoseModule.setupModel(part, getNoseRootTransform(true), ModelOrientation.TOP); currentMountModule.setupModel(part, getMountRootTransform(true), ModelOrientation.BOTTOM); }
private void setNoseModuleFromEditor(MountModelData newModule, bool updateSymmetry) { currentNoseModule.destroyCurrentModel(); currentNoseModule = newModule; newModule.setupModel(part, part.transform.FindRecursive("model"), ModelOrientation.TOP); currentNoseType = newModule.name; if (!currentNoseModule.isValidTextureSet(currentNoseTexture)) { currentNoseTexture = currentNoseModule.modelDefinition.defaultTextureSet; } currentNoseModule.enableTextureSet(currentNoseTexture); updateEditorStats(true); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { SSTUModularFuelTank mft = p.GetComponent<SSTUModularFuelTank>(); MountModelData mt = Array.Find(mft.noseModules, t => t.name == newModule.name); mft.setNoseModuleFromEditor(mt, false); } } }