SceneEditorSessionclass

A SceneEditorSession holds a Scene that is open in the editor. It creates a widget, has a selection and undo system.

object→SceneEditorSession
Namespace
Editor
Assembly
Sandbox.Tools
Declaration
public class Editor.SceneEditorSession

Constructors1

Showing 1 constructors

Methods30

Showing 30 methods

public virtual sealed void AddUndo(string name, System.Action undo, System.Action redo)PUBLICVIRTUAL

ParameterTypeDescription
namestring—
undoAction—
redoAction—
Returns:void—

public void BringToFront()PUBLIC

Bring this scene tab to the front

Returns:void—

public void CancelUndoScope()PUBLIC

Cancels any open undo scopes, because we don't want the most recent change to appear in the undo stack.

Returns:void—

public static Editor.SceneEditorSession CreateFromPath(string path)PUBLICSTATIC

Opens an editor session from an existing scene or prefab

ParameterTypeDescription
pathstring—

public void DeserializeSelection(string selection)PUBLIC

Take a json string created by SerializeSelection and turn it into a selection

ParameterTypeDescription
selectionstring—
Returns:void—

public virtual void Destroy()PUBLICVIRTUAL

Returns:void—

public virtual void FrameTo(BBox& modreq(System.Runtime.InteropServices.InAttribute) box)PUBLICVIRTUAL

ParameterTypeDescription
boxBBox& modreq(InAttribute)—
Returns:void—

public void FullUndoSnapshot(string title)PUBLICOBSOLETE

Take a full scene snapshot for the undo system. This is usually a last resort, if you can't do anything more incremental.

Obsolete: Manual full scene undo snapshots are no longer working use UndoScope or AddUndo

ParameterTypeDescription
titlestring—
Returns:void—

public virtual sealed System.Collections.Generic.IEnumerable`1<object> GetSelection()PUBLICVIRTUAL

Returns:IEnumerable<object>—

public void MakeActive(bool bringToFront = True)PUBLIC

Makes this scene active and brings it to the front

ParameterTypeDescription
bringToFront = Truebool—
Returns:void—

protected virtual void OnEdited()PROTECTEDVIRTUAL

Returns:void—

public void PushUndoSelection()PUBLICOBSOLETE

Push the current selection into the undo system

Obsolete: Manual selections snapshots are no longer working use UndoScope or AddUndo

Returns:void—

public virtual sealed void RecordChange(Sandbox.SerializedProperty property)PUBLICVIRTUALOBSOLETE

Obsolete: This API member is obsolete.

ParameterTypeDescription
propertySerializedProperty—
Returns:void—

public void Reload()PUBLIC

Returns:void—

public virtual sealed void Save(bool saveAs)PUBLICVIRTUAL

ParameterTypeDescription
saveAsbool—
Returns:void—

public static System.IDisposable Scope()PUBLICSTATIC

Pushes the active scene to the current scope

Returns:IDisposable—

public string SerializeSelection()PUBLIC

Serlialize the current selection to a json string. The aim here is to make something we can transfer back to objects.

Returns:string—

public void SetPlaying(Sandbox.Scene scene)PUBLIC

ParameterTypeDescription
sceneScene—
Returns:void—

public virtual void StopPlaying()PUBLICVIRTUAL

Returns:void—

public System.IDisposable SuppressUndoSounds()PUBLIC

Temporarily disables undo/redo sounds.

Returns:IDisposable—

public void Tick()PUBLIC

Returns:void—

Properties12

Showing 12 properties

public virtual sealed bool Editor.SceneEditorSession.HasUnsavedChanges { get; set; }PUBLICVIRTUALGETSET

Returns:bool—

public bool Editor.SceneEditorSession.IsMounted { get; set; }PUBLICGETSET

True if this session is editing a scene opened from a mount. Mounted scenes live at a read-only mount:// path, so they can't be saved and never report unsaved changes.

Returns:bool—

public virtual bool Editor.SceneEditorSession.IsPlaying { get; set; }PUBLICVIRTUALGETSET

Returns:bool—

public bool Editor.SceneEditorSession.IsPrefabSession { get; set; }PUBLICGETSET

Returns true if this session is editing a prefab

Returns:bool—

public bool Editor.SceneEditorSession.ShouldUpdate { get; set; }PUBLICGETSETPER-FRAME

Should we call `Sandbox.Scene.EditorTick(System.Single,System.Single)` while this session is visible?

Returns:bool—

On this page

Constructorsprotected SceneEditorSession(Sandbox.Scene scene)Methodspublic virtual sealed System.Void AddUndo(System.String name, System.Action undo, System.Action redo)public System.Void BringToFront()public System.Void CancelUndoScope()public static Editor.SceneEditorSession CreateDefault()public static Editor.SceneEditorSession CreateFromPath(System.String path)public System.Void DeserializeSelection(System.String selection)public virtual System.Void Destroy()public virtual System.Void FrameTo(BBox& modreq(System.Runtime.InteropServices.InAttribute) box)public System.Void FullUndoSnapshot(System.String title)public virtual sealed Editor.SceneFolder GetSceneFolder()public virtual sealed System.Collections.Generic.IEnumerable`1<System.Object> GetSelection()public System.Void MakeActive(System.Boolean bringToFront = True)protected virtual System.Void OnEdited()public System.Void PushUndoSelection()public virtual sealed System.Void RecordChange(Sandbox.SerializedProperty property)public System.Void Reload()public static Editor.SceneEditorSession Resolve(Facepunch.ActionGraphs.ISourceLocation sourceLocation)public static Sandbox.Scene.ISceneEditorSession Resolve(Sandbox.Component component)public static Sandbox.Scene.ISceneEditorSession Resolve(Sandbox.GameObject go)public static Editor.SceneEditorSession Resolve(Sandbox.PrefabFile prefabFile)public static Editor.SceneEditorSession Resolve(Sandbox.Scene scene)public static Editor.SceneEditorSession Resolve(Sandbox.SceneFile sceneFile)public virtual sealed System.Void Save(System.Boolean saveAs)public static System.IDisposable Scope()public System.String SerializeSelection()public System.Void SetPlaying(Sandbox.Scene scene)public virtual System.Void StopPlaying()public System.IDisposable SuppressUndoSounds()public System.Void Tick()public virtual sealed ISceneUndoScope UndoScope(System.String name)Propertiespublic static Editor.SceneEditorSession Editor.SceneEditorSession.Active { get; set; }public static System.Collections.Generic.List`1<Editor.SceneEditorSession> Editor.SceneEditorSession.All { get; set; }public Editor.GameEditorSession Editor.SceneEditorSession.GameSession { get; set; }public virtual sealed System.Boolean Editor.SceneEditorSession.HasUnsavedChanges { get; set; }public System.Boolean Editor.SceneEditorSession.IsMounted { get; set; }public virtual System.Boolean Editor.SceneEditorSession.IsPlaying { get; set; }public System.Boolean Editor.SceneEditorSession.IsPrefabSession { get; set; }public System.Action`1<BBox> Editor.SceneEditorSession.OnFrameTo { get; set; }public virtual sealed Sandbox.Scene Editor.SceneEditorSession.Scene { get; set; }public virtual sealed Sandbox.SelectionSystem Editor.SceneEditorSession.Selection { get; set; }public System.Boolean Editor.SceneEditorSession.ShouldUpdate { get; set; }public Sandbox.Helpers.UndoSystem Editor.SceneEditorSession.UndoSystem { get; set; }Metadata