private void initialize() { //MonoBehaviour.print("NodeFairingInit: "+fairingCreated+ " :: " +fairingForceDisabled+ " :: "+fairingJettisoned + " :: " +fairingEnabled); if (rendersToRemove != null && rendersToRemove.Length > 0) { ROTUtils.removeTransforms(part, ROTUtils.parseCSV(rendersToRemove)); } loadFairingData(ROTConfigNodeUtils.parseConfigNode(configNodeData)); if (externalUpdateData != null) { updateFromExternalData(externalUpdateData); } if (fairingCreated || (fairingEnabled && !fairingJettisoned && !fairingForceDisabled && string.IsNullOrEmpty(nodeName)))//previously existed, recreate it, or should exist by default values in the config { buildFairing(); if (!string.IsNullOrEmpty(nodeName)) { AttachNode n = part.FindAttachNode(nodeName); if (n != null && n.attachedPart != null) { prevAttachedPart = n.attachedPart; //MonoBehaviour.print("Setting initial attached part to: " + prevAttachedPart); } } } else if (!fairingJettisoned && !fairingForceDisabled && !string.IsNullOrEmpty(nodeName))//else could potentially be activated by a node...check for activation { needsStatusUpdate = true; } updateTextureSet(false); needsGuiUpdate = true; //MonoBehaviour.print("NodeFairingInit End: " + fairingCreated + " :: " + fairingForceDisabled + " :: " + fairingJettisoned + " :: " + fairingEnabled); }
private void initialize() { if (initialized) { return; } initialized = true; prevDiameter = currentDiameter; coreNodeNames = ROTUtils.parseCSV(coreManagedNodes); //model-module setup/initialization ConfigNode node = ROTConfigNodeUtils.parseConfigNode(configNodeData); //list of CORE model nodes from config //each one may contain multiple 'model=modelDefinitionName' entries //but must contain no more than a single 'variant' entry. //if no variant is specified, they are added to the 'Default' variant. ConfigNode[] coreDefNodes = node.GetNodes("CORE"); ModelDefinitionLayoutOptions[] coreDefs; List <ModelDefinitionLayoutOptions> coreDefList = new List <ModelDefinitionLayoutOptions>(); int coreDefLen = coreDefNodes.Length; for (int i = 0; i < coreDefLen; i++) { string variantName = coreDefNodes[i].GetStringValue("variant", "Default"); coreDefs = ROTModelData.getModelDefinitionLayouts(coreDefNodes[i].GetStringValues("model")); coreDefList.AddUniqueRange(coreDefs); ModelDefinitionVariantSet mdvs = getVariantSet(variantName); mdvs.addModels(coreDefs); } coreDefs = coreDefList.ToArray(); coreModule = new ROTModelModule <ModuleROTProbe>(part, this, getRootTransform("ModularProbe-CORE"), ModelOrientation.CENTRAL, nameof(currentCore), null, nameof(currentCoreTexture), nameof(coreModulePersistentData)); coreModule.name = "ModularProbe-Core"; coreModule.getSymmetryModule = m => m.coreModule; coreModule.getValidOptions = () => getVariantSet(currentVariant).definitions; coreModule.massScalar = massScalingPower; coreModule.volumeScalar = volumeScalingPower; //set up the model lists and load the currently selected model coreModule.setupModelList(coreDefs); coreModule.setupModel(); updateModulePositions(); updateMassAndDimensions(); updateAttachNodes(false); updateAvailableVariants(); ROTStockInterop.updatePartHighlighting(part); }