Vixen
feb85697
csharp
public interface ISceneEditing

Scene authoring as a service: the entity and hierarchy verbs, callable without a window.

Read the guide page for this →

Remarks

Doc 50 § D2, the first slice of § P2b (#1290). Group, Snap To Floor, Align With View and their neighbours were private methods on the application, closed over its fields, so a plugin that wanted "group the selection, undoably, the way the menu does" could not call it. The menu lines are now names for these methods, registered by SceneModule through the same PluginContext a third party uses.

⚠ Every verb acts on Active and its selection, and every edit is one undo entry on that scene's stack. A verb that touches several entities opens one transaction or executes one command; none writes behind the stack's back.

⚠ Active is the active scene, not EditorProject.ActiveDocument. Doc 50 proposed the second; it is a different answer whenever an asset editor's tab has focus, because opening one activates its document — and a Group pressed then must still group entities.

Fields and properties (7)

  • SceneDocument Active

    The scene the verbs act on.

  • IReadOnlyList<SceneDocument> Scenes

    Every scene open in the editor, the first being the one it started with.

  • EditorCamera? View

    The camera of the focused viewport, or when no pane is showing.

  • bool IsIsolating

    Whether Isolate is hiding everything outside a selection.

  • IReadOnlyDictionary<string, IReadOnlyList<Entity>> SelectionSets

    The named selections, as saved.

  • bool CanCopyTransform

    Whether the primary selection has a transform to copy.

  • bool HasCopiedTransform

    Whether something has been copied for PasteTransform.

Events (4)

  • Action<ISceneEditing>? ScenesChanged

    Raised after a scene was opened beside the others or closed.

  • Action<ISceneEditing>? ActiveChanged

    Raised after Active became another scene.

  • Action<ISceneEditing>? HierarchyChanged

    Raised after a verb changed the hierarchy in a way the outliner should redraw for.

  • Action<ISceneEditing>? MarksChanged

    Raised after a verb changed what is hidden, so the outliner restates its eyes.

Methods (31)

  • SceneDocument? OpenAdditively(string path)

    Opens a scene file beside the scenes already open, rather than over them.

  • bool Close(SceneDocument scene)

    Closes an open scene, and its entities leave the world with it.

  • bool Activate(SceneDocument scene)

    Makes an open scene the one the verbs act on.

  • void InvertSelection()

    Selects every entity not selected, and nothing that was.

  • void SelectChildren()

    Selects the children of everything selected.

  • void SelectParent()

    Selects the parents of everything selected.

  • Entity CreateChild()

    Creates an entity under the first selected one, and selects it.

  • Entity Group()

    Puts the selection under a new empty parent, as one undo step, and selects the group.

  • Entity GroupAsLod()

    Puts two or more entities under a LOD group, one level each, as one undo step.

  • int DuplicateSelection()

    Duplicates the selection beside itself and selects the copies.

  • void ClearParent()

    Moves the selection to the scene's root.

  • bool SetParent(IReadOnlyList<Entity> entities, Entity parent)

    Moves entities under a parent, undoably.

  • string? WhyNotParent(IReadOnlyList<Entity> entities, Entity candidate)

    Why entities cannot be hung from a candidate, or if they can.

  • void AlignWithView()

    Puts the selection where the view's camera is, looking where it looks.

  • void MoveToView()

    Moves the selection, keeping its shape, to the view's pivot.

  • void SnapToFloor()

    Drops each selected entity straight down onto whatever is under it, or onto Y = 0.

  • void Isolate()

    Hides everything the selection is not part of, or — while isolating — puts it all back.

  • IReadOnlyList<Entity> SelectByName(string text)

    Selects every entity whose name contains some text, ignoring case.

  • IReadOnlyList<(string Component, int Count)> ComponentsInScene()

    The components something in the active scene carries, by name, with how many carry each.

  • IReadOnlyList<Entity> SelectByType(string component)

    Selects every entity carrying a component.

  • bool SaveSelectionSet(string name)

    Names the current selection so it can be brought back.

  • IReadOnlyList<Entity> RecallSelectionSet(string name)

    Brings a named selection back, less whatever has since been deleted.

  • void ResetTransform()

    Puts the selection back at its parent's origin, unrotated and unscaled, as one undo entry.

  • bool CopyTransform()

    Remembers the primary selection's local transform.

  • void PasteTransform()

    Writes the copied transform onto everything selected, as one undo entry.

  • void Align(int axis)

    Puts everything selected on the primary's line along one axis, as one undo entry.

  • void Distribute(int axis)

    Spaces everything selected evenly between the two ends along one axis, as one undo entry.

  • Entity CreateEntity()

    Creates an empty entity under the first selected one, or at the root, and selects it.

  • Entity CreateShape(PrimitiveKind kind)

    Creates one of the built-in shapes under the first selected entity, and selects it.

  • Entity CreateLight(LightKind kind)

    Creates a light under the first selected entity, aimed down and forward, and selects it.

  • Entity CreateCamera()

    Creates a camera under the first selected entity, and selects it.

Used by (14)

  • ActiveSceneTestsVixen.Editor.App.Tests
  • AssetEditorsModuleVixen.Editor.AssetEditors
  • DiagnosticsModuleVixen.Editor.Diagnostics
  • EditorApplicationVixen.Editor.App
  • MilestoneE5TestsVixen.Editor.App.Tests
  • SceneEditingVixen.Editor.App
  • SceneEditingTestsVixen.Editor.App.Tests
  • SceneFilesTestsVixen.Editor.App.Tests
  • SceneModuleVixen.Editor.App
  • SceneOutlinerVixen.Editor.App
  • SceneQuestionsVixen.Editor.App
  • ScenesPanelVixen.Editor.App
  • ScenesPanelTestsVixen.Editor.App.Tests
  • ServiceReachTestsVixen.Editor.App.Tests