// Init
        //------------------------------------------------------------------
        public void Init(apEditor editor)
        {
            _editor   = editor;
            _img_Info = AssetDatabase.LoadAssetAtPath <Texture2D>(apEditorUtil.ResourcePath_Icon + "AmbientInfo.png");

            _str_Info      = _editor.GetText(TEXT.AmbientCorrection_Info);
            _str_Convert   = _editor.GetText(TEXT.AmbientCorrection_Convert);
            _str_Close     = _editor.GetText(TEXT.Close);
            _str_DoNotShow = _editor.GetText(TEXT.AmbientCorrection_Ignore);
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }

            //Bake 설정
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SetSuctomFFDGridSize));            //"Set Custom FFD Grid Size"
            //X, Y 개수를 표시
            int width_Label = 30;
            int width_Value = (width - 10) - 34;

            GUILayout.Space(10);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField("X", GUILayout.Width(width_Label));
            _nX = EditorGUILayout.IntSlider(_nX, 2, 8, GUILayout.Width(width_Value));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField("Y", GUILayout.Width(width_Label));
            _nY = EditorGUILayout.IntSlider(_nY, 2, 8, GUILayout.Width(width_Value));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(20);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            int width_Btn = ((width - 10) / 2) - 4;

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_StartEdit), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Start Edit"
            {
                _funcResult(true, _loadKey, _nX, _nY);
                CloseDialog();
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, _nX, _nY);
                CloseDialog();
            }
            EditorGUILayout.EndHorizontal();
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor)
            {
                CloseDialog();
                return;
            }

            width -= 10;
            //Bake 설정
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_NewPortraitName), GUILayout.Width(width));            //"New Portrait Name"
            //X, Y 개수를 표시

            GUILayout.Space(10);

            _newPortraitName = EditorGUILayout.TextField(_newPortraitName, GUILayout.Width(width));

            GUILayout.Space(20);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            int width_Btn = ((width - 10) / 2) - 4;

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_MakePortrait), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Make Portrait"
            {
                _funcResult(true, _loadKey, _newPortraitName);
                CloseDialog();
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Cancel), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Cancel"
            {
                _funcResult(false, _loadKey, "");
                CloseDialog();
            }
            EditorGUILayout.EndHorizontal();
        }
        // GUI
        //------------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetMeshGroup == null)
            {
                CloseDialog();
                return;
            }

            try
            {
                Color prevColor = GUI.backgroundColor;

                //레이아웃 구조
                //1. Save
                // - 저장 버튼
                //2. Load
                // - 로드 버튼
                // - 본 정보 리스트
                //   - <색상> 인덱스, 이름 -> 적용 여부 + IK + 색상 로드
                // - 전체 선택 / 해제
                // - 전체 IK 포함 여부,
                // - 옵션 : 크기

                width -= 10;

                //1. 다이얼로그 타이틀
                GUIStyle guiStyleBox = new GUIStyle(GUI.skin.box);
                guiStyleBox.alignment        = TextAnchor.MiddleCenter;
                guiStyleBox.normal.textColor = apEditorUtil.BoxTextColor;

                GUIStyle guiStyleBox_Left = new GUIStyle(GUI.skin.textField);
                guiStyleBox_Left.alignment = TextAnchor.MiddleLeft;

                //"  Export Pose"
                GUILayout.Box(new GUIContent("  " + _editor.GetText(TEXT.DLG_ExportPose), _editor.ImageSet.Get(apImageSet.PRESET.Rig_SaveLoad)), guiStyleBox, GUILayout.Width(width), GUILayout.Height(35));
                GUILayout.Space(5);

                //2. 기본 정보
                int widthLabel = 120;
                int widthValue = width - (widthLabel + 10 + 5);

                EditorGUILayout.LabelField(_retarget.SinglePoseFile._portraitName + " - " + _retarget.SinglePoseFile._meshGroupName);
                GUILayout.Space(10);

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
                GUILayout.Space(5);

                //"Pose Name..
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PoseName) + " : ", GUILayout.Width(widthLabel));
                _retarget.SinglePoseFile._poseName = EditorGUILayout.TextField(_retarget.SinglePoseFile._poseName, GUILayout.Width(widthValue));

                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
                GUILayout.Space(5);

                //"Description
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Description) + " : ", GUILayout.Width(widthLabel));
                _retarget.SinglePoseFile._description = EditorGUILayout.TextField(_retarget.SinglePoseFile._description, GUILayout.Width(widthValue));

                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);

                //3. Export할 Bone 선택
                int listHeight = height - 240;

                Rect lastRect = GUILayoutUtility.GetLastRect();

                GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
                GUI.Box(new Rect(0, lastRect.y + 5, width + 10, listHeight), "");

                List <apRetargetBonePoseUnit> bonePoseUnits = _retarget.SinglePoseFile._bones;
                int itemWidth  = width - 20;
                int itemHeight = 20;

                GUIStyle guiStyle_ItemLabel = new GUIStyle(GUI.skin.label);
                guiStyle_ItemLabel.alignment = TextAnchor.MiddleLeft;

                _scrollList = EditorGUILayout.BeginScrollView(_scrollList, false, true, GUILayout.Width(width + 10), GUILayout.Height(listHeight));
                EditorGUILayout.BeginVertical(GUILayout.Width(width - 10));

                for (int i = 0; i < bonePoseUnits.Count; i++)
                {
                    apRetargetBonePoseUnit boneUnit = bonePoseUnits[i];

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
                    GUILayout.Space(5);

                    EditorGUILayout.LabelField(new GUIContent("", _imgIcon_Bone), GUILayout.Width(itemHeight), GUILayout.Height(itemHeight));
                    EditorGUILayout.LabelField(boneUnit._name, guiStyle_ItemLabel, GUILayout.Width(200), GUILayout.Height(itemHeight));

                    GUILayout.Space(10);

                    //"Export", "Export"

                    if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.DLG_Export), _editor.GetText(TEXT.DLG_Export), boneUnit._isExported, true, 120, itemHeight))
                    {
                        boneUnit._isExported = !boneUnit._isExported;
                    }

                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.EndVertical();
                GUILayout.Space(listHeight + 100);

                EditorGUILayout.EndScrollView();

                GUILayout.Space(10);


                // Select All / Deselect All
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width + 10), GUILayout.Height(25));
                GUILayout.Space(5);
                //"Select All"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_SelectAll), GUILayout.Width((width - 6) / 2), GUILayout.Height(25)))
                {
                    for (int i = 0; i < bonePoseUnits.Count; i++)
                    {
                        apRetargetBonePoseUnit boneUnit = bonePoseUnits[i];
                        boneUnit._isExported = true;
                    }
                }
                //"Deselect All"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_DeselectAll), GUILayout.Width((width - 6) / 2), GUILayout.Height(25)))
                {
                    for (int i = 0; i < bonePoseUnits.Count; i++)
                    {
                        apRetargetBonePoseUnit boneUnit = bonePoseUnits[i];
                        boneUnit._isExported = false;
                    }
                }

                GUILayout.Space(10);

                EditorGUILayout.EndHorizontal();


                string strExportBtn = " " + _editor.GetText(TEXT.DLG_ExportPose);
                if (apEditorUtil.ToggledButton_2Side(_editor.ImageSet.Get(apImageSet.PRESET.Rig_SaveLoad),
                                                     strExportBtn, strExportBtn,
                                                     false, !string.IsNullOrEmpty(_retarget.SinglePoseFile._poseName), width, 30))
                {
                    //TODO.
                    string fileFolderPath = Application.dataPath + "/../" + _editor._bonePose_BaseFolderName;
                    string savedFileName  = _retarget.SaveSinglePose(fileFolderPath);

                    if (string.IsNullOrEmpty(savedFileName))
                    {
                        _editor.Notification("Pose Save Failed", false, true);
                    }
                    else
                    {
                        _editor.Notification("Pose Saved [" + savedFileName + "]", false, false);
                    }
                    CloseDialog();
                }
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width), GUILayout.Height(25)))                //"Close"
                {
                    CloseDialog();
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("Exception : " + ex);
            }
        }
        // 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, 35, width, height - (90)), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

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

            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(_editor.GetText(TEXT.DLG_SelectMeshGroupToLink), guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));            //<투명 버튼//"Select Mesh Group to Link"
            GUILayout.Space(10);

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


            GUILayout.Button(new GUIContent(_editor.GetText(TEXT.DLG_MeshGroups), iconImageCategory), guiStyle_None, GUILayout.Height(20));            //<투명 버튼//"Mesh Groups"

            //GUILayout.Space(10);
            for (int i = 0; i < _selectableMeshGroups.Count; i++)
            {
                GUIStyle curGUIStyle = guiStyle_None;
                if (_selectableMeshGroups[i] == _selectedMeshGroup)
                {
                    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(" " + _selectableMeshGroups[i]._name, iconMeshGroup), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                {
                    _selectedMeshGroup = _selectableMeshGroups[i];
                }

                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"
            {
                if (_selectedMeshGroup != null)
                {
                    _funcResult(true, _loadKey, _selectedMeshGroup, _targetAnimClip);
                }
                else
                {
                    _funcResult(false, _loadKey, null, null);
                }
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, null, null);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 6
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, 35, width, height - (90)), "");
            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);
            //"Select Timeline Type to Add"
            GUILayout.Button(_editor.GetText(TEXT.DLG_SelectTimelineTypeToAdd), guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));            //<투명 버튼
            GUILayout.Space(10);

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

            //"Timeline Types"
            if (_guiContent_TimelineTypes == null)
            {
                _guiContent_TimelineTypes = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_TimelineTypes), false, iconImageCategory);
            }


            GUILayout.Button(_guiContent_TimelineTypes.Content, guiStyle_None, GUILayout.Height(20));            //<투명 버튼


            //항목의 이름
            if (_guiContent_LinkDataNameAndIcon == null)
            {
                _guiContent_LinkDataNameAndIcon = new apGUIContentWrapper(false);
            }


            //GUILayout.Space(10);
            for (int i = 0; i < _linkDataList.Count; i++)
            {
                GUIStyle curGUIStyle = guiStyle_None;
                if (_linkDataList[i] == _selectedLinkData)
                {
                    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(" " + _linkDataList[i]._name, _linkDataList[i]._icon), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))

                //변경
                _guiContent_LinkDataNameAndIcon.ClearText(false);
                _guiContent_LinkDataNameAndIcon.AppendSpaceText(1, false);
                _guiContent_LinkDataNameAndIcon.AppendText(_linkDataList[i]._name, true);

                _guiContent_LinkDataNameAndIcon.SetImage(_linkDataList[i]._icon);

                if (GUILayout.Button(_guiContent_LinkDataNameAndIcon.Content, curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                {
                    _selectedLinkData = _linkDataList[i];
                }

                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"
            {
                if (_selectedLinkData != null)
                {
                    _funcResult(true, _loadKey, _selectedLinkData._linkType, _selectedLinkData._modifierID, _targetAnimClip);
                }
                else
                {
                    _funcResult(false, _loadKey, apAnimClip.LINK_TYPE.AnimatedModifier, -1, null);
                }
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, apAnimClip.LINK_TYPE.AnimatedModifier, -1, null);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 7
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }



            //Sorting Layer를 추가하자
            if (_sortingLayerNames == null || _sortingLayerIDs == null)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }
            else if (_sortingLayerNames.Length != SortingLayer.layers.Length ||
                     _sortingLayerIDs.Length != SortingLayer.layers.Length)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }

            for (int i = 0; i < SortingLayer.layers.Length; i++)
            {
                _sortingLayerNames[i] = SortingLayer.layers[i].name;
                _sortingLayerIDs[i]   = SortingLayer.layers[i].id;
            }


            int width_2Btn = (width - 14) / 2;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Bake), _tab == TAB.Bake, width_2Btn, 25))
            {
                _tab = TAB.Bake;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Setting), _tab == TAB.Options, width_2Btn, 25))
            {
                _tab = TAB.Options;
            }
            EditorGUILayout.EndHorizontal();


            if (_tab == TAB.Bake)
            {
                GUILayout.Space(5);

                // 1. Bake에 대한 UI
                //Bake 설정
                //EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_BakeSetting));//"Bake Setting"
                //GUILayout.Space(5);

                EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Portrait), _targetPortrait, typeof(apPortrait), true);                //"Portait"

                GUILayout.Space(5);

                //"Bake Scale"
                float prevBakeScale = _targetPortrait._bakeScale;
                _targetPortrait._bakeScale = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_BakeScale), _targetPortrait._bakeScale);

                //"Z Per Depth"
                float prevBakeZSize = _targetPortrait._bakeZSize;
                _targetPortrait._bakeZSize = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_ZPerDepth), _targetPortrait._bakeZSize);

                if (_targetPortrait._bakeZSize < 0.5f)
                {
                    _targetPortrait._bakeZSize = 0.5f;
                }

                if (prevBakeScale != _targetPortrait._bakeScale ||
                    prevBakeZSize != _targetPortrait._bakeZSize)
                {
                    apEditorUtil.SetEditorDirty();
                }


                //Bake 버튼
                GUILayout.Space(10);
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Bake), GUILayout.Height(45)))                //"Bake"
                {
                    GUI.FocusControl(null);

                    //CheckChangedProperties(nextRootScale, nextZScale);
                    apEditorUtil.SetEditorDirty();

                    //-------------------------------------
                    // Bake 함수를 실행한다. << 중요오오오오
                    //-------------------------------------
                    apBakeResult bakeResult = _editor.Controller.Bake();


                    _editor.Notification("[" + _targetPortrait.name + "] is Baked", false, false);

                    if (bakeResult.NumUnlinkedExternalObject > 0)
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                    _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                    _editor.GetText(TEXT.Okay));
                    }
                }

                GUILayout.Space(10);
                apEditorUtil.GUI_DelimeterBoxH(width - 10);
                GUILayout.Space(10);


                //최적화 Bake
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_OptimizedBaking));                //"Optimized Baking"

                //"Target"
                apPortrait nextOptPortrait = (apPortrait)EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Target), _targetPortrait._bakeTargetOptPortrait, typeof(apPortrait), true);

                if (nextOptPortrait != _targetPortrait._bakeTargetOptPortrait)
                {
                    //타겟을 바꾸었다.
                    bool isChanged = false;
                    if (nextOptPortrait != null)
                    {
                        //1. 다른 Portrait를 선택했다.
                        if (!nextOptPortrait._isOptimizedPortrait)
                        {
                            //1-1. 최적화된 객체가 아니다.
                            EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                        _editor.GetText(TEXT.OptBakeError_NotOptTarget_Body),
                                                        _editor.GetText(TEXT.Close));
                        }
                        else if (nextOptPortrait._bakeSrcEditablePortrait != _targetPortrait)
                        {
                            //1-2. 다른 대상으로부터 Bake된 Portrait같다. (물어보고 계속)
                            bool isResult = EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                                        _editor.GetText(TEXT.OptBakeError_SrcMatchError_Body),
                                                                        _editor.GetText(TEXT.Okay),
                                                                        _editor.GetText(TEXT.Cancel));

                            if (isResult)
                            {
                                //뭐 선택하겠다는데요 뭐..
                                isChanged = true;
                            }
                        }
                        else
                        {
                            //1-3. 오케이. 변경 가능
                            isChanged = true;
                        }
                    }
                    else
                    {
                        //2. 선택을 해제했다.
                        isChanged = true;
                    }

                    if (isChanged)
                    {
                        //Target을 변경한다.
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                        _targetPortrait._bakeTargetOptPortrait = nextOptPortrait;
                    }
                }

                string optBtnText = "";
                if (_targetPortrait._bakeTargetOptPortrait != null)
                {
                    //optBtnText = "Optimized Bake to\n[" + _targetPortrait._bakeTargetOptPortrait.gameObject.name + "]";
                    optBtnText = string.Format("{0}\n[{1}]", _editor.GetText(TEXT.DLG_OptimizedBakeTo), _targetPortrait._bakeTargetOptPortrait.gameObject.name);
                }
                else
                {
                    //optBtnText = "Optimized Bake\n(Make New GameObject)";
                    optBtnText = _editor.GetText(TEXT.DLG_OptimizedBakeMakeNew);
                }
                GUILayout.Space(10);

                if (GUILayout.Button(optBtnText, GUILayout.Height(45)))
                {
                    GUI.FocusControl(null);

                    //CheckChangedProperties(nextRootScale, nextZScale);

                    //Optimized Bake를 하자
                    apBakeResult bakeResult = _editor.Controller.OptimizedBake(_targetPortrait, _targetPortrait._bakeTargetOptPortrait);

                    if (bakeResult.NumUnlinkedExternalObject > 0)
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                    _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                    _editor.GetText(TEXT.Okay));
                    }

                    _editor.Notification("[" + _targetPortrait.name + "] is Baked (Optimized)", false, false);
                }
            }
            else
            {
                //Vector2 curScroll = (_tab == TAB.Bake) ? _scroll_Bake : _scroll_Options;

                _scroll_Options = EditorGUILayout.BeginScrollView(_scroll_Options, false, true, GUILayout.Width(width), GUILayout.Height(height - 30));

                EditorGUILayout.BeginVertical(GUILayout.Width(width - 24));
                GUILayout.Space(5);

                width -= 24;

                // 2. Option에 대한 UI
                //1. Gamma Space Space
                bool prevBakeGamma   = _editor._isBakeColorSpaceToGamma;
                int  iPrevColorSpace = prevBakeGamma ? 0 : 1;
                int  iNextColorSpace = EditorGUILayout.Popup(_editor.GetUIWord(UIWORD.ColorSpace), iPrevColorSpace, _colorSpaceNames);
                if (iNextColorSpace != iPrevColorSpace)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (iNextColorSpace == 0)
                    {
                        //Gamma
                        _editor._isBakeColorSpaceToGamma = true;
                    }
                    else
                    {
                        //Linear
                        _editor._isBakeColorSpaceToGamma = false;
                    }
                }

                GUILayout.Space(10);

                //2. Sorting Layer
                int prevSortingLayerID = _editor._portrait._sortingLayerID;
                int prevSortingOrder   = _editor._portrait._sortingOrder;

                int layerIndex = -1;
                for (int i = 0; i < SortingLayer.layers.Length; i++)
                {
                    if (SortingLayer.layers[i].id == _editor._portrait._sortingLayerID)
                    {
                        //찾았다.
                        layerIndex = i;
                        break;
                    }
                }
                if (layerIndex < 0)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);

                    //어라 레이어가 없는데용..
                    //초기화해야겠다.
                    _editor._portrait._sortingLayerID = -1;
                    if (SortingLayer.layers.Length > 0)
                    {
                        _editor._portrait._sortingLayerID = SortingLayer.layers[0].id;
                        layerIndex = 0;
                    }
                }
                int nextIndex = EditorGUILayout.Popup(_editor.GetText(TEXT.SortingLayer), layerIndex, _sortingLayerNames);                //"Sorting Layer"
                if (nextIndex != layerIndex)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    //레이어가 변경되었다.
                    if (nextIndex >= 0 && nextIndex < SortingLayer.layers.Length)
                    {
                        //LayerID 변경
                        _editor._portrait._sortingLayerID = SortingLayer.layers[nextIndex].id;
                    }
                }
                _editor._portrait._sortingOrder = EditorGUILayout.IntField(_editor.GetText(TEXT.SortingOrder), _editor._portrait._sortingOrder);                //"Sorting Order"

                GUILayout.Space(10);

                //3. 메카님 사용 여부

                //EditorGUILayout.LabelField("Animation Settings");
                bool   prevIsUsingMecanim = _targetPortrait._isUsingMecanim;
                string prevMecanimPath    = _targetPortrait._mecanimAnimClipResourcePath;
                _targetPortrait._isUsingMecanim = EditorGUILayout.Toggle(_editor.GetText(TEXT.IsMecanimAnimation), _targetPortrait._isUsingMecanim); //"Is Mecanim Animation"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.AnimationClipExportPath));                                                           //"Animation Clip Export Path"

                GUIStyle guiStyle_ChangeBtn = new GUIStyle(GUI.skin.button);
                guiStyle_ChangeBtn.margin = GUI.skin.textField.margin;
                guiStyle_ChangeBtn.border = GUI.skin.textField.border;

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(20));
                GUILayout.Space(5);
                EditorGUILayout.TextField(_targetPortrait._mecanimAnimClipResourcePath, GUILayout.Width(width - (70 + 15)));
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Change), guiStyle_ChangeBtn, GUILayout.Width(70), GUILayout.Height(18)))
                {
                    string defaultPath = _targetPortrait._mecanimAnimClipResourcePath;
                    if (string.IsNullOrEmpty(defaultPath))
                    {
                        defaultPath = Application.dataPath;
                    }
                    string nextPath = EditorUtility.SaveFolderPanel("Select to export animation clips", defaultPath, "");
                    if (!string.IsNullOrEmpty(nextPath))
                    {
                        if (apEditorUtil.IsInAssetsFolder(nextPath))
                        {
                            //유효한 폴더인 경우
                            _targetPortrait._mecanimAnimClipResourcePath = nextPath;
                        }
                        else
                        {
                            //유효한 폴더가 아닌 경우
                            EditorUtility.DisplayDialog("Invalid Folder Path", "Invalid Clip Path", "Close");
                        }
                    }

                    GUI.FocusControl(null);
                }
                EditorGUILayout.EndHorizontal();



                GUILayout.Space(10);

                //4. Important
                //"Is Important"
                bool nextImportant = EditorGUILayout.Toggle(new GUIContent(_editor.GetText(TEXT.DLG_Setting_IsImportant), "When this setting is on, it always updates and the physics effect works."), _targetPortrait._isImportant);
                if (nextImportant != _targetPortrait._isImportant)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._isImportant = nextImportant;
                }

                //"FPS (Important Off)"
                int nextFPS = EditorGUILayout.DelayedIntField(new GUIContent(_editor.GetText(TEXT.DLG_Setting_FPS), "This setting is used when <Important> is off"), _targetPortrait._FPS);
                if (_targetPortrait._FPS != nextFPS)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (nextFPS < 10)
                    {
                        nextFPS = 10;
                    }
                    _targetPortrait._FPS = nextFPS;
                }

                GUILayout.Space(10);

                //5. Billboard + Perspective

                apPortrait.BILLBOARD_TYPE nextBillboardType = (apPortrait.BILLBOARD_TYPE)EditorGUILayout.Popup(_editor.GetText(TEXT.DLG_Billboard), (int)_targetPortrait._billboardType, _billboardTypeNames);
                if (nextBillboardType != _targetPortrait._billboardType)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._billboardType = nextBillboardType;
                }

                GUILayout.Space(10);

                //6. Shadow

                apPortrait.SHADOW_CASTING_MODE nextChastShadows = (apPortrait.SHADOW_CASTING_MODE)EditorGUILayout.EnumPopup(_editor.GetUIWord(UIWORD.CastShadows), _targetPortrait._meshShadowCastingMode);
                bool nextReceiveShaodw = EditorGUILayout.Toggle(_editor.GetUIWord(UIWORD.ReceiveShadows), _targetPortrait._meshReceiveShadow);
                if (nextChastShadows != _targetPortrait._meshShadowCastingMode ||
                    nextReceiveShaodw != _targetPortrait._meshReceiveShadow)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._meshShadowCastingMode = nextChastShadows;
                    _targetPortrait._meshReceiveShadow     = nextReceiveShaodw;
                }

                GUILayout.Space(10);

#if UNITY_2018_2_OR_NEWER
                //7. LWRP
                //LWRP 쉐이더를 쓸지 여부와 다시 강제로 생성하기 버튼을 만들자.
                bool prevUseLWRP  = _editor._isUseLWRPShader;
                int  iPrevUseLWRP = prevUseLWRP ? 1 : 0;
                int  iNextUseLWRP = EditorGUILayout.Popup("Render Pipeline", iPrevUseLWRP, _renderPipelineNames);
                if (iNextUseLWRP != iPrevUseLWRP)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (iNextUseLWRP == 0)
                    {
                        //사용 안함
                        _editor._isUseLWRPShader = false;
                    }
                    else
                    {
                        //LWRP 사용함
                        _editor._isUseLWRPShader = true;
                    }
                }
                if (GUILayout.Button("Generate Lightweight Shaders"))
                {
                    apShaderGenerator shaderGenerator = new apShaderGenerator();
                    shaderGenerator.GenerateLWRPShaders();
                }

                GUILayout.Space(10);
#endif

                //11.7 추가 : Ambient Light를 검은색으로 만든다.
                GUILayout.Space(10);
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_AmbientToBlack), GUILayout.Height(20)))
                {
                    MakeAmbientLightToBlack();
                }

                //CheckChangedProperties(nextRootScale, nextZScale);
                if (prevSortingLayerID != _editor._portrait._sortingLayerID ||
                    prevSortingOrder != _editor._portrait._sortingOrder ||
                    prevIsUsingMecanim != _targetPortrait._isUsingMecanim ||
                    !string.Equals(prevMecanimPath, _targetPortrait._mecanimAnimClipResourcePath) ||
                    prevBakeGamma != _editor._isBakeColorSpaceToGamma
#if UNITY_2018_2_OR_NEWER
                    || prevUseLWRP != _editor._isUseLWRPShader
#endif
                    )
                {
                    apEditorUtil.SetEditorDirty();
                    _editor.SaveEditorPref();
                }

                GUILayout.Space(height + 500);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndScrollView();
            }

            GUILayout.Space(5);
        }
