Ejemplo n.º 1
0
        private void updateTextureSet(bool useDefaults)
        {
            if (mpf == null)
            {
                return;
            }
            TextureSet s = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);

            RecoloringData[] colors = useDefaults ? s.maskColors : getSectionColors(string.Empty);
            Material         fm     = mpf.FairingMaterial;

            s.textureData[0].apply(fm);//TODO -- bit of an ugly hack; should at least pull a ref to whatever index that slot goes to
            s.textureData[0].apply(mpf.FairingMaterial);
            s.textureData[0].applyRecoloring(mpf.FairingMaterial, colors);
            s.textureData[0].apply(mpf.FairingConeMaterial);
            s.textureData[0].applyRecoloring(mpf.FairingConeMaterial, colors);
            List <Transform> trs = new List <Transform>();

            foreach (ProceduralFairings.FairingPanel fp in mpf.Panels)
            {
                s.enable(fp.go.transform, colors);
            }
            if (useDefaults)
            {
                recolorHandler.setColorData(colors);
            }
            SSTUModInterop.onPartTextureUpdated(part);
        }
Ejemplo n.º 2
0
        private void updateTextureSet(bool useDefaults)
        {
            if (mpf == null)
            {
                return;
            }
            TextureSet s = KSPShaderLoader.getTextureSet(currentTextureSet);

            RecoloringData[] colors = useDefaults ? s.maskColors : getSectionColors(string.Empty);
            Material         fm     = mpf.FairingMaterial;

            if (fm != null)
            {
                s.textureData[0].enable(fm, colors);
            }
            foreach (ProceduralFairings.FairingPanel fp in mpf.Panels)
            {
                s.enable(fp.go, colors);
            }
            if (useDefaults)
            {
                recolorHandler.setColorData(colors);
            }
            SSTUModInterop.onPartTextureUpdated(part);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Enables the input texture set name, or default texture for the model if 'none' or 'default' is input for the set name
        /// </summary>
        /// <param name="setName"></param>
        public void enableTextureSet(String setName, RecoloringData[] userColors)
        {
            if (setName == "none" || setName == "default" || String.IsNullOrEmpty(setName))
            {
                return;
            }
            TextureSet mts = Array.Find(modelDefinition.textureSets, m => m.name == setName);

            if (mts == null)
            {
                MonoBehaviour.print("ERROR: No texture set data for set by name: " + setName + "  --  for model: " + name);
                if (String.IsNullOrEmpty(modelDefinition.defaultTextureSet))
                {
                    MonoBehaviour.print("ERROR: Default texture set was null or empty string, this is a configuration error. " +
                                        "Please correct the model definition for model: " +
                                        modelDefinition.name + " to add a proper default texture set definition.");
                }
                int len = modelDefinition.textureSets.Length;
                MonoBehaviour.print("Texture sets avaialble for model: " + len + ". Default set: " + modelDefinition.defaultTextureSet);
                for (int i = 0; i < len; i++)
                {
                    MonoBehaviour.print("\n" + modelDefinition.textureSets[i].name);
                }
            }
            else if (model != null)
            {
                mts.enable(model, userColors);
            }
        }
Ejemplo n.º 4
0
        public void enableTextureSet(string name, RecoloringData[] userColors)
        {
            TextureSet s = TexturesUnlimitedLoader.getTextureSet(name);

            if (s != null)
            {
                s.enable(root.transform, userColors);
            }
        }
Ejemplo n.º 5
0
        public void enableTextureSet(string name, RecoloringData[] userColors)
        {
            TextureSet s = KSPShaderLoader.getTextureSet(name);

            if (s != null)
            {
                s.enable(root, userColors);
            }
        }
Ejemplo n.º 6
0
        public void enableTextureSet(string name, RecoloringData[] userColors)
        {
            TextureSet set = KSPShaderLoader.getTextureSet(name);

            if (set != null)
            {
                set.enable(rootObject, userColors);
            }
            else
            {
                MonoBehaviour.print("ERROR: " + name + " is not a valid texture set for fairing.");
            }
        }
Ejemplo n.º 7
0
 private void updateModuleTexture(SingleModelData module, TextureSet set)
 {
     if (module.model == null) { return; }//model may be null if the module has no model (e.g. 'None' mount type)
     set.enable(module.model.transform);
 }