Ejemplo n.º 1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            initialize();
            float max = techLimitMaxDiameter < maxTankDiameter ? techLimitMaxDiameter : maxTankDiameter;

            string[] names = SSTUUtils.getNames(mainTankModules, m => m.name);
            this.updateUIChooseOptionControl("currentTankType", names, names, true, currentTankType);
            this.updateUIFloatEditControl("currentTankDiameter", minTankDiameter, max, tankDiameterIncrement * 2, tankDiameterIncrement, tankDiameterIncrement * 0.05f, true, currentTankDiameter);
            updateAvailableVariants();
            updateUIScaleControls();
            Fields["currentTankDiameter"].uiControlEditor.onFieldChanged      = tankDiameterUpdated;
            Fields["currentTankVerticalScale"].uiControlEditor.onFieldChanged = tankHeightScaleUpdated;
            Fields["currentTankType"].uiControlEditor.onFieldChanged          = tankTypeUpdated;
            Fields["currentNoseType"].uiControlEditor.onFieldChanged          = noseTypeUpdated;
            Fields["currentMountType"].uiControlEditor.onFieldChanged         = mountTypeUpdated;

            Fields["currentNoseTexture"].uiControlEditor.onFieldChanged  = onNoseTextureUpdated;
            Fields["currentTankTexture"].uiControlEditor.onFieldChanged  = onTankTextureUpdated;
            Fields["currentMountTexture"].uiControlEditor.onFieldChanged = onMountTextureUpdated;

            Fields["currentTankType"].guiActiveEditor  = mainTankModules.Length > 1;
            Fields["currentNoseType"].guiActiveEditor  = noseModules.Length > 1;
            Fields["currentMountType"].guiActiveEditor = mountModules.Length > 1;

            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onPartGeometryUpdate(part, true);
            if (HighLogic.LoadedSceneIsEditor)
            {
                GameEvents.onEditorShipModified.Add(new EventData <ShipConstruct> .OnEvent(onEditorVesselModified));
            }
        }
Ejemplo n.º 2
0
        private void init()
        {
            if (initialized)
            {
                return;
            }
            initialized   = true;
            rcsIndices    = SSTUUtils.parseIntArray(rcsModuleIndex);
            engineIndices = SSTUUtils.parseIntArray(engineModuleIndex);
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ConfigNode[] fuelTypeNodes = node.GetNodes("FUELTYPE");
            int          len           = fuelTypeNodes.Length;

            fuelTypes = FuelTypeISP.parse(fuelTypeNodes);
            fuelType  = Array.Find(fuelTypes, m => m.fuelPreset.name == currentFuelType);
            if (fuelType == null && (fuelTypes != null && fuelTypes.Length > 0))
            {
                SSTULog.error("ERROR: SSTUModularRCS - currentFuelType was null for value: " + currentFuelType);
                fuelType        = fuelTypes[0];
                currentFuelType = fuelType.fuelPreset.name;
                SSTULog.error("Assigned default fuel type of: " + currentFuelType + ".  This is likely a config error that needs to be corrected.");
            }
            else if (fuelTypes == null || fuelTypes.Length < 1)
            {
                SSTULog.error("ERROR: SSTURCSFuelSelection - No fuel type definitions found.");
            }
        }
Ejemplo n.º 3
0
 public AttachNodeBaseData(String nodeData)
 {
     String[] dataVals = nodeData.Split(new String[] { "," }, StringSplitOptions.None);
     position    = new Vector3(SSTUUtils.safeParseFloat(dataVals[0].Trim()), SSTUUtils.safeParseFloat(dataVals[1].Trim()), SSTUUtils.safeParseFloat(dataVals[2].Trim()));
     orientation = new Vector3(SSTUUtils.safeParseFloat(dataVals[3].Trim()), SSTUUtils.safeParseFloat(dataVals[4].Trim()), SSTUUtils.safeParseFloat(dataVals[5].Trim()));
     size        = dataVals.Length > 6 ? SSTUUtils.safeParseInt(dataVals[6]) : 4;
 }
