/// <summary> /// Restores texture set data and either loads default texture set or saved texture set (if any) /// </summary> private void initialize() { if (textureSets != null) { //already initialized from OnLoad (prefab, some in-editor parts) return; } ConfigNode node = Utils.parseConfigNode(configNodeData); string[] setNames = node.GetStringValues("textureSet", false); string modelShaderName = node.GetStringValue("modelShader"); List <TextureSet> allSets = new List <TextureSet>(); if (!string.IsNullOrEmpty(modelShaderName)) { TextureSet set = TexturesUnlimitedLoader.getModelShaderTextureSet(modelShaderName); if (set != null) { allSets.Add(set); } } TextureSet[] sets = TexturesUnlimitedLoader.getTextureSets(setNames); for (int i = 0; i < sets.Length; i++) { allSets.Add(sets[i]); } ConfigNode[] fullNodeSets = node.GetNodes("KSP_TEXTURE_SET"); for (int i = 0; i < fullNodeSets.Length; i++) { allSets.Add(new TextureSet(fullNodeSets[i], "create")); } textureSets = new TextureSetContainer(this, Fields[nameof(currentTextureSet)], Fields[nameof(persistentData)], allSets); if (string.IsNullOrEmpty(currentTextureSet)) { currentTextureSet = allSets[0].name; } this.updateUIChooseOptionControl(nameof(currentTextureSet), textureSets.getTextureSetNames(), textureSets.getTextureSetTitles(), true, currentTextureSet); textureSets.enableCurrentSet(getModelTransforms(), false); Fields[nameof(currentTextureSet)].guiName = sectionName; }
/// <summary> /// Restores texture set data and either loads default texture set or saved texture set (if any) /// </summary> private void initialize() { if (textureSets != null) { //already initialized from OnLoad (prefab, some in-editor parts) return; } ConfigNode node = Utils.parseConfigNode(configNodeData); string[] setNames = node.GetStringValues("textureSet", true); textureSets = new TextureSetContainer(this, Fields[nameof(currentTextureSet)], Fields[nameof(persistentData)], setNames); if (string.IsNullOrEmpty(currentTextureSet)) { currentTextureSet = setNames[0]; } this.updateUIChooseOptionControl(nameof(currentTextureSet), textureSets.getTextureSetNames(), textureSets.getTextureSetTitles(), true, currentTextureSet); textureSets.enableCurrentSet(getModelTransforms()); Fields[nameof(currentTextureSet)].guiName = sectionName; }