Vixen
02b45cc4
csharp
public sealed class MeshEdit

Which mesh is being edited, in which element mode, and what is selected in it.

Read the guide page for this →

Remarks

Doc 24's P2, editor side. The kernel has the selection and the topology queries — MeshSelection and MeshTopology — and what is here is the part that needs a scene: which entity, which of its elements the pointer is over, and what a click does about it.

⚠ One per editor and handed to every pane, exactly as SnapContext is. Selecting a face in the perspective view and seeing it highlighted in the top view is the behaviour every reference toolset has; one of these per pane would be four selections of one mesh with nothing reconciling them, and the first operation to read the wrong one would be a bug nobody could reproduce.

⚠ One target rather than a set, and that is what every reference toolset does too. The element indices of two meshes are two numbering schemes, so a selection spanning both is one that no single operation can act on. The target follows the entity selection: exactly one entity selected is the mesh being edited, and anything else is none.

⚠ The selection survives a position change and is dropped by a topology change, which is P2's exit criterion. Undoing a drag puts the corners back and leaves every index meaning what it did; an extrude renumbers the tables, so an index kept across one names a different element. The table sizes recorded when the mesh was last seen are what tell the two apart — cheaply, and without the document having to describe what changed.

Fields and properties (11)

  • public SceneDocument Document

    The scene the mesh being edited belongs to.

  • public bool IsEnabled

    Whether an element mode is in force at all.

  • public Entity Target

    Whose mesh is being edited, or Null for none.

  • public MeshElementKind Element

    Which kind of element a click selects.

  • public MeshSelection Selection

    What is selected.

  • public SubObject Hover

    Which element the pointer is over, or None.

  • public int Segments

    How many divisions a curved primitive is made editable at.

  • public bool IsActive

    Whether the target has geometry to edit.

  • public EditMesh? Mesh

    The mesh being edited, or .

  • public SubObjectFilter Filter

    Which filter a pick should use for the current element mode.

  • public Func<Entity, bool>? Confirm

    What to ask before a shape's live parameters are thrown away, or null to just do it.

Events (1)

  • public Action<MeshElementKind>? ElementChanged

    Raised when the element mode changes, however it changed.

Methods (9)

  • public MeshEdit(SceneDocument document)

    Watches a scene, so that a mesh changing under the selection is noticed.

  • public bool Reconcile()

    Brings the target and the selection up to date with the scene.

  • public bool Demote()

    Makes sure the target's geometry is something an edit may change.

  • public bool Enter(MeshElementKind kind)

    Goes into an element mode on whatever is selected.

  • public void Exit()

    Comes back out of the element modes.

  • public EditMesh? MakeEditable()

    Gives the target editable geometry, if it has none and can have some.

  • public bool Clicked(SubObject hit, bool additive)

    Turns a picked element into a change to the selection.

  • public void Positions(List<int> into)

    Which shared positions the selection covers.

  • public Vector3? Centre(in Matrix4x4 transform)

    Where the selection is, in world space.

Used by (17)

  • BlockoutBooleanTestsVixen.Editor.Blockout.Tests
  • BlockoutCreateTestsVixen.Editor.Blockout.Tests
  • BlockoutCubeGridVixen.Editor.Blockout
  • BlockoutGeometryVixen.Editor.Blockout
  • BlockoutGeometryTestsVixen.Editor.Blockout.Tests
  • BlockoutHistoryTestsVixen.Editor.Blockout.Tests
  • BlockoutModeVixen.Editor.Blockout
  • BlockoutModuleVixen.Editor.Blockout
  • BlockoutSelectionVixen.Editor.Blockout
  • BlockoutSelectionTestsVixen.Editor.Blockout.Tests
  • BlockoutSurfaceTestsVixen.Editor.Blockout.Tests
  • BlockoutSurfacesVixen.Editor.Blockout
  • EditorApplicationVixen.Editor.App
  • MeshEditTestsVixen.Editor.SceneView.Tests
  • MeshGizmoTargetVixen.Editor.SceneView
  • SceneLinesVixen.Editor.SceneView
  • SceneViewportVixen.Editor.SceneView