Ejemplo n.º 4
0
 private void initialize()
 {
     //MonoBehaviour.print("NodeFairingInit: "+fairingCreated+ " :: " +fairingForceDisabled+ " :: "+fairingJettisoned + " :: " +fairingEnabled);
     if (rendersToRemove != null && rendersToRemove.Length > 0)
     {
         SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(rendersToRemove));
     }
     loadFairingData(SSTUConfigNodeUtils.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 repairPanels()
 {
     foreach (PanelData pd in panelData)
     {
         SSTUUtils.enableRenderRecursive(pd.pivotTransform, true);
     }
 }
Ejemplo n.º 6
0
        public void prepModel()
        {
            if (model != null)
            {
                return;
            }

            String    transformName = "ProcDecouplerRoot";
            Transform modelBase     = part.transform.FindRecursive(transformName);

            if (modelBase != null)
            {
                GameObject.DestroyImmediate(modelBase.gameObject);
            }
            modelBase = new GameObject(transformName).transform;
            modelBase.NestToParent(part.transform.FindRecursive("model"));
            model = new ProceduralCylinderModel();

            UVMap uvs = UVMap.GetUVMapGlobal(uvMap);

            model.outsideUV = uvs.getArea("outside");
            model.insideUV  = uvs.getArea("inside");
            model.topUV     = uvs.getArea("top");
            model.bottomUV  = uvs.getArea("top");
            setModelParameters();
            TextureData data = currentTextureSetData.textureDatas[0];

            model.setMaterial(SSTUUtils.loadMaterial(data.diffuseTextureName, data.normalTextureName));
            model.createModel();
            model.setParent(modelBase);
            updatePhysicalAttributes();
            updateDecouplerForce();
            SSTUModInterop.onPartGeometryUpdate(part, true);
        }
Ejemplo n.º 7
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;

            recolorHandler = new RecoloringHandler(Fields[nameof(customColorData)]);

            mpf = part.GetComponent <ModuleProceduralFairing>();
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            string[]   names  = node.GetStringValues("textureSet");
            string[]   titles = SSTUUtils.getNames(TexturesUnlimitedLoader.getTextureSets(names), m => m.title);
            TextureSet t      = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);

            if (t == null)
            {
                currentTextureSet = names[0];
                t = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);
                initializedColors = false;
            }
            if (!initializedColors)
            {
                initializedColors = true;
                recolorHandler.setColorData(t.maskColors);
            }
            this.updateUIChooseOptionControl(nameof(currentTextureSet), names, titles, true, currentTextureSet);
            Fields[nameof(currentTextureSet)].guiActiveEditor = names.Length > 1;
        }
 private void breakPanels()
 {
     foreach (PanelData pd in panelData)
     {
         SSTUUtils.enableRenderRecursive(pd.pivotTransform, false);
     }
 }
Ejemplo n.º 9
0
        public String getNextTextureSetName(String currentSetName, bool iterateBackwards)
        {
            ModelTextureSet set        = SSTUUtils.findNext(modelDefinition.textureSets, m => m.name == currentSetName, iterateBackwards);
            String          newSetName = set == null ? "none" : set.name;

            return(newSetName);
        }
Ejemplo n.º 10
0
 protected void updateModelMaterial()
 {
     if (root != null)
     {
         SSTUUtils.setMaterialRecursive(root.transform, currentMaterial);
     }
 }
Ejemplo n.º 11
0
        public ModelTextureData(ConfigNode node)
        {
            diffuseTextureName  = node.GetStringValue("diffuseTexture");
            normalTextureName   = node.GetStringValue("normalTexture");
            emissiveTextureName = node.GetStringValue("emissiveTexture");
            specularTextureName = node.GetStringValue("specularTexture");
            aoTextureName       = node.GetStringValue("aoTexture");
            shader = node.GetStringValue("shader");
            string[] meshNamesRaw = node.GetStringValues("mesh");

            int len = meshNamesRaw.Length;

            meshRecurse = new bool[len];
            meshNames   = new string[len];
            string[] splits;
            string   name;
            bool     recurse;

            for (int i = 0; i < len; i++)
            {
                splits         = meshNamesRaw[i].Split(new char[] { ',' });
                name           = splits[0];
                recurse        = splits.Length > 1 ? SSTUUtils.safeParseBool(splits[1]) : false;
                meshNames[i]   = name;
                meshRecurse[i] = recurse;
            }
            excludedMeshes = node.GetStringValues("excludeMesh");
        }
