Vixen
02b45cc4
csharp
public static class SceneClone

Copying an entity, and everything under it, into the same scene.

Read the guide page for this →

Remarks

Doc 24's P4 Duplicate, and the thing doc 20's clipboard was blocked on. EditorParity files Cut, Copy, Paste and Duplicate as planned with the note that cloning a subtree needs "a component-wise copy the engine does not have yet" — this is that copy. It stays here rather than in the shell because what has to be cloned is a scene's idea of an entity: its components, its name, its geometry and the parameters that generated the geometry, none of which the command stack knows about.

⚠ The scene component registry is the filter, which is the same rule saving applies. What a file can carry is what a clone carries, so a duplicate is exactly what you would get by saving the entity and reading it back — and nothing is copied that a build could not compile. The hierarchy links are excluded for the reason they are excluded from a file: they hold entity handles, and a copy of one names the original's parent.

⚠ Undoable through Create per entity, inside one transaction. Duplicating a room of nine walls is one thing somebody did and has to be one Ctrl+Z; it is nine entries underneath because the create command is what knows how to give a handle back.

⚠ Behaviours are not copied yet, and that is stated rather than silent. A Behavior is an object with authored fields rather than a value in a column, so cloning one means constructing an instance and copying the members the contract left in — which is SceneBehaviorRegistry's to answer and is doc 20's E1 rather than doc 24's P4. A duplicated block-out wall has no behaviours to lose.

Methods (3)

  • public static Entity Duplicate(SceneDocument document, Entity entity, Entity parent = default(Entity), Vector3 offset = default(Vector3), string? name = null)

    Copies an entity and its subtree, undoably.

  • public static int Duplicate(SceneDocument document, IEnumerable<Entity> entities, Vector3 offset, List<Entity> into)

    Copies several entities and their subtrees as one undoable act.

  • public static int Components(World world, Entity from, Entity to)

    Copies every component a scene file could carry from one entity onto another.

Used by (1)

  • BlockoutCreateVixen.Editor.Blockout