Ejemplo n.º 1
0
 // Token: 0x06000371 RID: 881 RVA: 0x0001E8C0 File Offset: 0x0001CAC0
 public void Show()
 {
     GUILayout.BeginVertical(ACCTexturesView.inboxStyle, new GUILayoutOption[0]);
     try
     {
         string text = (this.expand ? "- " : "+ ") + this.material.name;
         if (GUILayout.Button(text, ACCTexturesView.uiParams.lStyleC, new GUILayoutOption[0]))
         {
             this.expand = !this.expand;
         }
         if (this.expand)
         {
             foreach (ACCTexture acctexture in this.edited)
             {
                 bool flag = this.matNo == ACCTexturesView.editTarget.matNo && acctexture.propKey == ACCTexturesView.editTarget.propKey;
                 if (acctexture.prop.Keyword == Keyword.NONE || this.material.IsKeywordEnabled(acctexture.prop.KeywordString))
                 {
                     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                     try
                     {
                         if (!ACCTexturesView.textureModifier.IsValidTarget(ACCTexturesView.holder.CurrentMaid, ACCTexturesView.holder.CurrentSlot.Name, this.material, acctexture.propName))
                         {
                             bool enabled = GUI.enabled;
                             GUI.enabled = false;
                             GUILayout.Button("+変更", ACCTexturesView.uiParams.bStyle, new GUILayoutOption[]
                             {
                                 ACCTexturesView.buttonLWidth
                             });
                             GUI.enabled = enabled;
                         }
                         else if (flag)
                         {
                             if (GUILayout.Button("-変更", ACCTexturesView.uiParams.bStyle, new GUILayoutOption[]
                             {
                                 ACCTexturesView.buttonLWidth
                             }))
                             {
                                 ACCTexturesView.editTarget.Clear();
                             }
                         }
                         else if (GUILayout.Button("+変更", ACCTexturesView.uiParams.bStyle, new GUILayoutOption[]
                         {
                             ACCTexturesView.buttonLWidth
                         }))
                         {
                             ACCTexturesView.editTarget.slotName = ACCTexturesView.holder.CurrentSlot.Name;
                             ACCTexturesView.editTarget.matNo    = this.matNo;
                             ACCTexturesView.editTarget.propName = acctexture.propName;
                             ACCTexturesView.editTarget.propKey  = acctexture.propKey;
                         }
                         GUILayout.Label(acctexture.propName, ACCTexturesView.uiParams.lStyle, new GUILayoutOption[0]);
                         if (flag && acctexture.type.hasShadow && acctexture.propKey == ShaderPropType.MainTex.key && GUILayout.Button("_ShadowTexに反映", ACCTexturesView.uiParams.bStyleSC, new GUILayoutOption[0]))
                         {
                             ACCTexturesView.textureModifier.DuplicateFilter(ACCTexturesView.holder.CurrentMaid, ACCTexturesView.holder.CurrentSlot.Name, this.material, acctexture.propName, "_ShadowTex");
                         }
                         if (GUILayout.Button("opt", ACCTexturesView.uiParams.bStyleSC, new GUILayoutOption[]
                         {
                             ACCTexturesView.restWidth
                         }))
                         {
                             acctexture.expand = !acctexture.expand;
                         }
                     }
                     finally
                     {
                         GUILayout.EndHorizontal();
                     }
                     if (flag)
                     {
                         ACCTexturesView.textureModifier.ProcGUI(ACCTexturesView.holder.CurrentMaid, ACCTexturesView.holder.CurrentSlot.Name, this.material, acctexture.propName);
                     }
                     float      height     = (float)ACCTexturesView.uiParams.itemHeight;
                     ComboBoxLO comboBoxLO = null;
                     bool       flag2      = false;
                     if (acctexture.toonType != 0)
                     {
                         if (this.combos.TryGetValue(acctexture.propName, out comboBoxLO))
                         {
                             if (comboBoxLO.IsClickedComboButton)
                             {
                                 height = (float)(comboBoxLO.ItemCount * ACCTexturesView.uiParams.itemHeight) * 0.8f;
                             }
                         }
                         else
                         {
                             comboBoxLO = new ComboBoxLO(new GUIContent("選"), ACCTexturesView.ItemNames, ACCTexturesView.uiParams.bStyle, ACCTexturesView.uiParams.boxStyle, ACCTexturesView.uiParams.listStyle, true);
                             comboBoxLO.SetItemWidth(ACCTexturesView.comboWidth);
                             this.combos[acctexture.propName] = comboBoxLO;
                             comboBoxLO.SelectItem(acctexture.editname);
                         }
                     }
                     GUILayout.BeginHorizontal(new GUILayoutOption[]
                     {
                         GUILayout.Height(height)
                     });
                     try
                     {
                         bool   flag3 = false;
                         string text2 = acctexture.editname;
                         if (acctexture.toonType != 0)
                         {
                             int selectedItemIndex = comboBoxLO.SelectedItemIndex;
                             int num = comboBoxLO.Show(ACCTexturesView.uiParams.optBtnWidth);
                             if (num != selectedItemIndex)
                             {
                                 text2 = ACCTexturesView.ItemNames[num].text;
                                 flag2 = true;
                             }
                             flag3 = comboBoxLO.IsClickedComboButton;
                         }
                         else
                         {
                             GUILayout.Label(string.Empty, new GUILayoutOption[]
                             {
                                 ACCTexturesView.uiParams.optBtnWidth
                             });
                         }
                         if (flag3)
                         {
                             ACCTexturesView.uiParams.textStyle.fontSize = (int)((double)ACCTexturesView.fontSizeS * 0.8);
                         }
                         text2 = GUILayout.TextField(text2, ACCTexturesView.uiParams.textStyle, new GUILayoutOption[]
                         {
                             ACCTexturesView.contentWidth
                         });
                         acctexture.SetName(text2);
                         if (flag3)
                         {
                             ACCTexturesView.uiParams.textStyle.fontSize = ACCTexturesView.fontSize;
                         }
                         GUI.enabled = acctexture.dirty;
                         if ((ACCTexturesView.settings.toonComboAutoApply && flag2) || GUILayout.Button("適", ACCTexturesView.uiParams.bStyle, new GUILayoutOption[]
                         {
                             ACCTexturesView.uiParams.optBtnWidth
                         }))
                         {
                             Texture texture = this.ChangeTexFile(this.textureDir, acctexture.editname, this.matNo, acctexture.propName);
                             if (texture != null)
                             {
                                 acctexture.tex = texture;
                             }
                             acctexture.dirty = false;
                         }
                         GUI.enabled = true;
                         if (GUILayout.Button("...", ACCTexturesView.uiParams.bStyle, new GUILayoutOption[]
                         {
                             ACCTexturesView.uiParams.optBtnWidth
                         }))
                         {
                             this.OpenFileBrowser(this.matNo, acctexture);
                         }
                     }
                     finally
                     {
                         GUILayout.EndHorizontal();
                     }
                     if (acctexture.expand)
                     {
                         GUILayout.BeginVertical(new GUILayoutOption[0]);
                         try
                         {
                             Vector2    textureOffset = this.material.GetTextureOffset(acctexture.prop.propId);
                             ACCTexture tex           = acctexture;
                             if (this.DrawSliders("offset", ref textureOffset, -1f, 1f, () => tex.original.texOffset, false))
                             {
                                 this.material.SetTextureOffset(acctexture.prop.propId, textureOffset);
                             }
                             Vector2 textureScale = this.material.GetTextureScale(acctexture.prop.propId);
                             if (this.DrawSliders("scale ", ref textureScale, 0.001f, 20f, () => tex.original.texScale, true))
                             {
                                 this.material.SetTextureScale(acctexture.prop.propId, textureScale);
                             }
                         }
                         finally
                         {
                             GUILayout.EndVertical();
                         }
                     }
                 }
             }
         }
     }
     finally
     {
         GUILayout.EndVertical();
     }
 }
