Generic procedural fairing container
コード例 #1
0
ファイル: FairingData.cs プロジェクト: kremonia/SSTULabs
        //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;
        }
コード例 #2
0
ファイル: FairingData.cs プロジェクト: shadowmage45/SSTULabs
 //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);
 }
コード例 #3
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();
        }