Ejemplo n.º 8
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, 35, width, height - (90 + 12)), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

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

            Texture2D iconImage_FoldDown  = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown);
            Texture2D iconImage_FoldRight = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldRight);

            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);

            guiStyle.normal.textColor = GUI.skin.label.normal.textColor;
            guiStyle.alignment        = TextAnchor.MiddleLeft;

            GUIStyle guiStyle_Selected = new GUIStyle(GUIStyle.none);

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

            GUIStyle guiStyle_NotSelectable = new GUIStyle(GUIStyle.none);

            guiStyle_NotSelectable.normal.textColor = Color.red;
            guiStyle_NotSelectable.alignment        = TextAnchor.MiddleLeft;


            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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

            GUIContent guiContent_Bone = new GUIContent(iconBone);

            GUILayout.Space(10);
            //GUILayout.Button("Select a Bone to Link", guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));//<투명 버튼
            //"Search  "
            _strSearchKeyword = EditorGUILayout.DelayedTextField(_editor.GetText(TEXT.DLG_Search) + "  ", _strSearchKeyword, GUILayout.Width(width - 20), GUILayout.Height(15));

            if (string.IsNullOrEmpty(_strSearchKeyword))
            {
                _isSearched = false;
            }
            else
            {
                _isSearched = true;
            }
            GUILayout.Space(10);

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

            //_targetMeshGroup._name + " Bones"
            GUILayout.Button(new GUIContent(string.Format("{0} {1}", _targetMeshGroup._name, _editor.GetText(TEXT.DLG_Bones)), iconImageCategory), guiStyle, GUILayout.Height(20));            //<투명 버튼

            //GUILayout.Space(10);

            for (int i = 0; i < _boneUnits_Root.Count; i++)
            {
                DrawBoneUnit(_boneUnits_Root[i], 0, width, iconImage_FoldDown, iconImage_FoldRight, guiContent_Bone, guiStyle, guiStyle_Selected, guiStyle_NotSelectable, _scrollList.x);
            }

            GUILayout.Space(50);


            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);

            EditorGUILayout.BeginHorizontal();


            bool isClose = false;
            bool isSelectBtnAvailable = (_selectedBoneUnit != null && _selectedBoneUnit._isSelectable);

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Select), false, isSelectBtnAvailable, (width / 2) - 8, 30))            //"Select"
            {
                if (_selectedBoneUnit != null)
                {
                    //선택 가능한 Unit이라면 Return
                    if (_selectedBoneUnit._isSelectable)
                    {
                        _funcResult(true, _loadKey, _selectedBoneUnit._bone == null, _selectedBoneUnit._bone, _targetBone, _requestType);
                        isClose = true;
                    }
                }
            }

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Close), false, true, (width / 2) - 8, 30))            //"Close"
            {
                //_funcResult(false, _loadKey, null, null);
                _funcResult(false, _loadKey, false, null, null, _requestType);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            bool isChanged = false;

            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                //Debug.LogError("Exit - Editor / Portrait is Null");
                CloseDialog();
                return;
            }

            //int height_top = 30;
            //int height_bottom = 35 + 40;
            //int height_middle = height - (height_top + height_bottom);
            int height_middle = 370;

            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_ModLockSettings), GUILayout.Height(25));            //"Modifier Lock Settings"



            GUI.Box(new Rect(0, 30, width / 2, 300), "");
            GUI.Box(new Rect(width / 2 - 1, 30, width / 2 + 1, 300), "");


            Texture2D img_Lock   = _editor.ImageSet.Get(apImageSet.PRESET.Edit_ModLock);
            Texture2D img_Unlock = _editor.ImageSet.Get(apImageSet.PRESET.Edit_ModUnlock);

            GUIStyle guiStyle_Title = new GUIStyle(GUI.skin.label);

            guiStyle_Title.alignment = TextAnchor.MiddleCenter;

            GUIStyle guiStyle_Box = new GUIStyle(GUI.skin.box);

            guiStyle_Box.alignment = TextAnchor.MiddleCenter;

            int width_half = (width - 10) / 2;

            EditorGUILayout.BeginVertical(GUILayout.Width(width), GUILayout.Height(height_middle));

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(40));

            GUILayout.Space(5);
            //Lock Mode / Unlock Mode
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetText(TEXT.DLG_ModLockMode), img_Lock), guiStyle_Title, GUILayout.Width(width_half), GUILayout.Height(40));
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetText(TEXT.DLG_ModUnlockMode), img_Unlock), guiStyle_Title, GUILayout.Width(width_half), GUILayout.Height(40));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            Color prevColor = GUI.backgroundColor;

            //1. 설명

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(60));
            GUILayout.Space(5);
            GUI.backgroundColor = new Color(prevColor.r * 1.8f, prevColor.g * 0.7f, prevColor.b * 0.7f, 1.0f);
            //"Other than the selected Modifier\nwill not be executed."
            GUILayout.Box(_editor.GetText(TEXT.DLG_ModLockDescription), guiStyle_Box, GUILayout.Width(width_half - 5), GUILayout.Height(60));

            GUILayout.Space(5);

            GUI.backgroundColor = new Color(prevColor.r * 0.7f, prevColor.g * 1.8f, prevColor.b * 1.8f, 1.0f);
            //"Except Modifiers which are of the same type\nor can not be edited at the same time,\nothers are executed."
            GUILayout.Box(_editor.GetText(TEXT.DLG_ModUnlockDescription), guiStyle_Box, GUILayout.Width(width_half - 5), GUILayout.Height(60));

            GUI.backgroundColor = prevColor;

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);


            //2. 어떤 객체가 Modifier나 Timeline Layer에 등록 안된 경우, 배타적인 계산을 하지 않는다.
            //Lock On인 경우 없다.
            //"Calculating transformations\nof unregistered objects"
            string strOpt_CalculateIfNotAddedOther_On = _editor.GetText(TEXT.DLG_ModLockCalculateUnregisteredObj);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(40));
            GUILayout.Space(5 + width_half + 5);
            if (apEditorUtil.ToggledButton_2Side(strOpt_CalculateIfNotAddedOther_On,
                                                 strOpt_CalculateIfNotAddedOther_On,
                                                 _editor._modLockOption_CalculateIfNotAddedOther,
                                                 true,
                                                 width_half - 5, 40))
            {
                _editor._modLockOption_CalculateIfNotAddedOther = !_editor._modLockOption_CalculateIfNotAddedOther;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);


            //3. Color Preview
            //"Render Calculated Colors"
            string strOpt_ColorPreview = _editor.GetText(TEXT.DLG_ModLockRenderCalculatedColors);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton_2Side(strOpt_ColorPreview, strOpt_ColorPreview,
                                                 _editor._modLockOption_ColorPreview_Lock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_ColorPreview_Lock = !_editor._modLockOption_ColorPreview_Lock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            GUILayout.Space(5);

            if (apEditorUtil.ToggledButton_2Side(strOpt_ColorPreview, strOpt_ColorPreview,
                                                 _editor._modLockOption_ColorPreview_Unlock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_ColorPreview_Unlock = !_editor._modLockOption_ColorPreview_Unlock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            //4. Bone Preview
            //"Preview Calculated Bones"
            string strOpt_BonePreview = _editor.GetText(TEXT.DLG_ModLockPreviewCalculatedBones);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton_2Side(strOpt_BonePreview, strOpt_BonePreview,
                                                 _editor._modLockOption_BonePreview_Lock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_BonePreview_Lock = !_editor._modLockOption_BonePreview_Lock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            GUILayout.Space(5);

            if (apEditorUtil.ToggledButton_2Side(strOpt_BonePreview, strOpt_BonePreview,
                                                 _editor._modLockOption_BonePreview_Unlock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_BonePreview_Unlock = !_editor._modLockOption_BonePreview_Unlock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);


            //5. Mesh Preview
            //string strOpt_MeshPreview = "Preview Calculated Meshes";
            //EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            //GUILayout.Space(5);
            //if(apEditorUtil.ToggledButton_2Side(strOpt_MeshPreview, strOpt_MeshPreview,
            //									_editor._modLockOption_MeshPreview_Lock,
            //									true,
            //									width_half - 5, 30))
            //{
            //	_editor._modLockOption_MeshPreview_Lock = !_editor._modLockOption_MeshPreview_Lock;
            //	isChanged = true;
            //	_editor.SaveEditorPref();
            //}

            //GUILayout.Space(5);

            //if(apEditorUtil.ToggledButton_2Side(strOpt_MeshPreview, strOpt_MeshPreview,
            //									_editor._modLockOption_MeshPreview_Unlock,
            //									true,
            //									width_half - 5, 30))
            //{
            //	_editor._modLockOption_MeshPreview_Unlock = !_editor._modLockOption_MeshPreview_Unlock;
            //	isChanged = true;
            //	_editor.SaveEditorPref();
            //}

            //EditorGUILayout.EndHorizontal();

            //GUILayout.Space(5);


            //6. Modifier List UI
            //"Show Modifier List"
            string strOpt_ModifierListUI = _editor.GetText(TEXT.DLG_ModLockShowModifierList);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton_2Side(strOpt_ModifierListUI, strOpt_ModifierListUI,
                                                 _editor._modLockOption_ModListUI_Lock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_ModListUI_Lock = !_editor._modLockOption_ModListUI_Lock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            GUILayout.Space(5);

            if (apEditorUtil.ToggledButton_2Side(strOpt_ModifierListUI, strOpt_ModifierListUI,
                                                 _editor._modLockOption_ModListUI_Unlock,
                                                 true,
                                                 width_half - 5, 30))
            {
                _editor._modLockOption_ModListUI_Unlock = !_editor._modLockOption_ModListUI_Unlock;
                isChanged = true;
                _editor.SaveEditorPref();
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(15);


            //7. Preview 색상
            //"Preview Color"
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_ModLockPreviewColor));
            //try
            //{
            //	Color nextColor = EditorGUILayout.ColorField("Mesh Preview Color", _editor._modLockOption_MeshPreviewColor);
            //	if(!IsSameColor(nextColor, _editor._modLockOption_MeshPreviewColor))
            //	{
            //		_editor._modLockOption_MeshPreviewColor = nextColor;
            //		isChanged = true;
            //		_editor.SaveEditorPref();
            //	}
            //}
            //catch(Exception) { }

            try
            {
                //"Bone Preview Color"
                _editor._modLockOption_BonePreviewColor = EditorGUILayout.ColorField(_editor.GetText(TEXT.DLG_ModLockBonePreviewColor), _editor._modLockOption_BonePreviewColor);
            }
            catch (Exception) { }

            EditorGUILayout.EndVertical();


            //"Restore Settings"
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_ModLockRestoreSettings), GUILayout.Height(20)))
            {
                //TODO
                _editor._modLockOption_CalculateIfNotAddedOther = false;
                _editor._modLockOption_ColorPreview_Lock        = false;
                _editor._modLockOption_ColorPreview_Unlock      = true;              //<< True 기본값
                _editor._modLockOption_BonePreview_Lock         = false;
                _editor._modLockOption_BonePreview_Unlock       = true;              //<< True 기본값
                //_editor._modLockOption_MeshPreview_Lock =		false;
                //_editor._modLockOption_MeshPreview_Unlock =		false;
                _editor._modLockOption_ModListUI_Lock   = false;
                _editor._modLockOption_ModListUI_Unlock = false;

                //_editor._modLockOption_MeshPreviewColor = apEditor.DefauleColor_ModLockOpt_MeshPreview;
                _editor._modLockOption_BonePreviewColor = apEditor.DefauleColor_ModLockOpt_BonePreview;
                isChanged = true;
                _editor.SaveEditorPref();
            }


            if (isChanged)
            {
                if (_editor.Select != null)
                {
                    _editor.Select.RefreshModifierExclusiveEditing();
                    _editor.Select.RefreshAnimEditingLayerLock();
                }
            }

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(35)))
            {
                _editor.SaveEditorPref();
                CloseDialog();
            }
        }