Ejemplo n.º 2
0
        public void Show()
        {
            GUILayout.BeginVertical(inboxStyle);
            try {
                var matName = (expand? "- " : "+ ") + material.name;
                if (GUILayout.Button(matName, uiParams.lStyleC))
                {
                    expand = !expand;
                }
                if (!expand)
                {
                    return;
                }

                foreach (var editTex in edited)
                {
                    var bTargetElement = (matNo == editTarget.matNo && editTex.propKey == editTarget.propKey);

                    if (editTex.prop.Keyword != Keyword.NONE)
                    {
                        if (!material.IsKeywordEnabled(editTex.prop.KeywordString))
                        {
                            continue;
                        }
                    }

                    GUILayout.BeginHorizontal();
                    try {
                        // エディット用スライダーの開閉
                        if (!textureModifier.IsValidTarget(holder.CurrentMaid, holder.CurrentSlot.Name, material, editTex.propName))
                        {
                            // 参照先が Texture2D が取れなかった (例 : RenderTexture ) 場合は何もしない
                            var tmp = GUI.enabled;
                            GUI.enabled = false;
                            GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth);
                            GUI.enabled = tmp;
                        }
                        else if (bTargetElement)
                        {
                            // エディット中のテクスチャの場合
                            if (GUILayout.Button("-変更", uiParams.bStyle, buttonLWidth))
                            {
                                editTarget.Clear();
                            }
                        }
                        else
                        {
                            // エディット中以外のテクスチャの場合
                            if (GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth))
                            {
                                editTarget.slotName = holder.CurrentSlot.Name;
                                editTarget.matNo    = matNo;
                                editTarget.propName = editTex.propName;
                                editTarget.propKey  = editTex.propKey;
                            }
                        }
                        GUILayout.Label(editTex.propName, uiParams.lStyle);
                        if (bTargetElement && editTex.type.hasShadow && editTex.propKey == ShaderPropType.MainTex.key)
                        {
                            if (GUILayout.Button("_ShadowTexに反映", uiParams.bStyleSC))
                            {
                                // 現在のFilterを_ShadowTexにも反映
                                textureModifier.DuplicateFilter(holder.CurrentMaid, holder.CurrentSlot.Name, material, editTex.propName, "_ShadowTex");
                            }
                        }

                        if (GUILayout.Button("opt", uiParams.bStyleSC, restWidth))
                        {
                            editTex.expand = !editTex.expand;
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }

                    // テクスチャエディット用スライダー
                    if (bTargetElement)
                    {
                        textureModifier.ProcGUI(holder.CurrentMaid, holder.CurrentSlot.Name, material, editTex.propName);
                    }

                    float      height     = uiParams.itemHeight;
                    ComboBoxLO combo      = null;
                    var        cbSelected = false;
                    if (editTex.toonType != ACCTexture.NONE)
                    {
                        if (combos.TryGetValue(editTex.propName, out combo))
                        {
                            if (combo.IsClickedComboButton)
                            {
                                height = combo.ItemCount * uiParams.itemHeight * 0.8f;
                            }
                        }
                        else
                        {
                            combo = new ComboBoxLO(new GUIContent("選"), ItemNames, uiParams.bStyle, uiParams.boxStyle, uiParams.listStyle, true);
                            combo.SetItemWidth(comboWidth);
                            combos[editTex.propName] = combo;
                            combo.SelectItem(editTex.editname);
                        }
                    }
                    GUILayout.BeginHorizontal(GUILayout.Height(height));
                    try {
                        var hideField = false;
                        var editName  = editTex.editname;
                        if (editTex.toonType != ACCTexture.NONE)
                        {
                            // 偽コンボボックス
                            var prevSelected = combo.SelectedItemIndex;
                            var selected     = combo.Show(uiParams.optBtnWidth);
                            if (selected != prevSelected)
                            {
                                editName   = ItemNames[selected].text;
                                cbSelected = true;
                            }
                            hideField = combo.IsClickedComboButton;
                        }
                        else
                        {
                            GUILayout.Label(string.Empty, uiParams.optBtnWidth);
                        }
                        if (hideField)
                        {
                            uiParams.textStyle.fontSize = (int)(fontSizeS * 0.8);
                        }
                        editName = GUILayout.TextField(editName, uiParams.textStyle, contentWidth);
                        editTex.SetName(editName);

                        if (hideField)
                        {
                            uiParams.textStyle.fontSize = fontSize;
                        }

                        GUI.enabled = editTex.dirty;
                        if ((settings.toonComboAutoApply && cbSelected) ||
                            GUILayout.Button("適", uiParams.bStyle, uiParams.optBtnWidth))
                        {
                            var tex = ChangeTexFile(textureDir, editTex.editname, matNo, editTex.propName);
                            if (tex != null)
                            {
                                editTex.tex = tex;
                            }
                            editTex.dirty = false;
                        }
                        GUI.enabled = true;
                        if (GUILayout.Button("...", uiParams.bStyle, uiParams.optBtnWidth))
                        {
                            OpenFileBrowser(matNo, editTex);
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }

                    if (!editTex.expand)
                    {
                        continue;
                    }

                    GUILayout.BeginVertical();
                    try {
#if UNITY_5_6_OR_NEWER
                        var offset = material.GetTextureOffset(editTex.prop.propId);
                        var tex    = editTex;
                        if (DrawSliders("offset", ref offset, -1, 1, () => tex.original.texOffset))
                        {
                            material.SetTextureOffset(editTex.prop.propId, offset);
                        }

                        var scale = material.GetTextureScale(editTex.prop.propId);
                        if (DrawSliders("scale ", ref scale, 0.001f, 20f, () => tex.original.texScale, true))
                        {
                            material.SetTextureScale(editTex.prop.propId, scale);
                        }
#else
                        var offset = material.GetTextureOffset(editTex.prop.keyName);
                        var tex    = editTex;
                        if (DrawSliders("offset", ref offset, -1, 1, () => tex.original.texOffset))
                        {
                            material.SetTextureOffset(editTex.prop.keyName, offset);
                        }

                        var scale = material.GetTextureScale(editTex.prop.keyName);
                        if (DrawSliders("scale ", ref scale, 0.001f, 20f, () => tex.original.texScale, true))
                        {
                            material.SetTextureScale(editTex.prop.keyName, scale);
                        }
#endif
                    } finally {
                        GUILayout.EndVertical();
                    }
                }
            } finally {
                GUILayout.EndVertical();
            }
        }
