//Visible 속성이 붙은 경우는 이걸 호출해서 세팅해줘야 한다. //이전 //public void SetVisibleIconImage(GUIContent guiVisible_Current, GUIContent guiNonVisible_Current, // GUIContent guiVisible_TmpWork, GUIContent guiNonVisible_TmpWork, // GUIContent guiVisible_Default, GUIContent guiNonVisible_Default, // GUIContent guiVisible_ModKey, GUIContent guiNonVisible_ModKey, // GUIContent gui_NoKey // ) //변경 19.11.16 : Wrapper 클래스 이용 public void SetVisibleIconImage(apGUIContentWrapper guiVisible_Current, apGUIContentWrapper guiNonVisible_Current, apGUIContentWrapper guiVisible_TmpWork, apGUIContentWrapper guiNonVisible_TmpWork, apGUIContentWrapper guiVisible_Default, apGUIContentWrapper guiNonVisible_Default, apGUIContentWrapper guiVisible_ModKey, apGUIContentWrapper guiNonVisible_ModKey, apGUIContentWrapper gui_NoKey, FUNC_REFRESH_VISIBLE_PREFIX funcVisiblePrePostFix ) { if (_guiContent_Visible == null) { _guiContent_Visible = new apGUIContentWrapper[4]; } if (_guiContent_Nonvisible == null) { _guiContent_Nonvisible = new apGUIContentWrapper[4]; } _guiContent_Visible[(int)VISIBLE_ICON.Current] = guiVisible_Current; _guiContent_Visible[(int)VISIBLE_ICON.TmpWork] = guiVisible_TmpWork; _guiContent_Visible[(int)VISIBLE_ICON.Default] = guiVisible_Default; _guiContent_Visible[(int)VISIBLE_ICON.ModKey] = guiVisible_ModKey; _guiContent_Nonvisible[(int)VISIBLE_ICON.Current] = guiNonVisible_Current; _guiContent_Nonvisible[(int)VISIBLE_ICON.TmpWork] = guiNonVisible_TmpWork; _guiContent_Nonvisible[(int)VISIBLE_ICON.Default] = guiNonVisible_Default; _guiContent_Nonvisible[(int)VISIBLE_ICON.ModKey] = guiNonVisible_ModKey; _guiContent_NoKey = gui_NoKey; _funcRefreshVisiblePreFix = funcVisiblePrePostFix; //추가 19.11.24 }
public static apGUIContentWrapper Make(Texture2D image) { apGUIContentWrapper newGUIContent = new apGUIContentWrapper(false); newGUIContent.SetImage(image); return(newGUIContent); }
// Make //--------------------------------------------- public static apGUIContentWrapper Make(string text, bool isLongText) { apGUIContentWrapper newGUIContent = new apGUIContentWrapper(isLongText); newGUIContent.SetText(text); return(newGUIContent); }
public static apGUIContentWrapper Make(int space, string text, Texture2D image) { apGUIContentWrapper newGUIContent = new apGUIContentWrapper(false); newGUIContent.SetText(space, text); newGUIContent.SetImage(image); return(newGUIContent); }
public static apGUIContentWrapper Make(Texture2D image, string tooltip) { apGUIContentWrapper newGUIContent = new apGUIContentWrapper(false); newGUIContent.SetImage(image); newGUIContent.SetToolTop(tooltip); return(newGUIContent); }
public static apGUIContentWrapper Make(string text, bool isLongText, Texture2D image, string tooltip) { apGUIContentWrapper newGUIContent = new apGUIContentWrapper(isLongText); newGUIContent.SetText(text); newGUIContent.SetImage(image); newGUIContent.SetToolTop(tooltip); return(newGUIContent); }
private void MakeGUIContent() { if (_icon != null) { if (_guiContent_Icon == null) { _guiContent_Icon = apGUIContentWrapper.Make(_icon); } else { _guiContent_Icon.SetImage(_icon); } //_guiContent_Icon = new GUIContent(_icon);//이전 } else { //_guiContent_Icon = null;//null로 만들진 않는다. _guiContent_Icon.SetVisible(false); } //이전 //if (!string.IsNullOrEmpty(_text)) //{ // _guiContent_Text = new GUIContent(" " + _text + " "); //} //else //{ // _guiContent_Text = new GUIContent(" <No Name> "); //} //변경 if (_guiContent_Text == null) { _guiContent_Text = new apGUIContentWrapper(); } if (!string.IsNullOrEmpty(_text)) { //공백(1) + 텍스트 + 공백(2) _guiContent_Text.ClearText(false); _guiContent_Text.AppendSpaceText(1, false); _guiContent_Text.AppendText(_text, false); _guiContent_Text.AppendSpaceText(2, true); } else { _guiContent_Text.SetText(NO_NAME); } RefreshPrevRender(); }
// Common //-------------------------------------------------------------------------- //public void SetBasicIconImg(Texture2D imgFoldDown, Texture2D imgFoldRight, Texture2D imgModRegisted)//이전 public void SetBasicIconImg(apGUIContentWrapper guiContent_imgFoldDown, apGUIContentWrapper guiContent_imgFoldRight, apGUIContentWrapper guiContent_imgModRegisted) //변경 19.11.16 : 공유할 수 있게 { //이전 //_guiContent_FoldDown = new GUIContent(imgFoldDown); //_guiContent_FoldRight = new GUIContent(imgFoldRight); //_guiContent_ModRegisted = new GUIContent(imgModRegisted); //변경 _guiContent_FoldDown = guiContent_imgFoldDown; _guiContent_FoldRight = guiContent_imgFoldRight; _guiContent_ModRegisted = guiContent_imgModRegisted; }
//추가 Label에서 TmpWorkVisible을 초기화하는 버튼을 추가할 수 있다. //public void SetRestoreTmpWorkVisible(Texture2D btnIcon_ON, Texture2D btnIcon_OFF, FUNC_UNIT_CLICK_RESTORE_TMPWORK funcRestoreClick)//이전 public void SetRestoreTmpWorkVisible(apGUIContentWrapper guiContent_btnIcon_ON, apGUIContentWrapper guiContent_btnIcon_OFF, FUNC_UNIT_CLICK_RESTORE_TMPWORK funcRestoreClick) //변경 19.11.16 : 공유할 수 있게 { _isRestoreTmpWorkVisibleBtn = true; _isTmpWorkAnyChanged = false; //이전 //_guiContent_RestoreTmpWorkVisible_ON = new GUIContent(btnIcon_ON); //_guiContent_RestoreTmpWorkVisible_OFF = new GUIContent(btnIcon_OFF); //변경 _guiContent_RestoreTmpWorkVisible_ON = guiContent_btnIcon_ON; _guiContent_RestoreTmpWorkVisible_OFF = guiContent_btnIcon_OFF; _funcClickRestoreTmpWorkVisible = funcRestoreClick; }
private void ReloadGUIContent() { if (_editor == null) { return; } //GUIContent 추가 if (_guiContent_FoldDown == null) { _guiContent_FoldDown = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown)); } if (_guiContent_FoldRight == null) { _guiContent_FoldRight = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldRight)); } if (_guiContent_ModRegisted == null) { _guiContent_ModRegisted = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Registered)); } if (_guiContent_RestoreTmpWorkVisible_ON == null) { _guiContent_RestoreTmpWorkVisible_ON = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.RestoreTmpVisibility_ON)); } if (_guiContent_RestoreTmpWorkVisible_OFF == null) { _guiContent_RestoreTmpWorkVisible_OFF = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.RestoreTmpVisibility_OFF)); } if (_guiContent_OrderUp == null) { _guiContent_OrderUp = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.Modifier_LayerUp)); } if (_guiContent_OrderDown == null) { _guiContent_OrderDown = apGUIContentWrapper.Make(Editor.ImageSet.Get(apImageSet.PRESET.Modifier_LayerDown)); } }
// 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 || _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); }
// GUI //------------------------------------------------------------------ void OnGUI() { if (_editor == null) { CloseDialog(); return; } int width = (int)position.width; int height = (int)position.height; width -= 10; bool isClose = false; GUILayout.Space(5); GUIStyle guiStyle_Center = new GUIStyle(GUI.skin.label); guiStyle_Center.alignment = TextAnchor.MiddleCenter; guiStyle_Center.wordWrap = true; if (_guiContent_ImgInfo == null) { _guiContent_ImgInfo = new apGUIContentWrapper(); _guiContent_ImgInfo.SetImage(_img_Info); } //EditorGUILayout.LabelField(new GUIContent("", _img_Info), guiStyle_Center, GUILayout.Width(width), GUILayout.Height(256)); EditorGUILayout.LabelField(_guiContent_ImgInfo.Content, guiStyle_Center, GUILayout.Width(width), GUILayout.Height(256)); GUILayout.Space(10); //"Ambient Color가 검은색이 아니면 결과물이\n원본보다 밝게 보여질 수 있습니다." EditorGUILayout.LabelField(_str_Info, guiStyle_Center, GUILayout.Height(40)); GUILayout.Space(5); //"Ambient Color를 검은색으로 변경하기" if (GUILayout.Button(_str_Convert, GUILayout.Height(30))) { MakeAmbientLightToBlack(); isClose = true; } //"닫기" if (GUILayout.Button(_str_Close, GUILayout.Height(30))) { isClose = true; } GUILayout.Space(5); //"이 메시지 더이상 보지 않기" //이부분 버그 bool doNotShowAmbientDialog = !_editor._isAmbientCorrectionOption; EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25)); GUILayout.Space(10); //bool isAmbientOption = EditorGUILayout.Toggle(_editor._isAmbientCorrectionOption, GUILayout.Width(30)); bool nextDoNotShowAmbient = EditorGUILayout.Toggle(doNotShowAmbientDialog, GUILayout.Width(30)); GUILayout.Space(5); //if(isAmbientOption != _editor._isAmbientCorrectionOption) if (nextDoNotShowAmbient != doNotShowAmbientDialog) { //_editor._isAmbientCorrectionOption = isAmbientOption; _editor._isAmbientCorrectionOption = !nextDoNotShowAmbient; _editor.SaveEditorPref(); } EditorGUILayout.LabelField(_str_DoNotShow, GUILayout.Width(300)); EditorGUILayout.EndHorizontal(); if (isClose) { CloseDialog(); } }
// 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(); } } } }
// 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" if (_guiContent_ModifierText == null) { _guiContent_ModifierText = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_Modifiers), false, iconImageCategory); } if (_guiContent_Item == null) { _guiContent_Item = new apGUIContentWrapper(); } GUILayout.Button(_guiContent_ModifierText.Content, 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))) //변경 _guiContent_Item.ClearText(false); _guiContent_Item.AppendSpaceText(1, false); _guiContent_Item.AppendText(_modifiers[i]._name, true); _guiContent_Item.SetImage(_modifiers[i]._iconImage); if (GUILayout.Button(_guiContent_Item.Content, 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 || _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)); if (_guiContent_IsImportant == null) { _guiContent_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_FPS == null) { _guiContent_FPS = apGUIContentWrapper.Make(_editor.GetText(TEXT.DLG_Setting_FPS), false, "This setting is used when <Important> is off"); } 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; } //"Is Important" bool nextImportant = EditorGUILayout.Toggle(_guiContent_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_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); //수동으로 백업하기 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.SaveBackupManual(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) { } //고급 옵션들 //변경 3.22 : 이하는 고급 옵션으로 분리한다. //텍스트를 길게 작성할 수 있게 만든다. GUILayout.Space(20); EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_Advanced)); GUILayout.Space(10); GUIStyle guiStyle_WrapLabel = new GUIStyle(GUI.skin.label); guiStyle_WrapLabel.wordWrap = true; guiStyle_WrapLabel.alignment = TextAnchor.MiddleLeft; int labelWidth = width - (30 + 20); int toggleWidth = 20; bool prevStartupScreen = _editor._startScreenOption_IsShowStartup; //EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25)); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); //Height 삭제 GUILayout.Space(5); _editor._startScreenOption_IsShowStartup = EditorGUILayout.Toggle(_editor._startScreenOption_IsShowStartup, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_ShowStartPageOn), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); //GUILayout.Space(10); bool prevCheckVersion = _editor._isCheckLiveVersion_Option; //EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25)); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); //Height 삭제 GUILayout.Space(5); _editor._isCheckLiveVersion_Option = EditorGUILayout.Toggle(_editor._isCheckLiveVersion_Option, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.CheckLatestVersionOption), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); //추가 3.1 : 유휴 상태에서는 업데이트 빈도를 낮춤 bool prevLowCPUOption = _editor._isLowCPUOption; //EditorGUILayout.BeginHorizontal(GUILayout.Width(width), GUILayout.Height(25)); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); //Height 삭제 GUILayout.Space(5); _editor._isLowCPUOption = EditorGUILayout.Toggle(_editor._isLowCPUOption, GUILayout.Width(toggleWidth)); GUILayout.Space(5); //"Editor frame is low when idle" EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_LowCPU), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); //추가 3.29 : Ambient 자동으로 보정하기 기능 bool prevAmbientCorrection = _editor._isAmbientCorrectionOption; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); //Height 삭제 GUILayout.Space(5); _editor._isAmbientCorrectionOption = EditorGUILayout.Toggle(_editor._isAmbientCorrectionOption, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_AmbientColorCorrection), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); //추가 19.6.28 : 자동으로 Controller Tab으로 전환할 지 여부 (Mod, Anim) bool prevAutoSwitchController_Mod = _editor._isAutoSwitchControllerTab_Mod; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isAutoSwitchControllerTab_Mod = EditorGUILayout.Toggle(_editor._isAutoSwitchControllerTab_Mod, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.Setting_SwitchContTab_Mod), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); bool prevAutoSwitchController_Anim = _editor._isAutoSwitchControllerTab_Anim; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isAutoSwitchControllerTab_Anim = EditorGUILayout.Toggle(_editor._isAutoSwitchControllerTab_Anim, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.Setting_SwitchContTab_Anim), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); //추가 19.6.28 : 작업 종료시 메시의 작업용 보이기/숨기기를 초기화 할 지 여부 bool prevTempMeshVisibility = _editor._isRestoreTempMeshVisibilityWhenTackEnded; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isRestoreTempMeshVisibilityWhenTackEnded = EditorGUILayout.Toggle(_editor._isRestoreTempMeshVisibilityWhenTackEnded, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.Setting_TempVisibilityMesh), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); //추가 19.8.13 : 리깅 관련 옵션 bool prevRigOpt_ColorLikeParent = _editor._rigOption_NewChildBoneColorIsLikeParent; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._rigOption_NewChildBoneColorIsLikeParent = EditorGUILayout.Toggle(_editor._rigOption_NewChildBoneColorIsLikeParent, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField(_editor.GetText(TEXT.Setting_RigOpt_ColorLikeParent), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); //선택 잠금에 대해서 EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(34); EditorGUILayout.LabelField(_editor.GetText(TEXT.DLG_Setting_EnableSelectionLockEditMode), guiStyle_WrapLabel); EditorGUILayout.EndHorizontal(); bool prevSelectionEnableOption_RigPhy = _editor._isSelectionLockOption_RiggingPhysics; bool prevSelectionEnableOption_Morph = _editor._isSelectionLockOption_Morph; bool prevSelectionEnableOption_Transform = _editor._isSelectionLockOption_Transform; bool prevSelectionEnableOption_ControlTimeline = _editor._isSelectionLockOption_ControlParamTimeline; EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isSelectionLockOption_Morph = EditorGUILayout.Toggle(_editor._isSelectionLockOption_Morph, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField("- Morph " + _editor.GetText(TEXT.DLG_Modifier), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isSelectionLockOption_Transform = EditorGUILayout.Toggle(_editor._isSelectionLockOption_Transform, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField("- Transform " + _editor.GetText(TEXT.DLG_Modifier), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isSelectionLockOption_RiggingPhysics = EditorGUILayout.Toggle(_editor._isSelectionLockOption_RiggingPhysics, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField("- Rigging/Physic " + _editor.GetText(TEXT.DLG_Modifier), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Width(width)); GUILayout.Space(5); _editor._isSelectionLockOption_ControlParamTimeline = EditorGUILayout.Toggle(_editor._isSelectionLockOption_ControlParamTimeline, GUILayout.Width(toggleWidth)); GUILayout.Space(5); EditorGUILayout.LabelField("- Control Parameter " + _editor.GetUIWord(UIWORD.Timeline), guiStyle_WrapLabel, GUILayout.Width(labelWidth)); 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 || prevCheckVersion != _editor._isCheckLiveVersion_Option || prevLowCPUOption != _editor._isLowCPUOption || prevAmbientCorrection != _editor._isAmbientCorrectionOption || prevAutoSwitchController_Mod != _editor._isAutoSwitchControllerTab_Mod || prevAutoSwitchController_Anim != _editor._isAutoSwitchControllerTab_Anim || prevTempMeshVisibility != _editor._isRestoreTempMeshVisibilityWhenTackEnded || prevRigOpt_ColorLikeParent != _editor._rigOption_NewChildBoneColorIsLikeParent || prevSelectionEnableOption_RigPhy != _editor._isSelectionLockOption_RiggingPhysics || prevSelectionEnableOption_Morph != _editor._isSelectionLockOption_Morph || prevSelectionEnableOption_Transform != _editor._isSelectionLockOption_Transform || prevSelectionEnableOption_ControlTimeline != _editor._isSelectionLockOption_ControlParamTimeline ) { bool isLanguageChanged = (prevLanguage != _editor._language); _editor.SaveEditorPref(); apEditorUtil.SetEditorDirty(); //apGL.SetToneColor(_editor._colorOption_OnionToneColor); if (isLanguageChanged) { _editor.ResetHierarchyAll(); //이전 //_editor.RefreshTimelineLayers(true); //_editor.RefreshControllerAndHierarchy(); //변경 19.5.21 _editor.RefreshControllerAndHierarchy(true); //<<True를 넣으면 RefreshTimelineLayer 함수가 같이 호출된다. } } } 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(); }
// 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); 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)); if (_guiContent_Category == null) { _guiContent_Category = apGUIContentWrapper.Make(strCategory, false, _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown)); } if (_guiContent_MeshItem == null) { _guiContent_MeshItem = new apGUIContentWrapper(); _guiContent_MeshItem.SetImage(_editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Mesh)); _guiContent_MeshItem.ClearText(true); } if (_guiContent_MeshGroupItem == null) { _guiContent_MeshGroupItem = new apGUIContentWrapper(); _guiContent_MeshGroupItem.SetImage(_editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_MeshGroup)); _guiContent_MeshGroupItem.ClearText(true); } GUILayout.Button(_guiContent_Category.Content, 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); _guiContent_MeshItem.ClearText(false); _guiContent_MeshItem.AppendSpaceText(1, false); _guiContent_MeshItem.AppendText(mesh._name, true); if (GUILayout.Button(_guiContent_MeshItem.Content, 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); _guiContent_MeshGroupItem.ClearText(false); _guiContent_MeshGroupItem.AppendSpaceText(1, false); _guiContent_MeshGroupItem.AppendText(meshGroup._name, true); if (GUILayout.Button(_guiContent_MeshGroupItem.Content, 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(); } }
// 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; //변경 19.11.16 if (_guiContent_Bone == null) { _guiContent_Bone = apGUIContentWrapper.Make(iconBone); } //이전 //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.Content, 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 //-------------------------------------------------------------------------- public void GUI_Render(int posY, int leftWidth, int width, int height, Vector2 scroll, int scrollLayoutHeight, bool isGUIEvent, int level, bool isOrderButtonVisible = false) { CheckAndCreateGUIStyle(); //<<추가 : GUI Style 생성 //추가 19.11.22 //만약 렌더링하지 않아도 된다면 렌더링하지 않고 여백만 주고 넘어가야한다. if (!apEditorUtil.IsItemInScroll(posY, height, scroll, scrollLayoutHeight)) { GUILayout.Space(height); return; } Rect lastRect = GUILayoutUtility.GetLastRect(); //배경 렌더링 if (_isSelected) { Color 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 + scroll.x, lastRect.y + height, width + 10, height), ""); GUI.backgroundColor = prevColor; } EditorGUILayout.BeginHorizontal(GUILayout.Height(height)); GUILayout.Space(2); //추가 : 19.11.24 : Pre/Post Fix 아이콘을 여기서 실시간으로 갱신할 수 있다. if (isGUIEvent) { if (_funcRefreshVisiblePreFix != null) { //체크 : 만약 값이 바뀌었다면 DebugLog (에러를 잡았당!) //VISIBLE_TYPE debug_Prefix = _visibleType_Prefix; _funcRefreshVisiblePreFix(this); //if(debug_Prefix != _visibleType_Prefix) //{ // Debug.LogError("Prefix 미갱신 오류가 보정되었다! : " + _guiContent_Text.Content.text); //} } } _isCurRender_ModRegBox = _isModRegistered; _isCurRender_VisiblePrefix = (_unitType == UNIT_TYPE.ToggleButton_Visible && _visibleType_Prefix != VISIBLE_TYPE.None); _isCurRenderFoldBtn = (_childUnits.Count > 0 || (_parentUnit == null && _unitType == UNIT_TYPE.Label)); _isCurRender_VisiblePostFix = (_unitType == UNIT_TYPE.ToggleButton_Visible && _visibleType_Postfix != VISIBLE_TYPE.None); _isCurRender_RestoreTmpWorkVisible = (_unitType == UNIT_TYPE.Label && _isRestoreTmpWorkVisibleBtn); if (isGUIEvent) { //GUIEvent에서는 Prev를 무시한다. _isNextRender_ModRegBox = _isCurRender_ModRegBox; _isNextRender_VisiblePrefix = _isCurRender_VisiblePrefix; _isNextRenderFoldBtn = _isCurRenderFoldBtn; _isNextRender_VisiblePostFix = _isCurRender_VisiblePostFix; _isNextRender_RestoreTmpWorkVisible = _isCurRender_RestoreTmpWorkVisible; } else { //GUIEvent가 아닐 때에는 Prev의 값을 따른다. _isNextRender_ModRegBox = _isPrevRender_ModRegBox; _isNextRender_VisiblePrefix = _isPrevRender_VisiblePrefix; _isNextRenderFoldBtn = _isPrevRender_Fold; _isNextRender_VisiblePostFix = _isPrevRender_VisiblePostfix; _isNextRender_RestoreTmpWorkVisible = _isPrevRender_RestoreTmpWorkVisible; } // Modifier 등록 박스 렌더링 //if (_isCurRender_ModRegBox) if (_isNextRender_ModRegBox) { //이전 //GUILayout.Box(_guiContent_ModRegisted, _guiStyle_ModIcon, GUILayout.Width(8), GUILayout.Height(height)); //변경 GUILayout.Box(_guiContent_ModRegisted.Content, _guiStyle_ModIcon, GUILayout.Width(8), GUILayout.Height(height)); } else { GUILayout.Space(8); } // 앞쪽의 "보기" 버튼 //if (_unitType == UNIT_TYPE.ToggleButton_Visible && _visibleType_Prefix != VISIBLE_TYPE.None) if (_isNextRender_VisiblePrefix) { //앞쪽에도 Visible Button을 띄워야겠다면 apGUIContentWrapper visibleGUIContent = null; if (!_isCurRender_VisiblePrefix) { //만약 더미를 렌더링 하는 경우 visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Current]; } else { //정식 렌더링인 경우 switch (_visibleType_Prefix) { case VISIBLE_TYPE.Current_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.Current]; break; case VISIBLE_TYPE.Current_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Current]; break; case VISIBLE_TYPE.TmpWork_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.TmpWork]; break; case VISIBLE_TYPE.TmpWork_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.TmpWork]; break; case VISIBLE_TYPE.Default_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.Default]; break; case VISIBLE_TYPE.Default_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Default]; break; case VISIBLE_TYPE.ModKey_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.ModKey]; break; case VISIBLE_TYPE.ModKey_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.ModKey]; break; case VISIBLE_TYPE.NoKey: visibleGUIContent = _guiContent_NoKey; break; } } if (GUILayout.Button(visibleGUIContent.Content, _guiStyle_None, GUILayout.Width(20), GUILayout.Height(height))) { if (_isCurRender_VisiblePrefix) { if (_funcClickVisible != null) { _funcClickVisible(this, _savedKey, _savedObj, _visibleType_Prefix == VISIBLE_TYPE.Current_Visible || _visibleType_Prefix == VISIBLE_TYPE.Default_Visible || _visibleType_Prefix == VISIBLE_TYPE.TmpWork_Visible || _visibleType_Prefix == VISIBLE_TYPE.ModKey_Visible, true); } } } leftWidth -= 22; if (leftWidth < 0) { leftWidth = 0; //leftWidth = level * 5; } } //추가 : 레이어 순서 변경 버튼 if (isOrderButtonVisible && _isOrderChangable) { if (GUILayout.Button(_guiContent_OrderUp.Content, _guiStyle_None, GUILayout.Width(12), GUILayout.Height(height))) { if (_funcClickOrderChanged != null) { _funcClickOrderChanged(this, _savedKey, _savedObj, true); } } if (GUILayout.Button(_guiContent_OrderDown.Content, _guiStyle_None, GUILayout.Width(12), GUILayout.Height(height))) { if (_funcClickOrderChanged != null) { _funcClickOrderChanged(this, _savedKey, _savedObj, false); } } leftWidth -= 30; if (leftWidth < 0) { leftWidth = 0; //leftWidth = level * 5; } GUILayout.Space(leftWidth); } else { //기본 여백 GUILayout.Space(Mathf.Max(leftWidth, level * 10)); } //맨 앞에 ▼/▶ 아이콘을 보이고, 작동시킬지를 결정 //bool isFoldVisible = false; //if (_childUnits.Count > 0 || (_parentUnit == null && _unitType == UNIT_TYPE.Label)) //{ // isFoldVisible = true; //} int width_FoldBtn = height - 4; //int width_Icon = height - 2; int width_Icon = height - 6; //추가 19.6.29 : RestoreTmpWorkVisible버튼 if (_isNextRender_RestoreTmpWorkVisible) { if (GUILayout.Button((_isTmpWorkAnyChanged ? _guiContent_RestoreTmpWorkVisible_ON.Content : _guiContent_RestoreTmpWorkVisible_OFF.Content), _guiStyle_None, GUILayout.Width(width_FoldBtn), GUILayout.Height(height))) { if (_funcClickRestoreTmpWorkVisible != null) { _funcClickRestoreTmpWorkVisible(); } } GUILayout.Space(2); } if (_isNextRenderFoldBtn) { //Fold 아이콘을 출력하고 Button 기능을 추가한다. GUIContent btnContent = _guiContent_FoldDown.Content; if (!_isFoldOut) { btnContent = _guiContent_FoldRight.Content; } if (GUILayout.Button(btnContent, _guiStyle_None, GUILayout.Width(width_FoldBtn), GUILayout.Height(height))) { if (_isCurRenderFoldBtn) { //정식 렌더링인 경우에 바꿔주자 _isFoldOut = !_isFoldOut; } } } else if (isOrderButtonVisible && _isOrderChangable) { GUILayout.Space(2); } else { GUILayout.Space(width_FoldBtn); } // 기본 아이콘 if (_guiContent_Icon != null && _guiContent_Icon.IsVisible) { if (GUILayout.Button(_guiContent_Icon.Content, _guiStyle_None, GUILayout.Width(width_Icon), GUILayout.Height(height))) { if (_unitType == UNIT_TYPE.Label) { //if (isFoldVisible) if (_isNextRenderFoldBtn && _isCurRenderFoldBtn) { _isFoldOut = !_isFoldOut; } } else { if (_funcClick != null) { apEditorUtil.ReleaseGUIFocus(); //<<추가 : 메뉴 바뀌면 무조건 GUI Focus를 날린다. _funcClick(this, _savedKey, _savedObj); } } } } if (!_isAvailable) { //GUI.contentColor = new Color(1.0f, 0.0f, 0.0f, 1.0f); _guiStyle_None.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 1.0f); _guiStyle_Selected.normal.textColor = new Color(0.5f, 0.5f, 0.5f, 1.0f); } //유닛의 타입에 따라 다르게 출력한다. switch (_unitType) { //Label : 별도의 버튼 기능 없이 아이콘+텍스트만 보인다. //만약, Fold가 가능한 경우 버튼으로 바뀌는데, Fold Toggle에 사용된다. case UNIT_TYPE.Label: //if (isFoldVisible) if (_isNextRenderFoldBtn) { if (GUILayout.Button(_guiContent_Text.Content, _guiStyle_None, GUILayout.Height(height))) { if (_isNextRenderFoldBtn && _isCurRenderFoldBtn) { _isFoldOut = !_isFoldOut; } } } else { EditorGUILayout.LabelField(_guiContent_Text.Content, GUILayout.Height(height)); } break; //OnlyButton : Toggle 기능 없이 항상 버튼의 역할을 한다. case UNIT_TYPE.OnlyButton: if (GUILayout.Button(_guiContent_Text.Content, _guiStyle_None, GUILayout.Height(height))) { if (_funcClick != null) { apEditorUtil.ReleaseGUIFocus(); //<<추가 : 메뉴 바뀌면 무조건 GUI Focus를 날린다. _funcClick(this, _savedKey, _savedObj); } } break; //ToggleButton : Off된 상태에서는 On하기 위한 버튼이며, On이 된 경우는 단순히 아이콘+텍스트만 출력한다. case UNIT_TYPE.ToggleButton: if (!_isSelected) { if (GUILayout.Button(_guiContent_Text.Content, _guiStyle_None, GUILayout.Height(height))) { if (_funcClick != null) { apEditorUtil.ReleaseGUIFocus(); //<<추가 : 메뉴 바뀌면 무조건 GUI Focus를 날린다. _funcClick(this, _savedKey, _savedObj); } } } else { GUILayout.Label(_guiContent_Text.Content, _guiStyle_Selected, GUILayout.Height(height)); } break; //ToggleButton case UNIT_TYPE.ToggleButton_Visible: if (!_isSelected) { if (GUILayout.Button(_guiContent_Text.Content, _guiStyle_None, GUILayout.Height(height))) { if (_funcClick != null) { apEditorUtil.ReleaseGUIFocus(); //<<추가 : 메뉴 바뀌면 무조건 GUI Focus를 날린다. _funcClick(this, _savedKey, _savedObj); } } } else { GUILayout.Label(_guiContent_Text.Content, _guiStyle_Selected, GUILayout.Height(height)); } //if (_visibleType_Postfix != VISIBLE_TYPE.None) if (_isNextRender_VisiblePostFix) { apGUIContentWrapper visibleGUIContent = null; if (!_isCurRender_VisiblePostFix) { //더미 렌더링이라면 visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Current]; } else { switch (_visibleType_Postfix) { case VISIBLE_TYPE.Current_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.Current]; break; case VISIBLE_TYPE.Current_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Current]; break; case VISIBLE_TYPE.TmpWork_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.TmpWork]; break; case VISIBLE_TYPE.TmpWork_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.TmpWork]; break; case VISIBLE_TYPE.Default_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.Default]; break; case VISIBLE_TYPE.Default_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.Default]; break; case VISIBLE_TYPE.ModKey_Visible: visibleGUIContent = _guiContent_Visible[(int)VISIBLE_ICON.ModKey]; break; case VISIBLE_TYPE.ModKey_NonVisible: visibleGUIContent = _guiContent_Nonvisible[(int)VISIBLE_ICON.ModKey]; break; case VISIBLE_TYPE.NoKey: visibleGUIContent = _guiContent_NoKey; break; } } if (GUILayout.Button(visibleGUIContent.Content, _guiStyle_None, GUILayout.Width(20), GUILayout.Height(height))) { if (_isCurRender_VisiblePostFix) { if (_funcClickVisible != null) { _funcClickVisible(this, _savedKey, _savedObj, _visibleType_Postfix == VISIBLE_TYPE.Current_Visible || _visibleType_Postfix == VISIBLE_TYPE.Default_Visible || _visibleType_Postfix == VISIBLE_TYPE.TmpWork_Visible || _visibleType_Postfix == VISIBLE_TYPE.ModKey_Visible, false); } } } } break; } EditorGUILayout.EndHorizontal(); if (!_isAvailable) { //GUI.contentColor = _guiColor_ContentColor; _guiStyle_None.normal.textColor = _guiColor_TextColor_None; _guiStyle_Selected.normal.textColor = _guiColor_TextColor_Selected; } if (isGUIEvent) { //이전 프레임과 렌더링 동기화 //설정에 의해 Prev를 갱신합니다. RefreshPrevRender(); } }
public override void OnInspectorGUI() { //return; LoadImages(); //base.OnInspectorGUI(); apPortrait targetPortrait = target as apPortrait; if (targetPortrait != _targetPortrait) { _targetPortrait = targetPortrait; Init(); } if (_targetPortrait == null) { //Profiler.EndSample(); return; } //Profiler.BeginSample("anyPortrait Inspector GUI"); //return; if (apEditor.IsOpen()) { //에디터가 작동중에는 안보이도록 하자 //EditorGUILayout.LabelField("Editor is opened"); GUILayout.Space(10); EditorGUILayout.LabelField(_guiContent_EditorIsOpen, GUILayout.Height(36)); //Profiler.EndSample(); return; } try { bool request_OpenEditor = false; bool request_QuickBake = false; bool request_RefreshMeshes = false; bool prevImportant = _targetPortrait._isImportant; MonoBehaviour prevAnimEventListener = _targetPortrait._optAnimEventListener; int prevSortingLayerID = _targetPortrait._sortingLayerID; apPortrait.SORTING_ORDER_OPTION prevSortingOrderOption = _targetPortrait._sortingOrderOption; int prevSortingOrder = _targetPortrait._sortingOrder; if (!EditorApplication.isPlaying) { int iconWidth = 32; int iconHeight = 34; int buttonHeight = 34; //추가 19.5.26 : 용량 최적화 기능이 추가되었는가 if (!_targetPortrait._isSizeOptimizedV117) { GUILayout.Space(10); Color prevBackColor = GUI.backgroundColor; GUI.backgroundColor = new Color(1.0f, 0.7f, 0.7f, 1.0f); GUILayout.Box("[File size reduction] has not been applied.\nExecute the [Bake] again.", _guiStyle_subTitle, GUILayout.Width((int)EditorGUIUtility.currentViewWidth - 36), GUILayout.Height(40)); GUI.backgroundColor = prevBackColor; } if (!_targetPortrait._isOptimizedPortrait) { GUILayout.Space(10); EditorGUILayout.BeginHorizontal(GUILayout.Height(iconHeight)); GUILayout.Space(5); EditorGUILayout.LabelField(_guiContent_OpenEditor, _guiStyle_buttonIcon, GUILayout.Width(iconWidth), GUILayout.Height(iconHeight)); GUILayout.Space(5); if (GUILayout.Button("Open Editor and Select", GUILayout.Height(buttonHeight))) { request_OpenEditor = true; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Height(iconHeight)); GUILayout.Space(5); EditorGUILayout.LabelField(_guiContent_QuickBake, _guiStyle_buttonIcon, GUILayout.Width(iconWidth), GUILayout.Height(iconHeight)); GUILayout.Space(5); if (GUILayout.Button("Quick Bake", GUILayout.Height(buttonHeight))) { request_QuickBake = true; } EditorGUILayout.EndHorizontal(); } else { GUILayout.Space(10); EditorGUILayout.BeginHorizontal(GUILayout.Height(iconHeight)); GUILayout.Space(5); EditorGUILayout.LabelField(_guiContent_OpenEditor, _guiStyle_buttonIcon, GUILayout.Width(iconWidth), GUILayout.Height(iconHeight)); GUILayout.Space(5); if (GUILayout.Button("Open Editor (Not Selectable)", GUILayout.Height(buttonHeight))) { //열기만 하고 선택은 못함 request_OpenEditor = true; } EditorGUILayout.EndHorizontal(); } //추가 12.18 : Mesh를 리프레시 하자 EditorGUILayout.BeginHorizontal(GUILayout.Height(iconHeight)); GUILayout.Space(5); EditorGUILayout.LabelField(_guiContent_RefreshMeshes, _guiStyle_buttonIcon, GUILayout.Width(iconWidth), GUILayout.Height(iconHeight)); GUILayout.Space(5); if (GUILayout.Button("Refresh Meshes", GUILayout.Height(buttonHeight))) { request_RefreshMeshes = true; } EditorGUILayout.EndHorizontal(); } GUILayout.Space(10); //BasicSettings //----------------------------------------------------------------------------- //"Basic Settings" int width = (int)EditorGUIUtility.currentViewWidth; int subTitleWidth = width - 44; int subTitleHeight = 26; GUILayout.Box(_guiContent_BasicSettings, _guiStyle_subTitle, GUILayout.Width(subTitleWidth), GUILayout.Height(subTitleHeight)); _targetPortrait._isImportant = EditorGUILayout.Toggle("Is Important", _targetPortrait._isImportant); _targetPortrait._optAnimEventListener = (MonoBehaviour)EditorGUILayout.ObjectField("Event Listener", _targetPortrait._optAnimEventListener, typeof(MonoBehaviour), true); GUILayout.Space(5); //추가3.22 //Sorting Layer string[] sortingLayerName = new string[SortingLayer.layers.Length]; int layerIndex = -1; for (int i = 0; i < SortingLayer.layers.Length; i++) { sortingLayerName[i] = SortingLayer.layers[i].name; if (SortingLayer.layers[i].id == _targetPortrait._sortingLayerID) { layerIndex = i; } } int nextLayerIndex = EditorGUILayout.Popup("Sorting Layer", layerIndex, sortingLayerName); apPortrait.SORTING_ORDER_OPTION nextSortingOption = (apPortrait.SORTING_ORDER_OPTION)EditorGUILayout.EnumPopup("Sorting Order Option", _targetPortrait._sortingOrderOption); int nextLayerOrder = _targetPortrait._sortingOrder; if (_targetPortrait._sortingOrderOption == apPortrait.SORTING_ORDER_OPTION.SetOrder) { nextLayerOrder = EditorGUILayout.IntField("Sorting Order", _targetPortrait._sortingOrder); if (nextLayerOrder != _targetPortrait._sortingOrder) { _targetPortrait.SetSortingOrder(nextLayerOrder); } } if (nextLayerIndex != layerIndex) { //Sorting Layer를 바꾸자 if (nextLayerIndex >= 0 && nextLayerIndex < SortingLayer.layers.Length) { string nextLayerName = SortingLayer.layers[nextLayerIndex].name; _targetPortrait.SetSortingLayer(nextLayerName); } } if (nextSortingOption != _targetPortrait._sortingOrderOption) { _targetPortrait._sortingOrderOption = nextSortingOption; //변경된 Sorting Order Option에 따라서 바로 Sorting을 해야한다. _targetPortrait.ApplySortingOptionToOptRootUnits(); switch (_targetPortrait._sortingOrderOption) { case apPortrait.SORTING_ORDER_OPTION.SetOrder: _targetPortrait.SetSortingOrder(_targetPortrait._sortingOrder); break; case apPortrait.SORTING_ORDER_OPTION.DepthToOrder: case apPortrait.SORTING_ORDER_OPTION.ReverseDepthToOrder: _targetPortrait.SetSortingOrderChangedAutomatically(true); _targetPortrait.RefreshSortingOrderByDepth(); break; } } if (prevImportant != _targetPortrait._isImportant || prevAnimEventListener != _targetPortrait._optAnimEventListener || prevSortingLayerID != _targetPortrait._sortingLayerID || prevSortingOrderOption != _targetPortrait._sortingOrderOption || prevSortingOrder != _targetPortrait._sortingOrder) { apEditorUtil.SetEditorDirty(); } GUILayout.Space(5); //빌보드 apPortrait.BILLBOARD_TYPE nextBillboard = (apPortrait.BILLBOARD_TYPE)EditorGUILayout.EnumPopup("Billboard Type", _targetPortrait._billboardType); if (nextBillboard != _targetPortrait._billboardType) { _targetPortrait._billboardType = nextBillboard; apEditorUtil.SetEditorDirty(); } GUILayout.Space(20); // Root Portraits //----------------------------------------------------------------------------- GUILayout.Box(_guiContent_RootPortraits, _guiStyle_subTitle, GUILayout.Width(subTitleWidth), GUILayout.Height(subTitleHeight)); _isFold_RootPortraits = EditorGUILayout.Foldout(_isFold_RootPortraits, "Portraits"); if (_isFold_RootPortraits) { for (int i = 0; i < _targetPortrait._optRootUnitList.Count; i++) { apOptRootUnit rootUnit = _targetPortrait._optRootUnitList[i]; EditorGUILayout.ObjectField("[" + i + "]", rootUnit, typeof(apOptRootUnit), true); } } GUILayout.Space(20); // Animation Settings //----------------------------------------------------------------------------- GUILayout.Box(_guiContent_AnimationSettings, _guiStyle_subTitle, GUILayout.Width(subTitleWidth), GUILayout.Height(subTitleHeight)); _isFold_AnimationClips = EditorGUILayout.Foldout(_isFold_AnimationClips, "Animation Clips"); if (_isFold_AnimationClips) { for (int i = 0; i < _targetPortrait._animClips.Count; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); apAnimClip animClip = _targetPortrait._animClips[i]; if (animClip._uniqueID == _targetPortrait._autoPlayAnimClipID) { EditorGUILayout.LabelField("[" + i + "] (Auto)", GUILayout.Width(80)); } else { EditorGUILayout.LabelField("[" + i + "]", GUILayout.Width(80)); } EditorGUILayout.TextField(animClip._name); try { AnimationClip nextAnimationClip = EditorGUILayout.ObjectField(animClip._animationClipForMecanim, typeof(AnimationClip), false) as AnimationClip; if (nextAnimationClip != animClip._animationClipForMecanim) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Animation Changed"); animClip._animationClipForMecanim = nextAnimationClip; } } catch (Exception) { } EditorGUILayout.EndHorizontal(); } } GUILayout.Space(10); AnimationClip nextEmptyAnimClip = EditorGUILayout.ObjectField("Empty Anim Clip", _targetPortrait._emptyAnimClipForMecanim, typeof(AnimationClip), false) as AnimationClip; if (nextEmptyAnimClip != _targetPortrait._emptyAnimClipForMecanim) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Animation Changed"); _targetPortrait._emptyAnimClipForMecanim = nextEmptyAnimClip; } GUILayout.Space(10); //EditorGUILayout.LabelField("Mecanim Settings"); EditorGUILayout.LabelField(_guiContent_Mecanim, GUILayout.Height(24)); bool isNextUsingMecanim = EditorGUILayout.Toggle("Use Mecanim", _targetPortrait._isUsingMecanim); if (_targetPortrait._isUsingMecanim != isNextUsingMecanim) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Mecanim Setting Changed"); _targetPortrait._isUsingMecanim = isNextUsingMecanim; } if (_targetPortrait._isUsingMecanim) { //GUILayout.Space(10); try { Animator nextAnimator = EditorGUILayout.ObjectField("Animator", _targetPortrait._animator, typeof(Animator), true) as Animator; if (nextAnimator != _targetPortrait._animator) { //하위에 있는 Component일 때에만 변동 가능 if (nextAnimator == null) { _targetPortrait._animator = null; } else { if (nextAnimator == _targetPortrait.GetComponent <Animator>()) { _targetPortrait._animator = nextAnimator; } else { EditorUtility.DisplayDialog("Invalid Animator", "Invalid Animator. Only the Animator, which is its own component, is valid.", "Okay"); } } } } catch (Exception) { } if (_targetPortrait._animator == null) { //1. Animator가 없다면 // > 생성하기 // > 생성되어 있다면 다시 링크 GUIStyle guiStyle_WarningText = new GUIStyle(GUI.skin.label); guiStyle_WarningText.normal.textColor = Color.red; EditorGUILayout.LabelField("Warning : No Animator!", guiStyle_WarningText); GUILayout.Space(5); if (GUILayout.Button("Add / Check Animator", GUILayout.Height(25))) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Mecanim Setting Changed"); Animator animator = _targetPortrait.gameObject.GetComponent <Animator>(); if (animator == null) { animator = _targetPortrait.gameObject.AddComponent <Animator>(); } _targetPortrait._animator = animator; } } else { //2. Animator가 있다면 if (GUILayout.Button("Refresh Layers", GUILayout.Height(25))) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Mecanim Setting Changed"); //Animator의 Controller가 있는지 체크해야한다. if (_targetPortrait._animator.runtimeAnimatorController == null) { //AnimatorController가 없다면 Layer는 초기화 _targetPortrait._animatorLayerBakedData.Clear(); } else { //AnimatorController가 있다면 레이어에 맞게 설정 _targetPortrait._animatorLayerBakedData.Clear(); UnityEditor.Animations.AnimatorController animatorController = _targetPortrait._animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController; if (animatorController != null && animatorController.layers.Length > 0) { for (int iLayer = 0; iLayer < animatorController.layers.Length; iLayer++) { apAnimMecanimData_Layer newLayerData = new apAnimMecanimData_Layer(); newLayerData._layerIndex = iLayer; newLayerData._layerName = animatorController.layers[iLayer].name; newLayerData._blendType = apAnimMecanimData_Layer.MecanimLayerBlendType.Unknown; switch (animatorController.layers[iLayer].blendingMode) { case UnityEditor.Animations.AnimatorLayerBlendingMode.Override: newLayerData._blendType = apAnimMecanimData_Layer.MecanimLayerBlendType.Override; break; case UnityEditor.Animations.AnimatorLayerBlendingMode.Additive: newLayerData._blendType = apAnimMecanimData_Layer.MecanimLayerBlendType.Additive; break; } _targetPortrait._animatorLayerBakedData.Add(newLayerData); } } } } GUILayout.Space(5); EditorGUILayout.LabelField("Animator Controller Layers"); for (int i = 0; i < _targetPortrait._animatorLayerBakedData.Count; i++) { apAnimMecanimData_Layer layer = _targetPortrait._animatorLayerBakedData[i]; EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); EditorGUILayout.LabelField("[" + layer._layerIndex + "]", GUILayout.Width(50)); EditorGUILayout.TextField(layer._layerName); apAnimMecanimData_Layer.MecanimLayerBlendType nextBlendType = (apAnimMecanimData_Layer.MecanimLayerBlendType)EditorGUILayout.EnumPopup(layer._blendType); EditorGUILayout.EndHorizontal(); if (nextBlendType != layer._blendType) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Mecanim Setting Changed"); _targetPortrait._animatorLayerBakedData[i]._blendType = nextBlendType; } } } } GUILayout.Space(20); //추가 3.4 : 타임라인 설정 #if UNITY_2017_1_OR_NEWER EditorGUILayout.LabelField(_guiContent_Timeline, GUILayout.Height(24)); _isFold_Timeline = EditorGUILayout.Foldout(_isFold_Timeline, "Track Data"); if (_isFold_Timeline) { int nextTimelineTracks = EditorGUILayout.DelayedIntField("Size", _nTimelineTrackSet); if (nextTimelineTracks != _nTimelineTrackSet) { //TimelineTrackSet의 개수가 바뀌었다. UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Track Setting Changed"); _nTimelineTrackSet = nextTimelineTracks; if (_nTimelineTrackSet < 0) { _nTimelineTrackSet = 0; } //일단 이전 개수만큼 복사를 한다. int nPrev = 0; List <apPortrait.TimelineTrackPreset> prevSets = new List <apPortrait.TimelineTrackPreset>(); if (targetPortrait._timelineTrackSets != null && targetPortrait._timelineTrackSets.Length > 0) { for (int i = 0; i < targetPortrait._timelineTrackSets.Length; i++) { prevSets.Add(targetPortrait._timelineTrackSets[i]); } nPrev = targetPortrait._timelineTrackSets.Length; } //배열을 새로 만들자 targetPortrait._timelineTrackSets = new apPortrait.TimelineTrackPreset[_nTimelineTrackSet]; //가능한 이전 소스를 복사한다. for (int i = 0; i < _nTimelineTrackSet; i++) { if (i < nPrev) { targetPortrait._timelineTrackSets[i] = new apPortrait.TimelineTrackPreset(); targetPortrait._timelineTrackSets[i]._playableDirector = prevSets[i]._playableDirector; targetPortrait._timelineTrackSets[i]._trackName = prevSets[i]._trackName; targetPortrait._timelineTrackSets[i]._layer = prevSets[i]._layer; targetPortrait._timelineTrackSets[i]._blendMethod = prevSets[i]._blendMethod; } else { targetPortrait._timelineTrackSets[i] = new apPortrait.TimelineTrackPreset(); } } apEditorUtil.ReleaseGUIFocus(); } GUILayout.Space(5); if (targetPortrait._timelineTrackSets != null) { apPortrait.TimelineTrackPreset curTrackSet = null; for (int i = 0; i < targetPortrait._timelineTrackSets.Length; i++) { //트랙을 하나씩 적용 curTrackSet = targetPortrait._timelineTrackSets[i]; EditorGUILayout.LabelField("[" + i + "] : " + (curTrackSet._playableDirector == null ? "<None>" : curTrackSet._playableDirector.name)); PlayableDirector nextDirector = EditorGUILayout.ObjectField("Director", curTrackSet._playableDirector, typeof(PlayableDirector), true) as PlayableDirector; string nextTrackName = EditorGUILayout.DelayedTextField("Track Name", curTrackSet._trackName); int nextLayer = EditorGUILayout.DelayedIntField("Layer", curTrackSet._layer); apAnimPlayUnit.BLEND_METHOD nextBlendMethod = (apAnimPlayUnit.BLEND_METHOD)EditorGUILayout.EnumPopup("Blend", curTrackSet._blendMethod); if (nextDirector != curTrackSet._playableDirector || nextTrackName != curTrackSet._trackName || nextLayer != curTrackSet._layer || nextBlendMethod != curTrackSet._blendMethod ) { UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty(); Undo.IncrementCurrentGroup(); Undo.RegisterCompleteObjectUndo(_targetPortrait, "Track Setting Changed"); curTrackSet._playableDirector = nextDirector; curTrackSet._trackName = nextTrackName; curTrackSet._layer = nextLayer; curTrackSet._blendMethod = nextBlendMethod; apEditorUtil.ReleaseGUIFocus(); } GUILayout.Space(5); } } } GUILayout.Space(20); #endif bool isChanged = false; // Control Parameters //----------------------------------------------------------------------------- if (_guiContent_Category == null) { _guiContent_Category = apGUIContentWrapper.Make("Category", false); } GUILayout.Box(_guiContent_ControlParams, _guiStyle_subTitle, GUILayout.Width(subTitleWidth), GUILayout.Height(subTitleHeight)); #if UNITY_2017_3_OR_NEWER _curControlCategory = (apControlParam.CATEGORY)EditorGUILayout.EnumFlagsField(_guiContent_Category.Content, _curControlCategory); #else _curControlCategory = (apControlParam.CATEGORY)EditorGUILayout.EnumMaskPopup(_guiContent_Category.Content, _curControlCategory); #endif EditorGUILayout.Space(); //1. 컨르롤러를 제어할 수 있도록 하자 if (_controlParams != null) { for (int i = 0; i < _controlParams.Count; i++) { if ((int)(_controlParams[i]._category & _curControlCategory) != 0) { if (GUI_ControlParam(_controlParams[i])) { isChanged = true; } } } } GUILayout.Space(30); //2. 토글 버튼을 두어서 기본 Inspector 출력 여부를 결정하자. string strBaseButton = "Show All Properties"; if (_showBaseInspector) { strBaseButton = "Hide Properties"; } if (GUILayout.Button(strBaseButton, GUILayout.Height(20))) { _showBaseInspector = !_showBaseInspector; } if (_showBaseInspector) { base.OnInspectorGUI(); } if (!Application.isPlaying && isChanged) { //플레이 중이라면 자동으로 업데이트 될 것이다. _targetPortrait.UpdateForce(); } if (_targetPortrait != null) { if (request_OpenEditor) { if (_targetPortrait._isOptimizedPortrait) { RequestDelayedOpenEditor(_targetPortrait, REQUEST_TYPE.Open); } else { RequestDelayedOpenEditor(_targetPortrait, REQUEST_TYPE.OpenAndSet); } //apEditor anyPortraitEditor = apEditor.ShowWindow(); //if (anyPortraitEditor != null && !_targetPortrait._isOptimizedPortrait) //{ // anyPortraitEditor.SetPortraitByInspector(_targetPortrait, false); //} } else if (request_QuickBake) { RequestDelayedOpenEditor(_targetPortrait, REQUEST_TYPE.QuickBake); //apEditor anyPortraitEditor = apEditor.ShowWindow(); //if (anyPortraitEditor != null) //{ // anyPortraitEditor.SetPortraitByInspector(_targetPortrait, true); // Selection.activeObject = _targetPortrait.gameObject; //} } else if (request_RefreshMeshes) { _targetPortrait.OnMeshResetInEditor(); } } } catch (Exception ex) { Debug.LogError("apInspector_Portrait Exception : " + ex); } //Profiler.EndSample(); }
// 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(); } }