// Show Window //-------------------------------------------------------------- public static object ShowDialog(apEditor editor, apMeshGroup srcMeshGroup, REQUEST_TARGET requestTarget, FUNC_SELECT_MULTIPLE_OBJECTS funcResult, string positiveBtnText, object savedObject, object exceptObject = null) { CloseDialog(); if (editor == null || editor._portrait == null) { return(null); } string windowName = ""; switch (requestTarget) { case REQUEST_TARGET.Mesh: windowName = "Select Meshes"; break; case REQUEST_TARGET.MeshAndMeshGroups: windowName = "Meshes and MeshGroups"; break; case REQUEST_TARGET.ChildMeshTransforms: windowName = "Select Child Meshes"; break; } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_SelectMultipleObjects), true, windowName, true); apDialog_SelectMultipleObjects curTool = curWindow as apDialog_SelectMultipleObjects; object loadKey = new object(); if (curTool != null && curTool != s_window) { 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, srcMeshGroup, requestTarget, funcResult, positiveBtnText, savedObject, exceptObject); return(loadKey); } else { return(null); } }
// Init //-------------------------------------------------------------------- public void Init(apEditor editor, object loadKey, apMeshGroup srcMeshGroup, REQUEST_TARGET requestTarget, FUNC_SELECT_MULTIPLE_OBJECTS funcResult, string positiveBtnText, object savedObject, object exceptObject) { _editor = editor; _loadKey = loadKey; _meshGroup = srcMeshGroup; _funcResult = funcResult; //타겟을 검색하자 _meshes.Clear(); _meshGroups.Clear(); _meshTransforms.Clear(); _requestTarget = requestTarget; _target = TARGET_TAB.Mesh; _positiveBtnText = positiveBtnText; _savedObject = savedObject; _exceptObject = exceptObject; _img_Mesh = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Mesh); _img_MeshGroup = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_MeshGroup); _img_FoldDown = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_FoldDown); //대상이 되는 데이터를 가져온다. if (_requestTarget == REQUEST_TARGET.Mesh || _requestTarget == REQUEST_TARGET.MeshAndMeshGroups) { //1. Mesh for (int i = 0; i < _editor._portrait._meshes.Count; i++) { _meshes.Add(_editor._portrait._meshes[i]); } } if (_requestTarget == REQUEST_TARGET.MeshAndMeshGroups) { //2. Mesh Group for (int i = 0; i < _editor._portrait._meshGroups.Count; i++) { apMeshGroup meshGroup = _editor._portrait._meshGroups[i]; if (meshGroup == srcMeshGroup || meshGroup._parentMeshGroup != null) //다른 ChildMeshGroup도 가져오지 못하게.. { 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); } } } if (_requestTarget == REQUEST_TARGET.ChildMeshTransforms) { //3. Child Mesh Transform for (int i = 0; i < _meshGroup._renderUnits_All.Count; i++) { apRenderUnit renderUnit = _meshGroup._renderUnits_All[i]; if (renderUnit._meshTransform != null) { if (!_meshTransforms.Contains(renderUnit._meshTransform)) { _meshTransforms.Add(renderUnit._meshTransform); } } } _meshTransforms.Reverse(); } if (_exceptObject != null) { if (_exceptObject is apMesh) { apMesh exceptMesh = _exceptObject as apMesh; if (_meshes.Contains(exceptMesh)) { _meshes.Remove(exceptMesh); } } if (_exceptObject is apMeshGroup) { apMeshGroup exceptMeshGroup = _exceptObject as apMeshGroup; if (_meshGroups.Contains(exceptMeshGroup)) { _meshGroups.Remove(exceptMeshGroup); } } if (_exceptObject is apTransform_Mesh) { apTransform_Mesh exceptMestTF = _exceptObject as apTransform_Mesh; if (_meshTransforms.Contains(exceptMestTF)) { _meshTransforms.Remove(exceptMestTF); } } } }