public override bool OnMouseDown(System.Windows.Forms.MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod, int iOldX, int iOldY) { if ((IsEditingKeyPressed(eKeyMod) && (EditorSettingsBase.CameraStyle_e.MayaStyle != EditorManager.Settings.CameraStyle)) || eKeyMod == KeyModifier.Ctrl) { CurrentMode = TerrainEditor.HeightmapEditMode; // apply variants locally to this context if (CurrentMode == HeightmapEditMode_e.Elevate && (e.Button == MouseButtons.Right || (EditorManager.Tablet != null && EditorManager.Tablet.IsEraserPressed))) { CurrentMode = HeightmapEditMode_e.Subtract; } else if (CurrentMode == HeightmapEditMode_e.AddHoles && (e.Button == MouseButtons.Right || (EditorManager.Tablet != null && EditorManager.Tablet.IsEraserPressed))) { CurrentMode = HeightmapEditMode_e.RemoveHoles; } // in flatten mode with RMB we pick the height first if (CurrentMode == HeightmapEditMode_e.Flatten && e.Button == MouseButtons.Right) { Vector3F cursorCenter = TerrainEditor.CurrentTerrain.EngineTerrain.GetCurrentCursorCenter(); float fHeight = TerrainEditor.CurrentTerrain.TerrainHeightAtPosition(cursorCenter); HeightmapCursorProperties cursorProp = TerrainEditor.Cursor3DProperties as HeightmapCursorProperties; if (cursorProp != null) { cursorProp.AbsoluteHeight = fHeight; } } } return(base.OnMouseDown(e, eKeyMod, iOldX, iOldY)); }
public override bool OnMouseDown(System.Windows.Forms.MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod, int iOldX, int iOldY) { if ((IsEditingKeyPressed(eKeyMod) && (EditorSettingsBase.CameraStyle_e.MayaStyle != EditorManager.Settings.CameraStyle)) || eKeyMod == KeyModifier.Ctrl) { _bPaint = true; _bSubtract = (e.Button == MouseButtons.Right || (EditorManager.Tablet != null && EditorManager.Tablet.IsEraserPressed)); } return(base.OnMouseDown(e, eKeyMod, iOldX, iOldY)); }
public override bool OnPick(MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod) { // base implementation releases the pick handler base.OnPick(e, eKeyMod); ShapeCollection selection = EditorManager.SelectedShapes; foreach (ShapeBase shape in selection) { if (shape is HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape) { Vector3F vStart = new Vector3F(); Vector3F vEnd = new Vector3F(); EditorManager.EngineManager.GetRayAtScreenPos(out vStart, out vEnd, e.X, e.Y, EditorManager.Settings.MaxPickingDistance); ShapeTraceResult result = new ShapeTraceResult(); ShapeCollection relevantShapes = EditorManager.Scene.RootShapes; foreach (ShapeBase relevantShape in relevantShapes) { relevantShape.TraceShape(ShapeTraceMode_e.ShapePicking, vStart, vEnd, ref result, true); } if (result.bHit) { Vector3F dir = vEnd - vStart; dir.Normalize(); Vector3F hitPoint = vStart + dir * result.fHitDistance; HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape path = shape as HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape; if (m_start) { path.StartPoint = hitPoint; } else { path.EndPoint = hitPoint; } } break; } } return(true); }
public override bool OnMouseUp(System.Windows.Forms.MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod, int iOldX, int iOldY) { _bPaint = false; return(base.OnMouseUp(e, eKeyMod, iOldX, iOldY)); }
public override bool OnMouseUp(System.Windows.Forms.MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod, int iOldX, int iOldY) { CurrentMode = HeightmapEditMode_e.None; return(base.OnMouseUp(e, eKeyMod, iOldX, iOldY)); }