Vixen
02b45cc4
csharp
public sealed class ShapeDrag

Doc 24's shape tool, as a two-stage gesture over the work plane.

Read the guide page for this →

Remarks

"Drag a footprint on the work plane, then drag the height", which is the table's own description and is the gesture every reference toolset uses. Press and drag gives two corners on the plane; release settles them; moving the pointer then sets the height without a button held; a click commits. The shape that arrives has live parameters, so the numbers a designer dragged are still numbers afterwards.

⚠ World points in, entity out, and no viewport anywhere in the type. Turning a pointer into a point on a plane is the pane's job and turning two points into a shape is this one's, and keeping the seam there is what makes the whole gesture a unit test — "drag from here to there and then up by three" is three method calls and an assertion about a mesh, which is exactly the bargain doc 24's testing table asks for.

⚠ The second stage has no button held, and that is not an oversight. A press-drag for the footprint and a second press-drag for the height would need the designer to find the object again between the two; every tool that does this — Unreal's, ProBuilder's, Blender's box-add — moves the pointer freely for the height and takes a click as the commit. Cancel is what Escape calls, and it removes the entity rather than leaving a flat one behind.

⚠ The entity exists from the moment the footprint does. Drawing a preview and then creating something at the end would be two representations of one shape and a preview that can disagree with the result; making the real thing early means what is on screen while dragging is what will be there, at the price of one create in the history that a cancel takes away again.

Fields and properties (5)

  • public ShapeStage Stage

    Which half of the gesture is in flight.

  • public ShapeKind Kind

    Which shape the next drag makes.

  • public Entity Entity

    The entity being dragged, or Null between gestures.

  • public WorkPlane? Plane

    The plane the footprint is dragged on, or null for the ground.

  • public float MinimumHeight

    How tall a shape is before the height stage has moved, in world units.

Methods (9)

  • public ShapeDrag(SceneDocument document)

    Drags shapes into one scene.

  • public void Begin(Vector3 corner)

    Starts a footprint at a point on the work plane.

  • public bool Drag(Vector3 corner)

    Drags the footprint's other corner.

  • public bool Settle()

    Settles the footprint and moves on to the height.

  • public bool Raise(float raised)

    Sets how tall the shape is.

  • public Entity Commit()

    Finishes the gesture and leaves the shape where it is.

  • public bool Cancel()

    Abandons the gesture and takes the entity away again.

  • public ShapeParameters Parameters()

    The parameters the gesture has arrived at so far.

  • public Vector3 Origin()

    Where the shape's origin is, which is the middle of the footprint on the plane.

Used by (2)

  • BlockoutCreateTestsVixen.Editor.Blockout.Tests
  • BlockoutModeVixen.Editor.Blockout