Ejemplo n.º 10
0
        // GUI
        //------------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

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

            int   height_List = height - 480;
            Color prevColor   = GUI.backgroundColor;

            GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
            GUI.Box(new Rect(0, 156, width, height_List), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SelectedPhysicsSetting));            //"Selected Physics Setting"

            //현재 선택한 Physics Param을 등록하는 UI

            GUIStyle boxGUIStyle = new GUIStyle(GUI.skin.box);

            boxGUIStyle.alignment        = TextAnchor.MiddleCenter;
            boxGUIStyle.normal.textColor = apEditorUtil.BoxTextColor;

            GUILayout.Box(_targetModMesh._renderUnit.Name, boxGUIStyle, GUILayout.Width(width - 8), GUILayout.Height(20));

            GUILayout.Space(5);
            int width_Left  = 90;
            int width_Right = width - 110;

            //Icon 이미지		|	이름	Icon 타입
            //					|	(저장)
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(70));
            GUILayout.Space(5);
            EditorGUILayout.BeginVertical(GUILayout.Width(width_Left), GUILayout.Height(70));
            //Icon을 출력하자
            Texture2D addParamIcon = _editor.ImageSet.Get(apEditorUtil.GetPhysicsPresetIconType(_addParamIcon));

            GUILayout.Box(addParamIcon, boxGUIStyle, GUILayout.Width(65), GUILayout.Height(65));
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUILayout.Width(width_Right), GUILayout.Height(70));
            //이름, Icon 및 등록 버튼

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Name), GUILayout.Width(80));            //"Name"
            _strAddParamName = EditorGUILayout.TextField(_strAddParamName, GUILayout.Width(width_Right - 88));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Icon), GUILayout.Width(80));            //"Icon"
            _addParamIcon = (apPhysicsPresetUnit.ICON)EditorGUILayout.EnumPopup(_addParamIcon, GUILayout.Width(width_Right - 88));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_RegistToPreset), GUILayout.Width(150)))            //"Regist To Preset"
            {
                //TODO
                if (_targetModMesh.PhysicParam != null)
                {
                    //bool result = EditorUtility.DisplayDialog("Regist to Preset", "Regist Preset [" + _strAddParamName + "] ?", "Regist", "Cancel");
                    bool result = EditorUtility.DisplayDialog(_editor.GetText(TEXT.PhysicPreset_Regist_Title),
                                                              _editor.GetTextFormat(TEXT.PhysicPreset_Regist_Body, _strAddParamName),
                                                              _editor.GetText(TEXT.PhysicPreset_Regist_Okay),
                                                              _editor.GetText(TEXT.Cancel));

                    if (result)
                    {
                        _editor.PhysicsPreset.AddNewPreset(_targetModMesh.PhysicParam, _strAddParamName, _addParamIcon);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(5);


            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);

            guiStyle.normal.textColor = GUI.skin.label.normal.textColor;
            guiStyle.alignment        = TextAnchor.MiddleLeft;

            GUIStyle guiStyle_NotSelectable = new GUIStyle(GUIStyle.none);

            guiStyle_NotSelectable.normal.textColor = Color.red;
            guiStyle_NotSelectable.alignment        = TextAnchor.MiddleLeft;


            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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

            //GUIContent guiContent_Bone = new GUIContent(iconBone);

            GUILayout.Space(10);
            //GUILayout.Button("Select a Physics Preset", guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));//<투명 버튼


            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height_List));

            //"Presets"
            GUILayout.Button(new GUIContent(_editor.GetText(TEXT.DLG_Presets), iconImageCategory), guiStyle, GUILayout.Height(20));            //<투명 버튼

            for (int i = 0; i < _editor.PhysicsPreset.Presets.Count; i++)
            {
                //DrawBoneUnit(_boneUnits_Root[i], 0, width, iconImage_FoldDown, iconImage_FoldRight, guiContent_Bone, guiStyle, guiStyle_NotSelectable, _scrollList.x);
                DrawPresetUnit(_editor.PhysicsPreset.Presets[i], i, width - 18, _scrollList.x);
            }

            GUILayout.Space(310);

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);



            //선택한 정보를 보여주자
            //string curName = "<Not Selected>";
            string    curName = "<" + _editor.GetText(TEXT.DLG_NotSelected) + ">";
            Texture2D curIcon = null;

            float curMoveRange = 0.0f;
            //float curStretchRange_Min = 0.0f;
            float curStretchRange_Max       = 0.0f;
            float curStretchK               = 0.0f;
            float curInertiaK               = 0.0f;
            float curDamping                = 0.0f;
            float curMass                   = 100.0f;
            bool  curIsRestrictMoveRange    = false;
            bool  curIsRestrictStretchRange = false;


            Vector2 curGravityConstValue = Vector2.zero;
            Vector2 curWindConstValue    = Vector2.zero;
            Vector2 curWindRandomRange   = Vector2.zero;

            float curAirDrag   = 0.0f;
            float curViscosity = 0.0f;
            float curRestoring = 1.0f;

            if (_selectedUnit != null)
            {
                curName = _selectedUnit._name;
                curIcon = _editor.ImageSet.Get(apEditorUtil.GetPhysicsPresetIconType(_selectedUnit._icon));
                //curStretchRange_Min = _selectedUnit._stretchRange_Min;
                curStretchRange_Max = _selectedUnit._stretchRange_Max;

                curIsRestrictMoveRange    = _selectedUnit._isRestrictMoveRange;
                curIsRestrictStretchRange = _selectedUnit._isRestrictStretchRange;

                curMoveRange = _selectedUnit._moveRange;
                curStretchK  = _selectedUnit._stretchK;
                curInertiaK  = _selectedUnit._inertiaK;
                curDamping   = _selectedUnit._damping;
                curMass      = _selectedUnit._mass;


                curGravityConstValue = _selectedUnit._gravityConstValue;
                curWindConstValue    = _selectedUnit._windConstValue;
                curWindRandomRange   = _selectedUnit._windRandomRange;

                curAirDrag   = _selectedUnit._airDrag;
                curViscosity = _selectedUnit._viscosity;
                curRestoring = _selectedUnit._restoring;
            }

            Texture2D imgIcon_Stretch   = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Stretch);
            Texture2D imgIcon_Inertia   = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Inertia);
            Texture2D imgIcon_Restoring = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Recover);
            Texture2D imgIcon_Viscosity = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Viscosity);
            Texture2D imgIcon_Gravity   = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Gravity);
            Texture2D imgIcon_Wind      = _editor.ImageSet.Get(apImageSet.PRESET.Physic_Wind);
            //반반 나눠서 그려주자
            int width_Info      = ((width - 10) / 2) - 10;
            int height_Info     = 270;
            int width_InfoLabel = 120;
            int width_InfoValue = (width_Info - width_InfoLabel) - 4;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(height_Info));
            GUILayout.Space(5);
            EditorGUILayout.BeginVertical(GUILayout.Width(width_Info), GUILayout.Height(height_Info));
            //Icon, Name, Basic Setting, Gravity, Wind를 보여주자
            if (curIcon == null)
            {
                EditorGUILayout.LabelField(curName, GUILayout.Width(width_Info), GUILayout.Height(26));
            }
            else
            {
                EditorGUILayout.LabelField(new GUIContent("  " + curName, curIcon), GUILayout.Width(width_Info), GUILayout.Height(26));
            }
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.Mass), GUILayout.Width(width_InfoLabel));            //"Mass"
            EditorGUILayout.FloatField(curMass, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.Damping), GUILayout.Width(width_InfoLabel));            //"Damping"
            EditorGUILayout.FloatField(curDamping, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.AirDrag), GUILayout.Width(width_InfoLabel));            //"Air Drag"
            EditorGUILayout.FloatField(curAirDrag, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();


            if (curIsRestrictMoveRange)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.MoveRange), GUILayout.Width(width_InfoLabel));                //"Move Range"
                EditorGUILayout.FloatField(curMoveRange, GUILayout.Width(width_InfoValue));
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.MoveRangeUnlimited), GUILayout.Width(width_Info));                //"Move Range : (Unlimited)"
                EditorGUILayout.EndHorizontal();
            }



            GUILayout.Space(5);

            //"  Gravity"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Gravity), imgIcon_Gravity), GUILayout.Width(width_Info), GUILayout.Height(25));
            apEditorUtil.DelayedVector2Field(curGravityConstValue, width_Info - 4);

            GUILayout.Space(5);
            //"  Wind"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Wind), imgIcon_Wind), GUILayout.Width(width_Info), GUILayout.Height(25));
            apEditorUtil.DelayedVector2Field(curWindConstValue, width_Info - 4);
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.WindRandomRangeSize), GUILayout.Width(width_Info));            //"Wind Random Size"
            apEditorUtil.DelayedVector2Field(curWindRandomRange, width_Info - 4);

            EditorGUILayout.EndVertical();

            GUILayout.Space(4);

            EditorGUILayout.BeginVertical(GUILayout.Width(width_Info), GUILayout.Height(height_Info));
            //Stretchiness, Inertia, Restoring, Viscosity를 보여주고, 삭제 버튼(또는 Reserved) 표시

            //"  Stretchiness"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Stretchiness), imgIcon_Stretch), GUILayout.Width(width_Info), GUILayout.Height(25));
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.K_Value), GUILayout.Width(width_InfoLabel));            //"K-Value"
            EditorGUILayout.FloatField(curStretchK, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            if (curIsRestrictStretchRange)
            {
                //EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                //EditorGUILayout.LabelField("Shorten Range", GUILayout.Width(width_InfoLabel));
                //EditorGUILayout.FloatField(curStretchRange_Min, GUILayout.Width(width_InfoValue));
                //EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.LengthenRatio), GUILayout.Width(width_InfoLabel));                //"Lengthen Range"
                EditorGUILayout.FloatField(curStretchRange_Max, GUILayout.Width(width_InfoValue));
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                //EditorGUILayout.LabelField("Shorten Range : (Unlimited)", GUILayout.Width(width_Info));
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.LengthenRatioUnlimited), GUILayout.Width(width_Info));                //"Lengthen Range : (Unlimited)"
                EditorGUILayout.EndHorizontal();
            }


            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            //"  Inertia"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Inertia), imgIcon_Inertia), GUILayout.Width(width_InfoLabel), GUILayout.Height(25));
            EditorGUILayout.FloatField(curInertiaK, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            //"  Restoring"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Restoring), imgIcon_Restoring), GUILayout.Width(width_InfoLabel), GUILayout.Height(25));
            EditorGUILayout.FloatField(curRestoring, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
            //"  Viscosity"
            EditorGUILayout.LabelField(new GUIContent("  " + _editor.GetUIWord(UIWORD.Viscosity), imgIcon_Viscosity), GUILayout.Width(width_InfoLabel), GUILayout.Height(25));
            EditorGUILayout.FloatField(curViscosity, GUILayout.Width(width_InfoValue));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            if (_selectedUnit != null)
            {
                //삭제 가능한지 체크
                if (!_selectedUnit._isReserved)
                {
                    //"Remove Preset"
                    if (GUILayout.Button(_editor.GetText(TEXT.DLG_RemovePreset), GUILayout.Width(width_Info - 4)))
                    {
                        //bool result = EditorUtility.DisplayDialog("Remove Preset", "Remove Preset [" + _selectedUnit._name + "] ?", "Remove", "Cancel");
                        bool result = EditorUtility.DisplayDialog(_editor.GetText(TEXT.PhysicPreset_Remove_Title),
                                                                  _editor.GetTextFormat(TEXT.PhysicPreset_Remove_Body, _selectedUnit._name),
                                                                  _editor.GetText(TEXT.Remove),
                                                                  _editor.GetText(TEXT.Cancel));

                        if (result)
                        {
                            int targetID = _selectedUnit._uniqueID;
                            _selectedUnit = null;

                            _editor.PhysicsPreset.RemovePreset(targetID);
                        }
                    }
                }
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            bool isClose = false;
            bool isSelectBtnAvailable = _selectedUnit != null;

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Apply), false, isSelectBtnAvailable, (width / 2) - 8, 30))            //"Apply"
            {
                _funcResult(true, _loadKey, _selectedUnit, _targetModMesh);
                isClose = true;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Close), false, true, (width / 2) - 8, 30))            //"Close"
            {
                //_funcResult(false, _loadKey, null, null);
                _funcResult(false, _loadKey, null, _targetModMesh);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                //Debug.LogError("Exit - Editor / Portrait is Null");
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                //Debug.LogError("Exit - Editor / Portrait Missmatch");
                CloseDialog();
                return;
            }

            int tabBtnHeight = 25;
            int tabBtnWidth  = ((width - 10) / 3) - 4;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(tabBtnHeight));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Portrait), _tab == TAB.PortriatSetting, tabBtnWidth, tabBtnHeight))            //"Portrait"
            {
                _tab = TAB.PortriatSetting;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Editor), _tab == TAB.EditorSetting, tabBtnWidth, tabBtnHeight))            //"Editor"
            {
                _tab = TAB.EditorSetting;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_About), _tab == TAB.About, tabBtnWidth, tabBtnHeight))            //"About"
            {
                _tab = TAB.About;
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            int scrollHeight = height - 40;

            _scroll = EditorGUILayout.BeginScrollView(_scroll, false, true, GUILayout.Width(width), GUILayout.Height(scrollHeight));
            width  -= 25;
            GUILayout.BeginVertical(GUILayout.Width(width));

            switch (_tab)
            {
            case TAB.PortriatSetting:
            {
                //Portrait 설정
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PortraitSetting));                                    //"Portrait Settings"
                GUILayout.Space(10);
                string nextName = EditorGUILayout.DelayedTextField(_editor.GetText(TEXT.DLG_Name), _targetPortrait.name); //"Name"
                if (nextName != _targetPortrait.name)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait.name = nextName;
                }

                //"FPS (Important Off)"
                int nextFPS = EditorGUILayout.DelayedIntField(new GUIContent(_editor.GetText(TEXT.DLG_Setting_FPS), "This setting is used when <Important> is off"), _targetPortrait._FPS);
                if (_targetPortrait._FPS != nextFPS)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (nextFPS < 10)
                    {
                        nextFPS = 10;
                    }
                    _targetPortrait._FPS = nextFPS;
                }

                //"Is Important"
                bool nextImportant = EditorGUILayout.Toggle(new GUIContent(_editor.GetText(TEXT.DLG_Setting_IsImportant), "When this setting is on, it always updates and the physics effect works."), _targetPortrait._isImportant);
                if (nextImportant != _targetPortrait._isImportant)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._isImportant = nextImportant;
                }


                GUILayout.Space(10);
                //수동으로 백업하기
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Setting_ManualBackUp), GUILayout.Height(30)))                               //"Save Backup (Manual)"
                {
                    if (_editor.Backup.IsAutoSaveWorking())
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.BackupError_Title),
                                                    _editor.GetText(TEXT.BackupError_Body),
                                                    _editor.GetText(TEXT.Okay));
                    }
                    else
                    {
                        string defaultBackupFileName = _targetPortrait.name + "_backup_" + apBackup.GetCurrentTimeString();
                        string savePath = EditorUtility.SaveFilePanel("Backup File Path", "", defaultBackupFileName, "bck");
                        if (string.IsNullOrEmpty(savePath))
                        {
                            _editor.Notification("Backup Canceled", true, false);
                        }
                        else
                        {
                            _editor.Backup.SaveBackup(savePath, _targetPortrait);
                            _editor.Notification("Backup Saved [" + savePath + "]", false, true);
                        }

                        CloseDialog();
                    }
                }
            }
            break;

            case TAB.EditorSetting:
            {
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_EditorSetting));                                //"Editor Settings"
                GUILayout.Space(10);

                apEditor.LANGUAGE prevLanguage = _editor._language;
                int prevLangIndex = -1;
                for (int i = 0; i < _validLanguageIndex.Length; i++)
                {
                    if (_validLanguageIndex[i] == (int)prevLanguage)
                    {
                        prevLangIndex = i;
                    }
                }
                if (prevLangIndex < 0)
                {
                    prevLangIndex = 0;                                    //English 강제
                }

                bool prevGUIFPS        = _editor._guiOption_isFPSVisible;
                bool prevGUIStatistics = _editor._guiOption_isStatisticsVisible;

                Color prevColor_Background = _editor._colorOption_Background;
                Color prevColor_GridCenter = _editor._colorOption_GridCenter;
                Color prevColor_Grid       = _editor._colorOption_Grid;

                Color prevColor_MeshEdge        = _editor._colorOption_MeshEdge;
                Color prevColor_MeshHiddenEdge  = _editor._colorOption_MeshHiddenEdge;
                Color prevColor_Outline         = _editor._colorOption_Outline;
                Color prevColor_TFBorder        = _editor._colorOption_TransformBorder;
                Color prevColor_VertNotSelected = _editor._colorOption_VertColor_NotSelected;
                Color prevColor_VertSelected    = _editor._colorOption_VertColor_Selected;

                Color prevColor_GizmoFFDLine      = _editor._colorOption_GizmoFFDLine;
                Color prevColor_GizmoFFDInnerLine = _editor._colorOption_GizmoFFDInnerLine;

                Color prevColor_ToneColor = _editor._colorOption_OnionToneColor;

                bool   prevBackup_IsAutoSave = _editor._backupOption_IsAutoSave;
                string prevBackup_Path       = _editor._backupOption_BaseFolderName;
                int    prevBackup_Time       = _editor._backupOption_Minute;


                string prevBonePose_Path = _editor._bonePose_BaseFolderName;

                //"Language"
                //이전 방식은 Enum을 모두 조회
                //_editor._language = (apEditor.LANGUAGE)EditorGUILayout.Popup(_editor.GetText(TEXT.DLG_Setting_Language), (int)_editor._language, _strLanguageName);

                //사용 가능한 Language만 따로 조회
                int nextLangIndex = EditorGUILayout.Popup(_editor.GetText(TEXT.DLG_Setting_Language), prevLangIndex, _strLanguageName);
                _editor._language = (apEditor.LANGUAGE)_validLanguageIndex[nextLangIndex];

                GUILayout.Space(10);
                _editor._guiOption_isFPSVisible        = EditorGUILayout.Toggle(_editor.GetText(TEXT.DLG_Setting_ShowFPS), _editor._guiOption_isFPSVisible);                         //"Show FPS"
                _editor._guiOption_isStatisticsVisible = EditorGUILayout.Toggle(_editor.GetText(TEXT.DLG_Setting_ShowStatistics), _editor._guiOption_isStatisticsVisible);           // "Show Statistics"


                GUILayout.Space(10);
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_AutoBackupSetting));                                                           //"Auto Backup Option"
                _editor._backupOption_IsAutoSave = EditorGUILayout.Toggle(_editor.GetText(TEXT.DLG_Setting_AutoBackup), _editor._backupOption_IsAutoSave); //"Auto Backup"

                if (_editor._backupOption_IsAutoSave)
                {
                    //경로와 시간
                    //"Time (Min)"
                    _editor._backupOption_Minute = EditorGUILayout.IntField(_editor.GetText(TEXT.DLG_Setting_BackupTime), _editor._backupOption_Minute, GUILayout.Width(width));

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(18));
                    GUILayout.Space(5);
                    //"Save Path"
                    _editor._backupOption_BaseFolderName = EditorGUILayout.TextField(_editor.GetText(TEXT.DLG_Setting_BackupPath), _editor._backupOption_BaseFolderName, GUILayout.Width(width - 100), GUILayout.Height(18));
                    if (GUILayout.Button(_editor.GetText(TEXT.DLG_Change), GUILayout.Width(90), GUILayout.Height(18)))                                   //"Change"
                    {
                        string pathResult = EditorUtility.SaveFolderPanel("Set the Backup Folder", _editor._backupOption_BaseFolderName, "");
                        if (!string.IsNullOrEmpty(pathResult))
                        {
                            //Debug.Log("백업 폴더 경로 [" + pathResult + "] - " + Application.dataPath);
                            Uri targetUri = new Uri(pathResult);
                            Uri baseUri   = new Uri(Application.dataPath);

                            string relativePath = baseUri.MakeRelativeUri(targetUri).ToString();
                            _editor._backupOption_BaseFolderName = relativePath;
                            //Debug.Log("상대 경로 [" + relativePath + "]");
                            apEditorUtil.SetEditorDirty();
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                GUILayout.Space(10);
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_PoseSnapshotSetting));                                //"Pose Snapshot Option"
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(18));
                GUILayout.Space(5);
                //"Save Path"
                _editor._bonePose_BaseFolderName = EditorGUILayout.TextField(_editor.GetText(TEXT.DLG_Setting_BackupPath), _editor._bonePose_BaseFolderName, GUILayout.Width(width - 100), GUILayout.Height(18));

                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Change), GUILayout.Width(90), GUILayout.Height(18)))                                //"Change"
                {
                    string pathResult = EditorUtility.SaveFolderPanel("Set the Pose Folder", _editor._bonePose_BaseFolderName, "");
                    if (!string.IsNullOrEmpty(pathResult))
                    {
                        Uri targetUri = new Uri(pathResult);
                        Uri baseUri   = new Uri(Application.dataPath);

                        string relativePath = baseUri.MakeRelativeUri(targetUri).ToString();

                        _editor._bonePose_BaseFolderName = relativePath;

                        apEditorUtil.SetEditorDirty();
                    }
                }
                EditorGUILayout.EndHorizontal();



                GUILayout.Space(10);
                try
                {
                    //int width_Btn = 65;
                    //int width_Color = width - (width_Btn + 8);

                    //int height_Color = 18;
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_BackgroundColors));                                    //"Background Colors"

                    //"Background"
                    _editor._colorOption_Background = ColorUI(_editor.GetText(TEXT.DLG_Setting_Background), _editor._colorOption_Background, width, apEditor.DefaultColor_Background);

                    //"Grid Center"
                    _editor._colorOption_GridCenter = ColorUI(_editor.GetText(TEXT.DLG_Setting_GridCenter), _editor._colorOption_GridCenter, width, apEditor.DefaultColor_GridCenter);

                    //"Grid"
                    _editor._colorOption_Grid = ColorUI(_editor.GetText(TEXT.DLG_Setting_Grid), _editor._colorOption_Grid, width, apEditor.DefaultColor_Grid);

                    //"Atlas Border"
                    _editor._colorOption_AtlasBorder = ColorUI(_editor.GetText(TEXT.DLG_Setting_AtlasBorder), _editor._colorOption_AtlasBorder, width, apEditor.DefaultColor_AtlasBorder);


                    GUILayout.Space(5);
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_MeshGUIColors));                                    //"Mesh GUI Colors"

                    //"Mesh Edge"
                    _editor._colorOption_MeshEdge = ColorUI(_editor.GetText(TEXT.DLG_Setting_MeshEdge), _editor._colorOption_MeshEdge, width, apEditor.DefaultColor_MeshEdge);

                    //"Mesh Hidden Edge"
                    _editor._colorOption_MeshHiddenEdge = ColorUI(_editor.GetText(TEXT.DLG_Setting_MeshHiddenEdge), _editor._colorOption_MeshHiddenEdge, width, apEditor.DefaultColor_MeshHiddenEdge);

                    //"Outline"
                    _editor._colorOption_Outline = ColorUI(_editor.GetText(TEXT.DLG_Setting_Outline), _editor._colorOption_Outline, width, apEditor.DefaultColor_Outline);

                    //"Transform Border"
                    _editor._colorOption_TransformBorder = ColorUI(_editor.GetText(TEXT.DLG_Setting_TransformBorder), _editor._colorOption_TransformBorder, width, apEditor.DefaultColor_TransformBorder);

                    //"Vertex"
                    _editor._colorOption_VertColor_NotSelected = ColorUI(_editor.GetText(TEXT.DLG_Setting_Vertex), _editor._colorOption_VertColor_NotSelected, width, apEditor.DefaultColor_VertNotSelected);

                    //"Selected Vertex"
                    _editor._colorOption_VertColor_Selected = ColorUI(_editor.GetText(TEXT.DLG_Setting_SelectedVertex), _editor._colorOption_VertColor_Selected, width, apEditor.DefaultColor_VertSelected);


                    GUILayout.Space(5);
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_GizmoColors));                                    //"Gizmo Colors"

                    //"FFD Line"
                    _editor._colorOption_GizmoFFDLine = ColorUI(_editor.GetText(TEXT.DLG_Setting_FFDLine), _editor._colorOption_GizmoFFDLine, width, apEditor.DefaultColor_GizmoFFDLine);

                    //"FFD Inner Line"
                    _editor._colorOption_GizmoFFDInnerLine = ColorUI(_editor.GetText(TEXT.DLG_Setting_FFDInnerLine), _editor._colorOption_GizmoFFDInnerLine, width, apEditor.DefaultColor_GizmoFFDInnerLine);

                    GUILayout.Space(5);
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_OnionSkinColor));                                    //"Onion Skin Color"

                    //"Onion Skin (2x)"
                    _editor._colorOption_OnionToneColor = ColorUI(_editor.GetText(TEXT.DLG_Setting_OnionSkinColor2X), _editor._colorOption_OnionToneColor, width, apEditor.DefaultColor_OnionToneColor);
                }
                catch (Exception)
                {
                }

                GUILayout.Space(10);
                bool prevStartupScreen = _editor._startScreenOption_IsShowStartup;
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
                GUILayout.Space(5);
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_StartPage_AlawysOn), GUILayout.Width((width - (10 + 30))));
                _editor._startScreenOption_IsShowStartup = EditorGUILayout.Toggle(_editor._startScreenOption_IsShowStartup, GUILayout.Width(30));
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(20);

                //"Restore Editor Default Setting"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Setting_RestoreDefaultSetting), GUILayout.Height(20)))
                {
                    _editor.RestoreEditorPref();
                }


                if (prevLanguage != _editor._language ||
                    prevGUIFPS != _editor._guiOption_isFPSVisible ||
                    prevGUIStatistics != _editor._guiOption_isStatisticsVisible ||
                    prevColor_Background != _editor._colorOption_Background ||
                    prevColor_GridCenter != _editor._colorOption_GridCenter ||
                    prevColor_Grid != _editor._colorOption_Grid ||

                    prevColor_MeshEdge != _editor._colorOption_MeshEdge ||
                    prevColor_MeshHiddenEdge != _editor._colorOption_MeshHiddenEdge ||
                    prevColor_Outline != _editor._colorOption_Outline ||
                    prevColor_TFBorder != _editor._colorOption_TransformBorder ||
                    prevColor_VertNotSelected != _editor._colorOption_VertColor_NotSelected ||
                    prevColor_VertSelected != _editor._colorOption_VertColor_Selected ||

                    prevColor_GizmoFFDLine != _editor._colorOption_GizmoFFDLine ||
                    prevColor_GizmoFFDInnerLine != _editor._colorOption_GizmoFFDInnerLine ||
                    prevColor_ToneColor != _editor._colorOption_OnionToneColor ||
                    prevBackup_IsAutoSave != _editor._backupOption_IsAutoSave ||
                    !prevBackup_Path.Equals(_editor._backupOption_BaseFolderName) ||
                    prevBackup_Time != _editor._backupOption_Minute ||
                    !prevBonePose_Path.Equals(_editor._bonePose_BaseFolderName) ||

                    prevStartupScreen != _editor._startScreenOption_IsShowStartup
                    )
                {
                    bool isLanguageChanged = (prevLanguage != _editor._language);

                    _editor.SaveEditorPref();
                    apEditorUtil.SetEditorDirty();

                    apGL.SetToneColor(_editor._colorOption_OnionToneColor);

                    if (isLanguageChanged)
                    {
                        _editor.ResetHierarchyAll();
                        _editor.RefreshTimelineLayers(true);
                        _editor.RefreshControllerAndHierarchy();
                    }
                }
            }
            break;

            case TAB.About:
            {
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_About));                                //"About"

                GUILayout.Space(20);
                apEditorUtil.GUI_DelimeterBoxH(width);
                GUILayout.Space(20);

                EditorGUILayout.LabelField("[AnyPortrait]");
                EditorGUILayout.LabelField("Build : " + apVersion.I.APP_VERSION_NUMBER_ONLY);



                GUILayout.Space(20);
                apEditorUtil.GUI_DelimeterBoxH(width);
                GUILayout.Space(20);

                EditorGUILayout.LabelField("[Open Source Library License]");
                GUILayout.Space(20);

                EditorGUILayout.LabelField("[PSD File Import Library]");
                GUILayout.Space(10);
                EditorGUILayout.LabelField("Ntreev Photoshop Document Parser for .Net");
                GUILayout.Space(10);

                EditorGUILayout.LabelField("Released under the MIT License.");
                GUILayout.Space(10);

                EditorGUILayout.LabelField("Copyright (c) 2015 Ntreev Soft co., Ltd.");
                GUILayout.Space(10);

                EditorGUILayout.LabelField("Permission is hereby granted, free of charge,");
                EditorGUILayout.LabelField("to any person obtaining a copy of this software");
                EditorGUILayout.LabelField("and associated documentation files (the \"Software\"),");
                EditorGUILayout.LabelField("to deal in the Software without restriction,");
                EditorGUILayout.LabelField("including without limitation the rights ");
                EditorGUILayout.LabelField("to use, copy, modify, merge, publish, distribute,");
                EditorGUILayout.LabelField("sublicense, and/or sell copies of the Software, ");
                EditorGUILayout.LabelField("and to permit persons to whom the Software is furnished");
                EditorGUILayout.LabelField("to do so, subject to the following conditions:");
                GUILayout.Space(10);

                EditorGUILayout.LabelField("The above copyright notice and ");
                EditorGUILayout.LabelField("this permission notice shall be included");
                EditorGUILayout.LabelField("in all copies or substantial portions of the Software.");
                GUILayout.Space(10);

                EditorGUILayout.LabelField("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT ");
                EditorGUILayout.LabelField("WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, ");
                EditorGUILayout.LabelField("INCLUDING BUT NOT LIMITED TO THE WARRANTIES ");
                EditorGUILayout.LabelField("OF MERCHANTABILITY, FITNESS FOR A PARTICULAR ");
                EditorGUILayout.LabelField("PURPOSE AND NONINFRINGEMENT. ");
                EditorGUILayout.LabelField("IN NO EVENT SHALL THE AUTHORS OR ");
                EditorGUILayout.LabelField("COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES ");
                EditorGUILayout.LabelField("OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ");
                EditorGUILayout.LabelField("TORT OR OTHERWISE, ARISING FROM, OUT OF OR ");
                EditorGUILayout.LabelField("IN CONNECTION WITH THE SOFTWARE OR ");
                EditorGUILayout.LabelField("THE USE OR OTHER DEALINGS IN THE SOFTWARE.");

                GUILayout.Space(20);
                apEditorUtil.GUI_DelimeterBoxH(width);
                GUILayout.Space(20);

                EditorGUILayout.LabelField("[GIF Export Library]");
                GUILayout.Space(10);
                EditorGUILayout.LabelField("NGif, Animated GIF Encoder for .NET");
                GUILayout.Space(10);
                EditorGUILayout.LabelField("Released under the CPOL 1.02.");
                GUILayout.Space(10);
            }
            break;
            }



            GUILayout.Space(height);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 12
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, 37, width, height - 90), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);

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

            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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

            GUILayout.Space(10);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SelectImage), guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));            //<투명 버튼//"Select Image"
            GUILayout.Space(10);

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

            GUILayout.Space(20);

            int imageUnitHeight = 200;

            int scrollWidth    = width - 16;
            int imageUnitWidth = (scrollWidth / 3) - 12;

            for (int iTex = 0; iTex < _textureData.Count; iTex += 3)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(scrollWidth), GUILayout.Height(imageUnitHeight));
                GUILayout.Space(5);
                if (iTex < _textureData.Count)
                {
                    EditorGUILayout.BeginVertical(GUILayout.Width(imageUnitWidth), GUILayout.Height(imageUnitHeight));
                    DrawTextureUnit(_textureData[iTex], imageUnitWidth, imageUnitHeight);
                    EditorGUILayout.EndVertical();
                }

                GUILayout.Space(2);

                if (iTex + 1 < _textureData.Count)
                {
                    EditorGUILayout.BeginVertical(GUILayout.Width(imageUnitWidth), GUILayout.Height(imageUnitHeight));
                    DrawTextureUnit(_textureData[iTex + 1], imageUnitWidth, imageUnitHeight);
                    EditorGUILayout.EndVertical();
                }

                GUILayout.Space(2);

                if (iTex + 2 < _textureData.Count)
                {
                    EditorGUILayout.BeginVertical(GUILayout.Width(imageUnitWidth), GUILayout.Height(imageUnitHeight));
                    DrawTextureUnit(_textureData[iTex + 2], imageUnitWidth, imageUnitHeight);
                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.EndHorizontal();
                GUILayout.Space(20);
            }

            GUILayout.Space(height - 90);
            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, _targetMesh, _loadKey, _curSelectedTextureData);
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 13
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();
            }
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }

            //Sorting Layer를 추가하자
            if (_sortingLayerNames == null || _sortingLayerIDs == null)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }
            else if (_sortingLayerNames.Length != SortingLayer.layers.Length ||
                     _sortingLayerIDs.Length != SortingLayer.layers.Length)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }

            for (int i = 0; i < SortingLayer.layers.Length; i++)
            {
                _sortingLayerNames[i] = SortingLayer.layers[i].name;
                _sortingLayerIDs[i]   = SortingLayer.layers[i].id;
            }


            //Bake 설정
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_BakeSetting));            //"Bake Setting"
            GUILayout.Space(5);

            EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Portrait), _targetPortrait, typeof(apPortrait), true);            //"Portait"

            GUILayout.Space(5);

            //"Bake Scale"
            float prevBakeScale = _targetPortrait._bakeScale;

            _targetPortrait._bakeScale = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_BakeScale), _targetPortrait._bakeScale);



            //"Z Per Depth"
            float prevBakeZSize = _targetPortrait._bakeZSize;

            _targetPortrait._bakeZSize = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_ZPerDepth), _targetPortrait._bakeZSize);


            if (_targetPortrait._bakeZSize < 0.5f)
            {
                _targetPortrait._bakeZSize = 0.5f;
            }

            GUILayout.Space(5);



            //Gamma Space Space
            bool prevBakeGamma   = _editor._isBakeColorSpaceToGamma;
            int  iPrevColorSpace = prevBakeGamma ? 0 : 1;
            int  iNextColorSpace = EditorGUILayout.Popup(_editor.GetUIWord(UIWORD.ColorSpace), iPrevColorSpace, _colorSpaceNames);

            if (iNextColorSpace != iPrevColorSpace)
            {
                if (iNextColorSpace == 0)
                {
                    //Gamma
                    _editor._isBakeColorSpaceToGamma = true;
                }
                else
                {
                    //Linear
                    _editor._isBakeColorSpaceToGamma = false;
                }
            }
            //_editor._isBakeColorSpaceToGamma = EditorGUILayout.Toggle("Gamma Color Space", _editor._isBakeColorSpaceToGamma);

            //GUILayout.Space(5);
            //float nextPhysicsScale = EditorGUILayout.DelayedFloatField("Physic Scale", _targetPortrait._physicBakeScale);

            GUILayout.Space(5);

            //Sorting Layer
            int prevSortingLayerID = _editor._portrait._sortingLayerID;
            int prevSortingOrder   = _editor._portrait._sortingOrder;

            int layerIndex = -1;

            for (int i = 0; i < SortingLayer.layers.Length; i++)
            {
                if (SortingLayer.layers[i].id == _editor._portrait._sortingLayerID)
                {
                    //찾았다.
                    layerIndex = i;
                    break;
                }
            }
            if (layerIndex < 0)
            {
                //어라 레이어가 없는데용..
                //초기화해야겠다.
                _editor._portrait._sortingLayerID = -1;
                if (SortingLayer.layers.Length > 0)
                {
                    _editor._portrait._sortingLayerID = SortingLayer.layers[0].id;
                    layerIndex = 0;
                }
            }
            int nextIndex = EditorGUILayout.Popup("Sorting Layer", layerIndex, _sortingLayerNames);

            if (nextIndex != layerIndex)
            {
                //레이어가 변경되었다.
                if (nextIndex >= 0 && nextIndex < SortingLayer.layers.Length)
                {
                    //LayerID 변경
                    _editor._portrait._sortingLayerID = SortingLayer.layers[nextIndex].id;
                }
            }
            _editor._portrait._sortingOrder = EditorGUILayout.IntField("Sorting Order", _editor._portrait._sortingOrder);



            //CheckChangedProperties(nextRootScale, nextZScale);
            if (prevBakeScale != _targetPortrait._bakeScale ||
                prevBakeZSize != _targetPortrait._bakeZSize ||
                prevSortingLayerID != _editor._portrait._sortingLayerID ||
                prevSortingOrder != _editor._portrait._sortingOrder)
            {
                apEditorUtil.SetEditorDirty();
            }

            if (prevBakeGamma != _editor._isBakeColorSpaceToGamma

                )
            {
                apEditorUtil.SetEditorDirty();
                _editor.SaveEditorPref();
            }

            GUILayout.Space(10);


            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Bake), GUILayout.Height(45)))            //"Bake"
            {
                GUI.FocusControl(null);

                //CheckChangedProperties(nextRootScale, nextZScale);
                apEditorUtil.SetEditorDirty();

                //-------------------------------------
                // Bake 함수를 실행한다. << 중요오오오오
                //-------------------------------------
                apBakeResult bakeResult = _editor.Controller.Bake();


                _editor.Notification("[" + _targetPortrait.name + "] is Baked", false, false);

                if (bakeResult.NumUnlinkedExternalObject > 0)
                {
                    EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                _editor.GetText(TEXT.Okay));
                }
            }

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width - 10);
            GUILayout.Space(10);

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_OptimizedBaking));            //"Optimized Baking"

            //"Target"
            apPortrait nextOptPortrait = (apPortrait)EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Target), _targetPortrait._bakeTargetOptPortrait, typeof(apPortrait), true);

            if (nextOptPortrait != _targetPortrait._bakeTargetOptPortrait)
            {
                //타겟을 바꾸었다.
                bool isChanged = false;
                if (nextOptPortrait != null)
                {
                    //1. 다른 Portrait를 선택했다.
                    if (!nextOptPortrait._isOptimizedPortrait)
                    {
                        //1-1. 최적화된 객체가 아니다.
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                    _editor.GetText(TEXT.OptBakeError_NotOptTarget_Body),
                                                    _editor.GetText(TEXT.Close));
                    }
                    else if (nextOptPortrait._bakeSrcEditablePortrait != _targetPortrait)
                    {
                        //1-2. 다른 대상으로부터 Bake된 Portrait같다. (물어보고 계속)
                        bool isResult = EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                                    _editor.GetText(TEXT.OptBakeError_SrcMatchError_Body),
                                                                    _editor.GetText(TEXT.Okay),
                                                                    _editor.GetText(TEXT.Cancel));

                        if (isResult)
                        {
                            //뭐 선택하겠다는데요 뭐..
                            isChanged = true;
                        }
                    }
                    else
                    {
                        //1-3. 오케이. 변경 가능
                        isChanged = true;
                    }
                }
                else
                {
                    //2. 선택을 해제했다.
                    isChanged = true;
                }

                if (isChanged)
                {
                    //Target을 변경한다.
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._bakeTargetOptPortrait = nextOptPortrait;
                }
            }

            string optBtnText = "";

            if (_targetPortrait._bakeTargetOptPortrait != null)
            {
                //optBtnText = "Optimized Bake to\n[" + _targetPortrait._bakeTargetOptPortrait.gameObject.name + "]";
                optBtnText = string.Format("{0}\n[{1}]", _editor.GetText(TEXT.DLG_OptimizedBakeTo), _targetPortrait._bakeTargetOptPortrait.gameObject.name);
            }
            else
            {
                //optBtnText = "Optimized Bake\n(Make New GameObject)";
                optBtnText = _editor.GetText(TEXT.DLG_OptimizedBakeMakeNew);
            }
            GUILayout.Space(10);

            if (GUILayout.Button(optBtnText, GUILayout.Height(45)))
            {
                GUI.FocusControl(null);

                //CheckChangedProperties(nextRootScale, nextZScale);

                //Optimized Bake를 하자
                apBakeResult bakeResult = _editor.Controller.OptimizedBake(_targetPortrait, _targetPortrait._bakeTargetOptPortrait);

                if (bakeResult.NumUnlinkedExternalObject > 0)
                {
                    EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                _editor.GetText(TEXT.Okay));
                }

                _editor.Notification("[" + _targetPortrait.name + "] is Baked (Optimized)", false, false);
            }
        }
        // GUI
        //------------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

            int   height_List = height - 450;
            Color prevColor   = GUI.backgroundColor;

            GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
            GUI.Box(new Rect(0, 156, width, height_List), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SelectedControlParamSetting));            //"Selected Controller Parameter Setting"

            //현재 선택한 Physics Param을 등록하는 UI

            GUIStyle boxGUIStyle = new GUIStyle(GUI.skin.box);

            boxGUIStyle.alignment        = TextAnchor.MiddleCenter;
            boxGUIStyle.normal.textColor = apEditorUtil.BoxTextColor;

            GUILayout.Box(_targetControlParam._keyName, boxGUIStyle, GUILayout.Width(width - 8), GUILayout.Height(20));

            GUILayout.Space(5);
            int width_Left  = 90;
            int width_Right = width - 110;

            //Icon 이미지 | 이름, ValueType과 값 범위 (수정 불가)
            //            | 저장 버튼

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(70));
            GUILayout.Space(5);
            EditorGUILayout.BeginVertical(GUILayout.Width(width_Left), GUILayout.Height(70));
            //Icon을 출력하자
            Texture2D addParamIcon = _editor.ImageSet.Get(apEditorUtil.GetControlParamPresetIconType(_targetControlParam._iconPreset));

            GUILayout.Box(addParamIcon, boxGUIStyle, GUILayout.Width(65), GUILayout.Height(65));
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(GUILayout.Width(width_Right), GUILayout.Height(70));
            //이름, Icon 및 등록 버튼

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Range), GUILayout.Width(80));            //"Range"
            EditorGUILayout.LabelField(_strValueInfo, GUILayout.Width(width_Right - 88));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Default), GUILayout.Width(80));            //"Default"
            EditorGUILayout.LabelField(_strDefaultInfo, GUILayout.Width(width_Right - 88));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Right));
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_RegistToPreset), GUILayout.Width(150)))            //"Regist To Preset"
            {
                //bool result = EditorUtility.DisplayDialog("Regist to Preset", "Regist Preset [" + _strAddParamName + "] ?", "Regist", "Cancel");
                bool result = EditorUtility.DisplayDialog(_editor.GetText(TEXT.ControlParamPreset_Regist_Title),
                                                          _editor.GetTextFormat(TEXT.ControlParamPreset_Regist_Body, _strAddParamName),
                                                          _editor.GetText(TEXT.ControlParamPreset_Regist_Okay),
                                                          _editor.GetText(TEXT.Cancel));

                if (result)
                {
                    //Control Param으로 추가하자
                    _editor.ControlParamPreset.AddNewPreset(_targetControlParam);
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(5);


            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);

            guiStyle.normal.textColor = GUI.skin.label.normal.textColor;
            guiStyle.alignment        = TextAnchor.MiddleLeft;

            GUIStyle guiStyle_NotSelectable = new GUIStyle(GUIStyle.none);

            guiStyle_NotSelectable.normal.textColor = Color.red;
            guiStyle_NotSelectable.alignment        = TextAnchor.MiddleLeft;


            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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


            GUILayout.Space(10);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height_List));

            //"Presets"
            GUILayout.Button(new GUIContent(_editor.GetText(TEXT.DLG_Presets), _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown)), guiStyle, GUILayout.Height(20));            //<투명 버튼

            for (int i = 0; i < _editor.ControlParamPreset.Presets.Count; i++)
            {
                //DrawBoneUnit(_boneUnits_Root[i], 0, width, iconImage_FoldDown, iconImage_FoldRight, guiContent_Bone, guiStyle, guiStyle_NotSelectable, _scrollList.x);
                DrawPresetUnit(_editor.ControlParamPreset.Presets[i], i, width - 18, _scrollList.x);
            }

            GUILayout.Space(310);

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);

            //TODO : 선택된 객체 정보 + 삭제(Reserved 아닌 경우) + 적용과 취소
            int width_Info       = ((width - 10) / 2) - 10;
            int height_Info      = 150;
            int selectedIconSize = 40;

            if (_selectedUnit != null)
            {
                GUILayout.Box("[" + _selectedUnit._keyName + "]", boxGUIStyle, GUILayout.Width(width - 8), GUILayout.Height(30));

                //아이콘, 카테고리, 값 타입
                int rightInfoWidth = width - (selectedIconSize + 20);
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(selectedIconSize));
                Texture2D iconImage = _editor.ImageSet.Get(apEditorUtil.GetControlParamPresetIconType(_selectedUnit._iconPreset));
                GUILayout.Space(5);
                GUILayout.Box(iconImage, boxGUIStyle, GUILayout.Width(selectedIconSize), GUILayout.Height(selectedIconSize));

                GUILayout.Space(5);
                EditorGUILayout.BeginVertical(GUILayout.Width(rightInfoWidth), GUILayout.Height(selectedIconSize));

                //카테고리
                //값 타입
                GUILayout.Space(5);
                //"Category"
                EditorGUILayout.EnumPopup(_editor.GetText(TEXT.DLG_Category), _selectedUnit._category, GUILayout.Width(rightInfoWidth));
                //"Value Type"
                EditorGUILayout.EnumPopup(_editor.GetText(TEXT.DLG_ValueType), _selectedUnit._valueType, GUILayout.Width(rightInfoWidth));

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);



                //반반 나눠서 그려주자
                // Def    |  Label
                // Range  |  SnapSize

                int    bottomInfoWidth = width_Info - 10;
                string strValueDef     = "";
                string strLabel1       = "";
                string strLabel2       = "";

                int optLabelWidth  = 50;
                int optValueWidth  = bottomInfoWidth - (optLabelWidth + 10);
                int optValue2Width = (bottomInfoWidth - (optLabelWidth + 10)) / 2;

                switch (_selectedUnit._valueType)
                {
                case apControlParam.TYPE.Int:
                    strValueDef = _selectedUnit._int_Def.ToString();
                    //strLabel1 = "Min";
                    //strLabel2 = "Max";
                    strLabel1 = _editor.GetText(TEXT.DLG_Min);
                    strLabel2 = _editor.GetText(TEXT.DLG_Max);
                    break;

                case apControlParam.TYPE.Float:
                    strValueDef = _selectedUnit._float_Def.ToString();
                    //strLabel1 = "Min";
                    //strLabel2 = "Max";
                    strLabel1 = _editor.GetText(TEXT.DLG_Min);
                    strLabel2 = _editor.GetText(TEXT.DLG_Max);
                    break;

                case apControlParam.TYPE.Vector2:
                    strValueDef = _selectedUnit._vec2_Def.ToString();
                    //strLabel1 = "Axis 1";
                    //strLabel2 = "Axis 2";
                    strLabel1 = _editor.GetText(TEXT.DLG_Axis1);
                    strLabel2 = _editor.GetText(TEXT.DLG_Axis2);
                    break;
                }
                GUILayout.Space(5);

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(height_Info));
                GUILayout.Space(5);
                EditorGUILayout.BeginVertical(GUILayout.Width(width_Info), GUILayout.Height(height_Info));

                //왼쪽 영역
                //기본 값
                //값 범위
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_ValueRange), GUILayout.Width(width_Info));                //"Value Range"
                GUILayout.Space(5);

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Default), GUILayout.Width(optLabelWidth));                //"Default"
                EditorGUILayout.TextField(strValueDef, GUILayout.Width(optValueWidth));
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);


                switch (_selectedUnit._valueType)
                {
                case apControlParam.TYPE.Int:
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Min), GUILayout.Width(optLabelWidth));                            //"Min"
                    EditorGUILayout.IntField(_selectedUnit._int_Min, GUILayout.Width(optValueWidth));
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Max), GUILayout.Width(optLabelWidth));                            //"Max"
                    EditorGUILayout.IntField(_selectedUnit._int_Max, GUILayout.Width(optValueWidth));
                    EditorGUILayout.EndHorizontal();
                    break;

                case apControlParam.TYPE.Float:
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Min), GUILayout.Width(optLabelWidth));                            //"Min"
                    EditorGUILayout.FloatField(_selectedUnit._float_Min, GUILayout.Width(optValueWidth));
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width_Info));
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Max), GUILayout.Width(optLabelWidth));                            //"Max"
                    EditorGUILayout.FloatField(_selectedUnit._float_Max, GUILayout.Width(optValueWidth));
                    EditorGUILayout.EndHorizontal();
                    break;

                case apControlParam.TYPE.Vector2:
                {
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomInfoWidth));
                    EditorGUILayout.LabelField("", GUILayout.Width(optLabelWidth));
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Min), GUILayout.Width(optValue2Width));                                    //"Min"
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Max), GUILayout.Width(optValue2Width));                                    //"Max"
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomInfoWidth));
                    EditorGUILayout.LabelField("X", GUILayout.Width(optLabelWidth));
                    EditorGUILayout.FloatField(_selectedUnit._vec2_Min.x, GUILayout.Width(optValue2Width));
                    EditorGUILayout.FloatField(_selectedUnit._vec2_Max.x, GUILayout.Width(optValue2Width));
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomInfoWidth));
                    EditorGUILayout.LabelField("Y", GUILayout.Width(optLabelWidth));
                    EditorGUILayout.FloatField(_selectedUnit._vec2_Min.y, GUILayout.Width(optValue2Width));
                    EditorGUILayout.FloatField(_selectedUnit._vec2_Max.y, GUILayout.Width(optValue2Width));
                    EditorGUILayout.EndHorizontal();
                }

                break;
                }

                EditorGUILayout.EndVertical();

                GUILayout.Space(4);

                EditorGUILayout.BeginVertical(GUILayout.Width(width_Info), GUILayout.Height(height_Info));

                //오른쪽 영역
                //Label
                //SnapSize
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Label), GUILayout.Width(bottomInfoWidth));                //"Label"
                GUILayout.Space(5);
                EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomInfoWidth));
                EditorGUILayout.LabelField(strLabel1, GUILayout.Width(optLabelWidth));
                EditorGUILayout.TextField(_selectedUnit._label_Min, GUILayout.Width(optValueWidth));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomInfoWidth));
                EditorGUILayout.LabelField(strLabel2, GUILayout.Width(optLabelWidth));
                EditorGUILayout.TextField(_selectedUnit._label_Max, GUILayout.Width(optValueWidth));
                EditorGUILayout.EndHorizontal();


                GUILayout.Space(5);
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SnapSize), GUILayout.Width(bottomInfoWidth));                //"Snap Size"
                EditorGUILayout.IntField(_selectedUnit._snapSize, GUILayout.Width(bottomInfoWidth));


                //Reserved가 아니면 삭제가능
                if (!_selectedUnit._isReserved)
                {
                    //"Remove Preset"
                    if (GUILayout.Button(_editor.GetText(TEXT.DLG_RemovePreset), GUILayout.Height(25)))
                    {
                        bool result = EditorUtility.DisplayDialog(_editor.GetText(TEXT.ControlParamPreset_Remove_Title),
                                                                  _editor.GetTextFormat(TEXT.ControlParamPreset_Remove_Body, _selectedUnit._keyName),
                                                                  _editor.GetText(TEXT.Remove),
                                                                  _editor.GetText(TEXT.Cancel));

                        if (result)
                        {
                            int targetID = _selectedUnit._uniqueID;
                            _selectedUnit = null;

                            _editor.ControlParamPreset.RemovePreset(targetID);
                        }
                    }
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                //"No Selected"
                GUILayout.Box(_editor.GetText(TEXT.DLG_NotSelected), boxGUIStyle, GUILayout.Width(width - 8), GUILayout.Height(30));

                GUILayout.Space(height_Info + selectedIconSize + 14);
            }

            bool isClose = false;
            bool isSelectBtnAvailable = _selectedUnit != null;

            EditorGUILayout.BeginHorizontal();
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Apply), false, isSelectBtnAvailable, (width / 2) - 8, 30))            //"Apply"
            {
                _funcResult(true, _loadKey, _selectedUnit, _targetControlParam);
                isClose = true;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Close), false, true, (width / 2) - 8, 30))            //"Close"
            {
                //_funcResult(false, _loadKey, null, null);
                _funcResult(false, _loadKey, null, _targetControlParam);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

            //오프셋과 자식 복사 여부
            int width_Label = 30;
            int width_Value = (width - 10) - 34;

            GUILayout.Space(5);

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PositionOffset));
            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField("X", GUILayout.Width(width_Label));
            _offsetX = EditorGUILayout.FloatField(_offsetX, GUILayout.Width(width_Value));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField("Y", GUILayout.Width(width_Label));
            _offsetY = EditorGUILayout.FloatField(_offsetY, GUILayout.Width(width_Value));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetUIWord(UIWORD.DuplicateWithChildBones), GUILayout.Width(width - (10 + 30)));            //"Duplicate with Child Bones"
            _isDuplicateChildren = EditorGUILayout.Toggle(_isDuplicateChildren, GUILayout.Width(30));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            int width_Btn = ((width - 10) / 2) - 4;

            bool isCloseDialog = false;

            if (GUILayout.Button(_editor.GetUIWord(UIWORD.Duplicate), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Start Edit"
            {
                _funcResult(true, _targetBone, _loadKey, _offsetX, _offsetY, _isDuplicateChildren);
                isCloseDialog = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.Cancel), GUILayout.Width(width_Btn), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _targetBone, null, _offsetX, _offsetY, _isDuplicateChildren);
                isCloseDialog = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isCloseDialog)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 17
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }

            //_scroll = EditorGUILayout.BeginScrollView(_scroll, false, true, GUILayout.Width(width), GUILayout.Height(height));
            //EditorGUILayout.BeginVertical(GUILayout.Width(width - 28));
            width -= 10;


            //Color toneColor = _editor._colorOption_OnionToneColor;
            //Color animPrevColor = _editor._colorOption_OnionAnimPrevColor;
            //Color animNextColor = _editor._colorOption_OnionAnimNextColor;

            bool  isOutlineRender      = _editor._onionOption_IsOutlineRender;
            float outlineThickness     = _editor._onionOption_OutlineThickness;
            bool  isRenderOnlySelected = _editor._onionOption_IsRenderOnlySelected;
            bool  isRenderBehind       = _editor._onionOption_IsRenderBehind;
            bool  isRenderAnimFrames   = _editor._onionOption_IsRenderAnimFrames;
            int   prevRange            = _editor._onionOption_PrevRange;
            int   nextRange            = _editor._onionOption_NextRange;
            int   renderPerFrame       = _editor._onionOption_RenderPerFrame;
            float posOffsetX           = _editor._onionOption_PosOffsetX;
            float posOffsetY           = _editor._onionOption_PosOffsetY;
            bool  IKCalculateForce     = _editor._onionOption_IKCalculateForce;

            bool isChanged = false;

            GUIStyle guiStyle_Box = new GUIStyle(GUI.skin.box);

            guiStyle_Box.alignment = TextAnchor.MiddleCenter;
            if (EditorGUIUtility.isProSkin)
            {
                guiStyle_Box.normal.textColor = Color.white;
            }

            Color prevColor = GUI.backgroundColor;

            GUILayout.Space(10);
            GUI.backgroundColor = new Color(0.7f, 1.0f, 0.6f, 1.0f);

            GUILayout.Box(_editor.GetText(TEXT.DLG_BasicSettings), guiStyle_Box, GUILayout.Width(width), GUILayout.Height(25));            //"Basic Settings"
            GUI.backgroundColor = prevColor;
            GUILayout.Space(5);
            //- 색상
            //- 렌더링 방식 < Outline / Solid (Enum)
            //- 두께
            //- 앞/뒤 < Enum
            //- 선택Only / 전체 < Enum
            int widthValue     = 130;
            int widthLabel     = width - (10 + widthValue + 5);
            int widthValueHalf = (widthValue / 2) - 2;

            //1. 색상들

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Colors), GUILayout.Width(widthLabel));            //"Colors"
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Mesh), GUILayout.Width(widthValueHalf));          //"Mesh"
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Bone), GUILayout.Width(widthValueHalf));          //"Bone"
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_SingleMarker), GUILayout.Width(widthLabel));            //"Single Marker"
            try
            {
                Color nextToneColor = EditorGUILayout.ColorField(_editor._colorOption_OnionToneColor, GUILayout.Width(widthValueHalf));
                if (!IsSameColor(_editor._colorOption_OnionToneColor, nextToneColor))
                {
                    _editor._colorOption_OnionToneColor = nextToneColor;
                    apGL.SetToneOption(_editor._colorOption_OnionToneColor, _editor._onionOption_OutlineThickness, _editor._onionOption_IsOutlineRender, _editor._onionOption_PosOffsetX, _editor._onionOption_PosOffsetY, _editor._colorOption_OnionBoneColor);
                }
            }
            catch (Exception) { }
            try
            {
                Color nextBoneColor = EditorGUILayout.ColorField(_editor._colorOption_OnionBoneColor, GUILayout.Width(widthValueHalf));
                if (!IsSameColor(nextBoneColor, _editor._colorOption_OnionBoneColor))
                {
                    _editor._colorOption_OnionBoneColor = nextBoneColor;
                    apGL.SetToneOption(_editor._colorOption_OnionToneColor, _editor._onionOption_OutlineThickness, _editor._onionOption_IsOutlineRender, _editor._onionOption_PosOffsetX, _editor._onionOption_PosOffsetY, _editor._colorOption_OnionBoneColor);
                }
            }
            catch (Exception) { }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PreviousFrames), GUILayout.Width(widthLabel));            //"Previous Frames"
            try { _editor._colorOption_OnionAnimPrevColor = EditorGUILayout.ColorField(_editor._colorOption_OnionAnimPrevColor, GUILayout.Width(widthValueHalf)); }
            catch (Exception) { }
            try { _editor._colorOption_OnionBonePrevColor = EditorGUILayout.ColorField(_editor._colorOption_OnionBonePrevColor, GUILayout.Width(widthValueHalf)); }
            catch (Exception) { }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_NextFrames), GUILayout.Width(widthLabel));            //"Next Frames"
            try { _editor._colorOption_OnionAnimNextColor = EditorGUILayout.ColorField(_editor._colorOption_OnionAnimNextColor, GUILayout.Width(widthValueHalf)); }
            catch (Exception) { }
            try { _editor._colorOption_OnionBoneNextColor = EditorGUILayout.ColorField(_editor._colorOption_OnionBoneNextColor, GUILayout.Width(widthValueHalf)); }
            catch (Exception) { }
            EditorGUILayout.EndHorizontal();


            if (GUILayout.Button(_editor.GetText(TEXT.DLG_RestoretoDefaultColors), GUILayout.Width(width), GUILayout.Height(20)))            //"Restore Default Colors"
            {
                _editor._colorOption_OnionToneColor     = apEditor.DefaultColor_OnionToneColor;
                _editor._colorOption_OnionAnimPrevColor = apEditor.DefaultColor_OnionAnimPrevColor;
                _editor._colorOption_OnionAnimNextColor = apEditor.DefaultColor_OnionAnimNextColor;
                _editor._colorOption_OnionBoneColor     = apEditor.DefaultColor_OnionBoneColor;
                _editor._colorOption_OnionBonePrevColor = apEditor.DefaultColor_OnionBonePrevColor;
                _editor._colorOption_OnionBoneNextColor = apEditor.DefaultColor_OnionBoneNextColor;
                _editor.SaveEditorPref();
            }
            GUILayout.Space(10);

            //렌더 모드
            int iEnumRenderMode = (isOutlineRender ? 0 : 1);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Shape), GUILayout.Width(widthLabel));            //"Shape"
            int nextEnumRenderMode = EditorGUILayout.Popup(iEnumRenderMode, _enumTitle_RenderMode, GUILayout.Width(widthValue));

            if (nextEnumRenderMode != iEnumRenderMode)
            {
                isOutlineRender = (nextEnumRenderMode == 0 ? true : false);
                isChanged       = true;
            }
            EditorGUILayout.EndHorizontal();

            //- 두께
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Thickness01), GUILayout.Width(widthLabel));            //"Thickness (0~1)"
            float nextOutlineThickness = EditorGUILayout.DelayedFloatField(outlineThickness, GUILayout.Width(widthValue));

            if (nextOutlineThickness != outlineThickness)
            {
                outlineThickness = nextOutlineThickness;
                isChanged        = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();

            //- 앞/뒤 < Enum
            int iEnumRenderOrder = (isRenderBehind ? 1 : 0);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Order), GUILayout.Width(widthLabel));            //"Order"
            int nextEnumRenderOrder = EditorGUILayout.Popup(iEnumRenderOrder, _enumTitle_RenderOrder, GUILayout.Width(widthValue));

            if (nextEnumRenderOrder != iEnumRenderOrder)
            {
                isRenderBehind = (nextEnumRenderOrder == 0 ? false : true);
                isChanged      = true;
            }
            EditorGUILayout.EndHorizontal();

            //- 선택Only / 전체 < Enum
            int iEnumSelected = (isRenderOnlySelected ? 1 : 0);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Target), GUILayout.Width(widthLabel));            //"Target"
            int nextEnumSelected = EditorGUILayout.Popup(iEnumSelected, _enumTitle_SelectedMode, GUILayout.Width(widthValue));

            if (nextEnumSelected != iEnumSelected)
            {
                isRenderOnlySelected = (nextEnumSelected == 0 ? false : true);
                isChanged            = true;
            }
            EditorGUILayout.EndHorizontal();

            //float posOffsetX = _editor._onionOption_PosOffsetX;
            //float posOffsetY = _editor._onionOption_PosOffsetY;
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PositionOffset), GUILayout.Width(widthLabel));            //"Position Offset"
            float nextPosOffsetX = EditorGUILayout.DelayedFloatField(posOffsetX, GUILayout.Width((widthValue / 2) - 2));
            float nextPosOffsetY = EditorGUILayout.DelayedFloatField(posOffsetY, GUILayout.Width((widthValue / 2) - 2));

            if (Mathf.Abs(nextPosOffsetX - posOffsetX) > 0.0001f)
            {
                posOffsetX = nextPosOffsetX;
                isChanged  = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            if (Mathf.Abs(nextPosOffsetY - posOffsetY) > 0.0001f)
            {
                posOffsetY = nextPosOffsetY;
                isChanged  = true;
                apEditorUtil.ReleaseGUIFocus();
            }

            EditorGUILayout.EndHorizontal();

            //IK 계산
            int iEnumIK = (IKCalculateForce ? 0 : 1);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_IKCalculation), GUILayout.Width(widthLabel));            //"IK calculation"
            int nextEnumIK = EditorGUILayout.Popup(iEnumIK, _enimTitle_IKCalculate, GUILayout.Width(widthValue));

            if (nextEnumIK != iEnumIK)
            {
                IKCalculateForce = (nextEnumIK == 0 ? true : false);
                isChanged        = true;
            }
            EditorGUILayout.EndHorizontal();



            GUILayout.Space(20);
            GUI.backgroundColor = new Color(0.3f, 0.9f, 1.0f, 1.0f);
            GUILayout.Box(_editor.GetText(TEXT.DLG_AnimationSettings), guiStyle_Box, GUILayout.Width(width), GUILayout.Height(25));            //"Animation Settings"
            GUI.backgroundColor = prevColor;
            GUILayout.Space(5);
            //- 단일 프레임 <-> 범위 프레임 비교 < 아이콘
            //- 이전/이후 프레임
            //- Render Per Frame

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_AnimationFrameRendering), GUILayout.Width(width));            //"Animation Frame Rendering"
            Texture2D img_SingleFrame   = _editor.ImageSet.Get(apImageSet.PRESET.OnionSkin_SingleFrame);
            Texture2D img_MultipleFrame = _editor.ImageSet.Get(apImageSet.PRESET.OnionSkin_MultipleFrame);
            int       width_Half        = ((width - 10) / 2) - 2;


            string strBtn_SingleFrame    = " " + _editor.GetText(TEXT.DLG_SingleFrame);         //" Single Frame"
            string strBtn_MultipleFrames = " " + _editor.GetText(TEXT.DLG_MultipleFrames);      //" Multiple Frames"

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton_2Side(img_SingleFrame, strBtn_SingleFrame, strBtn_SingleFrame, !isRenderAnimFrames, true, width_Half, 30))
            {
                isRenderAnimFrames = false;
                isChanged          = true;
            }
            if (apEditorUtil.ToggledButton_2Side(img_MultipleFrame, strBtn_MultipleFrames, strBtn_MultipleFrames, isRenderAnimFrames, true, width_Half, 30))
            {
                isRenderAnimFrames = true;
                isChanged          = true;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Range), GUILayout.Width(width));            //"Range"
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PreviousRange), GUILayout.Width(widthLabel));            //"Previous"
            int changedPrevRange = EditorGUILayout.DelayedIntField(prevRange, GUILayout.Width(widthValue));

            if (changedPrevRange != prevRange)
            {
                prevRange = changedPrevRange;
                isChanged = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_NextRange), GUILayout.Width(widthLabel));            //"Next"
            int changedNextRange = EditorGUILayout.DelayedIntField(nextRange, GUILayout.Width(widthValue));

            if (changedNextRange != nextRange)
            {
                nextRange = changedNextRange;
                isChanged = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_FramePerRender), GUILayout.Width(widthLabel));            //"Render per Frame"
            int changedRenderPerFrame = EditorGUILayout.DelayedIntField(renderPerFrame, GUILayout.Width(widthValue));

            if (changedRenderPerFrame != renderPerFrame)
            {
                renderPerFrame = changedRenderPerFrame;
                isChanged      = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();

            if (isChanged)
            {
                _editor._onionOption_IsOutlineRender      = isOutlineRender;
                _editor._onionOption_OutlineThickness     = Mathf.Clamp01(outlineThickness);
                _editor._onionOption_IsRenderOnlySelected = isRenderOnlySelected;
                _editor._onionOption_IsRenderBehind       = isRenderBehind;
                _editor._onionOption_IsRenderAnimFrames   = isRenderAnimFrames;
                _editor._onionOption_PrevRange            = Mathf.Max(prevRange, 0);
                _editor._onionOption_NextRange            = Mathf.Max(nextRange, 0);
                _editor._onionOption_RenderPerFrame       = Mathf.Max(renderPerFrame, 1);
                _editor._onionOption_PosOffsetX           = posOffsetX;
                _editor._onionOption_PosOffsetY           = posOffsetY;
                _editor._onionOption_IKCalculateForce     = IKCalculateForce;

                _editor.SaveEditorPref();
            }



            GUILayout.Space(20);
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_RestoretoDefaultSettings), GUILayout.Width(width), GUILayout.Height(20)))           //"Restore to Default Settings"
            {
                //TODO
                _editor._onionOption_IsOutlineRender      = true;
                _editor._onionOption_OutlineThickness     = 0.5f;
                _editor._onionOption_IsRenderOnlySelected = false;
                _editor._onionOption_IsRenderBehind       = false;
                _editor._onionOption_IsRenderAnimFrames   = false;
                _editor._onionOption_PrevRange            = 1;
                _editor._onionOption_NextRange            = 1;
                _editor._onionOption_RenderPerFrame       = 1;
                _editor._onionOption_PosOffsetX           = 0.0f;
                _editor._onionOption_PosOffsetY           = 0.0f;
                _editor._onionOption_IKCalculateForce     = false;

                _editor.SaveEditorPref();
            }
            GUILayout.Space(5);

            if (GUILayout.Button(_editor.GetText(TEXT.Close), GUILayout.Width(width), GUILayout.Height(35)))
            {
                _editor.SaveEditorPref();
                CloseDialog();
            }

            //GUILayout.Height(height + 300);

            //EditorGUILayout.EndVertical();
            //EditorGUILayout.EndScrollView();
        }
