public void TransformChanged_Depth__MeshGroup_Setting(int depth) { if (Editor.Select.MeshGroup == null || !Editor.Select.IsMeshGroupSettingChangePivot) { return; } if (Editor.Select.SubMeshInGroup == null && Editor.Select.SubMeshGroupInGroup == null) { return; } apRenderUnit curRenderUnit = null; //apMatrix curMatrixParam = null; object targetObj = null; if (Editor.Select.SubMeshInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshInGroup); //curMatrixParam = Editor.Select.SubMeshInGroup._matrix; targetObj = Editor.Select.SubMeshInGroup; } else if (Editor.Select.SubMeshGroupInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshGroupInGroup); //curMatrixParam = Editor.Select.SubMeshGroupInGroup._matrix; targetObj = Editor.Select.SubMeshGroupInGroup; } if (curRenderUnit == null) { return; } //Undo apEditorUtil.SetRecord_MeshGroup(apUndoGroupData.ACTION.MeshGroup_Gizmo_MoveTransform, Editor, Editor.Select.MeshGroup, targetObj, false, true); bool bSort = false; if (curRenderUnit.GetDepth() != depth) { //curRenderUnit.SetDepth(depth); Editor.Select.MeshGroup.ChangeRenderUnitDepth(curRenderUnit, depth); bSort = true; apEditorUtil.ReleaseGUIFocus(); } if (bSort) { Editor.Select.MeshGroup.SortRenderUnits(true); } Editor.RefreshControllerAndHierarchy(); Editor.SetRepaint(); }
public void TransformChanged_Position__MeshGroup_Setting(Vector2 pos, int depth) { if (Editor.Select.MeshGroup == null || !Editor.Select.IsMeshGroupSettingChangePivot) { return; } if (Editor.Select.SubMeshInGroup == null && Editor.Select.SubMeshGroupInGroup == null) { return; } apRenderUnit curRenderUnit = null; apMatrix curMatrixParam = null; object targetObj = null; if (Editor.Select.SubMeshInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshInGroup); curMatrixParam = Editor.Select.SubMeshInGroup._matrix; targetObj = Editor.Select.SubMeshInGroup; } else if (Editor.Select.SubMeshGroupInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshGroupInGroup); curMatrixParam = Editor.Select.SubMeshGroupInGroup._matrix; targetObj = Editor.Select.SubMeshGroupInGroup; } if (curRenderUnit == null) { return; } //Undo apEditorUtil.SetRecord(apUndoGroupData.ACTION.MeshGroup_Gizmo_MoveTransform, Editor.Select.MeshGroup, targetObj, false, Editor); bool bSort = false; if (curRenderUnit.GetDepth() != depth) { //curRenderUnit.SetDepth(depth); Editor.Select.MeshGroup.ChangeRenderUnitDetph(curRenderUnit, depth); bSort = true; } curMatrixParam.SetPos(pos); curMatrixParam.MakeMatrix(); if (bSort) { Editor.Select.MeshGroup.SortRenderUnits(true); } Editor.SetRepaint(); }
public SubUnit(apRenderUnit renderUnit, int level, bool isTarget, bool isRoot) { _isRoot = isRoot; _level = level; _isTarget = isTarget; _name = renderUnit.Name; _depth = renderUnit.GetDepth(); _isMeshTransform = (renderUnit._meshTransform != null); _childUnits.Clear(); }
public apGizmos.TransformParam PivotReturn__MeshGroup_Setting() { if (Editor.Select.MeshGroup == null) { return(null); } if (Editor.Select.SubMeshInGroup == null && Editor.Select.SubMeshGroupInGroup == null) { return(null); } apRenderUnit curRenderUnit = null; apMatrix curMatrixParam = null; apMatrix resultMatrix = null; Color meshColor2X = Color.gray; bool isVisible = true; if (Editor.Select.SubMeshInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshInGroup); curMatrixParam = Editor.Select.SubMeshInGroup._matrix; meshColor2X = Editor.Select.SubMeshInGroup._meshColor2X_Default; isVisible = Editor.Select.SubMeshInGroup._isVisible_Default; } else if (Editor.Select.SubMeshGroupInGroup != null) { curRenderUnit = Editor.Select.MeshGroup.GetRenderUnit(Editor.Select.SubMeshGroupInGroup); curMatrixParam = Editor.Select.SubMeshGroupInGroup._matrix; meshColor2X = Editor.Select.SubMeshGroupInGroup._meshColor2X_Default; isVisible = Editor.Select.SubMeshGroupInGroup._isVisible_Default; } if (curRenderUnit == null) { return(null); } if (curRenderUnit._meshTransform != null) { resultMatrix = curRenderUnit._meshTransform._matrix_TFResult_World; } else if (curRenderUnit._meshGroupTransform != null) { resultMatrix = curRenderUnit._meshGroupTransform._matrix_TFResult_World; } else { return(null); } //Root의 MeshGroupTransform을 추가 apMatrix curMatrixParam_Result = new apMatrix(curMatrixParam); curMatrixParam_Result.RMultiply(Editor.Select.MeshGroup._rootMeshGroupTransform._matrix); //TODO : Pivot 수정중엔 Calculated 데이터가 제외되어야 한다. //Vector3 posW3 = curRenderUnit.WorldMatrixOfNode.GetPosition(); Vector2 posW2 = resultMatrix._pos; if (!Editor.Select.IsMeshGroupSettingChangePivot) { return(apGizmos.TransformParam.Make( posW2, //<<Calculate를 포함한다. //curMatrixParam._pos, //curMatrixParam_Result._angleDeg, //curMatrixParam_Result._scale, resultMatrix._angleDeg, resultMatrix._scale, curRenderUnit.GetDepth(), //curRenderUnit.GetColor(), meshColor2X, isVisible, curRenderUnit.WorldMatrix, false, apGizmos.TRANSFORM_UI.Color, //색상만 설정 가능 curMatrixParam._pos, curMatrixParam._angleDeg, curMatrixParam._scale)); } else { return(apGizmos.TransformParam.Make( //curMatrixParam_Result._pos,//<<Calculate를 포함한다. posW2, //<<Calculate를 포함한다. //curMatrixParam._pos, //curMatrixParam_Result._angleDeg, //curMatrixParam_Result._scale, resultMatrix._angleDeg, resultMatrix._scale, curRenderUnit.GetDepth(), //curRenderUnit.GetColor(), meshColor2X, isVisible, //curMatrixParam_Result.MtrxToSpace, curRenderUnit.WorldMatrix, false, //apGizmos.TRANSFORM_UI.TRS, apGizmos.TRANSFORM_UI.TRS_WithDepth //Depth 포함한 TRS | apGizmos.TRANSFORM_UI.Color, //색상도 포함시킨다. curMatrixParam._pos, curMatrixParam._angleDeg, curMatrixParam._scale )); } }
// Init //------------------------------------------------------------------------------------------------ private void Init(apEditor editor, apPortrait portrait, apMeshGroup meshGroup, apModifierBase modifier, apModifiedMesh modMesh, apRenderUnit renderUnit, bool isAnimEdit, apAnimClip animClip, apAnimKeyframe keyframe) { _editor = editor; _portrait = portrait; _meshGroup = meshGroup; _modifier = modifier; _modMesh = modMesh; _renderUnit = modMesh._renderUnit; _isAnimEdit = isAnimEdit; _animClip = animClip; _keyframe = keyframe; _selectionType = _editor.Select.SelectionType; _targetDepth = renderUnit.GetDepth(); _img_DepthCursor = _editor.ImageSet.Get(apImageSet.PRESET.ExtraOption_DepthCursor); _img_DepthMidCursor = _editor.ImageSet.Get(apImageSet.PRESET.ExtraOption_DepthMidCursor); _img_MeshTF = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_Mesh); _img_MeshGroupTF = _editor.ImageSet.Get(apImageSet.PRESET.Hierarchy_MeshGroup); _subUnits_All.Clear(); apRenderUnit parentUnit = _renderUnit._parentRenderUnit; apRenderUnit curRenderUnit = null; for (int i = 0; i < _meshGroup._renderUnits_All.Count; i++) { curRenderUnit = _meshGroup._renderUnits_All[i]; //Parent가 같은 형제 렌더 유닛에 대해서만 처리한다. //단, MeshTransform일 때, Clipping Child는 생략한다. if (curRenderUnit._meshTransform != null && curRenderUnit._meshTransform._isClipping_Child) { continue; } if (curRenderUnit._parentRenderUnit != parentUnit) { continue; } SubUnit subUnit = new SubUnit(curRenderUnit, curRenderUnit._level, (curRenderUnit == _renderUnit), (curRenderUnit == _meshGroup._rootRenderUnit)); _subUnits_All.Add(subUnit); } _subUnits_All.Sort(delegate(SubUnit a, SubUnit b) { return(b._depth - a._depth); }); //여기서는 실제 Depth보다 상대적 Depth만 고려한다. int curDepth = 0; for (int i = _subUnits_All.Count - 1; i >= 0; i--) { _subUnits_All[i]._depth = curDepth; if (_subUnits_All[i]._isTarget) { _targetDepth = curDepth; } curDepth++; } //이미지를 바꿀 수 있는가 RefreshImagePreview(); }