Vixen
02b45cc4
csharp
public static class SceneCsg

Doc 24's P6 non-destructive boolean: the operands survive and the result is derived.

Read the guide page for this →

Remarks

"The operands stay, the result is derived, and changing an operand re-evaluates it." That is the whole of the feature and it is why the boolean is worth having at all: a subtract that collapsed the two solids into one result would make "the doorway should be twenty centimetres wider" a rebuild, where non-destructively it is dragging a box that is still there.

⚠ The operands are hidden rather than deleted, and hidden is editor state. SceneDocument.Hidden is not written to the scene file and not a component — hiding something to work on what is behind it must not change what ships — so an operand is invisible in the viewport, still selectable in the outliner, and still exactly what a build would compile if anybody asked for it. Which nobody does, because the result is what carries the geometry.

⚠ Re-evaluation is pulled rather than pushed. Refresh compares one integer per node — a hash of its operands' mesh versions and transforms — so a frame that changed nothing costs a comparison per boolean in the scene. An event per operand would mean every drag of every box firing through a graph, and the ordering of two operands that both changed in one frame would decide how many times the result was rebuilt.

⚠ Nested booleans work because a node's operand may be a node. The evaluation is depth-first over the children, so a subtract of a union is two nodes and one traversal — which is how a designer actually builds a doorway with a window over it.

Methods (4)

  • public static int Refresh(SceneDocument document)

    Rebuilds every boolean in the document whose operands have changed.

  • public static bool Evaluate(SceneDocument document, Entity entity, bool force = true)

    Rebuilds one boolean from its operands.

  • public static EditMesh? Combine(SceneDocument document, Entity entity, BooleanOperation operation)

    Works out the geometry of one boolean without writing it anywhere.

  • public static IReadOnlyList<Entity> Operands(SceneDocument document, Entity entity)

    The entities a boolean reads, in the order the file lists them.

Used by (4)

  • BlockoutBooleanVixen.Editor.Blockout
  • BlockoutBooleanTestsVixen.Editor.Blockout.Tests
  • BooleanCommandVixen.Editor.SceneView
  • SceneViewportVixen.Editor.SceneView