Eden Editor Event Handlers – Arma 3
(Added more info to OnCopy and OnCut (provided by Dusty_SpaceShark from the Arma Discord)) |
m (Readded __NOEDITSECTION__) |
||
Line 1: | Line 1: | ||
__NOEDITSECTION__ | |||
{{TOC|side}} | {{TOC|side}} | ||
Revision as of 13:46, 2 December 2021
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
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
OnConnectingStart
When Connecting operation is initiated.
add3DENEventHandler ["OnConnectingStart", {
params ["_class", "_from"];
}];
- class: Config - connection config class
- from: Array of Eden Entities
OnConnectingEnd
When Connecting operation is terminated, no matter if it was confirmed or canceled.
add3DENEventHandler ["OnConnectingEnd", {
params ["_class", "_from", "_to"];
}];
- 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.
No arguments
OnCut
Fires when entities are cut (after the entities have been deleted).
No arguments
OnDeleteUnits
When entities are deleted.
No arguments
OnEntityMenu
When Entity Context Menu is opened.
add3DENEventHandler ["OnEntityMenu", {
params ["_position", "_entity", "_listPath"];
}];
- 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)
OnGridChange
When grid changes, either using Toolbar option, ot by scripting command set3DENGrid.
add3DENEventHandler ["OnGridChange", {
params ["_gridType", "_gridValue"];
}];
OnHistoryChange
When history changes.
No arguments
OnMapClosed
When map is closed.
No arguments
OnMapOpened
When map is opened.
No arguments
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
add3DENEventHandler ["OnMessage", {
params ["_messageID"];
}];
- messageID: Number
OnMissionAutosave
When scenario is autosaved.
No arguments
OnMissionLoad
When scenario is loaded.
No arguments
OnMissionNew
When new scenario is started. Executed also when Eden is opened with an empty scenario.
No arguments
OnMissionPreview
When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.
add3DENEventHandler ["OnMissionPreview", {
params ["_objects", "_groups", "_waypoints", "_markers"];
}];
- objects: Array
- groups: Array
- waypoints: Array
- markers: Array
Each array is in format:
[entity1, id1, entity2, id2, ..., entityN, idN]
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.
No arguments
OnMissionPreviewEnd
When preview ends and user returns back to Eden Editor.
No arguments
OnMissionSave
When scenario is saved.
No arguments
OnMissionSaveAs
When Save As action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).
No arguments
OnModeChange
When editing mode is changed (i.e. from Objects to Triggers).
No arguments
OnMoveGridToggle
When translation grid is toggled on or off.
No arguments
OnPaste
When entities are pasted.
No arguments
OnPasteUnitOrig
When entities are pasted on their original positions.
No arguments
OnRedo
When undo operation is redone.
No arguments
OnRotateGridToggle
When rotation grid is toggled on or off.
No arguments
OnSelectionChange
When entity selection changes. Use get3DENSelected to return currently selected entities.
No arguments
OnScaleGridToggle
When area scaling grid is toggled on or off.
No arguments
OnSearchCreate
When "SearchCreate" action is triggered (e.g. when pressing Ctrl+Shift+F).
No arguments
OnSearchEdit
When "SearchEdit" action is triggered (e.g. when pressing Ctrl+F).
No arguments
OnServerToggle
When server is created or destroyed from the preview.
No arguments
OnSubmodeChange
When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.
No arguments
OnSurfaceSnapToggle
When surface snap settings are changed.
No arguments
OnTerrainNew
When new terrain is loaded. Executed also when Eden is opened.
No arguments
OnToggleMapTextures
When map textures are toggled on or off.
No arguments
OnTogglePlaceEmptyVehicle
When the Place vehicles with crew is toggled on/off in Objects mode.
No arguments
OnUndo
When an operation is undone.
No arguments
OnVerticalToggle
When vertical mode settings are changed.
No arguments
OnWidgetArea
When area widget is selected.
No arguments
OnWidgetNone
When no widget is selected.
No arguments
OnWidgetRotation
When rotation widget is selected.
No arguments
OnWidgetScale
When scaling widget is selected.
No arguments
OnWidgetToggle
When widget is toggled (i.e. browsing through all widget types)
No arguments
OnWidgetTranslation
When translation widget is selected.
No arguments
OnWorkspacePartSwitch
When scenario phase is selected.
No arguments
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
edenObject addEventHandler ["AttributesChanged3DEN", {
params ["_object"];
}];
- object: Object - affected object
ConnectionChanged3DEN
When a connection is added or removed from an object.
edenObject addEventHandler ["ConnectionChanged3DEN", {
params ["_object"];
}];
- object: Object - affected object
RegisteredToWorld3DEN
When object is re-added to the scenario after undoing a delete operation.
edenObject addEventHandler ["RegisteredToWorld3DEN", {
params ["_object"];
}];
- 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.
edenObject addEventHandler ["UnregisteredFromWorld3DEN", {
params ["_object"];
}];
- 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.
edenObject addEventHandler ["Dragged3DEN", {
params ["_object"];
}];
- object: Object - affected object