Ejemplo n.º 12
0
        public void Start()
        {
            if (!moduleIsEnabled || vessel == null || pivotData == null || secondaryPivotData == null || vessel.solarFlux <= 0)
            {
                return;
            }
            CelestialBody sun = FlightGlobals.Bodies[0];

            sunTransform = sun.transform;
            if (panelState == SSTUPanelState.EXTENDED)
            {
                PivotData pd;
                int       len = pivotData.Length;
                for (int i = 0; i < len; i++)
                {
                    pd = pivotData[i];
                    Vector3    vector = pd.pivotTransform.InverseTransformPoint(sunTransform.position);
                    float      y      = (float)SSTUUtils.toDegrees(Mathf.Atan2(vector.x, vector.z));
                    Quaternion to     = pd.pivotTransform.rotation * Quaternion.Euler(0f, y, 0f);
                    pd.pivotTransform.rotation = to;
                }
                len = secondaryPivotData.Length;
                for (int i = 0; i < len; i++)
                {
                    pd = secondaryPivotData[i];
                    Vector3    vector = pd.pivotTransform.InverseTransformPoint(sunTransform.position);
                    float      y      = (float)SSTUUtils.toDegrees(Mathf.Atan2(vector.x, vector.z));
                    Quaternion to     = pd.pivotTransform.rotation * Quaternion.Euler(0f, y, 0f);
                    pd.pivotTransform.rotation = to;
                }
            }
        }
Ejemplo n.º 13
0
        private void constructSingleModel(Transform parent, ModelOrientation orientation, bool reUse)
        {
            String modelName = modelDefinition.modelName;

            if (String.IsNullOrEmpty(modelName))//no model to setup
            {
                return;
            }
            if (reUse)
            {
                Transform tr = parent.transform.FindModel(modelDefinition.modelName);
                if (tr != null)
                {
                    tr.name            = modelDefinition.modelName;
                    tr.gameObject.name = modelDefinition.modelName;
                }
                model = tr == null ? null : tr.gameObject;
            }
            if (!String.IsNullOrEmpty(modelName) && model == null)
            {
                model = SSTUUtils.cloneModel(modelName);
            }
            if (model != null)
            {
                model.transform.NestToParent(parent);
                if ((modelDefinition.invertForTop && orientation == ModelOrientation.TOP) || (modelDefinition.invertForBottom && orientation == ModelOrientation.BOTTOM))
                {
                    model.transform.Rotate(modelDefinition.invertAxis, 180, Space.Self);
                }
            }
            else
            {
                MonoBehaviour.print("ERROR: Could not locate model for name: " + modelName);
            }
        }
Ejemplo n.º 14
0
 private void setBottomDiameterFromEditor(float newDiameter, bool updateSymmetry)
 {
     if (newDiameter > maxDiameter)
     {
         newDiameter = maxDiameter;
     }
     if (newDiameter < minDiameter)
     {
         newDiameter = minDiameter;
     }
     if (SSTUUtils.isResearchGame() && newDiameter > techLimitMaxDiameter)
     {
         newDiameter = techLimitMaxDiameter;
     }
     bottomDiameter = newDiameter;
     rebuildFairing(true);
     updateShieldStatus();
     restoreEditorFields();
     if (updateSymmetry)
     {
         foreach (Part p in part.symmetryCounterparts)
         {
             p.GetComponent <SSTUInterstageFairing>().setBottomDiameterFromEditor(newDiameter, false);
         }
     }
 }
Ejemplo n.º 15
0
 private void updatePivotRotation(PivotData pd)
 {
     //vector from pivot to sun
     //finding angle to turn towards based on direction of vector on a single axis
     if (userLock)
     {
         float y = userRotation;
         if (pd.pivotTransform.lossyScale.z < 0)
         {
             y = -y;
         }
         Quaternion current = pd.pivotTransform.rotation;
         pd.pivotTransform.localRotation = pd.defaultOrientation;
         Quaternion target = pd.pivotTransform.rotation * Quaternion.Euler(0f, y, 0f);
         pd.pivotTransform.rotation = Quaternion.Lerp(current, target, TimeWarp.deltaTime * this.trackingSpeed);
     }
     else
     {
         Vector3 vector = pd.pivotTransform.InverseTransformPoint(sunTransform.position);
         float   y      = (float)SSTUUtils.toDegrees(Mathf.Atan2(vector.x, vector.z));
         if (pd.pivotTransform.lossyScale.z < 0)
         {
             y = -y;
         }
         Quaternion to = pd.pivotTransform.rotation * Quaternion.Euler(0f, y, 0f);
         pd.pivotTransform.rotation = Quaternion.Lerp(pd.pivotTransform.rotation, to, TimeWarp.deltaTime * this.trackingSpeed);
     }
 }
