// Init //------------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, apControlParam targetControlParam, FUNC_SELECT_CONTROLPARAM_PRESET funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _targetControlParam = targetControlParam; _strAddParamName = targetControlParam._keyName; _selectedUnit = null; switch (_targetControlParam._valueType) { case apControlParam.TYPE.Int: _strValueInfo = "Int : " + _targetControlParam._int_Min + " ~ " + _targetControlParam._int_Max; _strDefaultInfo = _targetControlParam._int_Def.ToString(); break; case apControlParam.TYPE.Float: _strValueInfo = "Float : " + _targetControlParam._float_Min + " ~ " + _targetControlParam._float_Max; _strDefaultInfo = _targetControlParam._float_Def.ToString(); break; case apControlParam.TYPE.Vector2: _strValueInfo = "Vector2 : " + "[ X " + _targetControlParam._vec2_Min.x + " ~ " + _targetControlParam._vec2_Max.x + " , " + "[ Y " + _targetControlParam._vec2_Min.y + " ~ " + _targetControlParam._vec2_Max.y + " ]"; _strDefaultInfo = _targetControlParam._vec2_Def.x + ", " + _targetControlParam._vec2_Def.y; break; } }
// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apTextureData targetTextureData, FUNC_SELECT_TEXTUREASSET_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectTextureAsset), true, "Select Texture2D", true); apDialog_SelectTextureAsset curTool = curWindow as apDialog_SelectTextureAsset; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 500; int height = 600; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, targetTextureData, loadKey, funcResult); return(loadKey); } else { return(null); } }
// Show Window //-------------------------------------------------------------- public static object ShowDialog(apEditor editor, PARAM_TYPE paramTypeFilter, FUNC_SELECT_CONTROLPARAM_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectControlParam), true, "Select Control Param", true); apDialog_SelectControlParam curTool = curWindow as apDialog_SelectControlParam; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 250; int height = 400; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, paramTypeFilter, funcResult); return(loadKey); } else { return(null); } }
/// <summary> /// Undo를 위해 Action을 저장한다. /// Label과 기록되는 값을 통해서 중복 여부를 체크한다. /// </summary> /// <param name="parentObject">변동되는 오브젝트의 Parent</param> /// <param name="targetObject">변동되는 오브젝트</param> /// <param name="isMultiple">한번에 여러개의 객체를 동시에 처리하는가</param> public static void SetRecord(apUndoGroupData.ACTION action, MonoBehaviour parentMonoObject, //<<이게 중요 object targetObject, bool isMultiple, apEditor editor) { if (editor._portrait == null) { return; } //연속된 기록이면 Undo/Redo시 한번에 묶어서 실행되어야 한다. (예: 버텍스의 실시간 이동 기록) //이전에 요청되었던 기록이면 Undo ID를 유지해야한다. bool isNewAction = apUndoGroupData.I.SetAction(action, parentMonoObject, targetObject, isMultiple); EditorSceneManager.MarkAllScenesDirty(); //새로운 변동 사항이라면 UndoID 증가 if (isNewAction) { Undo.IncrementCurrentGroup(); _lastUndoID = Undo.GetCurrentGroup(); } Undo.RecordObject(parentMonoObject, apUndoGroupData.GetLabel(action)); //MonoObject별로 다르게 Undo를 등록하자 if (targetObject != null && targetObject != parentMonoObject as object && targetObject is MonoBehaviour) { //타겟 오브젝트도 Monobehaviour라면 같이 저장 Undo.RecordObject(targetObject as MonoBehaviour, apUndoGroupData.GetLabel(action)); } //테스트를 위해서 Undo 기록이 발생하면 노티를 띄운다. (Undo ID를 같이) //editor.Notification("U:" + apUndoGroupData.GetLabel(action) + " - " + Undo.GetCurrentGroup(), true); }
// Init //-------------------------------------------------------------------- public void Init(apEditor editor, object loadKey, apMeshGroup srcMeshGroup, FUNC_SELECT_TRANSFORM_RESULT funcResult) { _editor = editor; _loadKey = loadKey; //_srcMeshGroup = srcMeshGroup; _funcResult = funcResult; //타겟을 검색하자 _meshes.Clear(); _meshGroups.Clear(); for (int i = 0; i < _editor._portrait._meshes.Count; i++) { _meshes.Add(_editor._portrait._meshes[i]); } for (int i = 0; i < _editor._portrait._meshGroups.Count; i++) { apMeshGroup meshGroup = _editor._portrait._meshGroups[i]; if (meshGroup == srcMeshGroup) { continue; } //재귀적으로 이미 포함된 MeshGroup인지 판단한다. //추가 12.03 : 그 반대도 포함해야 한다. apTransform_MeshGroup childMeshGroupTransform = srcMeshGroup.FindChildMeshGroupTransform(meshGroup); apTransform_MeshGroup childMeshGroupTransform_Rev = meshGroup.FindChildMeshGroupTransform(srcMeshGroup); if (childMeshGroupTransform == null && childMeshGroupTransform_Rev == null) { //child가 아닐때 _meshGroups.Add(meshGroup); } } }
// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apBone bone, FUNC_DUPLICATE_BONE_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null || bone == null || funcResult == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_DuplicateBone), true, "Duplicate", true); apDialog_DuplicateBone curTool = curWindow as apDialog_DuplicateBone; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 300; int height = 150; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, bone, loadKey, funcResult); return(loadKey); } else { return(null); } }
// Functions //-------------------------------------------------------- public void Record(apEditor editor) { if (editor._portrait == null) { return; } _isRecorded = false; _controlParamRecords.Clear(); _animClipFrame_Record = -1; _animClipFrame_Cur = -1; for (int i = 0; i < editor._portrait._controller._controlParams.Count; i++) { _controlParamRecords.Add(new ControlParamRecord(editor._portrait._controller._controlParams[i])); } if (editor.Select.AnimClip != null) { _animClipFrame_Record = editor.Select.AnimClip.CurFrame; _animClipFrame_Cur = _animClipFrame_Record; } _isRecorded = true; }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apAnimClip targetAnimClip, FUNC_SELECT_MESHGROUP funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectLinkedMeshGroup), true, "Select Mesh Group", true); apDialog_SelectLinkedMeshGroup curTool = curWindow as apDialog_SelectLinkedMeshGroup; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 250; int height = 400; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetAnimClip, funcResult); return(loadKey); } else { return(null); } }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apMeshGroup targetMeshGroup, apBone selectedBone) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_RetargetSinglePoseExport), true, "Export Pose", true); apDialog_RetargetSinglePoseExport curTool = curWindow as apDialog_RetargetSinglePoseExport; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 400; int height = 600; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetMeshGroup, selectedBone); return(loadKey); } else { return(null); } }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apAnimClip targetAnimClip, FUNC_ADD_TIMELINE funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_AddAnimTimeline), true, "Select Timeline Type", true); apDialog_AddAnimTimeline curTool = curWindow as apDialog_AddAnimTimeline; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 250; int height = 400; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetAnimClip, funcResult); return(loadKey); } else { return(null); } }
// Show Window //------------------------------------------------------------------ public static void ShowDialog(apEditor editor, int parentX, int parentY) { CloseDialog(); if (editor == null) { return; } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_AmbientCorrection), true, "Ambient Correction", true); apDialog_AmbientCorrection curTool = curWindow as apDialog_AmbientCorrection; //object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 540; int height = 430; s_window = curTool; int basePosX = parentX - 50; int basePosY = parentY + 50; //s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), // (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), // width, height); s_window.position = new Rect(Mathf.Max(basePosX - (width / 2), 10), Mathf.Max(basePosY - (height / 2), 10), width, height); s_window.Init(editor); } }
public override void ExecuteNext2Prev(apEditor editor) { try { switch (_actionType) { case apUndoManager.ACTION_TYPE.Add: { apMesh mesh = _keyObj as apMesh; if (mesh == null) { return; } //Next에서 Prev로 Vertex List를 비교하여 [제거]해준다. //Add의 반대는 Remove Debug.Log("Undo : Add -> Remove"); } break; case apUndoManager.ACTION_TYPE.Remove: break; case apUndoManager.ACTION_TYPE.Changed: break; } } catch (Exception ex) { Debug.LogError("Undo Exception : " + ex); } }
// Init //------------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, apAnimClip targetAnimGroup, FUNC_ADD_TIMELINE funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _targetAnimClip = targetAnimGroup; _selectedLinkData = null; _linkDataList.Clear(); //타임라인을 검색해보자 //리스트에 들어가는건 한글로 바꾸기 힘들 수 있다. //_linkDataList.Add(new LinkableData(apAnimClip.LINK_TYPE.ControlParam, "Control Parameters", -1, _editor.ImageSet.Get(apImageSet.PRESET.Anim_WithControlParam))); AddLinkableData(apAnimClip.LINK_TYPE.ControlParam, "Control Parameters", -1); //"Control Parameters" //AddLinkableData(apAnimClip.LINK_TYPE.Bone, "Bones", -1); List <apModifierBase> modifiers = _targetAnimClip._targetMeshGroup._modifierStack._modifiers; for (int i = 0; i < modifiers.Count; i++) { apModifierBase curMod = modifiers[i]; if (!curMod.IsAnimated) { continue; } //"Modifier : " AddLinkableData(apAnimClip.LINK_TYPE.AnimatedModifier, "Modifier : " + curMod.DisplayName, curMod._uniqueID); } }
// Init //------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, FUNC_NEW_PORTRAIT_RESULT funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _newPortraitName = "New Portrait"; }
// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, FUNC_NEW_PORTRAIT_RESULT funcResult) { CloseDialog(); if (editor == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_NewPortrait), true, "Make New Portrait", true); apDialog_NewPortrait curTool = curWindow as apDialog_NewPortrait; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 300; int height = 110; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, funcResult); return(loadKey); } else { return(null); } }
// Show Window //-------------------------------------------------------------- public static object ShowDialog(apEditor editor, bool isPresetTarget, string msg, bool isNoneSelectable, FUNC_SELECT_MATERIALSET_RESULT funcResult, object savedObject) { CloseDialog(); if (editor == null || editor._portrait == null || editor.MaterialLibrary == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectMaterialSet), true, "Select Material Set", true); apDialog_SelectMaterialSet curTool = curWindow as apDialog_SelectMaterialSet; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 250; int height = 400; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, isPresetTarget, msg, isNoneSelectable, funcResult, savedObject); return(loadKey); } else { return(null); } }
// Show Window //-------------------------------------------------------------- public static object ShowDialog(apEditor editor, apMeshGroup srcMeshGroup, FUNC_SELECT_TRANSFORM_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_AddChildTransform), true, "Add Mesh/MeshGroup", true); apDialog_AddChildTransform curTool = curWindow as apDialog_AddChildTransform; object loadKey = new object(); if (curTool != null && curTool != s_window) { s_window = curTool; s_window.position = new Rect(100, 100, 250, 400); s_window.Init(editor, loadKey, srcMeshGroup, funcResult); return(loadKey); } else { return(null); } }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apModifiedMesh targetModMesh, FUNC_SELECT_PHYSICS_PRESET funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_PhysicsPreset), true, "Physics Preset", true); apDialog_PhysicsPreset curTool = curWindow as apDialog_PhysicsPreset; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 400; int height = 700; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetModMesh, funcResult); return(loadKey); } else { return(null); } }
// Init //------------------------------------------------------------------------ public void Init(FUNC_RETARGET_SINGLE_POSE_IMPORT_ANIM funcResult_Anim, FUNC_RETARGET_SINGLE_POSE_IMPORT_MOD funcResult_Mod, apEditor editor, object loadKey, apMeshGroup targetMeshGroup, apModifierBase targetModifier, apModifierParamSet targetParamSet, //<<일반 Modifier에서 작업하는 경우 apAnimClip targetAnimClip, apAnimTimeline targetAnimTimeline, int targetFrame) { _editor = editor; _loadKey = loadKey; _targetMeshGroup = targetMeshGroup; _funcResult_Anim = funcResult_Anim; _funcResult_Mod = funcResult_Mod; _targetModifier = targetModifier; _targetParamSet = targetParamSet; _targetAnimClip = targetAnimClip; _targetAnimTimeline = targetAnimTimeline; _targetFrame = targetFrame; //_imgIcon_Bone = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Bone); _category = CATEGORY.SameMeshGroup; _retarget.LoadSinglePoseFileList(editor); _selectedBonePoseFile = null; _isValidPose = false; _meshGroupUniqueID = _targetMeshGroup._uniqueID; _portraitName = _targetMeshGroup._parentPortrait.name; }
// Init //-------------------------------------------------------------- public void Init(apEditor editor, object loadKey, PARAM_TYPE paramTypeFilter, FUNC_SELECT_CONTROLPARAM_RESULT funcResult) { _editor = editor; _loadKey = loadKey; //_paramTypeFilter = paramTypeFilter; _funcResult = funcResult; _controlParams.Clear(); List <apControlParam> cParams = _editor._portrait._controller._controlParams; for (int i = 0; i < cParams.Count; i++) { apControlParam.TYPE paramType = cParams[i]._valueType; bool isAdded = false; switch (paramType) { //case apControlParam.TYPE.Bool: // if((int)(paramTypeFilter & PARAM_TYPE.Bool) != 0) { isAdded = true; } // break; case apControlParam.TYPE.Int: if ((int)(paramTypeFilter & PARAM_TYPE.Int) != 0) { isAdded = true; } break; case apControlParam.TYPE.Float: if ((int)(paramTypeFilter & PARAM_TYPE.Float) != 0) { isAdded = true; } break; case apControlParam.TYPE.Vector2: if ((int)(paramTypeFilter & PARAM_TYPE.Vector2) != 0) { isAdded = true; } break; //case apControlParam.TYPE.Vector3: // if((int)(paramTypeFilter & PARAM_TYPE.Vector3) != 0) { isAdded = true; } // break; //case apControlParam.TYPE.Color: // if((int)(paramTypeFilter & PARAM_TYPE.Color) != 0) { isAdded = true; } // break; } if (isAdded) { _controlParams.Add(cParams[i]); } } }
// Show Window //-------------------------------------------------------------- public static object ShowDialog(apEditor editor, apMeshGroup targetMeshGroup, FUNC_ADD_MODIFIER_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_AddModifier), true, "Select Modifier", true); apDialog_AddModifier curTool = curWindow as apDialog_AddModifier; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 250; int height = 400; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetMeshGroup, funcResult); return(loadKey); } else { return(null); } }
// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apPortrait portrait) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_Bake), true, "Bake", true); apDialog_Bake curTool = curWindow as apDialog_Bake; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 350; int height = 170; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, portrait, loadKey); return(loadKey); } else { return(null); } }
// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apPortrait portrait, FUNC_FFD_SIZE_RESULT funcResult, int curX, int curY) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_FFDSize), true, "Custom FFD Size", true); apDialog_FFDSize curTool = curWindow as apDialog_FFDSize; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 300; int height = 130; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, portrait, loadKey, funcResult, curX, curY); return(loadKey); } else { return(null); } }
// Show Window //------------------------------------------------------------------ public static void ShowDialog(apEditor editor, Texture2D img_Logo, bool isFullVersion) { CloseDialog(); if (editor == null) { return; } string strTitle = "Start Page"; if (!isFullVersion) { strTitle = "Demo Start Page"; } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_StartPage), true, strTitle, true); apDialog_StartPage curTool = curWindow as apDialog_StartPage; //object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 500; int height = 280; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, img_Logo, isFullVersion); } }
// Init //------------------------------------------------------------------------ public void Init(apEditor editor, object loadKey, apMeshGroup targetMeshGroup, FUNC_LOAD_RETARGET funcResult) { _editor = editor; _loadKey = loadKey; _funcResult = funcResult; _targetMeshGroup = targetMeshGroup; }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apMeshGroup targetMeshGroup, FUNC_LOAD_RETARGET funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_RetargetBase), true, "Export/Import Bones", true); apDialog_RetargetBase curTool = curWindow as apDialog_RetargetBase; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 500; int height = 800; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetMeshGroup, funcResult); return(loadKey); } else { return(null); } }
private IEnumerator Crt_RequestEditor() { yield return(new WaitForEndOfFrame()); Selection.activeObject = null; yield return(new WaitForEndOfFrame()); if (_requestPortrait != null) { try { apEditor anyPortraitEditor = apEditor.ShowWindow(); if (_requestType == REQUEST_TYPE.OpenAndSet) { anyPortraitEditor.SetPortraitByInspector(_requestPortrait, false); } else if (_requestType == REQUEST_TYPE.QuickBake) { anyPortraitEditor.SetPortraitByInspector(_requestPortrait, true); Selection.activeObject = _requestPortrait.gameObject; } } catch (Exception ex) { Debug.LogError("Open Editor Error : " + ex); } } _requestType = REQUEST_TYPE.None; _requestPortrait = null; }
/// <summary> /// Undo는 "같은 메뉴"에서만 가능하다. 메뉴를 전환할 때에는 Undo를 /// </summary> public static void ResetUndo(apEditor editor) { //apUndoManager.I.Clear(); if (editor._portrait != null) { Undo.ClearUndo(editor._portrait); } }
// Show Window / Close Dialog //------------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apBone targetBone, apMeshGroup targetMeshGroup, REQUEST_TYPE requestType, FUNC_SELECT_LINKED_BONE funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null) { return(null); } string windowName = ""; switch (requestType) { case REQUEST_TYPE.AttachChild: windowName = "Select a Bone as Child"; break; case REQUEST_TYPE.ChangeParent: windowName = "Select a Bone as Parent"; break; case REQUEST_TYPE.SelectIKTarget: windowName = "Select a Bone as IK Target"; break; case REQUEST_TYPE.SelectIKPositionControllerEffector: case REQUEST_TYPE.SelectIKLookAtControllerEffector: case REQUEST_TYPE.SelectIKLookAtControllerStartBone: windowName = "Select a Bone as IK Effector"; break; case REQUEST_TYPE.Mirror: windowName = "Select a Mirror Bone"; break; } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectLinkedBone), true, windowName, true); apDialog_SelectLinkedBone curTool = curWindow as apDialog_SelectLinkedBone; object loadKey = new object(); if (curTool != null && curTool != s_window) { //기본 Dialog보다 조금 더 크다. Hierarchy 방식으로 가로 스크롤이 포함되기 때문 int width = 350; int height = 600; s_window = curTool; s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2), (editor.position.yMin + editor.position.yMax) / 2 - (height / 2), width, height); s_window.Init(editor, loadKey, targetBone, targetMeshGroup, requestType, funcResult); return(loadKey); } else { return(null); } }
// Init //------------------------------------------------------------------ public void Init(apEditor editor, apPortrait portrait, object loadKey, FUNC_FFD_SIZE_RESULT funcResult, int curX, int curY) { _editor = editor; _loadKey = loadKey; _targetPortrait = portrait; _funcResult = funcResult; _nX = curX; _nY = curY; }