Eden Editor Event Handlers – Arma 3
(Added link to init3DEN.sqf) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
| (11 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
{{TOC|side}} | {{TOC|side}} | ||
== Editor Event Handlers == | |||
[[:Category:Eden Editor|Eden Editor]] Event Handlers are added to the editor instance and will remain active for the duration of a session. | |||
[[Eden Editor]] Event Handlers are added to the editor instance and will remain active for the duration of a session. | |||
Launching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance. | Launching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance. | ||
=== Related commands === | === Related commands === | ||
* [[add3DENEventHandler]] | * [[add3DENEventHandler]] | ||
* [[remove3DENEventHandler]] | * [[remove3DENEventHandler]] | ||
=== Event Scripts === | === Event Scripts === | ||
* See [[ | |||
* See [[Event Scripts#init3DEN.sqf|init3DEN.sqf]] | |||
=== Config === | === Config === | ||
Alternatively, you can define event handlers directly in the config. | Alternatively, you can define event handlers directly in the config. | ||
Use your custom section ( | Use your custom section ('''{{Color|#00F|mySection}}''' in the example) to prevent overriding handlers from other sources. | ||
Handlers defined here will automatically be added when Eden Editor is opened. | Handlers defined here will automatically be added when Eden Editor is opened. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
| Line 31: | Line 35: | ||
=== Events === | === Events === | ||
{{Feature| | |||
{{Feature|informative| | |||
* Most handlers do not receive any arguments; this is intended, as in most cases required data can be obtained using either [[get3DENActionState]] or specialised 'get*' [[:Category:Command Group: Eden Editor|Eden Editor commands]]. | |||
* Note that unlike [[Arma 3: Event Handlers|object's]] or [[Arma 3: Mission Event Handlers|mission's]] event handlers, the '''On''' prefix is present in both config and command event name. | |||
}} | |||
{{ConfigPage|start}} | {{ConfigPage|start}} | ||
{{ConfigPage|abc}} | {{ConfigPage|abc}} | ||
==== Init ==== | |||
Is executed when [[Eden Editor]] display was created. Only happens when Eden Editor is opened for the first time during game session. | |||
<sqf> | |||
add3DENEventHandler ["Init", { | |||
params ["_display3DEN"]; | |||
}]; | |||
</sqf> | |||
* display3DEN: [[Display]] | |||
{{ArgTitle|4|OnBeforeMissionPreview|{{GVI|arma3|2.16}}}} | |||
Runs before the scenario preview is started. If an event handler of this type returns [[true]], the mission preview will not be initialised. | |||
<sqf> | |||
add3DENEventHandler ["OnBeforeMissionPreview", { | |||
params ["_isPreviewMultiplayer"]; | |||
}]; | |||
</sqf> | |||
==== OnConnectingStart ==== | ==== OnConnectingStart ==== | ||
When [[ | When [[Eden Editor: Connecting|Connecting]] operation is initiated. | ||
< | <sqf> | ||
add3DENEventHandler ["OnConnectingStart", { | add3DENEventHandler ["OnConnectingStart", { | ||
params ["_class", "_from"]; | params ["_class", "_from"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* class: [[Config]] - connection config class | * class: [[Config]] - connection config class | ||
| Line 48: | Line 74: | ||
==== OnConnectingEnd ==== | ==== OnConnectingEnd ==== | ||
When [[ | When [[Eden Editor: Connecting|Connecting]] operation is terminated, no matter if it was confirmed or canceled. | ||
< | <sqf> | ||
add3DENEventHandler ["OnConnectingEnd", { | add3DENEventHandler ["OnConnectingEnd", { | ||
params ["_class", "_from", "_to"]; | params ["_class", "_from", "_to"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* class: Config - connection config class | * class: Config - connection config class | ||
| Line 62: | Line 88: | ||
==== OnCopy ==== | ==== OnCopy ==== | ||
Fires when entities are copied.<br> | Fires when entities are copied.<br> | ||
Also fires when entities are cut, but unlike {{ | Also fires when entities are cut, but unlike {{Link|#OnCut}}, {{Link|#OnCopy}} fires before the entities are deleted, meaning the entities are still accessible with [[get3DENSelected]]. | ||
<sqf> | |||
add3DENEventHandler ["OnCopy", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnCut ==== | ==== OnCut ==== | ||
Fires when entities are cut (after the entities have been deleted).< | Fires when entities are cut (after the entities have been deleted). | ||
<sqf> | |||
add3DENEventHandler ["OnCut", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnDeleteUnits ==== | ==== OnDeleteUnits ==== | ||
When entities are deleted.< | When entities are deleted. | ||
<sqf> | |||
add3DENEventHandler ["OnDeleteUnits", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
{{ArgTitle|4|OnEditableEntityAdded|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnEditableEntityAdded", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
{{ArgTitle|4|OnEditableEntityRemoved|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnEditableEntityRemoved", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
{{ArgTitle|4|OnEditableEntityAttributeChanged|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnEditableEntityAttributeChanged", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
{{ArgTitle|4|OnEntityDragged|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnEntityDragged", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnEntityMenu ==== | ==== OnEntityMenu ==== | ||
When [[ | When [[Eden Editor: Entity Context Menu|Entity Context Menu]] is opened. | ||
< | <sqf> | ||
add3DENEventHandler ["OnEntityMenu", { | add3DENEventHandler ["OnEntityMenu", { | ||
params ["_position", "_entity", "_listPath"]; | params ["_position", "_entity", "_listPath"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* position: [[Array]] - [[Position]] where user clicked to open the menu. | * position: [[Array]] - [[Position]] where user clicked to open the menu. | ||
| Line 91: | Line 165: | ||
* listPath: [[Array]] - UI tree path when clicked on entity in the entity list. | * listPath: [[Array]] - UI tree path when clicked on entity in the entity list. | ||
** Nil when clicked in the scene (we cannot use empty array, because that's a path to root item) | ** Nil when clicked in the scene (we cannot use empty array, because that's a path to root item) | ||
{{ArgTitle|4|OnEntityParentChanged|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnEntityParentChanged", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnGridChange ==== | ==== OnGridChange ==== | ||
When grid changes, either using [[Eden Editor: Toolbar|Toolbar]] option, ot by scripting command [[set3DENGrid]]. | When grid changes, either using [[Eden Editor: Toolbar|Toolbar]] option, ot by scripting command [[set3DENGrid]]. | ||
< | <sqf> | ||
add3DENEventHandler ["OnGridChange", { | add3DENEventHandler ["OnGridChange", { | ||
params ["_gridType", "_gridValue"]; | params ["_gridType", "_gridValue"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* gridType: [[String]] - can be "translation", "rotation" or "scaling" | * gridType: [[String]] - can be "translation", "rotation" or "scaling" | ||
| Line 106: | Line 189: | ||
==== OnHistoryChange ==== | ==== OnHistoryChange ==== | ||
When history changes.< | When history changes. | ||
<sqf> | |||
add3DENEventHandler ["OnHistoryChange", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMapClosed ==== | ==== OnMapClosed ==== | ||
When map is closed.< | When map is closed. | ||
<sqf> | |||
add3DENEventHandler ["OnMapClosed", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMapOpened ==== | ==== OnMapOpened ==== | ||
When map is opened.< | When map is opened. | ||
<sqf> | |||
add3DENEventHandler ["OnMapOpened", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
| Line 131: | Line 226: | ||
* 6 - Mission exported to MP | * 6 - Mission exported to MP | ||
* 7 - Attempting to delete a default layer | * 7 - Attempting to delete a default layer | ||
< | <sqf> | ||
add3DENEventHandler ["OnMessage", { | add3DENEventHandler ["OnMessage", { | ||
params ["_messageID"]; | params ["_messageID"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* messageID: [[Number]] | * messageID: [[Number]] | ||
{{ArgTitle|4|OnMissionAttributeChanged|{{GVI|arma3|2.16}}}} | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnMissionAttributeChanged", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnMissionAutosave ==== | ==== OnMissionAutosave ==== | ||
When scenario is autosaved.< | When scenario is autosaved. | ||
<sqf> | |||
add3DENEventHandler ["OnMissionAutosave", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionExportSP ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnMissionExportSP", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnMissionExportMP ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnMissionExportMP", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnMissionListChange ==== | |||
When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected. | |||
<sqf> | |||
add3DENEventHandler ["OnMissionListChange", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionLoad ==== | ==== OnMissionLoad ==== | ||
When scenario is loaded.< | When scenario is loaded. | ||
<sqf> | |||
add3DENEventHandler ["OnMissionLoad", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionNew ==== | ==== OnMissionNew ==== | ||
When new scenario is started. Executed also when Eden is opened with an empty scenario.< | When new scenario is started. Executed also when Eden is opened with an empty scenario. | ||
<sqf> | |||
add3DENEventHandler ["OnMissionNew", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionPreview ==== | ==== OnMissionPreview ==== | ||
When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed. | When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed. | ||
< | <sqf> | ||
add3DENEventHandler ["OnMissionPreview", { | add3DENEventHandler ["OnMissionPreview", { | ||
params ["_objects", "_groups", "_waypoints", "_markers"]; | params ["_objects", "_groups", "_waypoints", "_markers"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* objects: Array | * objects: Array | ||
| Line 170: | Line 313: | ||
* entity: [[Object]], [[Group]], [[Array]] or [[String]] | * entity: [[Object]], [[Group]], [[Array]] or [[String]] | ||
* ID: [[Number]] | * ID: [[Number]] | ||
==== OnMissionPreviewEnd ==== | ==== OnMissionPreviewEnd ==== | ||
When preview ends and user returns back to Eden Editor.< | When preview ends and user returns back to Eden Editor. | ||
<sqf> | |||
add3DENEventHandler ["OnMissionPreviewEnd", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionSave ==== | ==== OnMissionSave ==== | ||
When scenario is saved.< | When scenario is saved. | ||
<sqf> | |||
add3DENEventHandler ["OnMissionSave", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMissionSaveAs ==== | ==== OnMissionSaveAs ==== | ||
When ''Save As'' action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).< | When ''Save As'' action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet). | ||
<sqf> | |||
add3DENEventHandler ["OnMissionSaveAs", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnModeChange ==== | ==== OnModeChange ==== | ||
When editing mode is changed (i.e. from Objects to Triggers).< | When editing mode is changed (i.e. from Objects to Triggers). | ||
<sqf> | |||
add3DENEventHandler ["OnModeChange", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnMoveGridDecrease ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnMoveGridDecrease", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnMoveGridIncrease ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnMoveGridIncrease", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnMoveGridToggle ==== | ==== OnMoveGridToggle ==== | ||
When '''translation''' grid is toggled on or off.< | When '''translation''' grid is toggled on or off. | ||
<sqf> | |||
add3DENEventHandler ["OnMoveGridToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnPaste ==== | ==== OnPaste ==== | ||
When entities are pasted.< | When entities are pasted. | ||
<sqf> | |||
add3DENEventHandler ["OnPaste", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnPasteUnitOrig ==== | ==== OnPasteUnitOrig ==== | ||
When entities are pasted on their original positions.< | When entities are pasted on their original positions. | ||
<sqf> | |||
add3DENEventHandler ["OnPasteUnitOrig", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnRedo ==== | ==== OnRedo ==== | ||
When undo operation is redone.< | When undo operation is redone. | ||
<sqf> | |||
add3DENEventHandler ["OnRedo", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnRotateGridDecrease ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnRotateGridDecrease", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== | ==== OnRotateGridIncrease ==== | ||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnRotateGridIncrease", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== | ==== OnRotateGridToggle ==== | ||
When | When '''rotation''' grid is toggled on or off. | ||
<sqf> | |||
add3DENEventHandler ["OnRotateGridToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnScaleGridToggle ==== | ==== OnScaleGridToggle ==== | ||
When '''area scaling''' grid is toggled on or off.< | When '''area scaling''' grid is toggled on or off. | ||
<sqf> | |||
add3DENEventHandler ["OnScaleGridToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnSearchCreate ==== | ==== OnSearchCreate ==== | ||
When "SearchCreate" action is triggered (e.g. when pressing Ctrl+Shift+F).< | When "SearchCreate" action is triggered (e.g. when pressing Ctrl+Shift+F). | ||
<sqf> | |||
add3DENEventHandler ["OnSearchCreate", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnSearchEdit ==== | ==== OnSearchEdit ==== | ||
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).< | When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F). | ||
<sqf> | |||
add3DENEventHandler ["OnSearchEdit", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnSelectionChange ==== | |||
When entity selection changes. Use [[get3DENSelected]] to return currently selected entities. | |||
<sqf> | |||
add3DENEventHandler ["OnSelectionChange", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnServerToggle ==== | ==== OnServerToggle ==== | ||
When server is created or destroyed from the preview.< | When server is created or destroyed from the preview. | ||
<sqf> | |||
add3DENEventHandler ["OnServerToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnSubmodeChange ==== | ==== OnSubmodeChange ==== | ||
When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.< | When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes. | ||
<sqf> | |||
add3DENEventHandler ["OnSubmodeChange", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnSurfaceSnapToggle ==== | ==== OnSurfaceSnapToggle ==== | ||
When surface snap settings are changed.< | When surface snap settings are changed. | ||
<sqf> | |||
add3DENEventHandler ["OnSurfaceSnapToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnTerrainNew ==== | ==== OnTerrainNew ==== | ||
When new terrain is loaded. Executed also when Eden is opened.< | When new terrain is loaded. Executed also when Eden is opened. | ||
<sqf> | |||
add3DENEventHandler ["OnTerrainNew", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnToggleMapIDs ==== | |||
{{Wiki|TODO}} | |||
<sqf> | |||
add3DENEventHandler ["OnToggleMapIDs", { | |||
// params ["?"]; | |||
}]; | |||
</sqf> | |||
==== OnToggleMapTextures ==== | ==== OnToggleMapTextures ==== | ||
When map textures are toggled on or off.< | When map textures are toggled on or off. | ||
<sqf> | |||
add3DENEventHandler ["OnToggleMapTextures", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnTogglePlaceEmptyVehicle ==== | ==== OnTogglePlaceEmptyVehicle ==== | ||
When the ''Place vehicles with crew'' is toggled on/off in Objects mode.< | When the ''Place vehicles with crew'' is toggled on/off in Objects mode. | ||
<sqf> | |||
add3DENEventHandler ["OnTogglePlaceEmptyVehicle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnUndo ==== | ==== OnUndo ==== | ||
When an operation is undone.< | When an operation is undone. | ||
<sqf> | |||
add3DENEventHandler ["OnUndo", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnVerticalToggle ==== | ==== OnVerticalToggle ==== | ||
When vertical mode settings are changed.< | When vertical mode settings are changed. | ||
<sqf> | |||
add3DENEventHandler ["OnVerticalToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetArea ==== | ==== OnWidgetArea ==== | ||
When [[ | When [[Eden Editor: Transformation Widget|area widget]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetArea", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetNone ==== | ==== OnWidgetNone ==== | ||
When no [[ | When no [[Eden Editor: Transformation Widget|widget]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetNone", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetRotation ==== | ==== OnWidgetRotation ==== | ||
When [[ | When [[Eden Editor: Transformation Widget|rotation widget]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetRotation", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetScale ==== | ==== OnWidgetScale ==== | ||
When [[ | When [[Eden Editor: Transformation Widget|scaling widget]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetScale", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetToggle ==== | ==== OnWidgetToggle ==== | ||
When [[ | When [[Eden Editor: Transformation Widget|widget]] is toggled (i.e. browsing through all widget types) | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetToggle", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWidgetTranslation ==== | ==== OnWidgetTranslation ==== | ||
When [[ | When [[Eden Editor: Transformation Widget|translation widget]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWidgetTranslation", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
==== OnWorkspacePartSwitch ==== | ==== OnWorkspacePartSwitch ==== | ||
When [[ | When [[Eden Editor: Scenario Phases|scenario phase]] is selected. | ||
<sqf> | |||
add3DENEventHandler ["OnWorkspacePartSwitch", { | |||
// no arguments | |||
}]; | |||
</sqf> | |||
{{ConfigPage|end}} | {{ConfigPage|end}} | ||
== Object Event Handlers == | == Object Event Handlers == | ||
Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.<br> | Editor specific event handlers can be also added directly to [[Eden Editor: Object|objects]], using [[addEventHandler]] command.<br> | ||
{{Feature|important|These handlers exist only for the duration of active workspace. | {{Feature|important|These handlers exist only for the duration of active workspace. | ||
Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.}} | Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.}} | ||
=== Related commands === | === Related commands === | ||
| Line 330: | Line 628: | ||
=== Events === | === Events === | ||
{{Feature| | |||
{{Feature|informative|Most handlers do not receive any arguments. | |||
This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}} | This is intended, because in most cases, required data can be obtained using either [[get3DENActionState]] or specialised 'get' commands.}} | ||
{{ConfigPage|start}} | {{ConfigPage|start}} | ||
{{ConfigPage|abc}} | {{ConfigPage|abc}} | ||
| Line 340: | Line 640: | ||
* When attributes get changed using scripting commands such as [[set3DENAttributes]] or [[set3DENAttribute]] | * When attributes get changed using scripting commands such as [[set3DENAttributes]] or [[set3DENAttribute]] | ||
Unlike ''Dragged3DEN'' this event handler will not fire continuously but only when the attributes were changed '''and''' saved | Unlike ''Dragged3DEN'' this event handler will not fire continuously but only when the attributes were changed '''and''' saved | ||
< | <sqf> | ||
edenObject addEventHandler ["AttributesChanged3DEN", { | edenObject addEventHandler ["AttributesChanged3DEN", { | ||
params ["_object"]; | params ["_object"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* object: [[Object]] - affected object | * object: [[Object]] - affected object | ||
| Line 350: | Line 651: | ||
==== ConnectionChanged3DEN ==== | ==== ConnectionChanged3DEN ==== | ||
When a [[Eden Editor: Connecting|connection]] is added or removed from an object. | When a [[Eden Editor: Connecting|connection]] is added or removed from an object. | ||
< | <sqf> | ||
edenObject addEventHandler ["ConnectionChanged3DEN", { | edenObject addEventHandler ["ConnectionChanged3DEN", { | ||
params ["_object"]; | params ["_object"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* object: [[Object]] - affected object | * object: [[Object]] - affected object | ||
| Line 360: | Line 662: | ||
==== RegisteredToWorld3DEN ==== | ==== RegisteredToWorld3DEN ==== | ||
When object is re-added to the scenario after undoing a delete operation. | When object is re-added to the scenario after undoing a delete operation. | ||
< | <sqf> | ||
edenObject addEventHandler ["RegisteredToWorld3DEN", { | edenObject addEventHandler ["RegisteredToWorld3DEN", { | ||
params ["_object"]; | params ["_object"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* object: [[Object]] - affected object | * object: [[Object]] - affected object | ||
| Line 370: | Line 673: | ||
==== UnregisteredFromWorld3DEN ==== | ==== UnregisteredFromWorld3DEN ==== | ||
When object is removed from the scenario. That happens when you delete it, but also when you undo [[Eden Editor: Entity Placing|placement]] operation. | When object is removed from the scenario. That happens when you delete it, but also when you undo [[Eden Editor: Entity Placing|placement]] operation. | ||
< | <sqf> | ||
edenObject addEventHandler ["UnregisteredFromWorld3DEN", { | edenObject addEventHandler ["UnregisteredFromWorld3DEN", { | ||
params ["_object"]; | params ["_object"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* object: [[Object]] - affected object | * object: [[Object]] - affected object | ||
| Line 380: | Line 684: | ||
==== Dragged3DEN ==== | ==== Dragged3DEN ==== | ||
When object is '''dragged''' and/or '''rotated'''. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed. | When object is '''dragged''' and/or '''rotated'''. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed. | ||
< | <sqf> | ||
edenObject addEventHandler ["Dragged3DEN", { | edenObject addEventHandler ["Dragged3DEN", { | ||
params ["_object"]; | params ["_object"]; | ||
}]; | }]; | ||
</ | </sqf> | ||
* object: [[Object]] - affected object | * object: [[Object]] - affected object | ||
{{ConfigPage|end}} | {{ConfigPage|end}} | ||
Revision as of 15:56, 29 November 2023
Editor Event Handlers
Eden Editor Event Handlers are added to the editor instance and will remain active for the duration of a session. Launching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance.
Related commands
Event Scripts
- See init3DEN.sqf
Config
Alternatively, you can define event handlers directly in the config. Use your custom section (mySection in the example) to prevent overriding handlers from other sources. Handlers defined here will automatically be added when Eden Editor is opened.
class Cfg3DEN
{
class EventHandlers
{
class mySection
{
onUndo = "hint 'Undo';";
// <handlerName> = <handlerExpression>
};
};
};
Events
Init
Is executed when Eden Editor display was created. Only happens when Eden Editor is opened for the first time during game session.
- display3DEN: Display
OnBeforeMissionPreview
Runs before the scenario preview is started. If an event handler of this type returns true, the mission preview will not be initialised.
OnConnectingStart
When Connecting operation is initiated.
- class: Config - connection config class
- from: Array of Eden Entities
OnConnectingEnd
When Connecting operation is terminated, no matter if it was confirmed or canceled.
- class: Config - connection config class
- from: Array of 3DEN entities
- to: Eden Entity (when connecting was successful) or nil (when connecting was terminated)
OnCopy
Fires when entities are copied.
Also fires when entities are cut, but unlike OnCut, OnCopy fires before the entities are deleted, meaning the entities are still accessible with get3DENSelected.
OnCut
Fires when entities are cut (after the entities have been deleted).
OnDeleteUnits
When entities are deleted.
OnEditableEntityAdded
OnEditableEntityRemoved
OnEditableEntityAttributeChanged
OnEntityDragged
OnEntityMenu
When Entity Context Menu is opened.
- position: Array - Position where user clicked to open the menu.
- Entity position when clicked on an entity.
- Empty array when clicked on something that doesn't have position (i.e. abstract folder in Edit list like BLUFOR, Trigger, etc.)
- entity: Eden Entity
- Nil when clicked on empty space
- listPath: Array - UI tree path when clicked on entity in the entity list.
- Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)
OnEntityParentChanged
OnGridChange
When grid changes, either using Toolbar option, ot by scripting command set3DENGrid.
OnHistoryChange
When history changes.
OnMapClosed
When map is closed.
OnMapOpened
When map is opened.
OnMessage
Handler used for showing on-screen notifications, triggered by various range of events. Message IDs:
- 0 - Mission saved
- 1 - Mission autosaved
- 2 - Trying to move a character into full vehicle
- 3 - Moved character into enemy vehicle
- 4 - Trying to run mission without any player
- 5 - Mission exported to SP
- 6 - Mission exported to MP
- 7 - Attempting to delete a default layer
- messageID: Number
OnMissionAttributeChanged
OnMissionAutosave
When scenario is autosaved.
OnMissionExportSP
OnMissionExportMP
OnMissionListChange
When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.
OnMissionLoad
When scenario is loaded.
OnMissionNew
When new scenario is started. Executed also when Eden is opened with an empty scenario.
OnMissionPreview
When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.
- objects: Array
- groups: Array
- waypoints: Array
- markers: Array
Each array is in format:
[entity1, id1, entity2, id2, ..., entityN, idN]
OnMissionPreviewEnd
When preview ends and user returns back to Eden Editor.
OnMissionSave
When scenario is saved.
OnMissionSaveAs
When Save As action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).
OnModeChange
When editing mode is changed (i.e. from Objects to Triggers).
OnMoveGridDecrease
OnMoveGridIncrease
OnMoveGridToggle
When translation grid is toggled on or off.
OnPaste
When entities are pasted.
OnPasteUnitOrig
When entities are pasted on their original positions.
OnRedo
When undo operation is redone.
OnRotateGridDecrease
OnRotateGridIncrease
OnRotateGridToggle
When rotation grid is toggled on or off.
OnScaleGridToggle
When area scaling grid is toggled on or off.
OnSearchCreate
When "SearchCreate" action is triggered (e.g. when pressing Ctrl+Shift+F).
OnSearchEdit
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).
OnSelectionChange
When entity selection changes. Use get3DENSelected to return currently selected entities.
OnServerToggle
When server is created or destroyed from the preview.
OnSubmodeChange
When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.
OnSurfaceSnapToggle
When surface snap settings are changed.
OnTerrainNew
When new terrain is loaded. Executed also when Eden is opened.
OnToggleMapIDs
OnToggleMapTextures
When map textures are toggled on or off.
OnTogglePlaceEmptyVehicle
When the Place vehicles with crew is toggled on/off in Objects mode.
OnUndo
When an operation is undone.
OnVerticalToggle
When vertical mode settings are changed.
OnWidgetArea
When area widget is selected.
OnWidgetNone
When no widget is selected.
OnWidgetRotation
When rotation widget is selected.
OnWidgetScale
When scaling widget is selected.
OnWidgetToggle
When widget is toggled (i.e. browsing through all widget types)
OnWidgetTranslation
When translation widget is selected.
OnWorkspacePartSwitch
When scenario phase is selected.
Object Event Handlers
Editor specific event handlers can be also added directly to objects, using addEventHandler command.
Related commands
Events
AttributesChanged3DEN
Fires when object's attributes are changed. Can happen when:
- Changing the attributes by dragging, rotating or using one of the widgets
- Changing and saving the attributes from within the attributes window
- When attributes get changed using scripting commands such as set3DENAttributes or set3DENAttribute
Unlike Dragged3DEN this event handler will not fire continuously but only when the attributes were changed and saved
- object: Object - affected object
ConnectionChanged3DEN
When a connection is added or removed from an object.
- object: Object - affected object
RegisteredToWorld3DEN
When object is re-added to the scenario after undoing a delete operation.
- object: Object - affected object
UnregisteredFromWorld3DEN
When object is removed from the scenario. That happens when you delete it, but also when you undo placement operation.
- object: Object - affected object
Dragged3DEN
When object is dragged and/or rotated. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.
- object: Object - affected object