Eden Editor: Entity Context Menu: Difference between revisions
(fixed incorrect condition) |
(Expanded information) |
||
Line 1: | Line 1: | ||
== Create a custom Entity Context Menu entry== | |||
*Entries for the '''Context Menu''' are defined in the class '''Display3DEN'''. | |||
*The menu has multiple levels, the first level for example contains options like "Go Here" or folders like "Log". Those folders on the other hand can have another level, level 2.<br><br> | |||
<code>class ctrlMenu;//First we need to load the base class of the menu | |||
class Display3DEN | |||
{ | |||
class ContextMenu: ctrlMenu | |||
{ | |||
class Items | |||
{ | |||
class Log//The easiest way to add an entry is to use one of the already available folders, here we use the class '''Log''' '''(Level 1)''' | |||
{ | |||
picture = "\3denEnhanced\data\Enh_icon_clipboard.paa";//Icon used for the entry called '''Log''' | |||
items[] +=//Here we list all items we want to add to the '''Log''' class. | |||
{ | |||
"Enh_LogFactions" | |||
}; | |||
}; | |||
class Enh_LogFactions//Now we need to define the entry itself which will be inside the '''Log''' folder '''(Level 2)''' | |||
{ | |||
text = $STR_ENH_tools_logFaction_displayName;//Name of the entry, ideally localised | |||
action = "call Enh_fnc_logFactions";//The code which is executed when the entry was selected | |||
conditionShow = "hoverObject";//The Condition, see below | |||
}; | |||
}; | |||
}; | |||
};</code> | |||
== Conditions == | == Conditions == |
Revision as of 23:02, 10 January 2018
Create a custom Entity Context Menu entry
- Entries for the Context Menu are defined in the class Display3DEN.
- The menu has multiple levels, the first level for example contains options like "Go Here" or folders like "Log". Those folders on the other hand can have another level, level 2.
class ctrlMenu;//First we need to load the base class of the menu
class Display3DEN
{
class ContextMenu: ctrlMenu
{
class Items
{
class Log//The easiest way to add an entry is to use one of the already available folders, here we use the class Log (Level 1)
{
picture = "\3denEnhanced\data\Enh_icon_clipboard.paa";//Icon used for the entry called Log
items[] +=//Here we list all items we want to add to the Log class.
{
"Enh_LogFactions"
};
};
class Enh_LogFactions//Now we need to define the entry itself which will be inside the Log folder (Level 2)
{
text = $STR_ENH_tools_logFaction_displayName;//Name of the entry, ideally localised
action = "call Enh_fnc_logFactions";//The code which is executed when the entry was selected
conditionShow = "hoverObject";//The Condition, see below
};
};
};
};
Conditions
- Context menu entries can have different conditions which need to be true in order for the entry to appear.
- The condition is defined by the conditionShow config entry.
class YourEntry
{
action = "call BIS_fnc_someFunction"; // Can be any kind of expression defined as string
text = "Delete Crew"; // Name shown in the context menu
conditionShow = "hoverObjectVehicle"; // Condition
};
The condition is a Simple Expression and can use one of the variables below:
Condition | Description |
---|---|
selected | True when an Eden entity is selected |
hoverObjectBrain | True when hovering over an object with simulation "soldier" or "UAVpilot" |
hoverObjectVehicle | True when hovering over a vehicle |
hoverObject | True when hovering over any object |
hoverGroup | True when hovering over any group |
hoverTrigger | True when hovering over any trigger |
hoverWaypoint | True when hovering over any waypoint |
hoverLogic | True when hovering over any logic |
hoverMarker | True when hovering over any marker |
isMultiplayer | True when editing in multiplayer environment |
hoverObjectUav | True when hovering over an UAV |
isEditList | True when the menu is opened from entity menu |
hoverLayer | True when hovering over a Layer |
hoverObjectCanFly | True when hovering an object which can fly |
hoverObjectFlying | True when hovering an object which is flying |
selectedObject | True when an object is selected |
selectedWaypoint | True when a waypoint is selected |
selectedLogic | True when a logic is selected |
selectedMarker | True when a Marker is selected |