Ejemplo n.º 1
0
        // GUI
        //--------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _funcResult == null)
            {
                return;
            }

            Color prevColor = GUI.backgroundColor;

            GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
            GUI.Box(new Rect(0, 45, width, height - 100), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();



            Texture2D iconImageCategory = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown);

            GUIStyle guiStyle_None = new GUIStyle(GUIStyle.none);

            guiStyle_None.normal.textColor = GUI.skin.label.normal.textColor;

            GUIStyle guiStyle_Selected = new GUIStyle(GUIStyle.none);

            if (EditorGUIUtility.isProSkin)
            {
                guiStyle_Selected.normal.textColor = Color.cyan;
            }
            else
            {
                guiStyle_Selected.normal.textColor = Color.white;
            }


            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

            guiStyle_Center.normal.textColor = GUI.skin.label.normal.textColor;
            guiStyle_Center.alignment        = TextAnchor.MiddleCenter;

            GUILayout.Space(10);
            GUILayout.Button(_msg, guiStyle_Center, GUILayout.Width(width), GUILayout.Height(25));            //<투명 버튼
            GUILayout.Space(10);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height - 100));


            //TODO : 언어
            GUILayout.Button(new GUIContent((_isPresetTarget ? "Presets" : "Material Sets"), iconImageCategory), guiStyle_None, GUILayout.Height(20));            //<투명 버튼

            apMaterialSet curMatSet = null;

            //GUILayout.Space(10);
            for (int i = 0; i < _materialSets.Count; i++)
            {
                curMatSet = _materialSets[i];
                GUIStyle curGUIStyle = guiStyle_None;
                if (curMatSet == _curSelectedMatSet)
                {
                    Rect lastRect = GUILayoutUtility.GetLastRect();
                    prevColor = GUI.backgroundColor;

                    if (EditorGUIUtility.isProSkin)
                    {
                        GUI.backgroundColor = new Color(0.0f, 1.0f, 1.0f, 1.0f);
                    }
                    else
                    {
                        GUI.backgroundColor = new Color(0.4f, 0.8f, 1.0f, 1.0f);
                    }

                    GUI.Box(new Rect(lastRect.x, lastRect.y + 20, width, 20), "");
                    GUI.backgroundColor = prevColor;

                    curGUIStyle = guiStyle_Selected;
                }


                EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50));
                GUILayout.Space(15);
                if (GUILayout.Button(new GUIContent(" " + curMatSet._name, _img_MatSetType[curMatSet._icon]), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                {
                    _curSelectedMatSet = curMatSet;
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            bool isClose = false;

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Select), GUILayout.Height(30)))            //"Select"
            {
                _funcResult(true, _loadKey, _curSelectedMatSet, (_isNoneSelectable && _curSelectedMatSet != null && _curSelectedMatSet == _noneMatSet), _savedObject);
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// MaterialSet으로 부터 생성한다.
        /// </summary>
        /// <param name="srcMat"></param>
        /// <param name="uniqueID"></param>
        /// <param name="isFromPreset"></param>
        /// <param name="isDefault"></param>
        public void CopyFromSrc(apMaterialSet srcMat, int uniqueID, bool isFromPreset, bool isPreset, bool isDefault)
        {
            _uniqueID = uniqueID;
            _name     = srcMat._name;


            if (!isPreset)
            {
                //프리셋이 아닌 경우
                _isReserved = false;
                if (isFromPreset)
                {
                    //Src가 Preset인 경우
                    _linkedPresetID       = srcMat._uniqueID;
                    _linkedPresetMaterial = srcMat;
                }
                else
                {
                    //Src가 일반 MaterialSet인 경우
                    //같은 프리셋 공유
                    _linkedPresetID       = srcMat._linkedPresetID;
                    _linkedPresetMaterial = srcMat._linkedPresetMaterial;
                }


                _isDefault = isDefault;
            }
            else
            {
                //프리셋인 경우
                _isReserved           = false;
                _linkedPresetID       = -1;
                _linkedPresetMaterial = null;
            }

            _icon = srcMat._icon;


            _shaderPath_Normal_AlphaBlend        = srcMat._shaderPath_Normal_AlphaBlend;
            _shaderPath_Normal_Additive          = srcMat._shaderPath_Normal_Additive;
            _shaderPath_Normal_SoftAdditive      = srcMat._shaderPath_Normal_SoftAdditive;
            _shaderPath_Normal_Multiplicative    = srcMat._shaderPath_Normal_Multiplicative;
            _shaderPath_Clipped_AlphaBlend       = srcMat._shaderPath_Clipped_AlphaBlend;
            _shaderPath_Clipped_Additive         = srcMat._shaderPath_Clipped_Additive;
            _shaderPath_Clipped_SoftAdditive     = srcMat._shaderPath_Clipped_SoftAdditive;
            _shaderPath_Clipped_Multiplicative   = srcMat._shaderPath_Clipped_Multiplicative;
            _shaderPath_L_Normal_AlphaBlend      = srcMat._shaderPath_L_Normal_AlphaBlend;
            _shaderPath_L_Normal_Additive        = srcMat._shaderPath_L_Normal_Additive;
            _shaderPath_L_Normal_SoftAdditive    = srcMat._shaderPath_L_Normal_SoftAdditive;
            _shaderPath_L_Normal_Multiplicative  = srcMat._shaderPath_L_Normal_Multiplicative;
            _shaderPath_L_Clipped_AlphaBlend     = srcMat._shaderPath_L_Clipped_AlphaBlend;
            _shaderPath_L_Clipped_Additive       = srcMat._shaderPath_L_Clipped_Additive;
            _shaderPath_L_Clipped_SoftAdditive   = srcMat._shaderPath_L_Clipped_SoftAdditive;
            _shaderPath_L_Clipped_Multiplicative = srcMat._shaderPath_L_Clipped_Multiplicative;
            _shaderPath_AlphaMask = srcMat._shaderPath_AlphaMask;

            _propertySets.Clear();

            _isNeedToSetBlackColoredAmbient = srcMat._isNeedToSetBlackColoredAmbient;

#if UNITY_EDITOR
            LoadShaderAssets();
#endif

            //프로퍼티 복사
            for (int i = 0; i < srcMat._propertySets.Count; i++)
            {
                PropertySet newPropSet = new PropertySet();
                newPropSet.CopyFromSrc(srcMat._propertySets[i]);

                _propertySets.Add(newPropSet);
            }
        }
Ejemplo n.º 3
0
        // Init
        //--------------------------------------------------------------
        public void Init(apEditor editor, object loadKey, bool isPresetTarget, string msg, bool isNoneSelectable, FUNC_SELECT_MATERIALSET_RESULT funcResult, object savedObject)
        {
            _editor         = editor;
            _portrait       = _editor._portrait;
            _loadKey        = loadKey;
            _isPresetTarget = isPresetTarget;
            _funcResult     = funcResult;

            _savedObject = savedObject;

            _msg = msg;
            _isNoneSelectable = isNoneSelectable;

            if (_materialSets == null)
            {
                _materialSets = new List <apMaterialSet>();
            }
            _materialSets.Clear();

            List <apMaterialSet> srcMatSets = null;

            if (isPresetTarget)
            {
                //프리셋이면 MaterialLibrary에서 가져오자
                srcMatSets = _editor.MaterialLibrary.Presets;
            }
            else
            {
                //그렇지 않다면 Portrait에서 가져오자
                srcMatSets = _portrait._materialSets;
            }

            if (_isNoneSelectable)
            {
                //None 타입을 추가하자
                _noneMatSet       = new apMaterialSet();
                _noneMatSet._name = "(None)";
                _noneMatSet._icon = apMaterialSet.ICON.Unlit;
                _materialSets.Add(_noneMatSet);
            }

            for (int i = 0; i < srcMatSets.Count; i++)
            {
                _materialSets.Add(srcMatSets[i]);
            }

            _curSelectedMatSet = null;

            if (_img_MatSetType == null)
            {
                _img_MatSetType = new Dictionary <apMaterialSet.ICON, Texture2D>();
            }
            _img_MatSetType.Clear();

            _img_MatSetType.Add(apMaterialSet.ICON.Unlit, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Unlit));
            _img_MatSetType.Add(apMaterialSet.ICON.Lit, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Lit));
            _img_MatSetType.Add(apMaterialSet.ICON.LitSpecular, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_LitSpecular));
            _img_MatSetType.Add(apMaterialSet.ICON.LitSpecularEmission, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_LitSpecularEmission));
            _img_MatSetType.Add(apMaterialSet.ICON.LitRimlight, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_LitRim));
            _img_MatSetType.Add(apMaterialSet.ICON.LitRamp, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_LitRamp));
            _img_MatSetType.Add(apMaterialSet.ICON.Effect, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_FX));
            _img_MatSetType.Add(apMaterialSet.ICON.Cartoon, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Cartoon));
            _img_MatSetType.Add(apMaterialSet.ICON.Custom1, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Custom1));
            _img_MatSetType.Add(apMaterialSet.ICON.Custom2, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Custom2));
            _img_MatSetType.Add(apMaterialSet.ICON.Custom3, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_Custom3));
            _img_MatSetType.Add(apMaterialSet.ICON.UnlitVR, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_UnlitVR));
            _img_MatSetType.Add(apMaterialSet.ICON.LitVR, _editor.ImageSet.Get(apImageSet.PRESET.MaterialSetIcon_LitVR));
        }