Ejemplo n.º 16
0
 private void updateTextureSet()
 {
     if (textureSets != null && !String.IsNullOrEmpty(currentTextureSet))
     {
         TextureSet t = Array.Find(textureSets, m => m.setName == currentTextureSet);
         if (t != null)
         {
             TextureData d = t.textureDatas[0];
             if (d != null)
             {
                 diffuseTextureName = d.diffuseTextureName;
                 normalTextureName  = d.normalTextureName;
                 Texture diffuseTex = SSTUUtils.findTexture(diffuseTextureName, false);
                 Texture normalTex  = String.IsNullOrEmpty(normalTextureName) ? null : SSTUUtils.findTexture(normalTextureName, true);
                 fairingMaterial.mainTexture = diffuseTex;
                 fairingMaterial.SetTexture("_BumpMap", normalTex);
                 foreach (SSTUNodeFairingData f in fairingParts)
                 {
                     f.setMaterial(fairingMaterial);
                 }
             }
             else
             {
                 MonoBehaviour.print("ERROR: Could not locate fairing texture data for set name: " + t.setName);
             }
         }
     }
     updateOpacity();
 }
Ejemplo n.º 17
0
 private void initialize()
 {
     if (rendersToRemove != null && rendersToRemove.Length > 0)
     {
         SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(rendersToRemove));
     }
     loadFairingData(SSTUStockInterop.getPartModuleConfig(part, this));
     if (externalUpdateData != null)
     {
         updateFromExternalData(externalUpdateData);
     }
     updateEditorFields(false); //update cached editor gui field values for diameter, sections, etc.
     buildFairing();            //construct fairing from cached/persistent/default data
     needsStatusUpdate = true;
     if (textureSets != null)
     {
         if (textureSets.Length <= 1)//only a single, (or no) texture set selected/avaialable
         {
             Events["nextTextureEvent"].active = false;
         }
         if (textureSets.Length > 0 && String.IsNullOrEmpty(currentTextureSet))
         {
             TextureSet s = textureSets[0];
             currentTextureSet = textureSets[0].setName;
         }
     }
 }
Ejemplo n.º 18
0
        public void setupModel(Part part, Transform baseTransform, Transform targetRotator)
        {
            this.partTransform = part.transform;

            String suffix = (main ? "-main-" : "-drogue-") + index;

            retractedTarget = targetRotator.FindOrCreate("ParachuteRetractedTarget" + suffix).gameObject;
            retractedTarget.transform.NestToParent(targetRotator);
            retractedTarget.transform.localPosition = new Vector3(-retractedUpVector.x, -retractedUpVector.z, retractedUpVector.y);

            semiDeployedTarget = targetRotator.FindOrCreate("ParachuteSemiDeployTarget" + suffix).gameObject;
            semiDeployedTarget.transform.NestToParent(targetRotator);
            semiDeployedTarget.transform.localPosition = new Vector3(-semiDeployedUpVector.x, -semiDeployedUpVector.z, semiDeployedUpVector.y);

            fullDeployedTarget = targetRotator.FindOrCreate("ParachuteFullDeployTarget" + suffix).gameObject;
            fullDeployedTarget.transform.NestToParent(targetRotator);
            fullDeployedTarget.transform.localPosition = new Vector3(-fullDeployedUpVector.x, -fullDeployedUpVector.z, fullDeployedUpVector.y);

            parachutePivot = baseTransform.FindOrCreate("ParachuteSpacingPivot" + suffix).gameObject;
            parachutePivot.transform.NestToParent(baseTransform);
            parachutePivot.transform.localPosition = new Vector3(localPosition.x, localPosition.y, -localPosition.z);//TODO -- why does this need to be inverted?

            Transform modelTransform = parachutePivot.transform.FindRecursive(modelName);

            if (modelTransform == null)
            {
                baseModel = SSTUUtils.cloneModel(modelName);
            }
            else
            {
                baseModel = modelTransform.gameObject;
            }
            baseModel.transform.NestToParent(parachutePivot.transform);
            if (!String.IsNullOrEmpty(texture))
            {
                SSTUUtils.setMainTextureRecursive(baseModel.transform, GameDatabase.Instance.GetTexture(texture, false));
            }

            Transform tr = baseModel.transform.FindRecursive(definition.capName);

            if (tr == null)
            {
                MonoBehaviour.print("ERROR: Could not locate transform for cap name: " + definition.capName);
            }
            capModel = tr.gameObject;
            tr       = baseModel.transform.FindRecursive(definition.lineName);
            if (tr == null)
            {
                MonoBehaviour.print("ERROR: Could not locate transform for line name: " + definition.lineName);
            }
            lineModel = tr.gameObject;

            Vector3 lookDir = (-(parachutePivot.transform.position - semiDeployedTarget.transform.position));

            lookDir.Normalize();
            parachutePivot.transform.rotation = Quaternion.LookRotation(lookDir, part.transform.forward);
            prevWind = parachutePivot.transform.rotation;
            baseModel.transform.localRotation = Quaternion.AngleAxis(-90, Vector3.left);
        }
