/// <summary> /// Updates the main-segment model from user input in the editor /// </summary> /// <param name="newModel"></param> /// <param name="updateSymmetry"></param> private void updateMainModelFromEditor(String newModel, bool updateSymmetry) { SRBModelData mod = Array.Find(mainModules, m => m.name == newModel); if (mod != null && mod != currentMainModule) { currentMainModule.destroyCurrentModel(); currentMainModule = mod; currentMainModule.setupModel(part, part.transform.FindRecursive(baseTransformName), ModelOrientation.CENTRAL); currentMainName = currentMainModule.name; } if (!currentMainModule.isValidTextureSet(currentMainTexture)) { currentMainTexture = currentMainModule.modelDefinition.defaultTextureSet; } currentMainModule.enableTextureSet(currentMainTexture); updateModelScaleAndPosition(); updatePartResources(); updatePartMass(); updateAttachnodes(true); updateThrustOutput(); updateEditorValues(); updateGui(); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent<SSTUModularBooster>().updateMainModelFromEditor(newModel, false); } GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } }
/// <summary> /// Updates the main-segment model from user input in the editor /// </summary> /// <param name="newModel"></param> /// <param name="updateSymmetry"></param> private void updateMainModelFromEditor(String newModel, bool updateSymmetry) { SRBModelData mod = Array.Find(mainModules, m => m.name == newModel); if (mod != null && mod != currentMainModule) { currentMainModule.destroyCurrentModel(); currentMainModule = mod; currentMainModule.setupModel(part.transform.FindRecursive(baseTransformName), ModelOrientation.CENTRAL); } currentMainName = currentMainModule.name; if (!currentMainModule.isValidTextureSet(currentMainTexture)) { currentMainTexture = currentMainModule.getDefaultTextureSet(); } currentMainModule.enableTextureSet(currentMainTexture); currentMainModule.updateTextureUIControl(this, "currentMainTexture", currentMainTexture); updateModelScaleAndPosition(); updateEffectsScale(); updateContainerVolume(); updatePartMass(); updatePartCost(); updateAttachnodes(true); updateEditorValues(); updateThrustOutput(); updateGui(); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { p.GetComponent<SSTUModularBooster>().updateMainModelFromEditor(newModel, false); } } SSTUStockInterop.fireEditorUpdate(); SSTUModInterop.onPartGeometryUpdate(part, true); }