Ejemplo n.º 3
0
        public void Show()
        {
            GUILayout.BeginVertical(inboxStyle);
            try {
                string matName = (expand? "- " : "+ ") + material.name;
                if (GUILayout.Button(matName, uiParams.lStyleC))
                {
                    expand = !expand;
                }
                if (!expand)
                {
                    return;
                }

                foreach (ACCTexture editTex in edited)
                {
                    bool bTargetElement = (matNo == editTarget.matNo && editTex.propKey == editTarget.propKey);

                    GUILayout.BeginHorizontal();
                    try {
                        // エディット用スライダーの開閉
                        if (!textureModifier.IsValidTarget(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName))
                        {
                            // 参照先が Texture2D が取れなかった (例 : RenderTexture ) 場合は何もしない
                            var tmp = GUI.enabled;
                            GUI.enabled = false;
                            GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth);
                            GUI.enabled = tmp;
                        }
                        else if (bTargetElement)
                        {
                            // エディット中のテクスチャの場合
                            if (GUILayout.Button("-変更", uiParams.bStyle, buttonLWidth))
                            {
                                editTarget.Clear();
                            }
                        }
                        else
                        {
                            // エディット中以外のテクスチャの場合
                            if (GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth))
                            {
                                editTarget.slotName = holder.currentSlot.Name;
                                editTarget.matNo    = matNo;
                                editTarget.propName = editTex.propName;
                                editTarget.propKey  = editTex.propKey;
                            }
                        }
                        GUILayout.Label(editTex.propName, uiParams.lStyle);
                        if (bTargetElement && editTex.type.hasShadow && editTex.propKey == ShaderPropType.MainTex.key)
                        {
                            if (GUILayout.Button("_ShadowTexに反映", uiParams.bStyleSC))
                            {
                                // 現在のFilterを_ShadowTexにも反映
                                textureModifier.DuplicateFilter(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName, "_ShadowTex");
                            }
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }

                    // テクスチャエディット用スライダー
                    if (bTargetElement)
                    {
                        textureModifier.ProcGUI(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName);
                    }

                    float      height     = uiParams.itemHeight;
                    ComboBoxLO combo      = null;
                    bool       cbSelected = false;
                    if (editTex.toonType != ACCTexture.NONE)
                    {
                        if (combos.TryGetValue(editTex.propName, out combo))
                        {
                            if (combo.IsClickedComboButton)
                            {
                                height = combo.ItemCount * uiParams.itemHeight * 0.8f;
                            }
                        }
                        else
                        {
                            combo = new ComboBoxLO(new GUIContent("選"), ItemNames, uiParams.bStyle, uiParams.boxStyle, uiParams.listStyle, true);
                            combo.SetItemWidth(comboWidth);
                            combos[editTex.propName] = combo;
                            combo.SelectItem(editTex.editname);
                        }
                    }
                    GUILayout.BeginHorizontal(GUILayout.Height(height));
                    try {
                        bool   hideField = false;
                        string editName  = editTex.editname;
                        if (editTex.toonType != ACCTexture.NONE)
                        {
                            // 偽コンボボックス
                            int prevSelected = combo.SelectedItemIndex;
                            int selected     = combo.Show(uiParams.optBtnWidth);
                            if (selected != prevSelected)
                            {
                                editName   = ItemNames[selected].text;
                                cbSelected = true;
                            }
                            hideField = combo.IsClickedComboButton;
                        }
                        if (hideField)
                        {
                            uiParams.textStyle.fontSize = (int)(fontSizeS * 0.8);
                        }
                        editName = GUILayout.TextField(editName, uiParams.textStyle, contentWidth);
                        editTex.SetName(editName);

                        if (hideField)
                        {
                            uiParams.textStyle.fontSize = fontSize;
                        }

                        GUI.enabled = editTex.dirty;
                        if ((settings.toonComboAutoApply && cbSelected) ||
                            GUILayout.Button("適", uiParams.bStyle, uiParams.optBtnWidth))
                        {
                            Texture tex = ChangeTexFile(textureDir, editTex.editname, matNo, editTex.propName);
                            if (tex != null)
                            {
                                editTex.tex = tex;
                            }
                            editTex.dirty = false;
                        }
                        GUI.enabled = true;
                        if (GUILayout.Button("...", uiParams.bStyle, uiParams.optBtnWidth))
                        {
                            OpenFileBrowser(matNo, editTex);
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }
                }
            } finally {
                GUILayout.EndVertical();
            }
        }
        public void Show() {

            GUILayout.BeginVertical(inboxStyle);
            try {
                string matName = (expand? "- " : "+ ") + material.name;
                if (GUILayout.Button(matName, uiParams.lStyleC)) {
                    expand = !expand;
                }
                if (!expand) return;

                foreach (ACCTexture editTex in edited) {
                    bool bTargetElement = (matNo == editTarget.matNo && editTex.propKey == editTarget.propKey);
    
                    GUILayout.BeginHorizontal();
                    try {
                        // エディット用スライダーの開閉
                        if (!textureModifier.IsValidTarget(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName)) {
                            // 参照先が Texture2D が取れなかった (例 : RenderTexture ) 場合は何もしない
                            var tmp = GUI.enabled;
                            GUI.enabled = false;
                            GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth);
                            GUI.enabled = tmp;
                        } else if (bTargetElement) {
                            // エディット中のテクスチャの場合
                            if (GUILayout.Button("-変更", uiParams.bStyle, buttonLWidth)) {
                                editTarget.Clear();
                            }
                        } else {
                            // エディット中以外のテクスチャの場合
                            if (GUILayout.Button("+変更", uiParams.bStyle, buttonLWidth)) {
                                editTarget.slotName = holder.currentSlot.Name;
                                editTarget.matNo = matNo;
                                editTarget.propName = editTex.propName;
                                editTarget.propKey  = editTex.propKey;
                            }
                        }
                        GUILayout.Label(editTex.propName, uiParams.lStyle);
                        if (bTargetElement && editTex.type.hasShadow && editTex.propKey == ShaderPropType.MainTex.key) {
                            if ( GUILayout.Button("_ShadowTexに反映", uiParams.bStyleSC) ) {
                                // 現在のFilterを_ShadowTexにも反映 
                                textureModifier.DuplicateFilter(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName, "_ShadowTex");
                            }
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }
    
                    // テクスチャエディット用スライダー
                    if (bTargetElement) {
                        textureModifier.ProcGUI(holder.currentMaid, holder.currentSlot.Name, material, editTex.propName);
                    }
        
                    float height = uiParams.itemHeight;
                    ComboBoxLO combo = null;
                    bool cbSelected = false;
                    if (editTex.toonType != ACCTexture.NONE) {
                        if (combos.TryGetValue(editTex.propName, out combo)) {
                            if (combo.IsClickedComboButton) {
                                height = combo.ItemCount*uiParams.itemHeight*0.8f;
                            }
                        } else {
                            combo = new ComboBoxLO(new GUIContent("選"), ItemNames, uiParams.bStyle, uiParams.boxStyle, uiParams.listStyle, true);
                            combo.SetItemWidth(comboWidth);
                            combos[editTex.propName] = combo;
                            combo.SelectItem(editTex.editname);
                        }
                    }
                    GUILayout.BeginHorizontal(GUILayout.Height(height));
                    try {
                        bool hideField = false;
                        string editName = editTex.editname;
                        if (editTex.toonType != ACCTexture.NONE) {
                            // 偽コンボボックス
                            int prevSelected = combo.SelectedItemIndex;
                            int selected = combo.Show(uiParams.optBtnWidth);
                            if (selected != prevSelected) {
                                editName = ItemNames[selected].text;
                                cbSelected = true;
                            }
                            hideField = combo.IsClickedComboButton;
                        }
                        if (hideField) uiParams.textStyle.fontSize = (int)(fontSizeS*0.8);
                        editName = GUILayout.TextField(editName, uiParams.textStyle, contentWidth);
                        editTex.SetName(editName);

                        if (hideField) uiParams.textStyle.fontSize = fontSize;
    
                        GUI.enabled = editTex.dirty;
                        if ((settings.toonComboAutoApply && cbSelected)
                            || GUILayout.Button("適", uiParams.bStyle, uiParams.optBtnWidth)) {
                            Texture tex = ChangeTexFile(textureDir, editTex.editname, matNo, editTex.propName);
                            if (tex != null) editTex.tex = tex;
                            editTex.dirty = false;
                        }
                        GUI.enabled = true;
                        if (GUILayout.Button("...", uiParams.bStyle, uiParams.optBtnWidth)) {
                            OpenFileBrowser(matNo, editTex);
                        }
                    } finally {
                        GUILayout.EndHorizontal();
                    }
                }
            } finally {
                GUILayout.EndVertical();
            }
        }