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)); }
/// <summary> /// Blits the brush into the heightfield using current cursor, position and brush. Called by mouse context. /// </summary> /// <param name="mode"></param> static public void BlitHeightmapBrush(HeightmapEditMode_e mode) { if (CurrentTerrain == null || CurrentBrush == null) { return; } if (_pendingChangedAction == null) { _pendingChangedAction = new PaintHeightmapAction(CurrentTerrain); } CurrentTerrain.EngineTerrain.BlitHeightBrush(CurrentBrush, (HeightmapCursorProperties)Cursor3DProperties, mode); PaintingDirty = true; }
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 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); }
public void SetHeightmapEditMode(HeightmapEditMode_e mode) { TerrainEditor.HeightmapEditMode = mode; switch (mode) { case HeightmapEditMode_e.Subtract: case HeightmapEditMode_e.Elevate: _heightmapCursor = _heightmapCursor_Elevate; break; case HeightmapEditMode_e.Flatten: _heightmapCursor = _heightmapCursor_Flatten; break; case HeightmapEditMode_e.Smooth: _heightmapCursor = _heightmapCursor_Smooth; break; case HeightmapEditMode_e.RemoveHoles: case HeightmapEditMode_e.AddHoles: _heightmapCursor = _heightmapCursor_Holes; break; } TerrainEditor.Cursor3DProperties = _heightmapCursor; EditorManager.ActiveView.CurrentContext = g_heightmapContext; this.tabControl.SelectedTab = tabPage_Heightmap; UpdateToolbar(); }
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)); }