Ejemplo n.º 18
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }



            //Sorting Layer를 추가하자
            if (_sortingLayerNames == null || _sortingLayerIDs == null)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }
            else if (_sortingLayerNames.Length != SortingLayer.layers.Length ||
                     _sortingLayerIDs.Length != SortingLayer.layers.Length)
            {
                _sortingLayerNames = new string[SortingLayer.layers.Length];
                _sortingLayerIDs   = new int[SortingLayer.layers.Length];
            }

            for (int i = 0; i < SortingLayer.layers.Length; i++)
            {
                _sortingLayerNames[i] = SortingLayer.layers[i].name;
                _sortingLayerIDs[i]   = SortingLayer.layers[i].id;
            }


            int width_2Btn = (width - 14) / 2;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Bake), _tab == TAB.Bake, width_2Btn, 25))
            {
                _tab = TAB.Bake;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Setting), _tab == TAB.Options, width_2Btn, 25))
            {
                _tab = TAB.Options;
            }
            EditorGUILayout.EndHorizontal();


            if (_tab == TAB.Bake)
            {
                GUILayout.Space(5);

                // 1. Bake에 대한 UI
                //Bake 설정
                //EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_BakeSetting));//"Bake Setting"
                //GUILayout.Space(5);

                EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Portrait), _targetPortrait, typeof(apPortrait), true);                //"Portait"

                GUILayout.Space(5);

                //"Bake Scale"
                float prevBakeScale = _targetPortrait._bakeScale;
                _targetPortrait._bakeScale = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_BakeScale), _targetPortrait._bakeScale);

                //"Z Per Depth"
                float prevBakeZSize = _targetPortrait._bakeZSize;
                _targetPortrait._bakeZSize = EditorGUILayout.FloatField(_editor.GetText(TEXT.DLG_ZPerDepth), _targetPortrait._bakeZSize);

                if (_targetPortrait._bakeZSize < 0.5f)
                {
                    _targetPortrait._bakeZSize = 0.5f;
                }

                if (prevBakeScale != _targetPortrait._bakeScale ||
                    prevBakeZSize != _targetPortrait._bakeZSize)
                {
                    apEditorUtil.SetEditorDirty();
                }


                //Bake 버튼
                GUILayout.Space(10);
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Bake), GUILayout.Height(45)))                //"Bake"
                {
                    GUI.FocusControl(null);

                    //CheckChangedProperties(nextRootScale, nextZScale);
                    apEditorUtil.SetEditorDirty();

                    //-------------------------------------
                    // Bake 함수를 실행한다. << 중요오오오오
                    //-------------------------------------

                    apBakeResult bakeResult = _editor.Controller.Bake();


                    _editor.Notification("[" + _targetPortrait.name + "] is Baked", false, false);

                    if (bakeResult.NumUnlinkedExternalObject > 0)
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                    _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                    _editor.GetText(TEXT.Okay));
                    }

                    //추가 3.29 : Bake 후에 Ambient를 체크하자
                    CheckAmbientAndCorrection();
                }

                GUILayout.Space(10);
                apEditorUtil.GUI_DelimeterBoxH(width - 10);
                GUILayout.Space(10);


                //최적화 Bake
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_OptimizedBaking));                //"Optimized Baking"

                //"Target"
                apPortrait nextOptPortrait = (apPortrait)EditorGUILayout.ObjectField(_editor.GetText(TEXT.DLG_Target), _targetPortrait._bakeTargetOptPortrait, typeof(apPortrait), true);

                if (nextOptPortrait != _targetPortrait._bakeTargetOptPortrait)
                {
                    //타겟을 바꾸었다.
                    bool isChanged = false;
                    if (nextOptPortrait != null)
                    {
                        //1. 다른 Portrait를 선택했다.
                        if (!nextOptPortrait._isOptimizedPortrait)
                        {
                            //1-1. 최적화된 객체가 아니다.
                            EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                        _editor.GetText(TEXT.OptBakeError_NotOptTarget_Body),
                                                        _editor.GetText(TEXT.Close));
                        }
                        else if (nextOptPortrait._bakeSrcEditablePortrait != _targetPortrait)
                        {
                            //1-2. 다른 대상으로부터 Bake된 Portrait같다. (물어보고 계속)
                            bool isResult = EditorUtility.DisplayDialog(_editor.GetText(TEXT.OptBakeError_Title),
                                                                        _editor.GetText(TEXT.OptBakeError_SrcMatchError_Body),
                                                                        _editor.GetText(TEXT.Okay),
                                                                        _editor.GetText(TEXT.Cancel));

                            if (isResult)
                            {
                                //뭐 선택하겠다는데요 뭐..
                                isChanged = true;
                            }
                        }
                        else
                        {
                            //1-3. 오케이. 변경 가능
                            isChanged = true;
                        }
                    }
                    else
                    {
                        //2. 선택을 해제했다.
                        isChanged = true;
                    }

                    if (isChanged)
                    {
                        //Target을 변경한다.
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                        _targetPortrait._bakeTargetOptPortrait = nextOptPortrait;
                    }
                }

                string optBtnText = "";
                if (_targetPortrait._bakeTargetOptPortrait != null)
                {
                    //optBtnText = "Optimized Bake to\n[" + _targetPortrait._bakeTargetOptPortrait.gameObject.name + "]";
                    optBtnText = string.Format("{0}\n[{1}]", _editor.GetText(TEXT.DLG_OptimizedBakeTo), _targetPortrait._bakeTargetOptPortrait.gameObject.name);
                }
                else
                {
                    //optBtnText = "Optimized Bake\n(Make New GameObject)";
                    optBtnText = _editor.GetText(TEXT.DLG_OptimizedBakeMakeNew);
                }
                GUILayout.Space(10);

                if (GUILayout.Button(optBtnText, GUILayout.Height(45)))
                {
                    GUI.FocusControl(null);

                    //CheckChangedProperties(nextRootScale, nextZScale);


                    //Optimized Bake를 하자
                    apBakeResult bakeResult = _editor.Controller.OptimizedBake(_targetPortrait, _targetPortrait._bakeTargetOptPortrait);

                    if (bakeResult.NumUnlinkedExternalObject > 0)
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.BakeWarning_Title),
                                                    _editor.GetTextFormat(TEXT.BakeWarning_Body, bakeResult.NumUnlinkedExternalObject),
                                                    _editor.GetText(TEXT.Okay));
                    }

                    _editor.Notification("[" + _targetPortrait.name + "] is Baked (Optimized)", false, false);

                    //추가 3.29 : Bake 후에 Ambient를 체크하자
                    CheckAmbientAndCorrection();
                }
            }
            else
            {
                //Vector2 curScroll = (_tab == TAB.Bake) ? _scroll_Bake : _scroll_Options;

                _scroll_Options = EditorGUILayout.BeginScrollView(_scroll_Options, false, true, GUILayout.Width(width), GUILayout.Height(height - 30));

                EditorGUILayout.BeginVertical(GUILayout.Width(width - 24));
                GUILayout.Space(5);

                width -= 24;

                // 2. Option에 대한 UI
                //1. Gamma Space Space
                bool prevBakeGamma   = _editor._isBakeColorSpaceToGamma;
                int  iPrevColorSpace = prevBakeGamma ? 0 : 1;
                int  iNextColorSpace = EditorGUILayout.Popup(_editor.GetUIWord(UIWORD.ColorSpace), iPrevColorSpace, _colorSpaceNames);
                if (iNextColorSpace != iPrevColorSpace)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (iNextColorSpace == 0)
                    {
                        //Gamma
                        _editor._isBakeColorSpaceToGamma = true;
                    }
                    else
                    {
                        //Linear
                        _editor._isBakeColorSpaceToGamma = false;
                    }
                }

                GUILayout.Space(10);

                //2. Sorting Layer
                int prevSortingLayerID = _editor._portrait._sortingLayerID;
                int prevSortingOrder   = _editor._portrait._sortingOrder;
                apPortrait.SORTING_ORDER_OPTION prevSortingLayerOption = _editor._portrait._sortingOrderOption;

                int layerIndex = -1;
                for (int i = 0; i < SortingLayer.layers.Length; i++)
                {
                    if (SortingLayer.layers[i].id == _editor._portrait._sortingLayerID)
                    {
                        //찾았다.
                        layerIndex = i;
                        break;
                    }
                }
                if (layerIndex < 0)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);

                    //어라 레이어가 없는데용..
                    //초기화해야겠다.
                    _editor._portrait._sortingLayerID = -1;
                    if (SortingLayer.layers.Length > 0)
                    {
                        _editor._portrait._sortingLayerID = SortingLayer.layers[0].id;
                        layerIndex = 0;
                    }
                }
                int nextIndex = EditorGUILayout.Popup(_editor.GetText(TEXT.SortingLayer), layerIndex, _sortingLayerNames);                //"Sorting Layer"
                if (nextIndex != layerIndex)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    //레이어가 변경되었다.
                    if (nextIndex >= 0 && nextIndex < SortingLayer.layers.Length)
                    {
                        //LayerID 변경
                        _editor._portrait._sortingLayerID = SortingLayer.layers[nextIndex].id;
                    }
                }

                //추가 19.8.18 : Sorting Order를 지정하는 방식을 3가지 + 미적용 1가지로 더 세분화
                apPortrait.SORTING_ORDER_OPTION nextSortingLayerOption = (apPortrait.SORTING_ORDER_OPTION)EditorGUILayout.EnumPopup(_editor.GetText(TEXT.SortingOrderOption), _editor._portrait._sortingOrderOption);
                if (nextSortingLayerOption != _editor._portrait._sortingOrderOption)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _editor._portrait._sortingOrderOption = nextSortingLayerOption;
                }

                if (_editor._portrait._sortingOrderOption == apPortrait.SORTING_ORDER_OPTION.SetOrder)
                {
                    //Set Order인 경우에만 한정
                    int nextOrder = EditorGUILayout.IntField(_editor.GetText(TEXT.SortingOrder), _editor._portrait._sortingOrder);                    //"Sorting Order"
                    if (nextOrder != _editor._portrait._sortingOrder)
                    {
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                        _editor._portrait._sortingOrder = nextOrder;
                    }
                }

                GUILayout.Space(10);

                //3. 메카님 사용 여부

                //EditorGUILayout.LabelField("Animation Settings");
                bool   prevIsUsingMecanim = _targetPortrait._isUsingMecanim;
                string prevMecanimPath    = _targetPortrait._mecanimAnimClipResourcePath;
                _targetPortrait._isUsingMecanim = EditorGUILayout.Toggle(_editor.GetText(TEXT.IsMecanimAnimation), _targetPortrait._isUsingMecanim); //"Is Mecanim Animation"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.AnimationClipExportPath));                                                           //"Animation Clip Export Path"

                GUIStyle guiStyle_ChangeBtn = new GUIStyle(GUI.skin.button);
                guiStyle_ChangeBtn.margin = GUI.skin.textField.margin;
                guiStyle_ChangeBtn.border = GUI.skin.textField.border;

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(20));
                GUILayout.Space(5);
                EditorGUILayout.TextField(_targetPortrait._mecanimAnimClipResourcePath, GUILayout.Width(width - (70 + 15)));
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Change), guiStyle_ChangeBtn, GUILayout.Width(70), GUILayout.Height(18)))
                {
                    string nextPath = EditorUtility.SaveFolderPanel("Select to export animation clips", "", "");
                    if (!string.IsNullOrEmpty(nextPath))
                    {
                        if (apEditorUtil.IsInAssetsFolder(nextPath))
                        {
                            //유효한 폴더인 경우
                            //중요 : 경로가 절대 경로로 찍힌다.
                            //상대 경로로 바꾸자
                            apEditorUtil.PATH_INFO_TYPE pathInfoType = apEditorUtil.GetPathInfo(nextPath);
                            if (pathInfoType == apEditorUtil.PATH_INFO_TYPE.Absolute_InAssetFolder)
                            {
                                //절대 경로 + Asset 폴더 안쪽이라면
                                //Debug.LogError("절대 경로가 리턴 되었다. : " + nextPath);
                                nextPath = apEditorUtil.AbsolutePath2RelativePath(nextPath);
                                //Debug.LogError(">> 상대 경로로 변경 : " + nextPath);
                            }

                            apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_BakeOptionChanged, _editor, _targetPortrait, _targetPortrait, false);

                            _targetPortrait._mecanimAnimClipResourcePath = nextPath;
                        }
                        else
                        {
                            //유효한 폴더가 아닌 경우
                            //EditorUtility.DisplayDialog("Invalid Folder Path", "Invalid Clip Path", "Close");
                            EditorUtility.DisplayDialog(
                                _editor.GetText(TEXT.DLG_AnimClipSavePathValidationError_Title),
                                _editor.GetText(TEXT.DLG_AnimClipSavePathResetError_Body),
                                _editor.GetText(TEXT.Close));
                        }
                    }

                    GUI.FocusControl(null);
                }
                EditorGUILayout.EndHorizontal();



                GUILayout.Space(10);

                if (_guiContent_Setting_IsImportant == null)
                {
                    _guiContent_Setting_IsImportant = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_Setting_IsImportant), false, "When this setting is on, it always updates and the physics effect works.");
                }
                if (_guiContent_Setting_FPS == null)
                {
                    _guiContent_Setting_FPS = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_Setting_FPS), false, "This setting is used when <Important> is off");
                }



                //4. Important
                //"Is Important"
                bool nextImportant = EditorGUILayout.Toggle(_guiContent_Setting_IsImportant.Content, _targetPortrait._isImportant);
                if (nextImportant != _targetPortrait._isImportant)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._isImportant = nextImportant;
                }

                //"FPS (Important Off)"
                int nextFPS = EditorGUILayout.DelayedIntField(_guiContent_Setting_FPS.Content, _targetPortrait._FPS);
                if (_targetPortrait._FPS != nextFPS)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (nextFPS < 10)
                    {
                        nextFPS = 10;
                    }
                    _targetPortrait._FPS = nextFPS;
                }

                GUILayout.Space(10);

                //5. Billboard + Perspective

                apPortrait.BILLBOARD_TYPE nextBillboardType = (apPortrait.BILLBOARD_TYPE)EditorGUILayout.Popup(_editor.GetText(TEXT.DLG_Billboard), (int)_targetPortrait._billboardType, _billboardTypeNames);
                if (nextBillboardType != _targetPortrait._billboardType)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._billboardType = nextBillboardType;
                }

                //추가 19.9.24 : Billboard인 경우 카메라의 SortMode를 OrthoGraphic으로 강제할지 여부
                if (_targetPortrait._billboardType != apPortrait.BILLBOARD_TYPE.None)
                {
                    GUILayout.Space(2);
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width));

                    int      width_Value            = 30;
                    int      width_Label            = width - (width_Value + 10);
                    GUIStyle guiStyle_LabelWrapText = new GUIStyle(GUI.skin.label);
                    guiStyle_LabelWrapText.wordWrap = true;

                    GUILayout.Space(5);
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.SetSortMode2Orthographic), guiStyle_LabelWrapText, GUILayout.Width(width_Label));

                    bool nextForceSortModeToOrtho = EditorGUILayout.Toggle(_targetPortrait._isForceCamSortModeToOrthographic, GUILayout.Width(width_Value), GUILayout.Height(20));
                    if (nextForceSortModeToOrtho != _targetPortrait._isForceCamSortModeToOrthographic)
                    {
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                        _targetPortrait._isForceCamSortModeToOrthographic = nextForceSortModeToOrtho;
                    }

                    EditorGUILayout.EndHorizontal();
                }


                GUILayout.Space(10);

                //6. Shadow

                apPortrait.SHADOW_CASTING_MODE nextChastShadows = (apPortrait.SHADOW_CASTING_MODE)EditorGUILayout.EnumPopup(_editor.GetUIWord(UIWORD.CastShadows), _targetPortrait._meshShadowCastingMode);
                bool nextReceiveShaodw = EditorGUILayout.Toggle(_editor.GetUIWord(UIWORD.ReceiveShadows), _targetPortrait._meshReceiveShadow);
                if (nextChastShadows != _targetPortrait._meshShadowCastingMode ||
                    nextReceiveShaodw != _targetPortrait._meshReceiveShadow)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._meshShadowCastingMode = nextChastShadows;
                    _targetPortrait._meshReceiveShadow     = nextReceiveShaodw;
                }

                GUILayout.Space(10);

                //#if UNITY_2018_1_OR_NEWER
                //변경 19.6.22 : LWRP 기능은 삭제
                //Material Library를 열도록 하자
                //>> 다시 변경 19.8.5 : Clipped Mesh 땜시 다시 열자

                //7. LWRP
                //LWRP 쉐이더를 쓸지 여부와 다시 강제로 생성하기 버튼을 만들자. : 이건 2019부터 적용 (그 전에는 SRP용 처리가 안된다.)
#if UNITY_2019_1_OR_NEWER
                bool prevUseLWRP  = _editor._isUseSRP;
                int  iPrevUseLWRP = prevUseLWRP ? 1 : 0;
                int  iNextUseLWRP = EditorGUILayout.Popup(_editor.GetText(TEXT.RenderPipeline), iPrevUseLWRP, _renderPipelineNames);               //"Render Pipeline"
                if (iNextUseLWRP != iPrevUseLWRP)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    if (iNextUseLWRP == 0)
                    {
                        //사용 안함
                        _editor._isUseSRP = false;
                    }
                    else
                    {
                        //LWRP 사용함
                        _editor._isUseSRP = true;
                    }
                }
                GUILayout.Space(10);