Ejemplo n.º 4
0
        // Link
        //-----------------------------------------------



        // Functions
        //-----------------------------------------------
        public apMaterialSet MakeReserved(int uniqueID,
                                          string name,
                                          ICON icon,
                                          string shaderPath_Normal_AlphaBlend,
                                          string shaderPath_Normal_Additive,
                                          string shaderPath_Normal_SoftAdditive,
                                          string shaderPath_Normal_Multiplicative,
                                          string shaderPath_Clipped_AlphaBlend,
                                          string shaderPath_Clipped_Additive,
                                          string shaderPath_Clipped_SoftAdditive,
                                          string shaderPath_Clipped_Multiplicative,
                                          string shaderPath_L_Normal_AlphaBlend,
                                          string shaderPath_L_Normal_Additive,
                                          string shaderPath_L_Normal_SoftAdditive,
                                          string shaderPath_L_Normal_Multiplicative,
                                          string shaderPath_L_Clipped_AlphaBlend,
                                          string shaderPath_L_Clipped_Additive,
                                          string shaderPath_L_Clipped_SoftAdditive,
                                          string shaderPath_L_Clipped_Multiplicative,
                                          string shaderPath_AlphaMask,
                                          bool isNeedToSetBlackColoredAmbient
                                          )
        {
            _uniqueID = uniqueID;
            _name     = name;

            if (_uniqueID < 10)
            {
                _isReserved = true;
            }
            else
            {
                _isReserved = false;
            }
            _linkedPresetID       = -1;
            _linkedPresetMaterial = null;
            _isDefault            = false;

            _icon = icon;


            _shaderPath_Normal_AlphaBlend        = shaderPath_Normal_AlphaBlend;
            _shaderPath_Normal_Additive          = shaderPath_Normal_Additive;
            _shaderPath_Normal_SoftAdditive      = shaderPath_Normal_SoftAdditive;
            _shaderPath_Normal_Multiplicative    = shaderPath_Normal_Multiplicative;
            _shaderPath_Clipped_AlphaBlend       = shaderPath_Clipped_AlphaBlend;
            _shaderPath_Clipped_Additive         = shaderPath_Clipped_Additive;
            _shaderPath_Clipped_SoftAdditive     = shaderPath_Clipped_SoftAdditive;
            _shaderPath_Clipped_Multiplicative   = shaderPath_Clipped_Multiplicative;
            _shaderPath_L_Normal_AlphaBlend      = shaderPath_L_Normal_AlphaBlend;
            _shaderPath_L_Normal_Additive        = shaderPath_L_Normal_Additive;
            _shaderPath_L_Normal_SoftAdditive    = shaderPath_L_Normal_SoftAdditive;
            _shaderPath_L_Normal_Multiplicative  = shaderPath_L_Normal_Multiplicative;
            _shaderPath_L_Clipped_AlphaBlend     = shaderPath_L_Clipped_AlphaBlend;
            _shaderPath_L_Clipped_Additive       = shaderPath_L_Clipped_Additive;
            _shaderPath_L_Clipped_SoftAdditive   = shaderPath_L_Clipped_SoftAdditive;
            _shaderPath_L_Clipped_Multiplicative = shaderPath_L_Clipped_Multiplicative;
            _shaderPath_AlphaMask = shaderPath_AlphaMask;

            _propertySets.Clear();

            _isNeedToSetBlackColoredAmbient = isNeedToSetBlackColoredAmbient;

#if UNITY_EDITOR
            LoadShaderAssets();
#endif



            return(this);
        }