Ejemplo n.º 19
0
        //creates/recreates FairingData instances from data from config node and any persistent node (if applicable)
        private void loadFairingData(ConfigNode node)
        {
            ConfigNode[] fairingNodes = node.GetNodes("FAIRING");
            fairingParts = new SSTUNodeFairingData[fairingNodes.Length];

            Transform modelBase = part.transform.FindRecursive("model");
            Transform parent;

            SSTUNodeFairing[] cs = part.GetComponents <SSTUNodeFairing>();
            int l           = Array.IndexOf(cs, this);
            int moduleIndex = l;

            for (int i = 0; i < fairingNodes.Length; i++)
            {
                parent          = modelBase.FindOrCreate(fairingName + "-" + moduleIndex + "-" + i);
                fairingParts[i] = new SSTUNodeFairingData();
                fairingParts[i].load(fairingNodes[i], parent.gameObject);
                if (fairingParts[i].canAdjustTop)
                {
                    enableTopDiameterControls = true;
                }
                if (fairingParts[i].canAdjustBottom)
                {
                    enableBottomDiameterControls = true;
                }
            }
            if (!String.IsNullOrEmpty(persistentDataString))
            {
                String[] datas  = SSTUUtils.parseCSV(persistentDataString, ":");
                int      length = datas.Length;
                for (int i = 0; i < length; i++)
                {
                    fairingParts[i].loadPersistence(datas[i]);
                }
            }

            textureSets = TextureSet.loadTextureSets(node.GetNodes("TEXTURESET"));

            if (fairingMaterial != null)
            {
                Material.Destroy(fairingMaterial);
                fairingMaterial = null;
            }

            if (textureSets != null && !String.IsNullOrEmpty(currentTextureSet))
            {
                TextureSet t = Array.Find(textureSets, m => m.setName == currentTextureSet);
                if (t != null)
                {
                    TextureData d = t.textureDatas[0];
                    if (d != null)
                    {
                        diffuseTextureName = d.diffuseTextureName;
                        normalTextureName  = d.normalTextureName;
                    }
                }
            }
            fairingMaterial = SSTUUtils.loadMaterial(diffuseTextureName, normalTextureName, "KSP/Bumped Specular");
        }
Ejemplo n.º 20
0
 public void setOpacity(float value)
 {
     opacity = value;
     if (rootObject != null)
     {
         SSTUUtils.setOpacityRecursive(rootObject.transform, value);
     }
 }
Ejemplo n.º 21
0
 public void loadPersistence(String data)
 {
     String[] csv = SSTUUtils.parseCSV(data);
     topY         = SSTUUtils.safeParseFloat(csv[0]);
     bottomY      = SSTUUtils.safeParseFloat(csv[1]);
     topRadius    = SSTUUtils.safeParseFloat(csv[2]);
     bottomRadius = SSTUUtils.safeParseFloat(csv[3]);
 }
