public override string GetInfo() { if (showInfo) { List <string> variantList; if (textureNames.Length > 0) { variantList = SMTools.parseNames(textureNames); } else { variantList = SMTools.parseNames(mapNames); } textureDisplayList = SMTools.parseNames(textureDisplayNames); StringBuilder info = new StringBuilder(); info.AppendLine("Alternate textures available:"); if (variantList.Count == 0) { if (variantList.Count == 0) { info.AppendLine("None"); } } for (int i = 0; i < variantList.Count; i++) { if (i > textureDisplayList.Count - 1) { info.AppendLine(getTextureDisplayName(variantList[i])); } else { info.AppendLine(textureDisplayList[i]); } } info.AppendLine("\nUse the SM Next button on the right click menu or SM Paintshop in the lower right of the screen."); return(info.ToString()); } else { return(string.Empty); } }
// runs the kind of commands that would normally be in OnStart, if they have not already been run. In case a method is called upon externally, but values have not been set up yet private void initializeData() { if (!initialized) { // you can't have fuel switching without symmetry, it breaks the editor GUI. if (useFuelSwitchModule) { updateSymmetry = true; } objectList = SMTools.parseNames(objectNames, true); texList = SMTools.parseNames(textureNames, true, true, textureRootFolder); mapList = SMTools.parseNames(mapNames, true, true, textureRootFolder); textureDisplayList = SMTools.parseNames(textureDisplayNames); fuelTankSetupList = SMTools.parseIntegers(fuelTankSetups); foreach (String targetObjectName in objectList) { Transform[] targetObjectTransformArray = part.FindModelTransforms(targetObjectName); List <Material> matList = new List <Material>(); foreach (Transform t in targetObjectTransformArray) { if (t != null && t.gameObject.GetComponent <Renderer>() != null) // check for if the object even has a mesh. otherwise part list loading crashes { Material targetMat = t.gameObject.GetComponent <Renderer>().material; if (targetMat != null) { if (!matList.Contains(targetMat)) { matList.Add(targetMat); } } } } targetMats.Add(matList); } initialized = true; } }