#endif
                //if(GUILayout.Button("Generate Lightweight Shaders"))
                //{
                //	apShaderGenerator shaderGenerator = new apShaderGenerator();
                //	shaderGenerator.GenerateLWRPShaders();
                //}

                //GUILayout.Space(10);
                //#endif

                //8. VR Supported 19.9.24 추가
                //VR Supported
                int iNextVRSupported = EditorGUILayout.Popup(_editor.GetText(TEXT.VROption), (int)_targetPortrait._vrSupportMode, _vrSupportModeLabel);
                if (iNextVRSupported != (int)_targetPortrait._vrSupportMode)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                    _targetPortrait._vrSupportMode = (apPortrait.VR_SUPPORT_MODE)iNextVRSupported;
                }

                if (_targetPortrait._vrSupportMode == apPortrait.VR_SUPPORT_MODE.SingleCamera)
                {
                    //Single Camera인 경우, Clipping Mask의 크기를 결정해야한다.
                    int iNextVRRTSize = EditorGUILayout.Popup(_editor.GetUIWord(UIWORD.MaskTextureSize), (int)_targetPortrait._vrRenderTextureSize, _vrRTSizeLabel);
                    if (iNextVRRTSize != (int)_targetPortrait._vrRenderTextureSize)
                    {
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Portrait_SettingChanged, _editor, _targetPortrait, null, false);
                        _targetPortrait._vrRenderTextureSize = (apPortrait.VR_RT_SIZE)iNextVRRTSize;
                    }
                }

                GUILayout.Space(10);


                //11.7 추가 : Ambient Light를 검은색으로 만든다.

                if (GUILayout.Button(_editor.GetText(TEXT.DLG_AmbientToBlack), GUILayout.Height(20)))
                {
                    MakeAmbientLightToBlack();
                }

                //CheckChangedProperties(nextRootScale, nextZScale);
                if (prevSortingLayerID != _editor._portrait._sortingLayerID ||
                    prevSortingOrder != _editor._portrait._sortingOrder ||
                    prevSortingLayerOption != _editor._portrait._sortingOrderOption ||
                    prevIsUsingMecanim != _targetPortrait._isUsingMecanim ||
                    !string.Equals(prevMecanimPath, _targetPortrait._mecanimAnimClipResourcePath) ||
                    prevBakeGamma != _editor._isBakeColorSpaceToGamma
#if UNITY_2019_1_OR_NEWER
                    || prevUseLWRP != _editor._isUseSRP
#endif
                    )
                {
                    apEditorUtil.SetEditorDirty();
                    _editor.SaveEditorPref();
                }

                GUILayout.Space(height + 500);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndScrollView();
            }

            GUILayout.Space(5);
        }
Ejemplo n.º 19
0
        // GUI
        //------------------------------------------------------------------------------------------------
        private void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            width -= 10;

            //만약 이 다이얼로그가 켜진 상태로 뭔가 바뀌었다면 종료
            bool isClose                  = false;
            bool isMoveAnimKeyframe       = false;
            bool isMoveAnimKeyframeToNext = false;

            if (_editor == null || _meshGroup == null || _modifier == null || _modMesh == null || _renderUnit == null)
            {
                //데이터가 없다.
                isClose = true;
            }
            else if (_editor.Select.SelectionType != _selectionType)
            {
                //선택 타입이 바뀌었다.
                isClose = true;
            }
            else
            {
                if (!_isAnimEdit)
                {
                    //1. 일반 모디파이어 편집시
                    //- 현재 선택된 MeshGroup이 바뀌었다면
                    //- 현재 선택된 Modifier가 바뀌었다면
                    //- Modifier 메뉴가 아니라면
                    //- ExEditingMode가 꺼졌다면
                    //> 해제
                    if (_editor.Select.ExEditingMode == apSelection.EX_EDIT.None ||
                        _editor.Select.MeshGroup != _meshGroup ||
                        _editor.Select.Modifier != _modifier ||
                        _editor._meshGroupEditMode != apEditor.MESHGROUP_EDIT_MODE.Modifier)
                    {
                        isClose = true;
                    }
                }
                else
                {
                    //2. 애니메이션 편집 시
                    //- 현재 선택된 AnimationClip이 바뀌었다면
                    //- 현재 선택된 MeshGroup이 바뀌었다면 (AnimClip이 있을 때)
                    //- AnimExEditingMode가 꺼졌다면
                    //- 재생 중이라면
                    //> 해제
                    if (_editor.Select.ExAnimEditingMode == apSelection.EX_EDIT.None ||
                        _editor.Select.AnimClip != _animClip ||
                        _animClip == null ||
                        _keyframe == null ||
                        _editor.Select.AnimClip._targetMeshGroup != _meshGroup ||
                        _editor.Select.IsAnimPlaying)
                    {
                        isClose = true;
                    }
                }
            }

            if (isClose)
            {
                CloseDialog();
                return;
            }


            //------------------------------------------------------------

            //1. 선택된 객체 정보
            //- RenderUnit 아이콘과 이름

            //2. <애니메이션인 경우>
            //- 현재 키프레임과 키프레임 이동하기

            //3. 가중치
            //- [일반] Weight CutOut
            //- [Anim] Prev / Next CutOut

            // (구분선)

            //4. Depth
            //- 아이콘과 Chainging Depth 레이블
            //- On / Off 버튼
            //- Depth 증감과 리스트 (좌우에 배치)

            //5. Texture (RenderUnit이 MeshTransform인 경우)
            //- 현재 텍스쳐
            //- 바뀔 텍스쳐
            //- 텍스쳐 선택하기 버튼

            //1. 선택된 객체 정보
            //- RenderUnit 아이콘과 이름
            //int iconSize = 25;
            GUIStyle guiStyle_TargetBox = new GUIStyle(GUI.skin.box);

            guiStyle_TargetBox.alignment = TextAnchor.MiddleCenter;
            Color prevColor = GUI.backgroundColor;

            // RenderUnit 이름
            Texture2D iconRenderUnit = null;

            if (_renderUnit._meshTransform != null)
            {
                iconRenderUnit = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Mesh);
            }
            else
            {
                iconRenderUnit = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_MeshGroup);
            }
            GUI.backgroundColor = new Color(0.5f, 1.0f, 1.0f, 1.0f);
            GUILayout.Box(new GUIContent("  " + _renderUnit.Name, iconRenderUnit), guiStyle_TargetBox, GUILayout.Width(width), GUILayout.Height(30));
            GUI.backgroundColor = prevColor;

            GUILayout.Space(5);

            //"Extra Property ON", "Extra Property OFF"
            if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.ExtraOpt_ExtraPropertyOn), _editor.GetText(TEXT.ExtraOpt_ExtraPropertyOff), _modMesh._isExtraValueEnabled, true, width, 25))
            {
                apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);

                _modMesh._isExtraValueEnabled = !_modMesh._isExtraValueEnabled;
                _meshGroup.RefreshModifierLink();                //<<옵션의 형태가 바뀌면 Modifier의 Link를 다시 해야한다.
                apEditorUtil.ReleaseGUIFocus();
            }

            GUILayout.Space(5);

            if (_isAnimEdit)
            {
                GUILayout.Space(10);

                //2. <애니메이션인 경우>
                //- 현재 키프레임과 키프레임 이동하기

                //"Target Frame"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_TargetFrame));
                int frameBtnSize      = 20;
                int frameCurBtnWidth  = 100;
                int frameMoveBtnWidth = (width - (10 + frameCurBtnWidth)) / 2;
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(frameBtnSize));
                GUILayout.Space(5);
                if (GUILayout.Button(_editor.ImageSet.Get(apImageSet.PRESET.Anim_MoveToPrevFrame), GUILayout.Width(frameMoveBtnWidth), GUILayout.Height(frameBtnSize)))
                {
                    //이전 프레임으로 이동하기
                    isMoveAnimKeyframe       = true;
                    isMoveAnimKeyframeToNext = false;
                }
                if (GUILayout.Button(_keyframe._frameIndex.ToString(), GUILayout.Width(frameCurBtnWidth), GUILayout.Height(frameBtnSize)))
                {
                    _animClip.SetFrame_Editor(_keyframe._frameIndex);
                    _editor.SetRepaint();
                }
                if (GUILayout.Button(_editor.ImageSet.Get(apImageSet.PRESET.Anim_MoveToNextFrame), GUILayout.Width(frameMoveBtnWidth), GUILayout.Height(frameBtnSize)))
                {
                    //다음 프레임으로 이동하기
                    isMoveAnimKeyframe       = true;
                    isMoveAnimKeyframeToNext = true;
                }

                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space(10);

            //3. 가중치
            //- [일반] Weight CutOut
            //- [Anim] Prev / Next CutOut

            EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_WeightSettings));            //"Weight Settings"
            GUILayout.Space(5);
            if (!_isAnimEdit)
            {
                //일반이면 CutOut이 1개
                float cutOut = EditorGUILayout.DelayedFloatField(_editor.GetText(TEXT.ExtraOpt_Offset), _modMesh._extraValue._weightCutout);                //"Offset (0~1)"

                if (cutOut != _modMesh._extraValue._weightCutout)
                {
                    cutOut = Mathf.Clamp01(cutOut);
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);

                    _modMesh._extraValue._weightCutout = cutOut;
                    apEditorUtil.ReleaseGUIFocus();
                }
            }
            else
            {
                //애니메이션이면 CutOut이 2개
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_Offset));
                float animPrevCutOut = EditorGUILayout.DelayedFloatField(_editor.GetText(TEXT.ExtraOpt_OffsetPrevKeyframe), _modMesh._extraValue._weightCutout_AnimPrev);                //"Prev Keyframe"
                float animNextCutOut = EditorGUILayout.DelayedFloatField(_editor.GetText(TEXT.ExtraOpt_OffsetNextKeyframe), _modMesh._extraValue._weightCutout_AnimNext);                //"Next Keyframe"

                if (animPrevCutOut != _modMesh._extraValue._weightCutout_AnimPrev ||
                    animNextCutOut != _modMesh._extraValue._weightCutout_AnimNext
                    )
                {
                    animPrevCutOut = Mathf.Clamp01(animPrevCutOut);
                    animNextCutOut = Mathf.Clamp01(animNextCutOut);
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);

                    _modMesh._extraValue._weightCutout_AnimPrev = animPrevCutOut;
                    _modMesh._extraValue._weightCutout_AnimNext = animNextCutOut;
                    apEditorUtil.ReleaseGUIFocus();
                }
            }

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);

            int tabBtnWidth  = ((width - 10) / 2);
            int tabBtnHeight = 25;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(tabBtnHeight));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.ExtraOpt_Tab_Depth), _tab == TAB.Depth, tabBtnWidth, tabBtnHeight))           //"Depth"
            {
                _tab = TAB.Depth;
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.ExtraOpt_Tab_Image), _tab == TAB.Image, tabBtnWidth, tabBtnHeight))           //"Image"
            {
                _tab = TAB.Image;
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            if (_tab == TAB.Depth)
            {
                //4. Depth
                //- 아이콘과 Chainging Depth 레이블
                //- On / Off 버튼
                //- Depth 증감과 리스트 (좌우에 배치)

                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_ChangingDepth));                //"Changing Depth"
                GUILayout.Space(5);

                //"Depth Option ON", "Depth Option OFF"
                if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.ExtraOpt_DepthOptOn), _editor.GetText(TEXT.ExtraOpt_DepthOptOff), _modMesh._extraValue._isDepthChanged, _modMesh._isExtraValueEnabled, width, 25))
                {
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);

                    _modMesh._extraValue._isDepthChanged = !_modMesh._extraValue._isDepthChanged;
                    _meshGroup.RefreshModifierLink();                    //<<Modifier Link를 다시 해야한다.
                    _editor.SetRepaint();
                }
                GUILayout.Space(5);

                bool isDepthAvailable = _modMesh._extraValue._isDepthChanged && _modMesh._isExtraValueEnabled;

                int depthListWidth_Left       = 80;
                int depthListWidth_Right      = width - (10 + depthListWidth_Left);
                int depthListWidth_RightInner = depthListWidth_Right - 20;
                int depthListHeight           = 276;
                //int depthListHeight_LeftBtn = (depthListHeight - 40) / 2;
                int depthListHeight_LeftBtn   = 40;
                int depthListHeight_LeftSpace = (depthListHeight - (40 + depthListHeight_LeftBtn * 2)) / 2;
                int depthListHeight_RightList = 20;

                //리스트 배경
                Rect lastRect = GUILayoutUtility.GetLastRect();
                if (!isDepthAvailable)
                {
                    GUI.backgroundColor = new Color(1.0f, 0.6f, 0.6f, 1.0f);
                }
                GUI.Box(new Rect(5 + depthListWidth_Left + 8, lastRect.y + 8, depthListWidth_Right, depthListHeight), "");
                if (!isDepthAvailable)
                {
                    GUI.backgroundColor = prevColor;
                }

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(depthListHeight));
                GUILayout.Space(5);
                EditorGUILayout.BeginVertical(GUILayout.Width(depthListWidth_Left), GUILayout.Height(depthListHeight));
                // Depth List의 왼쪽
                // Depth 증감 버튼과 값
                GUILayout.Space(depthListHeight_LeftSpace);

                Texture2D img_AddWeight      = _editor.ImageSet.Get(apImageSet.PRESET.Rig_AddWeight);
                Texture2D img_SubtractWeight = _editor.ImageSet.Get(apImageSet.PRESET.Rig_SubtractWeight);


                //if (GUILayout.Button(, GUILayout.Width(depthListWidth_Left), GUILayout.Height(depthListHeight_LeftBtn)))
                if (apEditorUtil.ToggledButton(img_AddWeight, false, isDepthAvailable, depthListWidth_Left, depthListHeight_LeftBtn))
                {
                    //Depth 증가
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);
                    _modMesh._extraValue._deltaDepth++;
                    _editor.SetRepaint();
                    apEditorUtil.ReleaseGUIFocus();
                }

                //"Delta Depth"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_DeltaDepth), GUILayout.Width(depthListWidth_Left));
                int deltaDepth = EditorGUILayout.DelayedIntField(_modMesh._extraValue._deltaDepth, GUILayout.Width(depthListWidth_Left));
                if (deltaDepth != _modMesh._extraValue._deltaDepth)
                {
                    if (isDepthAvailable)
                    {
                        apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);
                        _modMesh._extraValue._deltaDepth = deltaDepth;
                        _editor.SetRepaint();
                        apEditorUtil.ReleaseGUIFocus();
                    }
                }

                //if (GUILayout.Button(_editor.ImageSet.Get(apImageSet.PRESET.Rig_SubtractWeight), GUILayout.Width(depthListWidth_Left), GUILayout.Height(depthListHeight_LeftBtn)))
                if (apEditorUtil.ToggledButton(img_SubtractWeight, false, isDepthAvailable, depthListWidth_Left, depthListHeight_LeftBtn))
                {
                    //Depth 감소
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);
                    _modMesh._extraValue._deltaDepth--;
                    _editor.SetRepaint();
                    apEditorUtil.ReleaseGUIFocus();
                }

                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUILayout.Width(depthListWidth_Right), GUILayout.Height(depthListHeight));
                // RenderUnit 리스트와 변환될 Depth 위치
                _scrollList = EditorGUILayout.BeginScrollView(_scrollList, false, true, GUILayout.Width(depthListWidth_Right), GUILayout.Height(depthListHeight));

                EditorGUILayout.BeginVertical(GUILayout.Width(depthListWidth_RightInner), GUILayout.Height(depthListHeight));
                GUILayout.Space(5);

                SubUnit curSubUnit = null;



                //int cursorDepth = _renderUnit.GetDepth() + _modMesh._extraValue._deltaDepth;
                int cursorDepth = _targetDepth + _modMesh._extraValue._deltaDepth;

                //GUI Content 생성 [11.16 수정]
                if (_guiContent_DepthMidCursor == null)
                {
                    _guiContent_DepthMidCursor = apGUIContentWrapper.Make(_img_DepthMidCursor);
                }
                if (_guiContent_DepthCursor == null)
                {
                    _guiContent_DepthCursor = apGUIContentWrapper.Make(_img_DepthCursor);
                }
                if (_guiContent_MeshIcon == null)
                {
                    _guiContent_MeshIcon = apGUIContentWrapper.Make(_img_MeshTF);
                }
                if (_guiContent_MeshGroupIcon == null)
                {
                    _guiContent_MeshGroupIcon = apGUIContentWrapper.Make(_img_MeshGroupTF);
                }
                //이전 코드
                //GUIContent guiContent_DepthMidCursor = new GUIContent(_img_DepthMidCursor);
                //GUIContent guiContent_DepthCursor = new GUIContent(_img_DepthCursor);
                //GUIContent guiContent_MeshIcon = new GUIContent(_img_MeshTF);
                //GUIContent guiContent_MeshGroupIcon = new GUIContent(_img_MeshGroupTF);

                int depthCursorSize = depthListHeight_RightList;

                for (int i = 0; i < _subUnits_All.Count; i++)
                {
                    curSubUnit = _subUnits_All[i];

                    if (curSubUnit._isTarget)
                    {
                        //타겟이면 배경색을 그려주자
                        lastRect = GUILayoutUtility.GetLastRect();
                        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);
                        }

                        int yOffset = 6;
                        if (i == 0)
                        {
                            yOffset = 7 - depthListHeight_RightList;
                        }
                        GUI.Box(new Rect(lastRect.x, lastRect.y + depthListHeight_RightList + yOffset, depthListWidth_RightInner + 10, depthListHeight_RightList), "");
                        GUI.backgroundColor = prevColor;
                    }

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(depthListWidth_RightInner), GUILayout.Height(depthListHeight_RightList));


                    //TODO : Depth 커서 그려주기
                    //GUILayout.Space(20);

                    DEPTH_CURSOR_TYPE depthCursorType = DEPTH_CURSOR_TYPE.None;
                    if (!curSubUnit._isTarget)
                    {
                        if (cursorDepth != _targetDepth)
                        {
                            if (cursorDepth == curSubUnit._depth)
                            {
                                depthCursorType = DEPTH_CURSOR_TYPE.Target;
                            }
                            else
                            {
                                if (cursorDepth > _targetDepth)
                                {
                                    //Depth가 증가했을 때
                                    if (_targetDepth < curSubUnit._depth && curSubUnit._depth < cursorDepth)
                                    {
                                        depthCursorType = DEPTH_CURSOR_TYPE.Mid;
                                    }
                                }
                                else
                                {
                                    //Depth가 감소했을 때
                                    if (cursorDepth < curSubUnit._depth && curSubUnit._depth < _targetDepth)
                                    {
                                        depthCursorType = DEPTH_CURSOR_TYPE.Mid;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (cursorDepth != _targetDepth)
                        {
                            depthCursorType = DEPTH_CURSOR_TYPE.Mid;
                        }
                        else
                        {
                            depthCursorType = DEPTH_CURSOR_TYPE.Target;
                        }
                    }
                    GUILayout.Space(5);
                    switch (depthCursorType)
                    {
                    case DEPTH_CURSOR_TYPE.None:
                        GUILayout.Space(depthCursorSize + 4);
                        break;

                    case DEPTH_CURSOR_TYPE.Mid:
                        EditorGUILayout.LabelField(_guiContent_DepthMidCursor.Content, GUILayout.Width(depthCursorSize), GUILayout.Height(depthCursorSize));
                        break;

                    case DEPTH_CURSOR_TYPE.Target:
                        EditorGUILayout.LabelField(_guiContent_DepthCursor.Content, GUILayout.Width(depthCursorSize), GUILayout.Height(depthCursorSize));
                        break;
                    }

                    EditorGUILayout.LabelField(curSubUnit._isMeshTransform ? _guiContent_MeshIcon.Content : _guiContent_MeshGroupIcon.Content, GUILayout.Width(depthCursorSize), GUILayout.Height(depthCursorSize));
                    EditorGUILayout.LabelField(curSubUnit._depth.ToString(), GUILayout.Width(20), GUILayout.Height(depthListHeight_RightList));
                    EditorGUILayout.LabelField(curSubUnit._name,
                                               GUILayout.Width(depthListWidth_RightInner - (24 + 5 + depthCursorSize + depthCursorSize + 20 + 8)),
                                               GUILayout.Height(depthListHeight_RightList)
                                               );

                    EditorGUILayout.EndHorizontal();
                }

                GUILayout.Space(depthListHeight + 100);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();
            }
            else
            {
                //5. Texture (RenderUnit이 MeshTransform인 경우)
                //- 현재 텍스쳐
                //- 바뀔 텍스쳐
                //- 텍스쳐 선택하기 버튼

                //"Changing Image"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_ChangingImage));
                GUILayout.Space(5);

                //"Image Option ON", "Image Option OFF"
                if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.ExtraOpt_ImageOptOn), _editor.GetText(TEXT.ExtraOpt_ImageOptOff), _modMesh._extraValue._isTextureChanged, _isImageChangable && _modMesh._isExtraValueEnabled, width, 25))
                {
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);

                    _modMesh._extraValue._isTextureChanged = !_modMesh._extraValue._isTextureChanged;
                    _meshGroup.RefreshModifierLink();                    //<<Modifier Link를 다시 해야한다.
                    _editor.SetRepaint();
                }
                GUILayout.Space(5);

                bool isTextureAvailable = _modMesh._extraValue._isTextureChanged && _isImageChangable && _modMesh._isExtraValueEnabled;

                int imageSlotSize      = 170;
                int imageSlotSpaceSize = width - (imageSlotSize * 2 + 6 + 10);
                int imageSlotHeight    = imageSlotSize + 50;

                Texture2D img_Src    = null;
                Texture2D img_Dst    = null;
                string    strSrcName = "< None >";
                string    strDstName = "< None >";

                if (_srcTexureData != null && _srcTexureData._image != null)
                {
                    img_Src    = _srcTexureData._image;
                    strSrcName = _srcTexureData._name;
                }
                if (_dstTexureData != null && _dstTexureData._image != null)
                {
                    img_Dst    = _dstTexureData._image;
                    strDstName = _dstTexureData._name;
                }

                GUIStyle guiStyle_ImageSlot = new GUIStyle(GUI.skin.box);
                guiStyle_ImageSlot.alignment = TextAnchor.MiddleCenter;

                GUIStyle guiStyle_ImageName = new GUIStyle(GUI.skin.label);
                guiStyle_ImageName.alignment = TextAnchor.MiddleCenter;

                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(imageSlotHeight));
                GUILayout.Space(5);

                //이미지 슬롯 1 : 원래 이미지
                EditorGUILayout.BeginVertical(GUILayout.Width(imageSlotSize), GUILayout.Height(imageSlotHeight));
                //"Original"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_SlotOriginal), GUILayout.Width(imageSlotSize));
                GUILayout.Box(img_Src, guiStyle_ImageSlot, GUILayout.Width(imageSlotSize), GUILayout.Height(imageSlotSize));
                GUILayout.Space(5);
                EditorGUILayout.LabelField(strSrcName, guiStyle_ImageName, GUILayout.Width(imageSlotSize));
                EditorGUILayout.EndVertical();

                GUILayout.Space(imageSlotSpaceSize);

                //이미지 슬롯 1 : 원래 이미지
                EditorGUILayout.BeginVertical(GUILayout.Width(imageSlotSize), GUILayout.Height(imageSlotHeight));
                //"Changed"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.ExtraOpt_SlotChanged), GUILayout.Width(imageSlotSize));
                GUILayout.Box(img_Dst, guiStyle_ImageSlot, GUILayout.Width(imageSlotSize), GUILayout.Height(imageSlotSize));
                GUILayout.Space(5);
                EditorGUILayout.LabelField(strDstName, guiStyle_ImageName, GUILayout.Width(imageSlotSize));
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();
                //"Set Image"
                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.ExtraOpt_SelectImage), false, isTextureAvailable, width, 30))
                {
                    //이미지 열기 열기
                    _loadKey_TextureSelect = apDialog_SelectTextureData.ShowDialog(_editor, null, OnTextureDataSelected);
                }
                //"Reset Image"
                if (GUILayout.Button(_editor.GetText(TEXT.ExtraOpt_ResetImage), GUILayout.Width(width), GUILayout.Height(20)))
                {
                    apEditorUtil.SetRecord_Modifier(apUndoGroupData.ACTION.Modifier_SettingChanged, _editor, _modifier, _modMesh._extraValue, false);
                    _modMesh._extraValue._textureDataID     = -1;
                    _modMesh._extraValue._linkedTextureData = null;

                    RefreshImagePreview();

                    Repaint();
                }
            }

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);
            //"Close"
            if (GUILayout.Button(_editor.GetText(TEXT.Close), GUILayout.Height(30)))
            {
                isClose = true;
            }
            if (isClose)
            {
                CloseDialog();
            }

            if (isMoveAnimKeyframe)
            {
                //키프레임 이동의 경우,
                //타임라인 레이어를 따라서 전,후로 이동한다.
                //이때 ModMesh가 아예 바뀌기 때문에 여기서 처리해야한다.
                if (_keyframe != null && _keyframe._parentTimelineLayer != null && _animClip != null)
                {
                    apAnimKeyframe moveKeyframe = (isMoveAnimKeyframeToNext ? _keyframe._nextLinkedKeyframe : _keyframe._prevLinkedKeyframe);
                    if (moveKeyframe != null && moveKeyframe._linkedModMesh_Editor != null)
                    {
                        _keyframe = moveKeyframe;
                        _modMesh  = _keyframe._linkedModMesh_Editor;
                        _animClip.SetFrame_Editor(moveKeyframe._frameIndex);

                        RefreshImagePreview();

                        apEditorUtil.ReleaseGUIFocus();

                        Repaint();
                        _editor.SetRepaint();
                    }
                }
            }
        }