Ejemplo n.º 22
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized    = true;
            recolorHandler = new RecoloringHandler(Fields[nameof(customColorData)]);
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            string[]   names  = node.GetStringValues("textureSet");
            string[]   titles = SSTUUtils.getNames(TexturesUnlimitedLoader.getTextureSets(names), m => m.title);
            TextureSet currentTextureSetData = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);

            if (currentTextureSetData == null)
            {
                currentTextureSet     = names[0];
                currentTextureSetData = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);
                initializedColors     = false;
            }
            if (!initializedColors)
            {
                initializedColors = true;
                recolorHandler.setColorData(currentTextureSetData.maskColors);
            }
            this.updateUIChooseOptionControl(nameof(currentTextureSet), names, titles, true, currentTextureSet);
            Fields[nameof(currentTextureSet)].guiActiveEditor = names.Length > 1;

            fuelType = VolumeContainerLoader.getPreset(fuelPreset);

            Transform modelBase = part.transform.FindRecursive("model");

            //Set up the engine models container
            ConfigNode[] modelNodes = node.GetNodes("MODEL");
            engineModelRoot = modelBase.FindOrCreate(engineModelRootName);
            ModelDefinitionLayoutOptions[] models = SSTUModelData.getModelDefinitions(modelNodes);
            engineModels = new ModelModule <SSTUInterstageDecoupler>(part, this, engineModelRoot, ModelOrientation.CENTRAL, nameof(currentEngineModel), nameof(currentEngineLayout), nameof(currentEngineTextureSet), nameof(customEngineColorData), null, null, null, null);
            engineModels.getSymmetryModule       = m => m.engineModels;
            engineModels.getValidOptions         = () => models;
            engineModels.getLayoutPositionScalar = () => currentBottomDiameter * 0.5f;
            //engineModels.getLayoutScaleScalar = () => currentEngineScale;
            engineModels.setupModelList(models);
            engineModels.setupModel();
            engineModels.updateSelections();
            updateEnginePositionAndScale();

            //set up the fairing container
            minHeight = engineModels.moduleHeight;
            Transform fairingContainerRoot = modelBase.FindOrCreate(baseTransformName);

            fairingBase = new FairingContainer(fairingContainerRoot.gameObject, cylinderSides, numberOfPanels, wallThickness);
            updateEditorFields();
            buildFairing();
            updateEnginePositionAndScale();
            updateFairingTextureSet(false);
            updateNodePositions(false);
            updatePartMass();
        }
Ejemplo n.º 23
0
        private void repairPanels()
        {
            int len = pivotData.Length;

            for (int i = 0; i < len; i++)
            {
                SSTUUtils.enableRenderRecursive(pivotData[i].pivotTransform, true);
            }
        }
Ejemplo n.º 24
0
 private void setupModel()
 {
     if (!String.IsNullOrEmpty(modelDefinition.modelName))
     {
         Transform  baseTransform = getBaseTransform();
         GameObject model         = SSTUUtils.cloneModel(modelDefinition.modelName);
         model.transform.NestToParent(baseTransform);
         model.transform.localScale = new Vector3(scale, scale, scale);
     }
 }
Ejemplo n.º 25
0
        public void nextTextureSetEvent()
        {
            enableTextureSet(SSTUUtils.findNext(textureSets, m => m.setName == currentTextureSet, false).setName);
            int index = part.Modules.IndexOf(this);

            foreach (Part p in part.symmetryCounterparts)
            {
                ((SSTUTextureSwitch)p.Modules[index]).enableTextureSet(currentTextureSet);
            }
        }
Ejemplo n.º 26
0
        public void nextDecalEvent()
        {
            SSTUDecal next = SSTUUtils.findNext(possibleDecals, m => m.name == currentDecal, false);

            currentDecal = next.name;
            foreach (Transform mesh in meshes)
            {
                next.enable(mesh);
            }
        }
Ejemplo n.º 27
0
        //private static Vector2 presetScrollPos;


        public static void openGUI(SSTUModularBooster srbModule, FloatCurve inputCurve)
        {
            module = srbModule;
            id     = module.GetInstanceID();
            MonoBehaviour.print("ThrustCurveEditor-input curve: " + curve + "\n" + SSTUUtils.printFloatCurve(curve));
            setupCurveData(inputCurve);
            texture = new Texture2D(graphWidth, graphHeight);
            updateGraphTexture();
            loadPresets();
        }
Ejemplo n.º 28
0
        private void loadMaterial()
        {
            if (fairingMaterial != null)
            {
                Material.Destroy(fairingMaterial);
                fairingMaterial = null;
            }
            TextureData data = currentTextureSetData.textureDatas[0];

            fairingMaterial = SSTUUtils.loadMaterial(data.diffuseTextureName, null, "KSP/Specular");
        }
Ejemplo n.º 29
0
 private void enableChuteRenders(bool drogue, bool main)
 {
     foreach (ParachuteModelData module in drogueChuteModules)
     {
         SSTUUtils.enableRenderRecursive(module.baseModel.transform, drogue);
     }
     foreach (ParachuteModelData module in mainChuteModules)
     {
         SSTUUtils.enableRenderRecursive(module.baseModel.transform, main);
     }
 }
Ejemplo n.º 30
0
        public static bool[] GetBoolValues(this ConfigNode node, String name)
        {
            String[] values = node.GetValues(name);
            int      len    = values.Length;

            bool[] vals = new bool[len];
            for (int i = 0; i < len; i++)
            {
                vals[i] = SSTUUtils.safeParseBool(values[i]);
            }
            return(vals);
        }