public override void OnClicked(VisionViewBase view) { base.OnClicked(view); if (TerrainEditor.CurrentSelection == null) { return; } ITerrainClipboardObject data = (EditorManager.ActiveComponent.Clipboard == null) ? null : EditorManager.ActiveComponent.Clipboard.Data as ITerrainClipboardObject; if (data == null) { return; } TerrainSelectionShape selShape = (TerrainSelectionShape)this.Owner; float fRadX = data.OriginalExtent.GetSizeX() * 0.5f; float fRadY = data.OriginalExtent.GetSizeY() * 0.5f; GroupAction action = new GroupAction("adjust selection size"); action.Add(SetPropertyAction.CreateSetPropertyAction(selShape, "MinX", fRadX)); // min values are also positive action.Add(SetPropertyAction.CreateSetPropertyAction(selShape, "MinY", fRadY)); action.Add(SetPropertyAction.CreateSetPropertyAction(selShape, "MaxX", fRadX)); action.Add(SetPropertyAction.CreateSetPropertyAction(selShape, "MaxY", fRadY)); EditorManager.Actions.Add(action); }
public PasteSelectionHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\paste32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Pastes the current clipboard content into this selection (uses scaling)"; }
public AdjustPasteSizeHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\fit_to_size32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Take the selection size from the clipboard data (same size in world units)"; }
public CopySelectionHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\copy32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Copies the current selection into the clipboard"; }
public void SetShowSelection(bool bShow, bool bMoveToCamera) { if (_selectionShape == null) { if (!bShow) return; bMoveToCamera = true; // first time visible _selectionShape = new TerrainSelectionShape("Terrain Selection"); _selectionShape.SetParent(this, false); // it is a non-serialized child shape _selectionShape.OnAddedToScene(); } if (bMoveToCamera) { Vector3F startRay, endRay; Vector3F hitPoint = new Vector3F(); int x = EditorManager.ActiveView.Size.Width / 2; int y = EditorManager.ActiveView.Size.Height / 2; EditorManager.EngineManager.GetRayAtScreenPos(out startRay, out endRay, x, y, EditorManager.Settings.MaxPickingDistance); if (EditorManager.EngineManager.GetTraceHit(startRay, endRay, ref hitPoint)) { _selectionShape.Position = hitPoint; } } EditorManager.ActiveView.UpdateView(false); GizmoBase gizmo = EditorManager.ActiveView.Gizmo; if (_selectionShape.Selected == bShow) { gizmo.RecalcGizmoPos(); return; } if (!bShow) { gizmo.Clear(); return; } // set light shape in front of the camera gizmo.SetSingleShape(_selectionShape, false); EditorManager.ActiveView.SetDefaultContext(); }
public PasteSelectionHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\paste32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Pastes the current clipboard content into this selection (uses scaling)"; }
public CopySelectionHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\copy32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Copies the current selection into the clipboard"; }
public AdjustPasteSizeHotspot(TerrainSelectionShape selShape) : base(selShape, @"textures\fit_to_size32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f) { this.ToolTipText = "Take the selection size from the clipboard data (same size in world units)"; }