Ejemplo n.º 20
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, 41, width, height - 90), "");
            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();

            //1. Tab
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));

            string strCategory = "";

            if (_target == TARGET.Mesh)
            {
                //strCategory = "Meshes";
                strCategory = _editor.GetText(TEXT.DLG_Meshes);
            }
            else
            {
                //strCategory = "Mesh Groups";
                strCategory = _editor.GetText(TEXT.DLG_MeshGroups);
            }

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Mesh), (_target == TARGET.Mesh), (width / 2) - 2, 25))            //"Mesh"
            {
                _target = TARGET.Mesh;
            }

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_MeshGroup), (_target == TARGET.MeshGroup), (width / 2) - 2, 25))            //"MeshGroup"
            {
                _target = TARGET.MeshGroup;
            }

            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5);

            Texture2D iconImage_Mesh      = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Mesh);
            Texture2D iconImage_MeshGroup = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_MeshGroup);
            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;
            }



            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height - 90));
            GUILayout.Button(new GUIContent(strCategory, iconImageCategory), guiStyle_None, GUILayout.Height(20));            //<투명 버튼

            if (_target == TARGET.Mesh)
            {
                for (int i = 0; i < _meshes.Count; i++)
                {
                    GUIStyle curGUIStyle = guiStyle_None;
                    apMesh   mesh        = _meshes[i];
                    if (mesh == _curSelectedMesh)
                    {
                        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(" " + mesh._name, iconImage_Mesh), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                    {
                        _curSelectedMesh = mesh;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }
            else
            {
                for (int i = 0; i < _meshGroups.Count; i++)
                {
                    GUIStyle    curGUIStyle = guiStyle_None;
                    apMeshGroup meshGroup   = _meshGroups[i];
                    if (meshGroup == _curSelectedMeshGroup)
                    {
                        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(" " + meshGroup._name, iconImage_MeshGroup), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                    {
                        _curSelectedMeshGroup = meshGroup;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

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

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Add), GUILayout.Height(30)))            //"Add"
            {
                if (_target == TARGET.Mesh)
                {
                    _funcResult(true, _loadKey, _curSelectedMesh, null);
                }
                else
                {
                    _funcResult(true, _loadKey, null, _curSelectedMeshGroup);
                }
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, null, null);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
Ejemplo n.º 21
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                Debug.LogError("Exit - Editor / Portrait is Null");
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자 + Overall Menu가 아니라면..
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait || _editor.Select.SelectionType != apSelection.SELECTION_TYPE.Overall)
            {
                Debug.LogError("Exit - Editor / Portrait Missmatch");
                CloseDialog();
                return;
            }

            //여기서 체크 및 실행하자
            //Request => Process => Process 처리
            if (_exportProcessType == EXPORT_TYPE.None && _exportRequestType != EXPORT_TYPE.None)
            {
                _iProcess = 0;
                switch (_exportRequestType)
                {
                case EXPORT_TYPE.None:
                    break;

                case EXPORT_TYPE.Thumbnail:
                    _exportProcessType = EXPORT_TYPE.Thumbnail;
                    break;

                case EXPORT_TYPE.PNG:
                    _exportProcessType = EXPORT_TYPE.PNG;
                    break;

                case EXPORT_TYPE.GIFAnimation:
                    _exportProcessType = EXPORT_TYPE.GIFAnimation;
                    break;
                }

                _exportRequestType = EXPORT_TYPE.None;
            }
            switch (_exportProcessType)
            {
            case EXPORT_TYPE.None:
                break;

            case EXPORT_TYPE.Thumbnail:
                Process_MakeThumbnail();
                break;

            case EXPORT_TYPE.PNG:
                Process_PNGScreenShot();
                break;

            case EXPORT_TYPE.GIFAnimation:
                Process_MakeGIF();
                break;
            }

            _scroll = EditorGUILayout.BeginScrollView(_scroll, false, true, GUILayout.Width(width), GUILayout.Height(height));
            width  -= 24;
            EditorGUILayout.BeginVertical(GUILayout.Width(width));

            int settingWidth       = ((width - 10) / 3) - 4;
            int settingWidth_Label = 50;
            int settingWidth_Value = settingWidth - (50 + 8);
            int settingHeight      = 70;

            EditorGUILayout.LabelField("Setting");
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(settingHeight));
            GUILayout.Space(5);

            //Position
            //------------------------
            EditorGUILayout.BeginVertical(GUILayout.Width(settingWidth), GUILayout.Height(settingHeight));


            EditorGUILayout.LabelField("Position", GUILayout.Width(settingWidth));
            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("X", GUILayout.Width(settingWidth_Label));
            int posX = EditorGUILayout.DelayedIntField(_editor._captureFrame_PosX, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("Y", GUILayout.Width(settingWidth_Label));
            int posY = EditorGUILayout.DelayedIntField(_editor._captureFrame_PosY, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
            //------------------------


            //Capture Size
            //------------------------
            EditorGUILayout.BeginVertical(GUILayout.Width(settingWidth), GUILayout.Height(settingHeight));

            EditorGUILayout.LabelField("Capture Size", GUILayout.Width(settingWidth));
            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("Width", GUILayout.Width(settingWidth_Label));
            int srcSizeWidth = EditorGUILayout.DelayedIntField(_editor._captureFrame_SrcWidth, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("Height", GUILayout.Width(settingWidth_Label));
            int srcSizeHeight = EditorGUILayout.DelayedIntField(_editor._captureFrame_SrcHeight, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();


            if (srcSizeWidth < 8)
            {
                srcSizeWidth = 8;
            }
            if (srcSizeHeight < 8)
            {
                srcSizeHeight = 8;
            }

            EditorGUILayout.EndVertical();


            //------------------------

            //File Size
            //-------------------------------
            EditorGUILayout.BeginVertical(GUILayout.Width(settingWidth), GUILayout.Height(settingHeight));

            EditorGUILayout.LabelField("File Size", GUILayout.Width(settingWidth));

            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("Width", GUILayout.Width(settingWidth_Label));
            int dstSizeWidth = EditorGUILayout.DelayedIntField(_editor._captureFrame_DstWidth, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal(GUILayout.Width(settingWidth));
            EditorGUILayout.LabelField("Height", GUILayout.Width(settingWidth_Label));
            int dstSizeHeight = EditorGUILayout.DelayedIntField(_editor._captureFrame_DstHeight, GUILayout.Width(settingWidth_Value));

            EditorGUILayout.EndHorizontal();

            if (dstSizeWidth < 8)
            {
                dstSizeWidth = 8;
            }
            if (dstSizeHeight < 8)
            {
                dstSizeHeight = 8;
            }



            EditorGUILayout.EndVertical();
            //-------------------------------

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(30));
            GUILayout.Space(5);
            int setting2CompWidth = ((width - 10) / 2) - 8;

            //Color와 AspectRatio
            EditorGUILayout.LabelField("BG Color", GUILayout.Width(80));
            Color prevCaptureColor = _editor._captureFrame_Color;

            try
            {
                _editor._captureFrame_Color = EditorGUILayout.ColorField(_editor._captureFrame_Color, GUILayout.Width(setting2CompWidth - 86));
            }
            catch (Exception) { }


            GUILayout.Space(30);
            if (apEditorUtil.ToggledButton_2Side("Aspect Ratio Fixed", "Aspect Ratio Not Fixed", _editor._isCaptureAspectRatioFixed, true, setting2CompWidth - 20, 20))
            {
                _editor._isCaptureAspectRatioFixed = !_editor._isCaptureAspectRatioFixed;

                if (_editor._isCaptureAspectRatioFixed)
                {
                    //AspectRatio를 굳혔다.
                    //Dst계열 변수를 Src에 맞춘다.
                    //Height를 고정, Width를 맞춘다.
                    _editor._captureFrame_DstWidth = GetAspectRatio_Width(_editor._captureFrame_DstHeight, _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight);
                    dstSizeWidth = _editor._captureFrame_DstWidth;
                }

                _editor.SaveEditorPref();


                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();


            //AspectRatio를 맞추어보자
            if (_editor._isCaptureAspectRatioFixed)
            {
                if (srcSizeWidth != _editor._captureFrame_SrcWidth)
                {
                    //Width가 바뀌었다. => Height를 맞추자
                    srcSizeHeight = GetAspectRatio_Height(srcSizeWidth, _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight);
                    //>> Dst도 바꾸자 => Width
                    dstSizeWidth = GetAspectRatio_Width(dstSizeHeight, _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight);
                }
                else if (srcSizeHeight != _editor._captureFrame_SrcHeight)
                {
                    //Height가 바뀌었다. => Width를 맞추자
                    srcSizeWidth = GetAspectRatio_Width(srcSizeHeight, _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight);
                    //>> Dst도 바꾸자 => Height
                    dstSizeHeight = GetAspectRatio_Height(dstSizeWidth, _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight);
                }
                else if (dstSizeWidth != _editor._captureFrame_DstWidth)
                {
                    //Width가 바뀌었다. => Height를 맞추자
                    dstSizeHeight = GetAspectRatio_Height(dstSizeWidth, _editor._captureFrame_DstWidth, _editor._captureFrame_DstHeight);
                    //>> Src도 바꾸다 => Width
                    srcSizeWidth = GetAspectRatio_Width(srcSizeHeight, _editor._captureFrame_DstWidth, _editor._captureFrame_DstHeight);
                }
                else if (dstSizeHeight != _editor._captureFrame_DstHeight)
                {
                    //Height가 바뀌었다. => Width를 맞추자
                    dstSizeWidth = GetAspectRatio_Width(dstSizeHeight, _editor._captureFrame_DstWidth, _editor._captureFrame_DstHeight);
                    //>> Dst도 바꾸자 => Height
                    srcSizeHeight = GetAspectRatio_Height(srcSizeWidth, _editor._captureFrame_DstWidth, _editor._captureFrame_DstHeight);
                }
            }

            if (posX != _editor._captureFrame_PosX ||
                posY != _editor._captureFrame_PosY ||
                srcSizeWidth != _editor._captureFrame_SrcWidth ||
                srcSizeHeight != _editor._captureFrame_SrcHeight ||
                dstSizeWidth != _editor._captureFrame_DstWidth ||
                dstSizeHeight != _editor._captureFrame_DstHeight
                )
            {
                _editor._captureFrame_PosX      = posX;
                _editor._captureFrame_PosY      = posY;
                _editor._captureFrame_SrcWidth  = srcSizeWidth;
                _editor._captureFrame_SrcHeight = srcSizeHeight;
                _editor._captureFrame_DstWidth  = dstSizeWidth;
                _editor._captureFrame_DstHeight = dstSizeHeight;

                _editor.SaveEditorPref();
                apEditorUtil.ReleaseGUIFocus();
            }

            if (prevCaptureColor.r != _editor._captureFrame_Color.r ||
                prevCaptureColor.g != _editor._captureFrame_Color.g ||
                prevCaptureColor.b != _editor._captureFrame_Color.b)
            {
                _editor.SaveEditorPref();
                //색상은 GUIFocus를 null로 만들면 안되기에..
            }



            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);

            EditorGUILayout.LabelField("Thumbnail Capture");
            GUILayout.Space(5);

            EditorGUILayout.LabelField("File Path");
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            GUILayout.Box(_editor._portrait._thumbnailImage, GUI.skin.label, GUILayout.Width(50), GUILayout.Height(25));
            _editor._portrait._imageFilePath_Thumbnail = EditorGUILayout.TextField(_editor._portrait._imageFilePath_Thumbnail, GUILayout.Width(width - (130)));
            if (GUILayout.Button("Change", GUILayout.Width(60)))
            {
                string fileName = EditorUtility.SaveFilePanelInProject("Thumbnail File Path", _editor._portrait.name + "_Thumb.png", "png", "Please Enter a file name to save Thumbnail to");
                if (!string.IsNullOrEmpty(fileName))
                {
                    _editor._portrait._imageFilePath_Thumbnail = fileName;
                    apEditorUtil.ReleaseGUIFocus();
                }
            }
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Make Thumbnail", GUILayout.Width(width), GUILayout.Height(30)))
            {
                if (string.IsNullOrEmpty(_editor._portrait._imageFilePath_Thumbnail))
                {
                    //EditorUtility.DisplayDialog("Thumbnail Creating Failed", "File Name is Empty", "Close");
                    EditorUtility.DisplayDialog(_editor.GetText(apLocalization.TEXT.ThumbCreateFailed_Title),
                                                _editor.GetText(apLocalization.TEXT.ThumbCreateFailed_Body_NoFile),
                                                _editor.GetText(apLocalization.TEXT.Close)
                                                );
                }
                else
                {
                    RequestExport(EXPORT_TYPE.Thumbnail);
                    #region [비동기 스타일로 변경]
                    //int thumbnailWidth = 256;
                    //int thumbnailHeight = 128;

                    //float preferAspectRatio = (float)thumbnailWidth / (float)thumbnailHeight;

                    //float srcAspectRatio = (float)_editor._captureFrame_SrcWidth / (float)_editor._captureFrame_SrcHeight;
                    ////긴쪽으로 캡쳐 크기를 맞춘다.
                    //int srcThumbWidth = _editor._captureFrame_SrcWidth;
                    //int srcThumbHeight = _editor._captureFrame_SrcHeight;
                    ////AspectRatio = W / H
                    //if(srcAspectRatio < preferAspectRatio)
                    //{
                    //	//가로가 더 길군요.
                    //	//가로를 자릅시다.

                    //	//H = W / AspectRatio;
                    //	srcThumbHeight = (int)((srcThumbWidth / preferAspectRatio) + 0.5f);
                    //}
                    //else
                    //{
                    //	//세로가 더 길군요.
                    //	//세로를 자릅시다.
                    //	//W = AspectRatio * H
                    //	srcThumbWidth = (int)((srcThumbHeight * preferAspectRatio) + 0.5f);
                    //}


                    //Texture2D result = _editor.Exporter.RenderToTexture(_editor.Select.RootUnit._childMeshGroup,
                    //												(int)(_editor._captureFrame_PosX + apGL.WindowSizeHalf.x), (int)(_editor._captureFrame_PosY + apGL.WindowSizeHalf.y),
                    //												srcThumbWidth, srcThumbHeight,
                    //												thumbnailWidth, thumbnailHeight,
                    //												_editor._captureFrame_Color
                    //												);

                    //if (result != null)
                    //{
                    //	//이미지를 저장하자
                    //	//이건 Asset으로 자동 저장
                    //	string filePathWOExtension = _editor._portrait._imageFilePath_Thumbnail.Substring(0, _editor._portrait._imageFilePath_Thumbnail.Length - 4);
                    //	bool isSaveSuccess = _editor.Exporter.SaveTexture2DToPNG(result, filePathWOExtension, true);

                    //	if(isSaveSuccess)
                    //	{
                    //		AssetDatabase.Refresh();

                    //		_editor._portrait._thumbnailImage = AssetDatabase.LoadAssetAtPath<Texture2D>(_editor._portrait._imageFilePath_Thumbnail);
                    //	}
                    //}
                    #endregion
                }
            }

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);

            //Screenshot을 찍자
            //-----------------------------------------------------------------------------------------------------------------------
            //-----------------------------------------------------------------------------------------------------------------------
            EditorGUILayout.LabelField("Screenshot Capture");
            GUILayout.Space(5);
            if (GUILayout.Button("Take a Screenshot", GUILayout.Width(width), GUILayout.Height(30)))
            {
                RequestExport(EXPORT_TYPE.PNG);
            }

            //-----------------------------------------------------------------------------------------------------------------------
            //-----------------------------------------------------------------------------------------------------------------------

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);


            //GIF Animation을 만들자
            //-----------------------------------------------------------------------------------------------------------------------
            //-----------------------------------------------------------------------------------------------------------------------
            EditorGUILayout.LabelField("GIF Animation");
            GUILayout.Space(5);

            apRootUnit curRootUnit = _editor.Select.RootUnit;

            if (_curRootUnit != curRootUnit)
            {
                //AnimList 리셋
                _animClips.Clear();

                _curRootUnit = curRootUnit;
                if (_curRootUnit != null)
                {
                    for (int i = 0; i < _editor._portrait._animClips.Count; i++)
                    {
                        apAnimClip animClip = _editor._portrait._animClips[i];
                        if (animClip._targetMeshGroup == _curRootUnit._childMeshGroup)
                        {
                            _animClips.Add(animClip);
                        }
                    }
                }

                _selectedAnimClip = null;
            }
            if (curRootUnit == null)
            {
                _selectedAnimClip = null;
            }
            else
            {
                if (_selectedAnimClip != null && _animClips.Count > 0)
                {
                    if (!_animClips.Contains(_selectedAnimClip))
                    {
                        _selectedAnimClip = null;
                    }
                }
                else
                {
                    _selectedAnimClip = null;
                }
            }

            string animName    = "< Animation is not selected >";
            Color  animBGColor = new Color(1.0f, 0.7f, 0.7f, 1.0f);
            if (_selectedAnimClip != null)
            {
                animName    = _selectedAnimClip._name;
                animBGColor = new Color(0.7f, 1.0f, 0.7f, 1.0f);
            }

            Color    prevGUIColor = GUI.backgroundColor;
            GUIStyle guiStyleBox  = new GUIStyle(GUI.skin.box);
            guiStyleBox.alignment = TextAnchor.MiddleCenter;

            GUI.backgroundColor = animBGColor;

            GUILayout.Box(animName, guiStyleBox, GUILayout.Width(width), GUILayout.Height(30));

            GUI.backgroundColor = prevGUIColor;

            GUILayout.Space(5);
            int width_GIFSetting = (width - 32) / 2;

            int gifQuality = 256 - _editor._captureFrame_GIFSampleQuality;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            string strQuality = "";
            if (gifQuality > 200)
            {
                strQuality = "Quality [ High ]";
            }
            else if (gifQuality > 120)
            {
                strQuality = "Quality [ Medium ]";
            }
            else
            {
                strQuality = "Quality [ Low ]";
            }
            EditorGUILayout.LabelField(strQuality, GUILayout.Width(width_GIFSetting));
            GUILayout.Space(20);

            EditorGUILayout.LabelField("Loop Count", GUILayout.Width(width_GIFSetting));

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            GUILayout.Space(5);
            //10 ~ 256
            //246 ~ 0
            gifQuality = EditorGUILayout.IntSlider(gifQuality, 0, 246, GUILayout.Width(width_GIFSetting));

            gifQuality = 256 - gifQuality;
            if (_editor._captureFrame_GIFSampleQuality != gifQuality)
            {
                _editor._captureFrame_GIFSampleQuality = gifQuality;
                _editor.SaveEditorPref();
            }

            GUILayout.Space(20);

            int loopCount = EditorGUILayout.DelayedIntField(_editor._captureFrame_GIFSampleLoopCount, GUILayout.Width(width_GIFSetting));

            if (loopCount != _editor._captureFrame_GIFSampleLoopCount)
            {
                loopCount = Mathf.Clamp(loopCount, 1, 10);
                _editor._captureFrame_GIFSampleLoopCount = loopCount;
                _editor.SaveEditorPref();
            }

            EditorGUILayout.EndHorizontal();

            //GUILayout.Space(10);

            //Rect lastRect_Progress = GUILayoutUtility.GetLastRect();

            //Rect barRect = new Rect(lastRect_Progress.x + 5, lastRect_Progress.y + 10, width - 5, 16);
            //float barRatio = 0.0f;
            //string strProcessName = "";
            //if(_exportProcessType == EXPORT_TYPE.GIFAnimation)
            //{
            //	barRatio = Mathf.Clamp01((float)_exportProcessX100 / 100.0f);
            //	strProcessName = "Exporting.. [ " + _exportProcessX100 + "% ]";
            //}

            ////EditorGUI.ProgressBar(barRect, barRatio, "Convert PSD Data To Editor..");

            //EditorGUI.ProgressBar(barRect, barRatio, strProcessName);
            //GUILayout.Space(20);


            if (apEditorUtil.ToggledButton_2Side("Take a GIF Animation", "Take a GIF Animation", false, (_selectedAnimClip != null), width, 30))
            {
                //RequestExport(EXPORT_TYPE.GIFAnimation);//리퀘스트 안할래..
                string defFileName  = "GIF_" + DateTime.Now.Year + "" + DateTime.Now.Month + "" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Second + ".gif";
                string saveFilePath = EditorUtility.SaveFilePanel("Save GIF Animation", _prevFilePath_Directory, defFileName, "gif");
                if (!string.IsNullOrEmpty(saveFilePath))
                {
                    bool result = _editor.Exporter.MakeGIFAnimation(saveFilePath,
                                                                    _editor.Select.RootUnit._childMeshGroup,
                                                                    _selectedAnimClip, _editor._captureFrame_GIFSampleLoopCount,
                                                                    (int)(_editor._captureFrame_PosX + apGL.WindowSizeHalf.x), (int)(_editor._captureFrame_PosY + apGL.WindowSizeHalf.y),
                                                                    _editor._captureFrame_SrcWidth, _editor._captureFrame_SrcHeight,
                                                                    _editor._captureFrame_DstWidth, _editor._captureFrame_DstHeight,
                                                                    _editor._captureFrame_Color,
                                                                    _editor._captureFrame_GIFSampleQuality
                                                                    );
                    if (result)
                    {
                        System.IO.FileInfo fi = new System.IO.FileInfo(saveFilePath);

                        Application.OpenURL("file://" + fi.Directory.FullName);
                        Application.OpenURL("file://" + saveFilePath);

                        _prevFilePath           = _editor.Exporter.GIF_FilePath;
                        _prevFilePath_Directory = fi.Directory.FullName;
                    }
                }
            }

            GUILayout.Space(10);

            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);
            guiStyle.normal.textColor = GUI.skin.label.normal.textColor;

            GUILayout.Button("Animation Clips", guiStyle, GUILayout.Width(width), GUILayout.Height(20));            //투명 버튼


            //애니메이션 클립 리스트를 만들어야 한다.
            if (_animClips.Count > 0)
            {
                Texture2D iconImage = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Animation);

                apAnimClip nextSelectedAnimClip = null;
                for (int i = 0; i < _animClips.Count; i++)
                {
                    apAnimClip animClip = _animClips[i];

                    if (animClip == _selectedAnimClip)
                    {
                        Rect lastRect = GUILayoutUtility.GetLastRect();
                        prevCaptureColor = GUI.backgroundColor;

                        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 = prevGUIColor;
                    }

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50));
                    GUILayout.Space(15);
                    if (GUILayout.Button(new GUIContent(" " + animClip._name, iconImage), guiStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                    {
                        nextSelectedAnimClip = animClip;
                    }

                    EditorGUILayout.EndHorizontal();
                }

                if (nextSelectedAnimClip != null)
                {
                    for (int i = 0; i < _editor._portrait._animClips.Count; i++)
                    {
                        _editor._portrait._animClips[i]._isSelectedInEditor = false;
                    }

                    nextSelectedAnimClip.LinkEditor(_editor._portrait);
                    nextSelectedAnimClip.RefreshTimelines();
                    nextSelectedAnimClip.SetFrame_Editor(nextSelectedAnimClip.StartFrame);
                    nextSelectedAnimClip.Pause_Editor();
                    nextSelectedAnimClip._isSelectedInEditor = true;
                    _selectedAnimClip = nextSelectedAnimClip;

                    _editor._portrait._animPlayManager.SetAnimClip_Editor(_selectedAnimClip);
                }
            }

            EditorGUILayout.EndVertical();
            GUILayout.Space(500);

            EditorGUILayout.EndScrollView();


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

            if (_editor == null || _editor._portrait == null || _editor._portrait != _portrait)
            {
                return;
            }

            bool isGUIEvent = (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout);


            EditorGUILayout.BeginVertical();

            Texture2D iconImageAnimation = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Animation);
            Texture2D iconImageCategory  = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown);
            Texture2D iconImageAddParam  = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Add);
            Texture2D iconImageLayerUp   = _editor.ImageSet.Get(apImageSet.PRESET.Modifier_LayerUp);
            Texture2D iconImageLayerDown = _editor.ImageSet.Get(apImageSet.PRESET.Modifier_LayerDown);
            Texture2D iconImageRemove    = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_RemoveTransform);

            GUIStyle guiStyleBox = new GUIStyle(GUI.skin.box);

            guiStyleBox.alignment        = TextAnchor.MiddleCenter;
            guiStyleBox.normal.textColor = apEditorUtil.BoxTextColor;

            //"  [ " + _animClip._name + " ] Animation Events"

            //변경
            if (_guiContent_AnimClipName == null)
            {
                _guiContent_AnimClipName = apGUIContentWrapper.Make(string.Format("  [ {0} ] {1}", _animClip._name, _editor.GetText(TEXT.DLG_AnimationEvents)), false, iconImageAnimation);
            }
            if (_guiContent_Range == null)
            {
                _guiContent_Range = apGUIContentWrapper.Make(string.Format("{0} : {1} ~ {2}", _editor.GetText(TEXT.DLG_Range), _animClip.StartFrame, _animClip.EndFrame), false);
            }
            if (_guiContent_IsLoop == null)
            {
                _guiContent_IsLoop = apGUIContentWrapper.Make(string.Format("{0} : {1}", _editor.GetText(TEXT.DLG_IsLoopAnimation), _animClip.IsLoop), false);
            }


            GUILayout.Box(_guiContent_AnimClipName.Content, guiStyleBox, GUILayout.Width(width - 10), GUILayout.Height(35));

            GUILayout.Space(5);
            //"Range : " + _animClip.StartFrame + " ~ " + _animClip.EndFrame
            EditorGUILayout.LabelField(_guiContent_Range.Content);

            //"Is Loop Animation : " + _animClip.IsLoop
            EditorGUILayout.LabelField(_guiContent_IsLoop.Content);

            GUILayout.Space(10);

            GUIStyle guiStyle_None = new GUIStyle(GUIStyle.none);

            guiStyle_None.normal.textColor = GUI.skin.label.normal.textColor;
            guiStyle_None.alignment        = TextAnchor.MiddleLeft;

            GUIStyle guiStyle_Selected = new GUIStyle(GUIStyle.none);

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

            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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


            int topHeight    = 120;
            int bottomHeight = 380;


            Color prevColor = GUI.backgroundColor;

            GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
            GUI.Box(new Rect(0, topHeight - 26, width, height - (topHeight + bottomHeight)), "");
            GUI.backgroundColor = prevColor;



            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height - (topHeight + bottomHeight)));
            GUILayout.Space(5);
            //"Animation Events"
            if (_guiContent_AnimEventCategory == null)
            {
                _guiContent_AnimEventCategory = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_AnimationEvents), false, iconImageCategory);
            }


            GUILayout.Button(_guiContent_AnimEventCategory.Content, guiStyle_None, GUILayout.Height(20));            //<투명 버튼//

            int nAnimEvents = 0;

            if (_animClip._animEvents != null)
            {
                nAnimEvents = _animClip._animEvents.Count;
            }

            //GUILayout.Space(10);
            apAnimEvent animEvent = null;

            for (int i = 0; i < nAnimEvents; i++)
            {
                GUIStyle curGUIStyle = guiStyle_None;
                animEvent = _animClip._animEvents[i];

                if (animEvent == _curSelectedEvent)
                {
                    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 + 21, width, 20), "");
                    GUI.backgroundColor = prevColor;

                    curGUIStyle = guiStyle_Selected;
                }


                EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50));
                GUILayout.Space(15);
                if (GUILayout.Button("[" + i + "] " + animEvent._eventName, curGUIStyle, GUILayout.Width(width - 80), GUILayout.Height(20)))
                {
                    _curSelectedEvent = animEvent;
                }

                if (animEvent._callType == apAnimEvent.CALL_TYPE.Once)
                {
                    if (GUILayout.Button(animEvent._frameIndex.ToString(), curGUIStyle, GUILayout.Width(45), GUILayout.Height(20)))
                    {
                        _curSelectedEvent = animEvent;
                    }
                }
                else
                {
                    if (GUILayout.Button(animEvent._frameIndex + " ~ " + animEvent._frameIndex_End, curGUIStyle, GUILayout.Width(45), GUILayout.Height(20)))
                    {
                        _curSelectedEvent = animEvent;
                    }
                }

                EditorGUILayout.EndHorizontal();
            }

            GUILayout.Space((height - (topHeight + bottomHeight)) + 100);
            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal(GUILayout.Height(30));
            GUILayout.Space(5);

            //"Add Event"
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_AddEvent), GUILayout.Width(width - (10 + 6 + (160))), GUILayout.Height(30)))
            {
                apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_AddEvent, _editor, _animClip._portrait, null, false);

                if (_animClip._animEvents == null)
                {
                    _animClip._animEvents = new List <apAnimEvent>();
                }

                apAnimEvent newEvent = new apAnimEvent();
                //새로운 이름을 찾자
                int    iNewName = 0;
                string newName  = "NewAnimEvent_" + iNewName;

                int cnt = 0;
                while (true)
                {
                    if (cnt > 500)
                    {
                        newName = "NewAnimEvent_Infinity";
                        break;
                    }
                    //중복되는 이름이 있는가
                    newName = "NewAnimEvent_" + iNewName;
                    bool isExist = _animClip._animEvents.Exists(delegate(apAnimEvent a)
                    {
                        return(string.Equals(a._eventName, newName));
                    });
                    if (!isExist)
                    {
                        //중복되지 않는 이름이다.
                        break;
                    }

                    //이름이 중복되는 군염
                    cnt++;
                    iNewName++;
                }

                newEvent._eventName  = newName;
                newEvent._frameIndex = _defaultFrame;

                _animClip._animEvents.Add(newEvent);

                _curSelectedEvent = newEvent;
            }

            //추가 3.29 : 이벤트 복사하기 : 프레임은 무조건 다음 프레임에
            string strCopy = _editor.GetUIWord(UIWORD.Copy);

            //if(GUILayout.Button(_editor.GetUIWord(UIWORD.Copy), GUILayout.Width(80), GUILayout.Height(30)))
            if (apEditorUtil.ToggledButton_2Side(strCopy, strCopy, false, _curSelectedEvent != null, 80, 30))
            {
                if (_curSelectedEvent != null)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_AddEvent, _editor, _animClip._portrait, null, false);

                    if (_animClip._animEvents == null)
                    {
                        _animClip._animEvents = new List <apAnimEvent>();
                    }

                    apAnimEvent newEvent = new apAnimEvent();

                    //선택한 이벤트와 동일한 속성으로 설정.
                    //- _defaultFrame과 다르다면, 거기에 복사
                    //- _defaultFrame과 같다면 +1프레임
                    newEvent._eventName = _curSelectedEvent._eventName;
                    newEvent._callType  = _curSelectedEvent._callType;

                    if (newEvent._callType == apAnimEvent.CALL_TYPE.Once)
                    {
                        if (_curSelectedEvent._frameIndex == _defaultFrame)
                        {
                            newEvent._frameIndex     = _curSelectedEvent._frameIndex + 1;
                            newEvent._frameIndex_End = _curSelectedEvent._frameIndex_End + 1;
                        }
                        else
                        {
                            int frameLength = Mathf.Max(_curSelectedEvent._frameIndex_End - _curSelectedEvent._frameIndex, 0);

                            newEvent._frameIndex     = _defaultFrame;
                            newEvent._frameIndex_End = newEvent._frameIndex + frameLength;
                        }
                    }
                    else
                    {
                        int frameLength = Mathf.Max(_curSelectedEvent._frameIndex_End - _curSelectedEvent._frameIndex, 0);

                        if (_curSelectedEvent._frameIndex <= _defaultFrame && _defaultFrame <= _curSelectedEvent._frameIndex + frameLength)
                        {
                            //DefaultFrame이 기존 이벤트 영역에 포함되어 있다.
                            //기존 영역의 밖에서 생성
                            newEvent._frameIndex     = _curSelectedEvent._frameIndex + frameLength + 1;
                            newEvent._frameIndex_End = newEvent._frameIndex + frameLength;
                        }
                        else
                        {
                            //DefaultFrame이 기존 이벤트 영역 밖에 있다.
                            //DefaultFrame부터 생성
                            newEvent._frameIndex     = _defaultFrame;
                            newEvent._frameIndex_End = newEvent._frameIndex + frameLength;
                        }
                    }

                    if (_curSelectedEvent._subParams == null)
                    {
                        _curSelectedEvent._subParams = new List <apAnimEvent.SubParameter>();
                    }
                    if (_curSelectedEvent._subParams != null)
                    {
                        for (int iParam = 0; iParam < _curSelectedEvent._subParams.Count; iParam++)
                        {
                            apAnimEvent.SubParameter existParam = _curSelectedEvent._subParams[iParam];
                            apAnimEvent.SubParameter newParam   = new apAnimEvent.SubParameter();

                            //속성들 복사
                            newParam._paramType      = existParam._paramType;
                            newParam._boolValue      = existParam._boolValue;
                            newParam._intValue       = existParam._intValue;
                            newParam._floatValue     = existParam._floatValue;
                            newParam._vec2Value      = existParam._vec2Value;
                            newParam._strValue       = existParam._strValue;
                            newParam._intValue_End   = existParam._intValue_End;
                            newParam._floatValue_End = existParam._floatValue_End;
                            newParam._vec2Value_End  = existParam._vec2Value_End;

                            newEvent._subParams.Add(newParam);
                        }
                    }


                    _animClip._animEvents.Add(newEvent);

                    _curSelectedEvent = newEvent;
                }
            }

            //"Sort"
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Sort), GUILayout.Width(80), GUILayout.Height(30)))
            {
                apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_SortEvents, _editor, _animClip._portrait, null, false);

                //프레임 순으로 정렬을 한다.
                if (_animClip._animEvents != null)
                {
                    _animClip._animEvents.Sort(delegate(apAnimEvent a, apAnimEvent b)
                    {
                        if (a._frameIndex == b._frameIndex)
                        {
                            return(string.Compare(a._eventName, b._eventName));
                        }
                        return(a._frameIndex - b._frameIndex);
                    });

                    apEditorUtil.SetEditorDirty();
                }
            }
            EditorGUILayout.EndHorizontal();

            //선택된 AnimEvent에 대한 설정을 하자
            GUILayout.Space(5);
            apEditorUtil.GUI_DelimeterBoxH(width - 10);
            GUILayout.Space(5);

            //선택이 안되었다면 더미 데이터로 채워야함
            int    curFrameIndex     = 0;
            int    curFrameIndex_End = 0;
            string curName           = "<None>";

            apAnimEvent.CALL_TYPE           curCallType  = apAnimEvent.CALL_TYPE.Once;
            List <apAnimEvent.SubParameter> curSubParams = null;
            int curNumSubParams = 0;

            bool isSelected = _curSelectedEvent != null && _animClip._animEvents.Contains(_curSelectedEvent);

            if (isSelected)
            {
                curFrameIndex     = _curSelectedEvent._frameIndex;
                curFrameIndex_End = _curSelectedEvent._frameIndex_End;
                curName           = _curSelectedEvent._eventName;
                curCallType       = _curSelectedEvent._callType;
                curSubParams      = _curSelectedEvent._subParams;
                curNumSubParams   = curSubParams.Count;
            }

            if (isSelected)
            {
                GUI.backgroundColor = new Color(0.6f, 0.8f, 0.9f, 1.0f);
            }

            //"(Not Selected)"
            GUILayout.Box((isSelected) ? curName : "(" + _editor.GetText(TEXT.DLG_NotSelected) + ")", guiStyleBox, GUILayout.Width(width - 10), GUILayout.Height(25));

            GUI.backgroundColor = prevColor;

            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(GUILayout.Height(90));
            curName     = EditorGUILayout.DelayedTextField(_editor.GetText(TEXT.DLG_EventName), curName);                      //"Event(Function) Name"
            curCallType = (apAnimEvent.CALL_TYPE)EditorGUILayout.EnumPopup(_editor.GetText(TEXT.DLG_CallMethod), curCallType); //"Call Method"
            if (curCallType == apAnimEvent.CALL_TYPE.Once)
            {
                curFrameIndex = EditorGUILayout.DelayedIntField(_editor.GetText(TEXT.DLG_TargetFrame), curFrameIndex);                //"Target Frame"
            }
            else
            {
                curFrameIndex     = EditorGUILayout.DelayedIntField(_editor.GetText(TEXT.DLG_StartFrame), curFrameIndex);            //"Start Frame"
                curFrameIndex_End = EditorGUILayout.DelayedIntField(_editor.GetText(TEXT.DLG_EndFrame), curFrameIndex_End);          //"End Frame"
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Parameters));            //"Parameters"
            GUILayout.Space(5);


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

            if (!isSelected)
            {
                if (!isGUIEvent)
                {
                    curNumSubParams = _prevNumSubParams;
                }
            }

            _scrollList_Param = EditorGUILayout.BeginScrollView(_scrollList_Param, GUILayout.Width(width), GUILayout.Height(100));

            GUILayout.Space(5);
            int valueWidth     = width - (10 + 35 + 130 + 36 + 36 + 36 + 20);
            int valueHalfWidth = ((valueWidth / 2) - 10);
            int midWaveWidth   = 20;

            valueWidth += 7;

            GUIStyle guiStyleListBtn = new GUIStyle(GUI.skin.button);

            guiStyleListBtn.margin = GUI.skin.textField.margin;

            apAnimEvent.SubParameter targetSubParam = null;
            bool isLayerUp     = false;
            bool isLayerDown   = false;
            bool isRemoveParam = false;

            //SubParam 리스트를 출력하자
            if (curNumSubParams > 0)
            {
                if (isSelected && curSubParams != null && curSubParams.Count == curNumSubParams)
                {
                    for (int i = 0; i < curNumSubParams; i++)
                    {
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50), GUILayout.Height(24));
                        GUILayout.Space(15);
                        GUILayout.Label("[" + i + "]", GUILayout.Width(30), GUILayout.Height(20));

                        curSubParams[i]._paramType = (apAnimEvent.PARAM_TYPE)EditorGUILayout.EnumPopup(curSubParams[i]._paramType, GUILayout.Width(120), GUILayout.Height(20));

                        switch (curSubParams[i]._paramType)
                        {
                        case apAnimEvent.PARAM_TYPE.Bool:
                        {
                            bool nextValue = EditorGUILayout.Toggle(curSubParams[i]._boolValue, GUILayout.Width(valueWidth));

                            if (curSubParams[i]._boolValue != nextValue)
                            {
                                apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                curSubParams[i]._boolValue = nextValue;
                            }
                        }
                        break;

                        case apAnimEvent.PARAM_TYPE.Integer:
                        {
                            if (curCallType == apAnimEvent.CALL_TYPE.Once)
                            {
                                int nextValue = EditorGUILayout.DelayedIntField(curSubParams[i]._intValue, GUILayout.Width(valueWidth));

                                if (curSubParams[i]._intValue != nextValue)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                    curSubParams[i]._intValue = nextValue;
                                }
                            }
                            else
                            {
                                int nextValue_Prev = EditorGUILayout.DelayedIntField(curSubParams[i]._intValue, GUILayout.Width(valueHalfWidth));
                                EditorGUILayout.LabelField(" ~ ", GUILayout.Width(midWaveWidth));
                                int nextValue_Next = EditorGUILayout.DelayedIntField(curSubParams[i]._intValue_End, GUILayout.Width(valueHalfWidth));

                                if (curSubParams[i]._intValue != nextValue_Prev ||
                                    curSubParams[i]._intValue_End != nextValue_Next)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                    curSubParams[i]._intValue     = nextValue_Prev;
                                    curSubParams[i]._intValue_End = nextValue_Next;
                                }
                            }
                        }
                        break;

                        case apAnimEvent.PARAM_TYPE.Float:
                        {
                            if (curCallType == apAnimEvent.CALL_TYPE.Once)
                            {
                                float nextValue = EditorGUILayout.DelayedFloatField(curSubParams[i]._floatValue, GUILayout.Width(valueWidth));
                                if (curSubParams[i]._floatValue != nextValue)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                    curSubParams[i]._floatValue = nextValue;
                                }
                            }
                            else
                            {
                                float nextValue_Prev = EditorGUILayout.DelayedFloatField(curSubParams[i]._floatValue, GUILayout.Width(valueHalfWidth));
                                EditorGUILayout.LabelField(" ~ ", GUILayout.Width(midWaveWidth));
                                float nextVelue_Next = EditorGUILayout.DelayedFloatField(curSubParams[i]._floatValue_End, GUILayout.Width(valueHalfWidth));

                                if (curSubParams[i]._floatValue != nextValue_Prev ||
                                    curSubParams[i]._floatValue_End != nextVelue_Next)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);

                                    curSubParams[i]._floatValue     = nextValue_Prev;
                                    curSubParams[i]._floatValue_End = nextVelue_Next;
                                }
                            }
                        }
                        break;

                        case apAnimEvent.PARAM_TYPE.Vector2:
                        {
                            if (curCallType == apAnimEvent.CALL_TYPE.Once)
                            {
                                Vector2 nextValue = apEditorUtil.DelayedVector2Field(curSubParams[i]._vec2Value, valueWidth);
                                if (curSubParams[i]._vec2Value.x != nextValue.x ||
                                    curSubParams[i]._vec2Value.y != nextValue.y)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                    curSubParams[i]._vec2Value = nextValue;
                                }
                            }
                            else
                            {
                                Vector2 nextValue_Prev = apEditorUtil.DelayedVector2Field(curSubParams[i]._vec2Value, valueHalfWidth);
                                EditorGUILayout.LabelField(" ~ ", GUILayout.Width(midWaveWidth));
                                Vector2 nextValue_Next = apEditorUtil.DelayedVector2Field(curSubParams[i]._vec2Value_End, valueHalfWidth);


                                if (curSubParams[i]._vec2Value.x != nextValue_Prev.x ||
                                    curSubParams[i]._vec2Value.y != nextValue_Prev.y ||
                                    curSubParams[i]._vec2Value_End.x != nextValue_Next.x ||
                                    curSubParams[i]._vec2Value_End.y != nextValue_Next.y)
                                {
                                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);

                                    curSubParams[i]._vec2Value     = nextValue_Prev;
                                    curSubParams[i]._vec2Value_End = nextValue_Next;
                                }
                            }
                        }
                        break;

                        case apAnimEvent.PARAM_TYPE.String:
                        {
                            string nextValue = EditorGUILayout.DelayedTextField(curSubParams[i]._strValue, GUILayout.Width(valueWidth));
                            if (!string.Equals(curSubParams[i]._strValue, nextValue))
                            {
                                apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                                curSubParams[i]._strValue = nextValue;
                            }
                        }
                        break;
                        }

                        if (GUILayout.Button(iconImageLayerUp, guiStyleListBtn, GUILayout.Width(30), GUILayout.Height(20)))
                        {
                            targetSubParam = curSubParams[i];
                            isLayerUp      = true;
                        }
                        if (GUILayout.Button(iconImageLayerDown, guiStyleListBtn, GUILayout.Width(30), GUILayout.Height(20)))
                        {
                            targetSubParam = curSubParams[i];
                            isLayerDown    = true;
                        }
                        if (GUILayout.Button(iconImageRemove, guiStyleListBtn, GUILayout.Width(30), GUILayout.Height(20)))
                        {
                            targetSubParam = curSubParams[i];
                            isRemoveParam  = true;
                        }


                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    for (int i = 0; i < curNumSubParams; i++)
                    {
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50));
                        GUILayout.Space(15);
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width - 50));
            GUILayout.Space(15);

            //변경
            if (_guiContent_AddParameter == null)
            {
                _guiContent_AddParameter = new apGUIContentWrapper();
                _guiContent_AddParameter.ClearText(false);
                _guiContent_AddParameter.AppendSpaceText(1, false);
                _guiContent_AddParameter.AppendText(_editor.GetText(TEXT.DLG_AddParameter), true);

                _guiContent_AddParameter.SetImage(iconImageAddParam);
            }

            if (isSelected)
            {
                //" Add Parameter"
                if (GUILayout.Button(_guiContent_AddParameter.Content, guiStyle_None, GUILayout.Height(20)))
                {
                    if (isSelected && curSubParams != null && curSubParams.Count == curNumSubParams)
                    {
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);

                        curSubParams.Add(new apAnimEvent.SubParameter());
                    }
                }
            }
            else
            {
                if (GUILayout.Button(apEditorUtil.Text_EMPTY, guiStyle_None, GUILayout.Height(20)))
                {
                    //Nooo..
                }
            }
            EditorGUILayout.EndHorizontal();



            GUILayout.Space(150);

            EditorGUILayout.EndScrollView();

            GUILayout.Space(10);

            EditorGUILayout.BeginVertical(GUILayout.Width(width), GUILayout.Height(40));
            if (isSelected)
            {
                //"Remove Event [" + curName + "]"
                if (GUILayout.Button(string.Format("{0} [{1}]", _editor.GetText(TEXT.DLG_RemoveEvent), curName), GUILayout.Height(20)))
                {
                    if (_curSelectedEvent != null && _animClip._animEvents.Contains(_curSelectedEvent))
                    {
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_RemoveEvent, _editor, _animClip._portrait, null, false);
                        _animClip._animEvents.Remove(_curSelectedEvent);

                        _curSelectedEvent = null;
                        isSelected        = false;
                    }
                }
            }
            else
            {
                if (GUILayout.Button("", guiStyle_None, GUILayout.Height(20)))
                {
                }
            }
            EditorGUILayout.EndVertical();



            if (isSelected && _curSelectedEvent != null)
            {
                //순서를 바꾸거나 SubParam을 삭제하는 요청이 있으면 처리해주자
                if (targetSubParam != null && _curSelectedEvent._subParams.Contains(targetSubParam))
                {
                    if (isLayerUp)
                    {
                        //Index -1

                        int index = _curSelectedEvent._subParams.IndexOf(targetSubParam);
                        if (index > 0)
                        {
                            apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                            _curSelectedEvent._subParams.Remove(targetSubParam);
                            _curSelectedEvent._subParams.Insert(index - 1, targetSubParam);
                        }
                    }
                    else if (isLayerDown)
                    {
                        //Index +1
                        int index = _curSelectedEvent._subParams.IndexOf(targetSubParam);
                        if (index < _curSelectedEvent._subParams.Count - 1)
                        {
                            apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                            _curSelectedEvent._subParams.Remove(targetSubParam);
                            _curSelectedEvent._subParams.Insert(index + 1, targetSubParam);
                        }
                    }
                    else if (isRemoveParam)
                    {
                        //삭제한다.
                        apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);
                        _curSelectedEvent._subParams.Remove(targetSubParam);
                    }
                }


                if (_curSelectedEvent._frameIndex != curFrameIndex ||
                    _curSelectedEvent._frameIndex_End != curFrameIndex_End ||
                    _curSelectedEvent._eventName != curName ||
                    _curSelectedEvent._callType != curCallType)
                {
                    apEditorUtil.SetRecord_Portrait(apUndoGroupData.ACTION.Anim_EventChanged, _editor, _animClip._portrait, null, false);

                    _curSelectedEvent._frameIndex     = curFrameIndex;
                    _curSelectedEvent._frameIndex_End = curFrameIndex_End;
                    _curSelectedEvent._eventName      = curName;
                    _curSelectedEvent._callType       = curCallType;
                }
            }


            EditorGUILayout.BeginHorizontal();
            bool isClose = false;

            //"Close"
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))
            {
                isClose = true;
                apEditorUtil.ReleaseGUIFocus();
            }
            EditorGUILayout.EndHorizontal();


            if (isGUIEvent)
            {
                _prevNumSubParams = curNumSubParams;
            }

            if (isClose)
            {
                CloseDialog();
            }
        }
        // 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, 35, width, height - (90 + 58)), "");
            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);
            //"Select Modifier"
            GUILayout.Button(_editor.GetText(TEXT.DLG_SelectModifier), guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));            //<투명 버튼
            GUILayout.Space(10);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height - (90 + 58)));


            //"Modifiers"
            GUILayout.Button(new GUIContent(_editor.GetText(TEXT.DLG_Modifiers), iconImageCategory), guiStyle_None, GUILayout.Height(20));            //<투명 버튼

            //GUILayout.Space(10);
            for (int i = 0; i < _modifiers.Count; i++)
            {
                GUIStyle curGUIStyle = guiStyle_None;
                if (_modifiers[i] == _curSelectedMod)
                {
                    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(" " + _modifiers[i]._name, _modifiers[i]._iconImage), curGUIStyle, GUILayout.Width(width - 35), GUILayout.Height(20)))
                {
                    _curSelectedMod = _modifiers[i];
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            GUIStyle guiStyle_InfoBox = new GUIStyle(GUI.skin.box);

            guiStyle_InfoBox.alignment        = TextAnchor.MiddleCenter;
            guiStyle_InfoBox.normal.textColor = apEditorUtil.BoxTextColor;

            GUILayout.Box(GetModInfo(), guiStyle_InfoBox, GUILayout.Width(width - 6), GUILayout.Height(54));
            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal();


            bool isClose = false;

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Select), GUILayout.Height(30)))            //"Select"
            {
                if (_curSelectedMod != null)
                {
                    //if(_curSelectedMod._modType == apModifierBase.MODIFIER_TYPE.Physic && apVersion.I.IsDemo)
                    if (!apVersion.I.IsAddableModifier((int)_curSelectedMod._modType, _curSelectedMod._validationKey))
                    {
                        //데모 버전 + 물리 Modifier는 데모 버전에서 선택할 수 없다.
                        EditorUtility.DisplayDialog(
                            _editor.GetText(TEXT.DemoLimitation_Title),
                            _editor.GetText(TEXT.DemoLimitation_Body),
                            _editor.GetText(TEXT.Okay));
                    }
                    else
                    {
                        _funcResult(true, _loadKey, _curSelectedMod._modType, _targetMeshGroup, _curSelectedMod._validationKey);
                        isClose = true;
                    }
                }
                else
                {
                    _funcResult(false, _loadKey, apModifierBase.MODIFIER_TYPE.Base, _targetMeshGroup, -1);
                    isClose = true;
                }
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, apModifierBase.MODIFIER_TYPE.Base, _targetMeshGroup, -1);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // GUI
        //------------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

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

            Color prevColor = GUI.backgroundColor;

            //레이아웃 구조
            //1. Save
            // - 저장 버튼
            //2. Load
            // - 로드 버튼
            // - 본 정보 리스트
            //   - <색상> 인덱스, 이름 -> 적용 여부 + IK + 색상 로드
            // - 전체 선택 / 해제
            // - 전체 IK 포함 여부,
            // - 옵션 : 크기

            width -= 10;

            //1. Save
            GUIStyle guiStyleBox = new GUIStyle(GUI.skin.box);

            guiStyleBox.alignment        = TextAnchor.MiddleCenter;
            guiStyleBox.normal.textColor = apEditorUtil.BoxTextColor;

            GUIStyle guiStyleBox_Left = new GUIStyle(GUI.skin.textField);

            guiStyleBox_Left.alignment = TextAnchor.MiddleLeft;

            //"  Export Bone Structure"
            GUILayout.Box(new GUIContent("  " + _editor.GetText(TEXT.DLG_ExportBoneStructure), _editor.ImageSet.Get(apImageSet.PRESET.Rig_SaveLoad)), guiStyleBox, GUILayout.Width(width), GUILayout.Height(35));
            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            int nBones = _targetMeshGroup._boneList_All.Count;
            //int nBones = _targetMeshGroup._boneList_All
            string strBones = "";

            if (nBones == 0)
            {
                //strBones = "No Bones to Export";
                strBones = _editor.GetText(TEXT.DLG_NoBonesToExport);
            }
            else if (nBones == 1)
            {
                //strBones = "1 Bone to Export";
                strBones = _editor.GetText(TEXT.DLG_1BoneToExport);
            }
            else
            {
                //strBones = nBones + " Bones to Export";
                strBones = _editor.GetTextFormat(TEXT.DLG_NBonesToExport, nBones);
            }
            if (nBones > 0)
            {
                GUI.backgroundColor = new Color(prevColor.r * 0.8f, prevColor.g * 1.5f, prevColor.b * 1.5f, 1.0f);
            }
            else
            {
                GUI.backgroundColor = new Color(prevColor.r * 1.5f, prevColor.g * 0.8f, prevColor.b * 0.8f, 1.0f);
            }
            GUILayout.Box(strBones, guiStyleBox, GUILayout.Width(width - 120), GUILayout.Height(25));
            GUI.backgroundColor = prevColor;

            //" Export"
            if (apEditorUtil.ToggledButton(_editor.ImageSet.Get(apImageSet.PRESET.Rig_SaveLoad), " " + _editor.GetText(TEXT.Export), false, (nBones > 0), 115, 25))
            {
                string saveFilePath = EditorUtility.SaveFilePanel("Save Bone Structure", "", "", "apb");
                if (!string.IsNullOrEmpty(saveFilePath))
                {
                    //Save를 하자
                    bool isResult = apRetarget.SaveBaseStruct(_targetMeshGroup, saveFilePath);
                    if (isResult)
                    {
                        _editor.Notification("[" + saveFilePath + "] is Saved", false, false);
                        //Debug.Log("[" + saveFilePath + "] is Saved");
                    }
                    else
                    {
                        //Debug.LogError("File Save Failed");
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);


            //2. Load
            // - 로드 버튼
            // - 본 정보 리스트
            //   - <색상> 인덱스, 이름 -> 적용 여부 + IK + 색상 로드
            // - 전체 선택 / 해제
            // - 전체 IK 포함 여부,
            // - 옵션 : 크기
            //"  Import Bone Structure"
            GUILayout.Box(new GUIContent("  " + _editor.GetText(TEXT.DLG_ImportBoneStructure), _editor.ImageSet.Get(apImageSet.PRESET.Rig_LoadBones)), guiStyleBox, GUILayout.Width(width), GUILayout.Height(35));
            GUILayout.Space(5);

            //로드한 파일 정보
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            //TODO :
            bool   isFileLoaded = _retargetData.IsBaseFileLoaded;
            string strFileName  = _retargetData.BaseLoadedFilePath;

            if (isFileLoaded)
            {
                GUI.backgroundColor = new Color(prevColor.r * 0.8f, prevColor.g * 2.0f, prevColor.b * 0.8f, 1.0f);
            }
            else
            {
                //strFileName = "No File is Imported";
                strFileName         = _editor.GetText(TEXT.DLG_NoFileIsImported);
                GUI.backgroundColor = new Color(prevColor.r * 1.5f, prevColor.g * 0.8f, prevColor.b * 0.8f, 1.0f);
            }

            EditorGUILayout.TextField(strFileName, guiStyleBox_Left, GUILayout.Width(width - 120), GUILayout.Height(25));
            GUI.backgroundColor = prevColor;

            //"Load File"
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_LoadFile), false, true, 115, 25))
            {
                string loadFilePath = EditorUtility.OpenFilePanel("Open Bone Structure", "", "apb");
                if (!string.IsNullOrEmpty(loadFilePath))
                {
                    bool loadResult = _retargetData.LoadBaseStruct(loadFilePath);
                    if (loadResult)
                    {
                        _editor.Notification("[" + loadFilePath + "] is Loaded", false, false);
                        //Debug.Log("[" + loadFilePath + "] is Loaded");
                    }
                }
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            int listHeight = height - 450;

            Rect lastRect = GUILayoutUtility.GetLastRect();

            GUI.backgroundColor = new Color(0.7f, 0.7f, 0.7f);
            GUI.Box(new Rect(0, lastRect.y + 5, width + 10, listHeight), "");
            GUI.backgroundColor = prevColor;


            List <apRetargetBoneUnit> baseBoneUnits = _retargetData.BaseBoneUnits;

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, false, true, GUILayout.Width(width + 10), GUILayout.Height(listHeight));
            EditorGUILayout.BeginVertical(GUILayout.Width(width - 20));

            if (baseBoneUnits != null)
            {
                GUIStyle guiStyle_ItemLabel = new GUIStyle(GUI.skin.label);
                guiStyle_ItemLabel.alignment = TextAnchor.MiddleLeft;

                GUIStyle guiStyle_ItemTextBox = new GUIStyle(GUI.skin.textField);
                guiStyle_ItemTextBox.alignment = TextAnchor.MiddleLeft;

                //   - <색상> 인덱스, 이름 -> 적용 여부 + IK + 색상 로드
                apRetargetBoneUnit boneUnit = null;
                int itemWidth  = width - 20;
                int itemHeight = 20;

                string strImport   = _editor.GetText(TEXT.DLG_Import);
                string strNoImport = _editor.GetText(TEXT.DLG_NoImport);
                string strIK       = "IK";          //<<이건 고유명사
                string strNoIK     = _editor.GetText(TEXT.DLG_NoIK);
                string strShape    = _editor.GetText(TEXT.DLG_Shape);
                string strNoShape  = _editor.GetText(TEXT.DLG_NoShape);

                for (int i = 0; i < baseBoneUnits.Count; i++)
                {
                    boneUnit = baseBoneUnits[i];
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
                    GUILayout.Space(10);
                    GUI.backgroundColor = boneUnit._color;
                    GUILayout.Box("", apEditorUtil.WhiteGUIStyle_Box, GUILayout.Width(16), GUILayout.Height(16));
                    GUI.backgroundColor = prevColor;

                    EditorGUILayout.LabelField(boneUnit._unitID.ToString(), guiStyle_ItemLabel, GUILayout.Width(30), GUILayout.Height(itemHeight));
                    boneUnit._name = EditorGUILayout.TextField(boneUnit._name, guiStyle_ItemTextBox, GUILayout.Width(120), GUILayout.Height(itemHeight));

                    GUILayout.Space(20);

                    //"Import", "Not Import"
                    if (apEditorUtil.ToggledButton_2Side(strImport, strNoImport, boneUnit._isImportEnabled, true, 100, itemHeight))
                    {
                        boneUnit._isImportEnabled = !boneUnit._isImportEnabled;
                    }
                    GUILayout.Space(10);
                    //"IK", "No IK"
                    if (apEditorUtil.ToggledButton_2Side(strIK, strNoIK, boneUnit._isIKEnabled, boneUnit._isImportEnabled, 70, itemHeight))
                    {
                        boneUnit._isIKEnabled = !boneUnit._isIKEnabled;
                    }
                    //"Shape", "No Shape"
                    if (apEditorUtil.ToggledButton_2Side(strShape, strNoShape, boneUnit._isShapeEnabled, boneUnit._isImportEnabled, 70, itemHeight))
                    {
                        boneUnit._isShapeEnabled = !boneUnit._isShapeEnabled;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndVertical();
            GUILayout.Space(listHeight + 100);
            EditorGUILayout.EndScrollView();
            GUILayout.Space(20);

            // - 전체 선택 / 해제
            // - 전체 IK 포함 여부,
            // - 옵션 : 크기
            int widthHalf = (width / 2) - 4;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_EnableAllBones), false, isFileLoaded, widthHalf, 25))            //"Enable All Bones"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isImportEnabled = true;
                    }
                }
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_DisableAllBones), false, isFileLoaded, widthHalf, 25))            //"Disable All Bones"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isImportEnabled = false;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_EnableAllIK), false, isFileLoaded, widthHalf, 25))            //"Enable All IK"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isIKEnabled = true;
                    }
                }
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_DisableAllIK), false, isFileLoaded, widthHalf, 25))            //"Disable All IK"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isIKEnabled = false;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
            GUILayout.Space(5);
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_EnableAllShape), false, isFileLoaded, widthHalf, 25))            //"Enable All Shape"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isShapeEnabled = true;
                    }
                }
            }
            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_DisableAllShape), false, isFileLoaded, widthHalf, 25))            //"Disable All Shape"
            {
                if (baseBoneUnits != null)
                {
                    for (int i = 0; i < baseBoneUnits.Count; i++)
                    {
                        baseBoneUnits[i]._isShapeEnabled = false;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            int widthLabel = 150;
            int widthValue = width - 155;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(20));
            GUILayout.Space(5);

            //"Import Scale"
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_ImportScale), GUILayout.Width(widthLabel));
            _retargetData._importScale = EditorGUILayout.FloatField(_retargetData._importScale, GUILayout.Width(widthValue));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);
            bool isClose = false;
            bool isSelectBtnAvailable = _retargetData.IsBaseFileLoaded;            //<<TODO : 파일을 연게 있다면 이게 true

            //"  Import to [" + _targetMeshGroup._name + "]"
            if (apEditorUtil.ToggledButton(_editor.ImageSet.Get(apImageSet.PRESET.Rig_LoadBones),
                                           "  " + _editor.GetTextFormat(TEXT.DLG_ImportToMeshGroup, _targetMeshGroup._name), false, isSelectBtnAvailable, width, 30))
            {
                _funcResult(true, _loadKey, _retargetData, _targetMeshGroup);
                isClose = true;
            }

            GUILayout.Space(10);
            apEditorUtil.GUI_DelimeterBoxH(width);
            GUILayout.Space(10);

            if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Close), false, true, width, 30))            //"Close"
            {
                //_funcResult(false, _loadKey, null, null);
                _funcResult(false, _loadKey, null, _targetMeshGroup);
                isClose = true;
            }

            if (isClose)
            {
                CloseDialog();
            }
        }
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetMeshGroup == null)
            {
                CloseDialog();
                return;
            }

            try
            {
                Color prevColor = GUI.backgroundColor;

                //레이아웃 구조
                // 타이틀
                // Pose 리스트 경로 + 변경 + 갱신
                // Pose 보기 종류 : 동일 MeshGroup만, 동일 Portrait만, 모든 Scene에서의 Pose 기록 (Import 안될 수도 있음)
                // Pose 리스트
                // 선택한 Pose 정보
                // Pose 이름, 설명
                // 저장된 Bone 이름들 (최대 4개 보여주기)
                // Import / Close

                width -= 10;

                //1. 다이얼로그 타이틀
                GUIStyle guiStyleBox = new GUIStyle(GUI.skin.box);
                guiStyleBox.alignment        = TextAnchor.MiddleCenter;
                guiStyleBox.normal.textColor = apEditorUtil.BoxTextColor;

                GUIStyle guiStyleBox_Left = new GUIStyle(GUI.skin.textField);
                guiStyleBox_Left.alignment = TextAnchor.MiddleLeft;

                //"  Import Pose"
                GUILayout.Box(new GUIContent("  " + _editor.GetText(TEXT.DLG_ImportPose), _editor.ImageSet.Get(apImageSet.PRESET.Rig_LoadBones)), guiStyleBox, GUILayout.Width(width), GUILayout.Height(35));
                GUILayout.Space(5);

                //2. Pose 리스트 경로 + 변경 + 갱신
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(20));
                int changeBtnWidth  = 70;
                int refreshBtnWidth = 80;
                int pathWidth       = width - (changeBtnWidth + refreshBtnWidth + 4 + 10);

                GUILayout.Space(5);
                EditorGUILayout.TextField(_editor._bonePose_BaseFolderName, GUILayout.Width(pathWidth), GUILayout.Height(20));

                //"Change"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Change), GUILayout.Width(changeBtnWidth), GUILayout.Height(20)))
                {
                    string pathResult = EditorUtility.SaveFolderPanel("Set the Pose Folder", _editor._bonePose_BaseFolderName, "");
                    if (!string.IsNullOrEmpty(pathResult))
                    {
                        Uri targetUri = new Uri(pathResult);
                        Uri baseUri   = new Uri(Application.dataPath);

                        string relativePath = baseUri.MakeRelativeUri(targetUri).ToString();

                        _editor._bonePose_BaseFolderName = relativePath;

                        apEditorUtil.SetEditorDirty();

                        _editor.SaveEditorPref();

                        _retarget.LoadSinglePoseFileList(_editor);
                        _selectedBonePoseFile = null;
                        _isValidPose          = false;
                    }
                }
                //"Refresh"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Refresh), GUILayout.Width(refreshBtnWidth), GUILayout.Height(20)))
                {
                    _retarget.LoadSinglePoseFileList(_editor);
                    _selectedBonePoseFile = null;
                    _isValidPose          = false;
                }

                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);

                //3. Pose 보기 종류
                int categoryBtnWidth  = (width - 10) / 3 - 1;
                int categoryBtnHeight = 20;
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(categoryBtnHeight));
                GUILayout.Space(5);

                //"Same MeshGroup"
                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_SameGroup), _category == CATEGORY.SameMeshGroup, true, categoryBtnWidth, categoryBtnHeight))
                {
                    _category             = CATEGORY.SameMeshGroup;
                    _selectedBonePoseFile = null;
                    _isValidPose          = false;
                }

                //"Same Portrait"
                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_SamePortrait), _category == CATEGORY.SamePortrait, true, categoryBtnWidth, categoryBtnHeight))
                {
                    _category             = CATEGORY.SamePortrait;
                    _selectedBonePoseFile = null;
                    _isValidPose          = false;
                }

                //"All Poses"
                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_AllPoses), _category == CATEGORY.AllPoses, true, categoryBtnWidth, categoryBtnHeight))
                {
                    _category             = CATEGORY.AllPoses;
                    _selectedBonePoseFile = null;
                    _isValidPose          = false;
                }

                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);

                //4. Pose 리스트
                int listHeight = height - 450;

                Rect lastRect = GUILayoutUtility.GetLastRect();

                GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
                GUI.Box(new Rect(0, lastRect.y + 5, width + 10, listHeight), "");

                List <apRetargetPoseListFile.FileMetaData> metaDataList = _retarget.SinglePoseList._metaDataList;

                int itemWidth  = width - 20;
                int itemHeight = 20;

                int poseNameWidth      = 120;
                int portraitNameWidth  = 100;
                int meshGroupNameWidth = 100;
                int selectBtnWidth     = (width - 40) - (poseNameWidth + portraitNameWidth + meshGroupNameWidth + 6);

                GUIStyle guiStyle_ItemLabel = new GUIStyle(GUI.skin.label);
                guiStyle_ItemLabel.alignment = TextAnchor.MiddleLeft;

                GUIStyle guiStyle_ItemCategory = new GUIStyle(GUI.skin.label);
                //guiStyle_ItemCategory.alignment = TextAnchor.MiddleCenter;
                if (EditorGUIUtility.isProSkin)
                {
                    guiStyle_ItemCategory.normal.textColor = Color.cyan;
                }
                else
                {
                    guiStyle_ItemCategory.normal.textColor = Color.blue;
                }


                _scrollList = EditorGUILayout.BeginScrollView(_scrollList, false, true, GUILayout.Width(width + 10), GUILayout.Height(listHeight));
                EditorGUILayout.BeginVertical(GUILayout.Width(width - 10));

                if (!_retarget.SinglePoseList._isFolderExist)
                {
                    //"Pose Folder does not exist."
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_PoseFolderNotExist), GUILayout.Width(itemWidth));
                }
                else
                {
                    //Pose 이름 / Portrait 이름 / MeshGroup 이름 / 선택

                    EditorGUILayout.BeginHorizontal(GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
                    GUILayout.Space(5);

                    //"Name"
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Name), guiStyle_ItemCategory, GUILayout.Width(poseNameWidth), GUILayout.Height(itemHeight));

                    //"Portrait"
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Portrait), guiStyle_ItemCategory, GUILayout.Width(portraitNameWidth), GUILayout.Height(itemHeight));

                    //"Mesh Group"
                    EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_MeshGroup), guiStyle_ItemCategory, GUILayout.Width(meshGroupNameWidth), GUILayout.Height(itemHeight));
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    apRetargetPoseListFile.FileMetaData metaData = null;
                    for (int i = 0; i < metaDataList.Count; i++)
                    {
                        metaData = metaDataList[i];

                        if (_category == CATEGORY.AllPoses)
                        {
                            //그냥 통과
                        }
                        else if (_category == CATEGORY.SamePortrait)
                        {
                            if (!string.Equals(_portraitName, metaData._portraitName))
                            {
                                //Portrait 이름이 다르면 스킵
                                continue;
                            }
                        }
                        else if (_category == CATEGORY.SameMeshGroup)
                        {
                            if (!string.Equals(_portraitName, metaData._portraitName) ||
                                _meshGroupUniqueID != metaData._meshGroupUniqueID)
                            {
                                //Portrait 이름이 다르거나 MeshGroupUniqueID가 다르다면 스킵
                                continue;
                            }
                        }

                        EditorGUILayout.BeginHorizontal(GUILayout.Width(itemWidth), GUILayout.Height(itemHeight));
                        GUILayout.Space(5);
                        EditorGUILayout.LabelField(metaData._poseName, guiStyle_ItemLabel, GUILayout.Width(poseNameWidth), GUILayout.Height(itemHeight));
                        EditorGUILayout.LabelField(metaData._portraitName, guiStyle_ItemLabel, GUILayout.Width(portraitNameWidth), GUILayout.Height(itemHeight));
                        EditorGUILayout.LabelField(metaData._meshGroupName, guiStyle_ItemLabel, GUILayout.Width(meshGroupNameWidth), GUILayout.Height(itemHeight));

                        //"Selected", "Select"
                        if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.DLG_Selected),
                                                             _editor.GetText(TEXT.DLG_Select), metaData == _selectedBonePoseFile, true, selectBtnWidth, itemHeight))
                        {
                            _selectedBonePoseFile = metaData;

                            _isValidPose = string.Equals(_portraitName, metaData._portraitName) &&
                                           _meshGroupUniqueID == metaData._meshGroupUniqueID;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }

                EditorGUILayout.EndVertical();
                GUILayout.Space(listHeight + 100);

                EditorGUILayout.EndScrollView();

                GUILayout.Space(10);
                //정보를 출력한다.
                //Pose 이름
                //설명
                //Portrait
                //MeshGroup
                //MeshGroup이 다르면 경고를 준다.
                //Bone 개수와 이름들
                //string selectedPoseName = "No Pose Selected";
                string selectedPoseName      = _editor.GetText(TEXT.DLG_NoPoseSelected);
                string selectedDesc          = "";
                string selectedPortrait      = "";
                string selectedMeshGroupName = "";
                int    boneCount             = 0;
                string selectedBoneNames     = "";

                if (_selectedBonePoseFile != null)
                {
                    selectedPoseName      = _selectedBonePoseFile._poseName;
                    selectedDesc          = _selectedBonePoseFile._description;
                    selectedPortrait      = _selectedBonePoseFile._portraitName;
                    selectedMeshGroupName = _selectedBonePoseFile._meshGroupName;
                    boneCount             = _selectedBonePoseFile._nBones;
                    selectedBoneNames     = _selectedBonePoseFile._boneNames;
                }

                GUIStyle guiStyle_Desc = new GUIStyle(GUI.skin.textField);
                guiStyle_Desc.wordWrap = true;

                if (_selectedBonePoseFile != null)
                {
                    GUI.backgroundColor = new Color(GUI.backgroundColor.r * 1.0f, GUI.backgroundColor.g * 1.8f, GUI.backgroundColor.b * 1.2f, 1.0f);
                }
                GUILayout.Box(selectedPoseName, guiStyleBox, GUILayout.Width(width), GUILayout.Height(30));
                if (_selectedBonePoseFile != null)
                {
                    GUI.backgroundColor = prevColor;
                }

                //"Description"
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Description), GUILayout.Width(width));
                EditorGUILayout.LabelField(selectedDesc, guiStyle_Desc, GUILayout.Width(width), GUILayout.Height(45));

                GUILayout.Space(5);

                EditorGUILayout.LabelField(string.Format("{0} : {1}", _editor.GetText(TEXT.DLG_Portrait), selectedPortrait), GUILayout.Width(width));            //"Portrait : "
                EditorGUILayout.LabelField(string.Format("{0} : {1}", _editor.GetText(TEXT.DLG_MeshGroup), selectedMeshGroupName), GUILayout.Width(width));      //"Mesh Group : "
                GUILayout.Space(5);
                EditorGUILayout.LabelField(string.Format("{0} : {1}", _editor.GetText(TEXT.DLG_NumberBones), boneCount), GUILayout.Width(width));                //"Number of Bones : "

                if (_selectedBonePoseFile == null)
                {
                    //"No Bones"
                    GUILayout.Box(_editor.GetText(TEXT.DLG_NoBones), GUILayout.Width(width), GUILayout.Height(45));
                }
                else
                {
                    if (_isValidPose)
                    {
                        GUI.backgroundColor = new Color(GUI.backgroundColor.r * 1.0f, GUI.backgroundColor.g * 1.5f, GUI.backgroundColor.b * 1.2f, 1.0f);
                        GUILayout.Box(selectedBoneNames, guiStyleBox, GUILayout.Width(width), GUILayout.Height(45));
                        GUI.backgroundColor = prevColor;
                    }
                    else
                    {
                        GUI.backgroundColor = new Color(GUI.backgroundColor.r * 1.5f, GUI.backgroundColor.g * 0.7f, GUI.backgroundColor.b * 0.7f, 1.0f);
                        //"[Warning. Import may not work properly]\n" + selectedBoneNames
                        GUILayout.Box(string.Format("[{0}]\n{1}", _editor.GetText(TEXT.DLG_Warningproperly), selectedBoneNames), guiStyleBox, GUILayout.Width(width), GUILayout.Height(45));
                        GUI.backgroundColor = prevColor;
                    }
                }

                //"Remove Pose", "Remove Pose"
                if (apEditorUtil.ToggledButton_2Side(_editor.GetText(TEXT.DLG_RemovePose), _editor.GetText(TEXT.DLG_RemovePose), false, _selectedBonePoseFile != null, width, 20))
                {
                    bool isResult = EditorUtility.DisplayDialog(_editor.GetText(TEXT.Retarget_RemoveSinglePose_Title),
                                                                _editor.GetTextFormat(TEXT.Retarget_RemoveSinglePose_Body, selectedPoseName),
                                                                _editor.GetText(TEXT.Remove), _editor.GetText(TEXT.Cancel)
                                                                );

                    if (isResult && _selectedBonePoseFile != null)
                    {
                        _retarget.SinglePoseList.RemoveFile(_selectedBonePoseFile);

                        //리스트 갱신
                        _retarget.LoadSinglePoseFileList(_editor);
                        _selectedBonePoseFile = null;
                        _isValidPose          = false;
                    }
                }

                string strImportPose = " " + _editor.GetText(TEXT.DLG_ImportPose);
                GUILayout.Space(10);

                //" Import Pose", " Import Pose"
                if (apEditorUtil.ToggledButton_2Side(_editor.ImageSet.Get(apImageSet.PRESET.Rig_LoadBones),
                                                     strImportPose, strImportPose, false, _selectedBonePoseFile != null, width, 30))
                {
                    //1. Retarget Bone Pose에 선택한 MetaData 정보를 넣자
                    if (_selectedBonePoseFile != null)
                    {
                        bool isSuccess = _retarget.LoadSinglePose(_selectedBonePoseFile._filePath);

                        if (!isSuccess)
                        {
                            EditorUtility.DisplayDialog(_editor.GetText(TEXT.Retarget_SinglePoseImportFailed_Title),
                                                        _editor.GetText(TEXT.Retarget_SinglePoseImportFailed_Body_Error),
                                                        _editor.GetText(TEXT.Close));
                        }
                        else
                        {
                            //2. 리턴 함수 콜
                            if (_funcResult_Anim != null)
                            {
                                _funcResult_Anim(_loadKey, true, _retarget, _targetMeshGroup, _targetAnimClip, _targetAnimTimeline, _targetFrame);
                            }
                            else if (_funcResult_Mod != null)
                            {
                                _funcResult_Mod(_loadKey, true, _retarget, _targetMeshGroup, _targetModifier, _targetParamSet);
                            }

                            //3. 창 닫기
                            CloseDialog();
                        }
                    }
                    else
                    {
                        EditorUtility.DisplayDialog(_editor.GetText(TEXT.Retarget_SinglePoseImportFailed_Title),
                                                    _editor.GetText(TEXT.Retarget_SinglePoseImportFailed_Body_NoFile),
                                                    _editor.GetText(TEXT.Close));
                    }
                }

                //"Close"
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width), GUILayout.Height(25)))
                {
                    if (_funcResult_Anim != null)
                    {
                        _funcResult_Anim(null, false, _retarget, _targetMeshGroup, _targetAnimClip, _targetAnimTimeline, _targetFrame);
                    }
                    else if (_funcResult_Mod != null)
                    {
                        _funcResult_Mod(null, false, _retarget, _targetMeshGroup, _targetModifier, _targetParamSet);
                    }

                    CloseDialog();
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 26
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            width -= 10;
            //if (_editor == null)
            //{
            //	CloseDialog();
            //	return;
            //}

            ////만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            //if (_editor != apEditor.CurrentEditor)
            //{
            //	CloseDialog();
            //	return;
            //}


            //1. 로고
            //2. 버전
            //3. 데모 기능 제한 확인하기

            int   logoWidth  = _img_Logo.width;
            int   logoHeight = _img_Logo.height;
            int   boxHeight  = (int)((float)width * ((float)logoHeight / (float)logoWidth));
            Color prevColor  = GUI.backgroundColor;

            GUI.backgroundColor = Color.black;
            GUILayout.Box(_img_Logo, GUILayout.Width(width), GUILayout.Height(boxHeight));

            GUI.backgroundColor = prevColor;
            GUILayout.Space(5);

            if (_isFullVersion)
            {
                EditorGUILayout.LabelField(string.Format("Build : {0}", apVersion.I.APP_VERSION));
            }
            else
            {
                //"Demo Version : " + apVersion.I.APP_VERSION
                EditorGUILayout.LabelField(string.Format("{0} : {1}", _editor.GetText(TEXT.DLG_DemoVersion), apVersion.I.APP_VERSION));
            }
            GUILayout.Space(10);

            //풀 버전 : 로고 / 버전 / 홈페이지 /  닫기 / "다시 보이지 않음" (Toogle)
            //데모 버전 : 로고 / 버전 / 데모와 정품 차이 안내<- 이거 한글만 되어있다. / 닫기 / AssetStore 페이지
            if (_isFullVersion)
            {
                //홈페이지
                //데모 다운로드 안내
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_StartPage_Hompage), GUILayout.Width(width), GUILayout.Height(40)))                //"Check Limitations"
                {
                    //홈페이지로 갑시다.
                    Application.OpenURL("https://www.rainyrizzle.com");
                    CloseDialog();
                }
            }
            else
            {
                //데모 다운로드 안내
                if (GUILayout.Button(_editor.GetText(TEXT.DLG_CheckLimitations), GUILayout.Width(width), GUILayout.Height(40)))                //"Check Limitations"
                {
                    //홈페이지로 갑시다.
                    if (_editor._language == apEditor.LANGUAGE.Korean)
                    {
                        Application.OpenURL("https://www.rainyrizzle.com/ap-demodownload-kor");
                    }
                    else
                    {
                        Application.OpenURL("https://www.rainyrizzle.com/ap-demodownload-eng");
                    }

                    CloseDialog();
                }
            }

            GUILayout.Space(5);

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width), GUILayout.Height(25)))           //"Close"
            {
                CloseDialog();
            }

            //왼쪽 : 에셋 스토어 또는 계속 시작

            GUILayout.Space(10);
            if (_isFullVersion)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25));
                GUILayout.Space(5);
                EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_StartPage_AlawysOn), GUILayout.Width(width - (12 + 20)), GUILayout.Height(20));
                bool isShow = EditorGUILayout.Toggle(_editor._startScreenOption_IsShowStartup, GUILayout.Width(20), GUILayout.Height(20));
                if (_editor._startScreenOption_IsShowStartup != isShow)
                {
                    _editor._startScreenOption_IsShowStartup = isShow;
                    _editor.SaveEditorPref();
                }

                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (GUILayout.Button("AssetStore", GUILayout.Width(width), GUILayout.Height(20)))
                {
                    //AssetStore 등록하면 여기에 넣자
                    Application.OpenURL("http://u3d.as/16c7");
                    CloseDialog();
                }
            }
        }
