Exemplo n.º 1
0
        // Show Window
        //--------------------------------------------------------------
        public static object ShowDialog(apEditor editor, bool isPresetTarget, string msg, bool isNoneSelectable, FUNC_SELECT_MATERIALSET_RESULT funcResult, object savedObject)
        {
            CloseDialog();

            if (editor == null || editor._portrait == null || editor.MaterialLibrary == null)
            {
                return(null);
            }

            EditorWindow curWindow             = EditorWindow.GetWindow(typeof(apDialog_SelectMaterialSet), true, "Select Material Set", true);
            apDialog_SelectMaterialSet curTool = curWindow as apDialog_SelectMaterialSet;

            object loadKey = new object();

            if (curTool != null && curTool != s_window)
            {
                int width  = 250;
                int height = 400;
                s_window          = curTool;
                s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2),
                                             (editor.position.yMin + editor.position.yMax) / 2 - (height / 2),
                                             width, height);
                s_window.Init(editor, loadKey, isPresetTarget, msg, isNoneSelectable, funcResult, savedObject);

                return(loadKey);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
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));
        }