public static EditorObject GetObjectFromScreenPoint(Vec2 pt, out Vec3 hitPos, bool includeFrozen, EditorObjectSelection ignore) { EditorObject result; using (PhysEntityVector vector = PhysEntityVector.Create()) { ignore.GetPhysEntities(vector); result = new EditorObject(Binding.FCE_ObjectManager_GetObjectFromScreenPoint(pt.X, pt.Y, out hitPos.X, out hitPos.Y, out hitPos.Z, includeFrozen, vector.Pointer)); } return result; }
public static EditorObject GetObjectFromScreenPoint(Vec2 pt, out Vec3 hitPos, bool includeFrozen, EditorObject ignore) { PhysEntityVector vector = PhysEntityVector.Null; if (ignore.IsValid) { vector = PhysEntityVector.Create(); ignore.GetPhysEntities(vector); } EditorObject result = new EditorObject(Binding.FCE_ObjectManager_GetObjectFromScreenPoint(pt.X, pt.Y, out hitPos.X, out hitPos.Y, out hitPos.Z, includeFrozen, vector.Pointer)); if (vector.IsValid) { vector.Dispose(); } return result; }
public void Unapply(EditorObject obj) { CoordinateSystem coordinateSystem = CoordinateSystem.FromAngles(obj.Angles); AABB localBounds = obj.LocalBounds; Vec3 vec = (localBounds.max + localBounds.min) * 0.5f; Vec3 vec2 = localBounds.Length * 0.5f; this.position -= obj.Position + vec.X * coordinateSystem.axisX + vec.Y * coordinateSystem.axisY; this.position = coordinateSystem.ConvertFromWorld(this.position); this.normal = coordinateSystem.ConvertFromWorld(this.normal); this.normalUp = coordinateSystem.ConvertFromWorld(this.normalUp); this.position.X = this.position.X / vec2.X; this.position.Y = this.position.Y / vec2.Y; if (this.position.X > 1f) { this.position.X = 1f; } else { if (this.position.X < -1f) { this.position.X = -1f; } } if (this.position.Y > 1f) { this.position.Y = 1f; } else { if (this.position.Y < -1f) { this.position.Y = -1f; } } if (this.position.Z > 1f) { this.position.Z = 1f; } else { if (this.position.Z < -1f) { this.position.Z = -1f; } } this.normal.Z = 0f; this.normalUp = new Vec3(0f, 0f, 1f); }
public bool Contains(EditorObject obj) { return this.IndexOf(obj) != -1; }
public static void GetObjectsFromMagicWand(EditorObjectSelection selection, EditorObject obj) { Binding.FCE_ObjectManager_GetObjectsFromMagicWand(selection.Pointer, obj.Pointer); }
private void SetupGizmo(EditorObject gizmoObject) { this.ClearGizmo(); this.m_gizmo = Gizmo.Create(); this.m_gizmo.RotationMode = this.m_gizmoRotationMode; this.m_gizmoObject = gizmoObject; this.UpdateGizmo(); this.TestGizmo(); }
private void ClearGizmo() { if (this.m_gizmo.IsValid) { this.m_gizmo.Dispose(); this.m_gizmo = Gizmo.Null; } this.m_gizmoObject = EditorObject.Null; }
public override bool OnMouseEvent(Editor.MouseEvent mouseEvent, MouseEventArgs mouseEventArgs) { switch (mouseEvent) { case Editor.MouseEvent.MouseUp: { Vec3 pos; EditorObject objectFromScreenPoint = ObjectManager.GetObjectFromScreenPoint(Editor.Viewport.NormalizedMousePos, out pos, false, this.m_source); if (objectFromScreenPoint.IsValid && objectFromScreenPoint.GetClosestPivot(pos, out this.m_targetPivot)) { UndoManager.RecordUndo(); this.m_context.m_selection.Center = this.m_sourcePivot.position; this.m_context.m_selection.SnapToPivot(this.m_sourcePivot, this.m_targetPivot, this.PreserveOrientation, this.m_angle); UndoManager.CommitUndo(); } base.ReleaseInput(); break; } case Editor.MouseEvent.MouseMove: { Vec3 pos2; this.m_target = ObjectManager.GetObjectFromScreenPoint(Editor.Viewport.NormalizedMousePos, out pos2, false, this.m_source); if (this.m_target.IsValid) { this.m_target.GetClosestPivot(pos2, out this.m_targetPivot); } break; } } return false; }
public void SetSnap(EditorObject snapObject) { this.m_snap = true; this.m_snapObject = snapObject; }
public void ClearSnap() { this.m_snap = false; this.m_snapObject = EditorObject.Null; }
public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist, out Vec3 hitNormal) { return(Binding.FCE_Editor_RayCastPhysics(raySrc.X, raySrc.Y, raySrc.Z, rayDir.X, rayDir.Y, rayDir.Z, ignore.Pointer, out hitPos.X, out hitPos.Y, out hitPos.Z, out hitDist, out hitNormal.X, out hitNormal.Y, out hitNormal.Z)); }
public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist) { Vec3 vec; return(Editor.RayCastPhysics(raySrc, rayDir, ignore, out hitPos, out hitDist, out vec)); }
private void OnSelectionChanged() { if (this.m_updatingList) { return; } int index = this.treeViewObjectSelection.SelectedNode.Index; if (index == this.m_value) { return; } this.m_value = index; this.m_currentObject = (EditorObject)this.treeViewObjectSelection.SelectedNode.Tag; if (this.ValueChanged != null) { this.ValueChanged(this, new EventArgs()); } if (this.CurrentObjectChanged != null) { this.CurrentObjectChanged(this, new EventArgs()); } }
public void ToggleObject(EditorObject obj) { Binding.FCE_ObjectSelection_ToggleObject(this.m_selPtr, obj.Pointer); }
public int IndexOf(EditorObject obj) { for (int i = 0; i < this.Count; i++) { if (this[i].Pointer == obj.Pointer) { return i; } } return -1; }
public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist, out Vec3 hitNormal) { return Binding.FCE_Editor_RayCastPhysics(raySrc.X, raySrc.Y, raySrc.Z, rayDir.X, rayDir.Y, rayDir.Z, ignore.Pointer, out hitPos.X, out hitPos.Y, out hitPos.Z, out hitDist, out hitNormal.X, out hitNormal.Y, out hitNormal.Z); }
public static void Focus(EditorObject obj) { if (!obj.IsValid) { return; } AABB worldBounds = obj.WorldBounds; Vec3 center = worldBounds.Center; Vec3 v = (worldBounds - center).Length * 0.5f; Vec3 vec = -Camera.FrontVector; Camera.Position = center + vec * (vec * v).Length * 4f; }
public static void GetObjectsFromMagicWand(EditorObjectSelection selection, EditorObject obj) { Binding.FCE_ObjectManager_GetObjectsFromMagicWand(selection.Pointer, obj.Pointer); }
public void SetSnap(float snapSize) { this.m_snap = true; this.m_snapSize = snapSize; this.m_snapObject = EditorObject.Null; }
public static void OnObjectAddedFromTool(EditorObject obj) { Binding.FCE_ObjectManager_OnObjectAddedFromTool(obj.Pointer); }
public void SetSelection(EditorObjectSelection selection, EditorObject gizmoObject) { this.ClearSelectionState(); this.m_selection.Dispose(); this.m_selection = selection; this.m_selection.ComputeCenter(); if (!this.m_selection.Contains(gizmoObject)) { gizmoObject = EditorObject.Null; } if (!gizmoObject.IsValid && this.m_selection.Count > 0) { gizmoObject = this.m_selection[0]; } if (gizmoObject.IsValid) { this.SetupGizmo(gizmoObject); } else { this.ClearGizmo(); } this.UpdateSelectionState(); this.UpdateSelection(); this.m_paramObjectSelection.Value = -1; }
public void RemoveObject(EditorObject obj) { Binding.FCE_ObjectSelection_RemoveObject(this.m_selPtr, obj.Pointer); }
public bool Start() { Vec3 pos; this.m_source = ObjectManager.GetObjectFromScreenPoint(Editor.Viewport.NormalizedMousePos, out pos); if (!this.m_source.IsValid) { return false; } if (!this.m_source.GetClosestPivot(pos, out this.m_sourcePivot)) { return false; } if (!this.m_context.m_selection.Contains(this.m_source)) { EditorObjectSelection editorObjectSelection = EditorObjectSelection.Create(); if ((Control.ModifierKeys & Keys.Control) != Keys.None) { this.m_context.m_selection.Clone(editorObjectSelection, false); } this.m_context.SelectObject(editorObjectSelection, this.m_source); this.m_context.SetSelection(editorObjectSelection, this.m_source); } base.AcquireInput(); return true; }
public bool Contains(EditorObject obj) { return(this.IndexOf(obj) != -1); }
private void SelectObject(EditorObjectSelection selection, EditorObject obj) { bool flag = (Control.ModifierKeys & Keys.Control) != Keys.None; Keys arg_17_0 = Control.ModifierKeys; bool flag2 = (Control.ModifierKeys & Keys.Alt) != Keys.None; if (this.m_paramMagicWand.Value) { using (EditorObjectSelection selection2 = EditorObjectSelection.Create()) { ObjectManager.GetObjectsFromMagicWand(selection2, obj); if (flag) { selection.ToggleSelection(selection2); } else { if (flag2) { selection.RemoveSelection(selection2); } else { selection.AddSelection(selection2); } } } return; } if (flag) { selection.ToggleObject(obj); return; } if (flag2) { selection.RemoveObject(obj); return; } selection.AddObject(obj); }
public void AddObject(EditorObject obj) { Binding.FCE_ObjectSelection_Add(this.m_selPtr, obj.Pointer); }
public static EditorObject GetObjectFromScreenPoint(Vec2 pt, out Vec3 hitPos, bool includeFrozen, EditorObject ignore) { PhysEntityVector vector = PhysEntityVector.Null; if (ignore.IsValid) { vector = PhysEntityVector.Create(); ignore.GetPhysEntities(vector); } EditorObject result = new EditorObject(Binding.FCE_ObjectManager_GetObjectFromScreenPoint(pt.X, pt.Y, out hitPos.X, out hitPos.Y, out hitPos.Z, includeFrozen, vector.Pointer)); if (vector.IsValid) { vector.Dispose(); } return(result); }
public static bool RayCastPhysics(Vec3 raySrc, Vec3 rayDir, EditorObject ignore, out Vec3 hitPos, out float hitDist) { Vec3 vec; return Editor.RayCastPhysics(raySrc, rayDir, ignore, out hitPos, out hitDist, out vec); }
public static void OnObjectAddedFromTool(EditorObject obj) { Binding.FCE_ObjectManager_OnObjectAddedFromTool(obj.Pointer); }
public void AddObject(EditorObject obj) { Binding.FCE_ObjectSelection_Add(this.m_selPtr, obj.Pointer); }