Ejemplo n.º 27
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _funcResult == null)
            {
                return;
            }
            int preferImageWidth = 120;
            int scrollWidth      = width - 20;
            int nImagePerRow     = (scrollWidth / preferImageWidth);

            if (nImagePerRow < 1)
            {
                nImagePerRow = 1;
            }
            int imageUnitWidth = (scrollWidth / nImagePerRow) - 14;

            Color prevColor = GUI.backgroundColor;

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

            EditorGUILayout.BeginVertical();

            GUIStyle guiStyle = new GUIStyle(GUIStyle.none);

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

            GUIStyle guiStyle_Center = new GUIStyle(GUIStyle.none);

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

            GUILayout.Space(10);
            //EditorGUILayout.LabelField("Select Texture", guiStyle_Center, GUILayout.Width(width), GUILayout.Height(15));//<투명 버튼
            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(15));
            GUILayout.Space(5);
            EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Search), GUILayout.Width(80));            //"Search"
            string prevSearchKeyword = _strSearchKeyword;

            _strSearchKeyword = EditorGUILayout.DelayedTextField(_strSearchKeyword, GUILayout.Width(width - (100 + 110)), GUILayout.Height(15));
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Refresh), GUILayout.Width(100), GUILayout.Height(15)))            //"Refresh"
            {
                RefreshTextureAssets();
            }

            if (prevSearchKeyword != _strSearchKeyword)
            {
                if (string.IsNullOrEmpty(_strSearchKeyword))
                {
                    _isSearched = false;
                }
                else
                {
                    _isSearched = true;
                }

                RefreshTextureAssets();
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(10);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height - (90 + 10)));

            GUILayout.Space(20);

            //int imageUnitHeight = 200;
            int imageUnitHeight = imageUnitWidth + 30;

            //int scrollWidth = width - 16;
            //int imageUnitWidth = (scrollWidth / 3) - 12;
            for (int iRow = 0; iRow < _texture2Ds.Count; iRow += nImagePerRow)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(scrollWidth), GUILayout.Height(imageUnitHeight + 8));
                for (int iCol = 0; iCol < nImagePerRow; iCol++)
                {
                    int iTex = iRow + iCol;
                    if (iTex >= _texture2Ds.Count)
                    {
                        break;
                    }


                    GUILayout.Space(5);
                    EditorGUILayout.BeginVertical(GUILayout.Width(imageUnitWidth), GUILayout.Height(imageUnitHeight));
                    DrawTextureUnit(_texture2Ds[iTex], imageUnitWidth, imageUnitHeight);
                    EditorGUILayout.EndVertical();

                    if (iCol < nImagePerRow - 1)
                    {
                        GUILayout.Space(2);
                    }
                }
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(20);
            }

            GUILayout.Space(height - 90);
            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            bool isClose = false;
            //string strSelectBtn = "Set Texture";
            string strSelectBtn = _editor.GetText(TEXT.DLG_SetTexture);

            if (_curSelectedTexture2D != null)
            {
                if (_curSelectedTexture2D.name.Length < 20)
                {
                    //strSelectBtn = "Set [" + _curSelectedTexture2D.name + "]";
                    strSelectBtn = string.Format("{0}\n[{1}]", _editor.GetText(TEXT.DLG_Select), _curSelectedTexture2D.name);
                }
                else
                {
                    //strSelectBtn = "Set [" + _curSelectedTexture2D.name.Substring(0, 15) + "..]";
                    strSelectBtn = string.Format("{0}\n[{1}]", _editor.GetText(TEXT.DLG_Select), _curSelectedTexture2D.name.Substring(0, 20));
                }
            }
            if (GUILayout.Button(strSelectBtn, GUILayout.Height(40), GUILayout.Width(width / 2 - 6)))
            {
                _funcResult(true, _targetTextureData, _loadKey, _curSelectedTexture2D);
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Height(40), GUILayout.Width(width / 2 - 6)))            //"Close"
            {
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // 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);

            //Top : (탭) 또는 없음

            int yOffset           = 10;
            int height_Properties = 80;
            int height_Bottom     = 70;
            int height_Main       = height - (height_Properties + height_Bottom + 60);


            GUI.Box(new Rect(0, yOffset, width, height_Main), "");


            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();


            //Request Type이 "Mesh" 또는 "ChildTransform"이라면 탭이 없다.
            //Request Type이 "MeshAndMeshGroups"라면 탭이 있다.


            //1. Tab
            GUILayout.Space(5);


            int    width_BtnHalf = (width - 10) / 2 - 2;
            string strCategory   = _meshGroup._name;

            GUILayout.Space(5);

            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;
            }

            int    height_ListItem = 20;
            string strSelected     = _editor.GetText(TEXT.DLG_Selected);
            string strNotSelected  = _editor.GetText(TEXT.DLG_NotSelected);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height_Main));
            EditorGUILayout.BeginVertical(GUILayout.Width(width - 24));

            GUILayout.Button(new GUIContent(strCategory, _img_FoldDown), guiStyle_None, GUILayout.Height(height_ListItem));            //<투명 버튼

            //리스트 방식 : 아이콘 + 이름 / Selected 버튼 (토글)

            int width_SelectBtn = 100;
            int width_Label     = width - (width_SelectBtn + 42);

            bool isSelected = false;

            //MeshTransform을 출력하자
            apTransform_Mesh curMeshTF = null;

            for (int i = 0; i < _meshTransforms.Count; i++)
            {
                curMeshTF = _meshTransforms[i];

                isSelected = _selectedMeshTransforms.Contains(curMeshTF);

                EditorGUILayout.BeginHorizontal(GUILayout.Height(height_ListItem));
                GUILayout.Space(10);
                EditorGUILayout.LabelField(new GUIContent(" " + curMeshTF._nickName, _img_Mesh), GUILayout.Width(width_Label), GUILayout.Height(height_ListItem));

                if (apEditorUtil.ToggledButton_2Side(strSelected, strNotSelected, isSelected, true, width_SelectBtn, height_ListItem))
                {
                    if (isSelected)
                    {
                        _selectedMeshTransforms.Remove(curMeshTF);
                    }
                    else
                    {
                        _selectedMeshTransforms.Add(curMeshTF);
                    }
                }

                EditorGUILayout.EndHorizontal();
                GUILayout.Space(2);
            }

            GUILayout.Space(height + 20);

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            //복사할 속성들을 토글한다.
            //두줄로 적자

            //"Select Properties to copy"
            EditorGUILayout.LabelField(_editor.GetText(TEXT.SelectPropertiesToCopy));
            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(height_Properties));

            GUILayout.Space(5);

            //왼쪽 줄
            EditorGUILayout.BeginVertical(GUILayout.Width(width_BtnHalf), GUILayout.Height(height_Properties));
            DrawPropertyToggle(COPIED_PROPERTIES.DefaultColor, _editor.GetText(TEXT.DefaultColor), width_BtnHalf);           //"Default Color"
            DrawPropertyToggle(COPIED_PROPERTIES.ShaderType, _editor.GetText(TEXT.BlendingType), width_BtnHalf);             //"Blending Type"
            DrawPropertyToggle(COPIED_PROPERTIES.CustomShader, _editor.GetText(TEXT.CustomShader), width_BtnHalf);           //"Custom Shader"
            DrawPropertyToggle(COPIED_PROPERTIES.RenderTextureSize, _editor.GetText(TEXT.RenderTextureSize), width_BtnHalf); //"Render Texture Size"

            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            //오른쪽 줄
            EditorGUILayout.BeginVertical(GUILayout.Width(width_BtnHalf), GUILayout.Height(height_Properties));
            DrawPropertyToggle(COPIED_PROPERTIES.TwoSides, _editor.GetText(TEXT.TwoSidedMesh), width_BtnHalf);                       //"2-Sides Rendering"
            DrawPropertyToggle(COPIED_PROPERTIES.ShadowSettings, _editor.GetText(TEXT.ShadowSettings), width_BtnHalf);               //"Shadow Settings"
            DrawPropertyToggle(COPIED_PROPERTIES.MaterialSet, _editor.GetText(TEXT.MaterialSet), width_BtnHalf);                     //"Material Set"
            DrawPropertyToggle(COPIED_PROPERTIES.MaterialProperties, _editor.GetText(TEXT.CustomMaterialProperties), width_BtnHalf); //"Custom Material Properties"
            EditorGUILayout.EndVertical();



            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            //첫줄에는 Select All / Deselect All
            //둘째줄에는 Add 또는 Apply (인자로 받음) / Close
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            GUILayout.Space(5);
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_SelectAll), GUILayout.Width(width_BtnHalf), GUILayout.Height(22)))
            {
                //Select All
                for (int i = 0; i < _meshTransforms.Count; i++)
                {
                    curMeshTF = _meshTransforms[i];
                    if (!_selectedMeshTransforms.Contains(curMeshTF))
                    {
                        _selectedMeshTransforms.Add(curMeshTF);
                    }
                }
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_DeselectAll), GUILayout.Width(width_BtnHalf), GUILayout.Height(22)))
            {
                //Deselect All
                _selectedMeshTransforms.Clear();
            }


            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal(GUILayout.Height(30));
            GUILayout.Space(5);

            bool isClose = false;

            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Apply), GUILayout.Width(width_BtnHalf), GUILayout.Height(30)))
            {
                _funcResult(true, _loadKey, _srcMeshTransform, _selectedMeshTransforms, GetCopiedPropertyList());
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width_BtnHalf), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, null, null, null);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }
        // 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);

            //Top : (탭) 또는 없음

            int height_Top    = (_requestTarget == REQUEST_TARGET.MeshAndMeshGroups) ? 25 : 0;
            int yOffset       = (_requestTarget == REQUEST_TARGET.MeshAndMeshGroups) ? (height_Top + 11) : (height_Top + 10);
            int height_Bottom = 70;
            int height_Main   = height - (height_Top + height_Bottom + 20);


            GUI.Box(new Rect(0, yOffset, width, height_Main), "");


            GUI.backgroundColor = prevColor;

            EditorGUILayout.BeginVertical();


            //Request Type이 "Mesh" 또는 "ChildTransform"이라면 탭이 없다.
            //Request Type이 "MeshAndMeshGroups"라면 탭이 있다.


            //1. Tab
            GUILayout.Space(5);


            int    width_BtnHalf = (width - 10) / 2 - 2;
            string strCategory   = "";

            if (_requestTarget == REQUEST_TARGET.MeshAndMeshGroups)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(height_Top));

                GUILayout.Space(5);

                //1. Mesh + MeshGroup을 선택하는 경우 탭으로 구분한다.
                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_Mesh), (_target == TARGET_TAB.Mesh), width_BtnHalf, height_Top))                //"Mesh"
                {
                    _target     = TARGET_TAB.Mesh;
                    _scrollList = Vector2.zero;
                }

                if (apEditorUtil.ToggledButton(_editor.GetText(TEXT.DLG_MeshGroup), (_target == TARGET_TAB.MeshGroup), width_BtnHalf, height_Top))                //"MeshGroup"
                {
                    _target     = TARGET_TAB.MeshGroup;
                    _scrollList = Vector2.zero;
                }


                if (_target == TARGET_TAB.Mesh)
                {
                    //"Meshes";
                    strCategory = _editor.GetText(TEXT.DLG_Meshes);
                }
                else
                {
                    //"Mesh Groups";
                    strCategory = _editor.GetText(TEXT.DLG_MeshGroups);
                }

                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (_requestTarget == REQUEST_TARGET.Mesh)
                {
                    //"Meshes";
                    strCategory = _editor.GetText(TEXT.DLG_Meshes);
                }
                else
                {
                    //Child MeshTransform > MeshGroup 이름;
                    strCategory = _meshGroup._name;
                }

                GUILayout.Space(5);
            }


            LIST_TYPE curListType = LIST_TYPE.Mesh;

            switch (_requestTarget)
            {
            case REQUEST_TARGET.Mesh:
                curListType = LIST_TYPE.Mesh;
                break;

            case REQUEST_TARGET.ChildMeshTransforms:
                curListType = LIST_TYPE.MeshTransforms;
                break;

            case REQUEST_TARGET.MeshAndMeshGroups:
            {
                if (_target == TARGET_TAB.Mesh)
                {
                    curListType = LIST_TYPE.Mesh;
                }
                else
                {
                    curListType = LIST_TYPE.MeshGroup;
                }
            }
            break;
            }


            GUIStyle guiStyle_None     = new GUIStyle(GUIStyle.none);
            GUIStyle guiStyle_Selected = new GUIStyle(GUIStyle.none);

            if (EditorGUIUtility.isProSkin)
            {
                guiStyle_Selected.normal.textColor = Color.cyan;
                guiStyle_None.normal.textColor     = GUI.skin.label.normal.textColor;
            }
            else
            {
                guiStyle_Selected.normal.textColor = Color.white;
                guiStyle_None.normal.textColor     = Color.black;
            }

            Texture2D whildImg = apEditorUtil.WhiteTexture;


            int height_ListItem = 25;

            //string strSelected = _editor.GetText(TEXT.DLG_Selected);
            //string strNotSelected = _editor.GetText(TEXT.DLG_NotSelected);

            _scrollList = EditorGUILayout.BeginScrollView(_scrollList, GUILayout.Width(width), GUILayout.Height(height_Main));
            EditorGUILayout.BeginVertical();

            GUILayout.Button(new GUIContent(strCategory, _img_FoldDown), guiStyle_None, GUILayout.Height(height_ListItem));            //<투명 버튼

            //리스트 방식 : 아이콘 + 이름 / Selected 버튼 (토글)

            //int width_SelectBtn = 100;
            //int width_Label = width - (width_SelectBtn + 42);

            bool isSelected = false;

            GUIStyle guiStyle_ItemLabelBtn = new GUIStyle(GUI.skin.label);

            guiStyle_ItemLabelBtn.alignment = TextAnchor.MiddleLeft;

            //Ctrl키나 Shift키를 누르면 여러개를 선택할 수 있다.
            bool isCtrlOrShift = false;

            if (Event.current.shift
#if UNITY_EDITOR_OSX
                || Event.current.command
#else
                || Event.current.control
#endif
                )
            {
                isCtrlOrShift = true;
            }


            //어떤 리스트를 보여야 하는지 여부
            if (curListType == LIST_TYPE.Mesh)
            {
                //1. Mesh를 출력하자
                apMesh curMesh = null;
                for (int i = 0; i < _meshes.Count; i++)
                {
                    curMesh = _meshes[i];

                    isSelected = _selectedObjects.Contains(curMesh);


                    if (DrawItem(curMesh._name, _img_Mesh, isSelected, guiStyle_None, guiStyle_Selected, i, width, height_ListItem, _scrollList.x))
                    {
                        if (!isCtrlOrShift)
                        {
                            //일단 무조건 클리어
                            _selectedObjects.Clear();
                        }

                        if (isSelected)
                        {
                            _selectedObjects.Remove(curMesh);
                        }
                        else
                        {
                            _selectedObjects.Add(curMesh);
                        }
                    }
                    GUILayout.Space(2);
                }
            }
            else if (curListType == LIST_TYPE.MeshGroup)
            {
                //2. MeshGroup을 출력하자
                apMeshGroup curMeshGroup = null;
                for (int i = 0; i < _meshGroups.Count; i++)
                {
                    curMeshGroup = _meshGroups[i];

                    isSelected = _selectedObjects.Contains(curMeshGroup);


                    if (DrawItem(curMeshGroup._name, _img_MeshGroup, isSelected, guiStyle_None, guiStyle_Selected, i, width, height_ListItem, _scrollList.x))
                    {
                        if (!isCtrlOrShift)
                        {
                            //일단 무조건 클리어
                            _selectedObjects.Clear();
                        }

                        if (isSelected)
                        {
                            _selectedObjects.Remove(curMeshGroup);
                        }
                        else
                        {
                            _selectedObjects.Add(curMeshGroup);
                        }
                    }
                    GUILayout.Space(2);
                }
            }
            else
            {
                //3. MeshTransform을 출력하자
                apTransform_Mesh curMeshTF = null;
                for (int i = 0; i < _meshTransforms.Count; i++)
                {
                    curMeshTF = _meshTransforms[i];

                    isSelected = _selectedObjects.Contains(curMeshTF);


                    if (DrawItem(curMeshTF._nickName, _img_Mesh, isSelected, guiStyle_None, guiStyle_Selected, i, width, height_ListItem, _scrollList.x))
                    {
                        if (!isCtrlOrShift)
                        {
                            //일단 무조건 클리어
                            _selectedObjects.Clear();
                        }

                        if (isSelected)
                        {
                            _selectedObjects.Remove(curMeshTF);
                        }
                        else
                        {
                            _selectedObjects.Add(curMeshTF);
                        }
                    }
                    GUILayout.Space(2);
                }
            }

            GUILayout.Space(height + 20);

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            GUILayout.Space(10);

            //첫줄에는 Select All / Deselect All
            //둘째줄에는 Add 또는 Apply (인자로 받음) / Close
            EditorGUILayout.BeginHorizontal(GUILayout.Height(22));
            GUILayout.Space(5);
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_SelectAll), GUILayout.Width(width_BtnHalf), GUILayout.Height(22)))
            {
                //Select All
                for (int i = 0; i < _meshes.Count; i++)
                {
                    apMesh curMesh = _meshes[i];
                    if (!_selectedObjects.Contains(curMesh))
                    {
                        _selectedObjects.Add(curMesh);
                    }
                }

                for (int i = 0; i < _meshGroups.Count; i++)
                {
                    apMeshGroup curMeshGroup = _meshGroups[i];
                    if (!_selectedObjects.Contains(curMeshGroup))
                    {
                        _selectedObjects.Add(curMeshGroup);
                    }
                }

                for (int i = 0; i < _meshTransforms.Count; i++)
                {
                    apTransform_Mesh curMeshTF = _meshTransforms[i];
                    if (!_selectedObjects.Contains(curMeshTF))
                    {
                        _selectedObjects.Add(curMeshTF);
                    }
                }
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_DeselectAll), GUILayout.Width(width_BtnHalf), GUILayout.Height(22)))
            {
                //Deselect All
                _selectedObjects.Clear();
            }


            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal(GUILayout.Height(30));
            GUILayout.Space(5);

            bool isClose = false;
            if (GUILayout.Button(_positiveBtnText, GUILayout.Width(width_BtnHalf), GUILayout.Height(30)))
            {
                _funcResult(true, _loadKey, _selectedObjects, _savedObject);
                isClose = true;
            }
            if (GUILayout.Button(_editor.GetText(TEXT.DLG_Close), GUILayout.Width(width_BtnHalf), GUILayout.Height(30)))            //"Close"
            {
                _funcResult(false, _loadKey, null, _savedObject);
                isClose = true;
            }
            EditorGUILayout.EndHorizontal();

            if (isClose)
            {
                CloseDialog();
            }
        }