public override void OnActivate(CSharpFramework.VisionViewBase currentView) { base.OnActivate(currentView); Picking.Init(); IProject.ProjectUnloaded += new EventHandler(IProject_ProjectUnloaded); }
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); }
/// <summary> /// Overridden function /// </summary> /// <param name="e"></param> /// <param name="eKeyMod"></param> /// <returns></returns> public override bool OnPick(System.Windows.Forms.MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod) { base.OnPick(e, eKeyMod); // releases the handler if (_destHeight == null || _terrain == null) return false; Vector3F vStart = new Vector3F(); Vector3F vEnd = new Vector3F(); Vector3F touchPoint = new Vector3F(); EditorManager.EngineManager.GetRayAtScreenPos(out vStart, out vEnd, e.X, e.Y, EditorManager.Settings.MaxPickingDistance); if (!_terrain.TraceTerrain(vStart, vEnd, ref touchPoint)) return false; _destHeight.AbsoluteHeight = _terrain.TerrainHeightAtPosition(touchPoint); return 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); }
void ApplicationLayout_ActiveLayoutChanged(object sender, CSharpFramework.Layout.LayoutManager.ActiveLayoutChangedArgs e) { SendLayout(e.NewLayout); }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragEnd(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotGravity) { if (_hotSpotGravity.HasChanged) { float fNewVal = _hotSpotGravity.CurrentDistance; Gravity = _hotSpotGravity.StartDistance; // set old value for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"Gravity",fNewVal)); } } if (hotSpot==_hotSpotLightGridOfs) { Vector3F vNewPos = _hotSpotLightGridOfs.CurrentPosition; LightGridSampleOfs = _hotSpotLightGridOfs.StartPosition; // set old value for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"LightGridSampleOfs",vNewPos)); // send an action which sets the property from old value to new one } }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> /// <param name="fDeltaX"></param> /// <param name="fDeltaY"></param> public override void OnHotSpotDrag(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view, float fDeltaX, float fDeltaY) { if (hotSpot==_hotSpotGravity) Gravity = _hotSpotGravity.CurrentDistance; }
public override float GetScene2DRenderingSortingKey(CSharpFramework.Controls.Scene2DView view) { return AbsoluteBoundingBox.Z1; // bottom of box }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> public override void OnHotSpotEvaluatePosition(CSharpFramework.View.HotSpotBase hotSpot) { if (hotSpot==_hotSpotSizeX) { _hotSpotSizeX.Axis = this.XAxis; if (!_hotSpotSizeX.IsDragging) _hotSpotSizeX.StartDistance = SizeX; } if (hotSpot==_hotSpotSizeY) { _hotSpotSizeY.Axis = this.YAxis; if (!_hotSpotSizeY.IsDragging) _hotSpotSizeY.StartDistance = SizeY; } }
public override bool OnExport(CSharpFramework.Scene.SceneExportInfo info) { return base.OnExport (info); }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> public override void OnHotSpotEvaluatePosition(CSharpFramework.View.HotSpotBase hotSpot) { if (hotSpot==_hotSpotConeAngleX) { if (!_hotSpotConeAngleX.IsDragging) _hotSpotConeAngleX.StartAngle = ConeAngleX; } if (hotSpot==_hotSpotConeAngleY) { if (!_hotSpotConeAngleY.IsDragging) _hotSpotConeAngleY.StartAngle = ConeAngleY; } if (hotSpot==_hotSpotLength) { _hotSpotLength.Axis = this.XAxis; if (!_hotSpotLength.IsDragging) _hotSpotLength.StartDistance = Length; } if (hotSpot==_hotSpotFadeOutDist1) { _hotSpotFadeOutDist1.Axis = this.XAxis; if (!_hotSpotFadeOutDist1.IsDragging) _hotSpotFadeOutDist1.StartDistance = FadeOutDistance + Length; } if (hotSpot==_hotSpotFadeOutDist2) { _hotSpotFadeOutDist2.Axis = this.XAxis; if (!_hotSpotFadeOutDist2.IsDragging) _hotSpotFadeOutDist2.StartDistance = Length - FadeOutDistance; } }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragEnd(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotConeAngleX) { if (_hotSpotConeAngleX.HasChanged) { float fNewAngle = _hotSpotConeAngleX.CurrentAngle; ConeAngleX = _hotSpotConeAngleX.StartAngle; // set old angle for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"ConeAngleX",fNewAngle)); } } if (hotSpot==_hotSpotConeAngleY) { if (_hotSpotConeAngleY.HasChanged) { float fNewAngle = _hotSpotConeAngleY.CurrentAngle; ConeAngleY = _hotSpotConeAngleY.StartAngle; // set old angle for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"ConeAngleY",fNewAngle)); } } if (hotSpot==_hotSpotLength) { if (_hotSpotLength.HasChanged) { float fNewDist = _hotSpotLength.CurrentDistance; Length = _hotSpotLength.StartDistance; // set old angle for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"Length",fNewDist)); } } if (hotSpot==_hotSpotFadeOutDist1) { if (_hotSpotFadeOutDist1.HasChanged) { float fNewDist = _hotSpotFadeOutDist1.CurrentDistance - _hotSpotLength.CurrentDistance; FadeOutDistance = _hotSpotFadeOutDist1.StartDistance - _hotSpotLength.CurrentDistance;; EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"FadeOutDistance",fNewDist)); } } if (hotSpot==_hotSpotFadeOutDist2) { if (_hotSpotFadeOutDist2.HasChanged) { float fNewDist = _hotSpotLength.CurrentDistance - _hotSpotFadeOutDist2.CurrentDistance; FadeOutDistance = _hotSpotLength.CurrentDistance - _hotSpotFadeOutDist2.StartDistance; EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"FadeOutDistance",fNewDist)); } } }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragBegin(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotConeAngleX) _hotSpotConeAngleX.StartAngle = this.ConeAngleX; if (hotSpot==_hotSpotConeAngleY) _hotSpotConeAngleY.StartAngle = this.ConeAngleY; if (hotSpot==_hotSpotLength) _hotSpotLength.StartDistance = this.Length; if (hotSpot==_hotSpotFadeOutDist1) _hotSpotFadeOutDist1.StartDistance = this.Length + this.FadeOutDistance; if (hotSpot==_hotSpotFadeOutDist2) _hotSpotFadeOutDist2.StartDistance = this.Length - this.FadeOutDistance; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> /// <param name="fDeltaX"></param> /// <param name="fDeltaY"></param> public override void OnHotSpotDrag(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view, float fDeltaX, float fDeltaY) { if (hotSpot==_hotSpotConeAngleX) ConeAngleX = _hotSpotConeAngleX.CurrentAngle; // update for the view if (hotSpot==_hotSpotConeAngleY) ConeAngleY = _hotSpotConeAngleY.CurrentAngle; if (hotSpot==_hotSpotLength) Length = _hotSpotLength.CurrentDistance; if (hotSpot==_hotSpotFadeOutDist1) FadeOutDistance = _hotSpotFadeOutDist1.CurrentDistance - _hotSpotLength.CurrentDistance; if (hotSpot==_hotSpotFadeOutDist2) FadeOutDistance = _hotSpotLength.CurrentDistance - _hotSpotFadeOutDist2.CurrentDistance; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragBegin(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotSizeX) _hotSpotSizeX.StartDistance = this.SizeX; if (hotSpot==_hotSpotSizeY) _hotSpotSizeY.StartDistance = this.SizeY; }
void VisionViewBase_MouseContextChanged(object sender, CSharpFramework.Contexts.ContextChangedArgs e) { bool bIsTerrain = e.newContext is TerrainEditingBaseContext; if (e.newContext != g_heightmapContext) TerrainEditor.HeightmapEditMode = HeightmapEditMode_e.None; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragEnd(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotSizeX) { if (_hotSpotSizeX.HasChanged) { float fNewVal = _hotSpotSizeX.CurrentDistance; SizeX = _hotSpotSizeX.StartDistance; // set old value for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"SizeX",fNewVal)); } } if (hotSpot==_hotSpotSizeY) { if (_hotSpotSizeY.HasChanged) { float fNewVal = _hotSpotSizeY.CurrentDistance; SizeY = _hotSpotSizeY.StartDistance; // set old value for the action EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this,"SizeY",fNewVal)); } } }
public override bool OnPick(MouseEventArgs e, CSharpFramework.Contexts.KeyModifier eKeyMod) { base.OnPick(e, eKeyMod); Vector3F vStart = new Vector3F(); Vector3F vEnd = new Vector3F(); EditorManager.EngineManager.GetRayAtScreenPos(out vStart, out vEnd, e.X, e.Y, EditorManager.Settings.MaxPickingDistance); ShapeComponentType compClass = (ShapeComponentType)EditorManager.EngineManager.ComponentClassManager.GetCollectionType("VMeshPaintingComponent"); if (compClass == null) return false; ShapeTraceResult result = new ShapeTraceResult(); ShapeCollection relevantShapes = EditorManager.Scene.RootShapes; foreach (ShapeBase shape in relevantShapes) shape.TraceShape(ShapeTraceMode_e.ShapePicking, vStart, vEnd, ref result, true); if (result.bHit && result.hitShape != null) { // first find whether a componen of this type is already added: ShapeComponent component = null; if (result.hitShape.ComponentCount > 0) component = result.hitShape.Components.GetComponentByType(compClass); if (_bAdd) { if (component != null) return true; // already attached component = (ShapeComponent)compClass.CreateInstance(null); AddShapeComponentAction action = new AddShapeComponentAction(result.hitShape, component); if (action.Valid) { EditorManager.Actions.Add(action); _terrainPanel.UpdateDecoration(false); } else EditorManager.EngineManager.LogPrintWarning("Cannot attach vegetation painting component to shape " + result.hitShape.ShapeName); } else { if (component == null) // no component of this type attached return true; RemoveShapeComponentAction action = new RemoveShapeComponentAction(result.hitShape, component); EditorManager.Actions.Add(action); _terrainPanel.UpdateDecoration(false); } } return true; }
private void _shaderFX_OnShaderEffectChanged(object sender, CSharpFramework.Scene.ShaderEffectConfig.ShaderEffectChangedArgs e) { if (EngineMirror!=null) EngineMirror.SetShaderEffect(_shaderFX); OnShaderEffectChanged(); }
public override void OnPaintScene2DView(CSharpFramework.Controls.Scene2DView view, PaintEventArgs e) { if (SectorVisibleMask == 0) return; if (_bViewBitmapDirty) { UpdatePreviewBitmap(); _bViewBitmapDirty = false; } if (_2dViewBitmap != null) { BoundingBox sectorBBox = SectorExtent; Point p1 = view.Transform(sectorBBox.vMin); Point p2 = view.Transform(sectorBBox.vMax); Rectangle dst = view.MakeValidRect(p1, p2); // darker images for unloaded sectors _2dViewAttr.SetGamma(CurrentStatus == SectorAction.Reloaded ? 1.0f : 4.0f); e.Graphics.DrawImage(_2dViewBitmap, dst, 0, _2dViewBitmapResolution - 1, _2dViewBitmapResolution, -_2dViewBitmapResolution, GraphicsUnit.Pixel, _2dViewAttr); // flip vertically // inside selection? then overlay with color if (view.TouchesSelectionMarquee(sectorBBox)) e.Graphics.FillRectangle(_selectionFill, dst); _pen.Color = Color.Turquoise; if (CurrentStatus == SectorAction.Modified) _pen.Color = Color.Orange; if (CurrentStatus == SectorAction.Reloaded) _pen.Color = Color.Magenta; dst.Location = new Point(p1.X, p2.Y); dst.Size = new Size(p2.X - p1.X, p1.Y - p2.Y); e.Graphics.DrawRectangle(_pen, dst); //Display terrain status // Locked, Modified, Unmodified if (_ownerTerrain.EngineTerrain.GetSectorNetworkLock(_iSectorX, _iSectorY)) { dst.Width = 10; dst.Height = 10; _pen.Color = Color.Red; e.Graphics.DrawRectangle(_pen, dst); } if (_ownerTerrain.EngineTerrain.GetSectorOwnsLock(_iSectorX, _iSectorY)) { dst.Width = 10; dst.Height = 10; _pen.Color = Color.Green; e.Graphics.DrawRectangle(_pen, dst); } } else base.OnPaintScene2DView(view, e); if (FilterCollisionCat != null && FilterCollisionCat.Enabled) { if (SectorCollisionMask > 0) { BoundingBox sectorBBox = SectorExtent; Point p1 = view.Transform(sectorBBox.vMin); Point p2 = view.Transform(sectorBBox.vMax); Rectangle dst = view.MakeValidRect(p1, p2); e.Graphics.DrawString("C", _font, Brushes.White, dst); } } }
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); }
void IScene_PropertyChanged(object sender, CSharpFramework.PropertyChangedArgs e) { if (e._component is HavokAiEditorPlugin.Shapes.HavokNavMeshShape) { if (e._propertyName != "UserDataString" && e._propertyName != "ExportShape" && e._propertyName != "Visible" && e._propertyName != "TextLabel") { _panel.EnableBuildButtonAsterisk(true); } } }
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); }
void IScene_ShapeChanged(object sender, CSharpFramework.Shapes.ShapeChangedArgs e) { if (e.shape is HavokAiEditorPlugin.Shapes.HavokNavMeshShape) { if ((e.action == CSharpFramework.Shapes.ShapeChangedArgs.Action.Added) || (e.action == CSharpFramework.Shapes.ShapeChangedArgs.Action.Removed)) { if (EditorManager.Scene.AllShapesOfType(typeof(HavokAiEditorPlugin.Shapes.HavokNavMeshShape)).Count == 0) { _panel.Enabled = false; } else { _panel.Enabled = true; _panel.EnableBuildButtonAsterisk(true); } } } else if (e.shape is HavokAiEditorPlugin.Shapes.HavokNavMeshTestPathShape) { if (e.action == CSharpFramework.Shapes.ShapeChangedArgs.Action.Removed) { _panel.EnablePathDependentControls(false, false); } } }
public override void OnPaintScene2DView(CSharpFramework.Controls.Scene2DView view, System.Windows.Forms.PaintEventArgs e) { base.OnPaintScene2DView(view, e); BoundingBox absBox = this.AbsoluteBoundingBox; Point p1 = view.Transform(absBox.vMin); Point p2 = view.Transform(absBox.vMax); Rectangle rect = view.MakeValidRect(p1, p2); zoneBrush.Color = Color.FromArgb(120, _previewColor.R, _previewColor.G, _previewColor.B); zonePen.Color = Color.FromArgb(255, _previewColor.R, _previewColor.G, _previewColor.B); e.Graphics.FillRectangle(zoneBrush, rect); e.Graphics.DrawRectangle(zonePen, rect); }
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; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> public override void OnHotSpotDragBegin(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view) { if (hotSpot==_hotSpotGravity) _hotSpotGravity.StartDistance = this.Gravity; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> /// <param name="view"></param> /// <param name="fDeltaX"></param> /// <param name="fDeltaY"></param> public override void OnHotSpotDrag(CSharpFramework.View.HotSpotBase hotSpot, VisionViewBase view, float fDeltaX, float fDeltaY) { if (hotSpot==_hotSpotSizeX) SizeX = _hotSpotSizeX.CurrentDistance; if (hotSpot==_hotSpotSizeY) SizeY = _hotSpotSizeY.CurrentDistance; }
/// <summary> /// Overridden function /// </summary> /// <param name="hotSpot"></param> public override void OnHotSpotEvaluatePosition(CSharpFramework.View.HotSpotBase hotSpot) { if (hotSpot==_hotSpotGravity) { _hotSpotGravity.Axis = -Vector3F.ZAxis; if (!_hotSpotGravity.IsDragging) _hotSpotGravity.StartDistance = Gravity; } if (hotSpot==_hotSpotLightGridOfs) { _hotSpotLightGridOfs.Visible = this.ShowLightgridWidget; if (_hotSpotLightGridOfs.IsDragging) // update while dragging LightGridSampleOfs = _hotSpotLightGridOfs.CurrentPosition; else _hotSpotLightGridOfs.StartPosition = LightGridSampleOfs; } }
void SendLayout(CSharpFramework.Layout.Layout layout) { if (layout == null || _isSDKScene) return; VisionGoogleAnalytics.RecordView("/vForge/" + layout.Name); }