Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ContextActionsEditorComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Editor", description: "Manager of editor context actions", icon: "WBData/ComponentEditorProps/componentEditor.png")]
5
15class SCR_ContextActionsEditorComponent : SCR_BaseActionsEditorComponent
16{
20
29
30 override protected int ValidateSelection(bool isInstant)
31 {
32 //--- Evaluate selected/hovered-on entities only when selecting, not when placing or transforming
33 if (!m_StateManager || m_StateManager.GetState() == EEditorState.SELECTING)
34 {
35
37 {
38 m_HoveredEntity = m_HoverManager.GetFirstEntity();
39
40 //--- If the entity is inside a composition, make the composition the hovered entity
42 m_HoveredEntity = m_LayerManager.GetParentBelowCurrentLayer(m_HoveredEntity);
43
44 //--- Update selection
46 {
48 {
49 //--- Open menu over entity outside of the current selection - select it instead
52 }
53 else if (!isInstant)
54 {
55 //--- Opened menu without any entity under cursor - clear the selection
56 //--- (not when the action was activated instantly, i.e., by a shortcut; it would prevent. e.g., deleting selected entity when cursor is on empty space)
57 m_SelectedManager.Clear();
58 }
59 }
60 }
61 else
62 {
63 m_HoveredEntity = null;
64 }
65
66 //--- Clear previously cached entities
67 m_SelectedEntities.Clear();
68
69 //--- Get selected entities
72
73 //--- No entities selected, use the entity under cursor (needed for example when deleting composition while hovering over one of its child entities)
74 if (m_HoveredEntity && m_SelectedEntities.IsEmpty())
76 }
77 else
78 {
79 m_HoveredEntity = null;
80 m_SelectedEntities.Clear();
81 }
82
83 //--- Cache flags
85 if (GetManager().IsLimited())
86 {
88 }
89 if (GetGame().GetInputManager().IsUsingMouseAndKeyboard())
90 {
91 flags |= EEditorContextActionFlags.USING_MOUSE_AND_KEYBOARD;
92 }
93 return flags;
94 }
95 override void EvaluateActions(notnull array<SCR_BaseEditorAction> actions, vector cursorWorldPosition, out notnull array<ref SCR_EditorActionData> filteredActions, out int flags = 0)
96 {
97 super.EvaluateActions(actions, cursorWorldPosition, filteredActions, flags);
98 m_OnMenuOpen.Invoke(actions, cursorWorldPosition, filteredActions, flags);
99 }
100
101 override protected bool ActionCanBeShown(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
102 {
103 return action.GetInfo() && action.CanBeShown(m_HoveredEntity, m_SelectedEntities, cursorWorldPosition, flags);
104 }
105
106 override protected bool ActionCanBePerformed(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
107 {
108 return action.CanBePerformed(m_HoveredEntity, m_SelectedEntities, cursorWorldPosition, flags);
109 }
110
111 override void EOnEditorActivate()
112 {
113 super.EOnEditorActivate();
114 DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_EDITOR_ACTIONS_MENU, "Actions Menu", "Editor");
115
118 }
119
120 override void EOnEditorDeactivate()
121 {
122 super.EOnEditorDeactivate();
123 DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_EDITOR_ACTIONS_MENU);
124 }
125};
SCR_EAIThreatSectorFlags flags
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
EEditorContextActionFlags
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseActionsEditorComponentClass m_HoverManager
SCR_EditableEntityComponent m_HoveredEntity
SCR_BaseEditableEntityFilter m_SelectedManager
ref set< SCR_EditableEntityComponent > m_SelectedEntities
InputManager GetInputManager()
bool IsLimited()
override SCR_EditorManagerEntity GetManager()
Diagnostic and developer menu system.
Definition DiagMenu.c:18
void SCR_BaseActionsEditorComponentClass(IEntityComponentSource componentSource, IEntitySource parentSource, IEntitySource prefabSource)
bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
bool ActionCanBePerformed(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
bool ActionCanBeShown(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
override void EvaluateActions(notnull array< SCR_BaseEditorAction > actions, vector cursorWorldPosition, out notnull array< ref SCR_EditorActionData > filteredActions, out int flags=0)
EEditorState
Unique editor state.
Definition EEditorState.c:6
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134