getArea() public method

public getArea ( string name ) : UVArea
name string
return UVArea
Esempio n. 1
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("bottom");
            setModelParameters();
            model.setMaterial(fairingMaterial);
            model.createModel();
            model.setParent(modelBase);
            updatePhysicalAttributes();
            updateDecouplerForce();
            SSTUModInterop.onPartGeometryUpdate(part, true);
        }
Esempio n. 2
0
        private void buildFairing()
        {
            fairingBase.clearProfile();

            UVMap uvs = UVMap.GetUVMapGlobal(uvMap);

            fairingBase.outsideUV = uvs.getArea("outside");
            fairingBase.insideUV  = uvs.getArea("inside");
            fairingBase.edgesUV   = uvs.getArea("edges");

            float halfHeight = currentHeight * 0.5f;

            fairingBase.addRing(-halfHeight, currentBottomDiameter * 0.5f);
            if (currentTopDiameter != currentBottomDiameter)
            {
                fairingBase.addRing(-halfHeight + currentTaperHeight, currentBottomDiameter * 0.5f);
            }
            if (currentHeight != currentTaperHeight || currentTopDiameter == currentBottomDiameter)
            {
                fairingBase.addRing(halfHeight, currentTopDiameter * 0.5f);
            }
            fairingBase.generateColliders = this.generateColliders;
            fairingBase.generateFairing();
            fairingBase.setMaterial(fairingMaterial);
            fairingBase.setOpacity(HighLogic.LoadedSceneIsEditor && editorTransparency ? 0.25f : 1.0f);

            updateEnginePositionAndScale();
            SSTUModInterop.onPartGeometryUpdate(part, true);
            SSTUStockInterop.fireEditorUpdate();
        }
Esempio n. 3
0
        //to be called on initial prefab part load; populate the instance with the default values from the input node
        public virtual void load(ConfigNode node, GameObject root)
        {
            fairingBase = new FairingContainer(root, cylinderSides, numOfSections, wallThickness);
            uvMapName   = node.GetStringValue("uvMap", uvMapName);
            UVMap uvMap = UVMap.GetUVMapGlobal(uvMapName);

            fairingBase.outsideUV = uvMap.getArea("outside");
            fairingBase.insideUV  = uvMap.getArea("inside");
            fairingBase.edgesUV   = uvMap.getArea("edges");
            rotationOffset        = node.GetVector3("rotationOffset", Vector3.zero);
            topY                = node.GetFloatValue("topY", topY);
            bottomY             = node.GetFloatValue("bottomY", bottomY);
            capSize             = node.GetFloatValue("capSize", capSize);
            wallThickness       = node.GetFloatValue("wallThickness", wallThickness);
            maxPanelHeight      = node.GetFloatValue("maxPanelHeight", maxPanelHeight);
            cylinderSides       = node.GetIntValue("cylinderSides", cylinderSides);
            numOfSections       = node.GetIntValue("numOfSections", numOfSections);
            topRadius           = node.GetFloatValue("topRadius", topRadius);
            bottomRadius        = node.GetFloatValue("bottomRadius", bottomRadius);
            canAdjustTop        = node.GetBoolValue("canAdjustTop", canAdjustTop);
            canAdjustBottom     = node.GetBoolValue("canAdjustBottom", canAdjustBottom);
            removeMass          = node.GetBoolValue("removeMass", removeMass);
            fairingJettisonMass = node.GetFloatValue("fairingJettisonMass", fairingJettisonMass);
            jettisonForce       = node.GetFloatValue("jettisonForce", jettisonForce);
            jettisonDirection   = node.GetVector3("jettisonDirection", jettisonDirection);
            fairingName         = node.GetStringValue("name", fairingName);
            enabled             = false;
        }
Esempio n. 4
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ConfigNode[] textureNodes = node.GetNodes("TEXTURESET");
            textureSetData        = TextureSet.loadTextureSets(textureNodes);
            currentTextureSetData = Array.Find(textureSetData, m => m.setName == currentTextureSet);
            if (currentTextureSetData == null)
            {
                currentTextureSetData = textureSetData[0];
                currentTextureSet     = currentTextureSetData.setName;
            }

            int len = textureSetData.Length;

            string[] textureSetNames = new string[len];
            for (int i = 0; i < len; i++)
            {
                textureSetNames[i] = textureSetData[i].setName;
            }
            this.updateUIChooseOptionControl("currentTextureSet", textureSetNames, textureSetNames, true, currentTextureSet);

            TextureData data = currentTextureSetData.textureDatas[0];

            fairingMaterial = SSTUUtils.loadMaterial(data.diffuseTextureName, null, "KSP/Specular");

            loadMaterial();

            Transform tr = part.transform.FindRecursive("model").FindOrCreate("PetalAdapterRoot");

            fairingBase = new InterstageFairingContainer(tr.gameObject, cylinderSides, numberOfPanels, wallThickness);
            UVMap uvs = UVMap.GetUVMapGlobal(uvMap);

            fairingBase.outsideUV = uvs.getArea("outside");
            fairingBase.insideUV  = uvs.getArea("inside");
            fairingBase.edgesUV   = uvs.getArea("edges");

            rebuildFairing(false);//will create fairing using default / previously saved fairing configuration
            restoreEditorFields();
            setPanelRotations(currentRotation);
            if (panelsJettisoned)
            {
                fairingBase.destroyExistingPanels();
            }
            updateGuiState();
        }
Esempio n. 5
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;

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

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ConfigNode[] textureNodes = node.GetNodes("TEXTURESET");
            string[]     names        = TextureSet.getTextureSetNames(textureNodes);
            string[]     titles       = TextureSet.getTextureSetTitles(textureNodes);
            TextureSet   t            = KSPShaderLoader.getTextureSet(currentTextureSet);

            if (t == null)
            {
                currentTextureSet = names[0];
                t = KSPShaderLoader.getTextureSet(currentTextureSet);
                initializedColors = false;
            }
            if (!initializedColors)
            {
                initializedColors = true;
                recolorHandler.setColorData(t.maskColors);
            }
            this.updateUIChooseOptionControl(nameof(currentTextureSet), names, titles, true, currentTextureSet);
            fairingMaterial = t.textureData[0].createMaterial("SSTUFairingMaterial");

            Transform tr = part.transform.FindRecursive("model").FindOrCreate("PetalAdapterRoot");

            fairingBase = new InterstageFairingContainer(tr.gameObject, cylinderSides, numberOfPanels, wallThickness);
            UVMap uvs = UVMap.GetUVMapGlobal(uvMap);

            fairingBase.outsideUV = uvs.getArea("outside");
            fairingBase.insideUV  = uvs.getArea("inside");
            fairingBase.edgesUV   = uvs.getArea("edges");

            validateStraightHeight();
            rebuildFairing(false);//will create fairing using default / previously saved fairing configuration
            setPanelRotations(currentRotation);
            if (panelsJettisoned)
            {
                fairingBase.destroyFairing();
            }
            updateGuiState();
        }