/// <summary>
 /// Singular 'enable texture set' function to be used by internal and external plugin code.  Optionally calls recursively
 /// to update symmetry counterparts if 'symmetry' parameter is true.<para/>
 /// </summary>
 /// <param name="name"></param>
 /// <param name="symmetry"></param>
 public void enableTextureSet(string name, bool symmetry, bool userInput)
 {
     if (textureSets == null)
     {
         return;
     }
     //TODO - validate input texture set name; log error if invalid
     currentTextureSet = name;
     textureSets.enableCurrentSet(getModelTransforms(), userInput);
     TextureCallbacks.onTextureSetChanged(part);
     if (symmetry)
     {
         this.actionWithSymmetry(m =>
         {
             m.enableTextureSet(name, false, userInput);
         });
     }
 }
Пример #2
0
        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            initialize();
            Callback <BaseField, System.Object> onChangeAction = delegate(BaseField a, System.Object b)
            {
                this.actionWithSymmetry(m =>
                {
                    m.currentTextureSet = currentTextureSet;
                    m.textureSets.enableCurrentSet(m.getModelTransforms());
                    TextureCallbacks.onTextureSetChanged(m.part);
                });
            };
            BaseField field = Fields[nameof(currentTextureSet)];

            field.uiControlEditor.onFieldChanged = onChangeAction;
            field.uiControlFlight.onFieldChanged = onChangeAction;
            field.guiActive = canChangeInFlight;
            if (textureSets.textureSets.Length <= 1)
            {
                field.guiActive = field.guiActiveEditor = false;
            }
        }