S&box Wiki

Revision Difference

Editor_Events#563095

<cat>Code.Editor</cat>⤶ <title>Editor Events</title>⤶ ⤶ <ambig page="Scene_Events">This page is about editor events. You may be looking for "Scene Events".</ambig>⤶ ⤶ To listen to an event, apply the [EventAttribute](https://sbox.game/dev/api/Sandbox.EventAttribute/ "View on sbox.game") to a method. ⤶ ```⤶ [Event( "tool.frame" )]⤶ public static void MyMethod() { }⤶ ```⤶ ⤶ <warning>Some events require additional parameters to work.</warning>⤶ ⤶ ```⤶ [Event( "scene.saved" )]⤶ public static void MyMethod( Scene scene ) { }⤶ ```⤶ ⤶ ## Editor⤶ Event | Params | Description⤶ --- | --- | ---⤶ `editor.created` | EditorMainWindow | Invokes when the editor has started.⤶ `tool.frame` | | Invokes every frame.⤶ `hotloaded` | | Invokes every hotload.⤶ `refresh` | | Invokes when assemblies are changed. Runs before tools.gamedata.refresh⤶ `tools.gamedata.refresh` | | Invokes when assemblies are changed.⤶ `app.exit` | | Invokes before the editor shuts down.⤶ `localaddons.changed` | | Invokes when project settings are updated.⤶ `keybinds.update` | | Invokes when editor kebinds are changed.⤶ ⤶ ## Asset System⤶ Event | Params | Description⤶ --- | --- | ---⤶ `assetsystem.changes` | | Invokes when an asset is updated.⤶ `assetsystem.newfolder` | | Invokes when a new folder is created. ⤶ `assettags.updated` | | Invokes when creating a new tag on an asset.⤶ `folder.contextmenu` | FolderContextMenu | Invokes when a folder is right clicked.⤶ `asset.contextmenu` | AssetContextMenu | Invokes when an asset is right clicked.⤶ `asset.nativecontextmenu` | Menu, Asset | Invokes when a folder is right clicked. Runs before asset.contextmenu.⤶ `package.changed` | Package | Invokes when a package is updated.⤶ `package.changed.installed` | Package | Invokes when a package is installed.⤶ `package.changed.uninstalled` | Package | Invokes when a package is uninstalled.⤶ `package.changed.favourite` | Package | Invokes when you favorite a package.⤶ `package.changed.rating` | Package | Invokes when you upvote/downvote a package.⤶ `assetsystem.openpicker` | AssetPickerParameters | Invokes when opening an asset picker.⤶ `asset.thumb.changed` | Asset | Invokes when an asset regenerates its thumbnail.⤶ `assetsystem.highlight` | string | Invokes when you click "Show in Asset Browser".⤶ `content.changed` | string | Invokes when a file has changed in the "Content" path.⤶ `compile.shader` | string | Invokes when a shader starts compiling.⤶ `open.shader` | string | Invokes when opening a shader in an editor.⤶ ⤶ ## Scenes⤶ Event | Params | Description⤶ --- | --- | ---⤶ `scene.open` | | Invokes when a scene or prefab is opened.⤶ `scene.startplay` | | Invokes when you click the play button.⤶ `scene.play` | | Invokes when the scene enters play mode.⤶ `scene.stop` | | Invokes when the scene exits play mode.⤶ `scene.session.save` | | Invokes every second a scene is open.⤶ `scene.saved` | Scene | Invokes when you save a scene.⤶ ⤶ ## UI⤶ Event | Params | Description⤶ --- | --- | ---⤶ `paintoverlay` | | Invokes when highlighting a panel in the "UI Panels" tab.⤶ `qt.mousepressed` | | Invokes when the editor recieves a mouse event.⤶ `gameframe.statusbar` | StatusBar | Invokes when the status bar is being built.⤶ `tools.headerbar.build` | HeadBarEvent | Invokes when the header bar is being built.⤶ `editor.preferences` | NavigationView | Invokes when the preferences widget is opened.⤶ ⤶ ## Tools⤶ Event | Params | Description⤶ --- | --- | ---⤶ `modeldoc.menu.tools` | Menu | Invokes when launching ModelDoc.⤶ `hammer.initialized` | | Invokes when hammer is opened.⤶ `hammer.rendermapviewhud` | | Invokes when hammer hud is rendered.⤶ `hammer.selection.changed` | | Invokes when hammer selection is changed.⤶ `hammer.rendermapview` | MapView | Invoked for each MapView before rendering begins.⤶ `hammer.mapview.contextmenu` | Menu, MapView | Invokes when the MapView is right clicked.⤶ `actiongraph.saving` | ActionGraph, GameResource | Invokes right before an action graph is saved.⤶ `actiongraph.saved` | ActionGraph | Invokes when the action graph is saved.⤶ `actiongraph.inspect` | IMessageContext |⤶ `actiongraph.findreflectionnodes` | FindReflectionNodeTypesEvent |⤶ `actiongraph.findtarget` | FindGraphTargetEvent |⤶ `actiongraph.globalnodes` | GetGlobalNodeTypesEvent |⤶ `actiongraph.localnodes` | GetLocalNodeTypesEvent |⤶ `actiongraph.querynodes` | QueryNodeTypesEvent |⤶ `actiongraph.nodemenu` | PopulateNodeMenuEvent |⤶ `actiongraph.createsubgraphmenu` | PopulateCreateSubGraphMenuEvent |⤶ `actiongraph.outputplugmenu` | PopulateOutputPlugMenuEvent |⤶ `actiongraph.inputplugmenu` | PopulateInputPlugMenuEvent |⤶ `actiongraph.gotoplugsource` | GoToPlugSourceEvent |⤶ `actiongraph.inputlabel` | BuildInputLabelEvent |⤶ `actiongraph.geteditorproperties` | GetEditorPropertiesEvent |⤶ ⤶ ## Misc⤶ Event | Params | Description⤶ --- | --- | ---⤶ `command (string)` | | Invokes when a tool command is run.⤶