Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
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"
)]
2
class
SCR_ContextActionsEditorComponentClass
:
SCR_BaseActionsEditorComponentClass
3
{
4
};
5
15
class
SCR_ContextActionsEditorComponent
: SCR_BaseActionsEditorComponent
16
{
17
protected
ref
ScriptInvoker
m_OnMenuOpen
=
new
ScriptInvoker
();
18
protected
SCR_LayersEditorComponent
m_LayerManager
;
19
protected
SCR_StatesEditorComponent
m_StateManager
;
20
25
ScriptInvoker
GetOnMenuOpen
()
26
{
27
return
m_OnMenuOpen
;
28
}
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
36
if
(
m_HoverManager
)
37
{
38
m_HoveredEntity
=
m_HoverManager
.GetFirstEntity();
39
40
//--- If the entity is inside a composition, make the composition the hovered entity
41
if
(
m_LayerManager
)
42
m_HoveredEntity
=
m_LayerManager
.GetParentBelowCurrentLayer(
m_HoveredEntity
);
43
44
//--- Update selection
45
if
(
m_SelectedManager
)
46
{
47
if
(
m_HoveredEntity
)
48
{
49
//--- Open menu over entity outside of the current selection - select it instead
50
if
(!
m_SelectedManager
.Contains(
m_HoveredEntity
))
51
m_SelectedManager
.Replace(
m_HoveredEntity
);
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
70
if
(
m_SelectedManager
)
71
m_SelectedManager
.GetEntities(
m_SelectedEntities
);
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())
75
m_SelectedEntities
.Insert(
m_HoveredEntity
);
76
}
77
else
78
{
79
m_HoveredEntity
= null;
80
m_SelectedEntities
.Clear();
81
}
82
83
//--- Cache flags
84
EEditorContextActionFlags
flags
;
85
if
(
GetManager
().
IsLimited
())
86
{
87
flags
|=
EEditorContextActionFlags
.LIMITED;
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
116
m_LayerManager
=
SCR_LayersEditorComponent
.Cast(
SCR_LayersEditorComponent
.GetInstance(
SCR_LayersEditorComponent
));
117
m_StateManager
=
SCR_StatesEditorComponent
.Cast(
SCR_StatesEditorComponent
.GetInstance(
SCR_StatesEditorComponent
));
118
}
119
120
override
void
EOnEditorDeactivate
()
121
{
122
super.EOnEditorDeactivate();
123
DiagMenu
.Unregister(
SCR_DebugMenuID
.DEBUGUI_EDITOR_ACTIONS_MENU);
124
}
125
};
flags
SCR_EAIThreatSectorFlags flags
Definition
AIControlComponentSerializer.c:16
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition
DebugMenuID.c:4
EEditorContextActionFlags
EEditorContextActionFlags
Definition
EEditorContextActionFlags.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
m_HoverManager
SCR_BaseActionsEditorComponentClass m_HoverManager
m_HoveredEntity
SCR_EditableEntityComponent m_HoveredEntity
Definition
SCR_BaseActionsEditorComponent.c:158
m_SelectedManager
SCR_BaseEditableEntityFilter m_SelectedManager
Definition
SCR_BaseActionsEditorComponent.c:155
m_SelectedEntities
ref set< SCR_EditableEntityComponent > m_SelectedEntities
Definition
SCR_BaseActionsEditorComponent.c:159
GetInputManager
InputManager GetInputManager()
Definition
SCR_BaseManualCameraComponent.c:205
IsLimited
bool IsLimited()
Definition
SCR_EditorManagerEntity.c:529
GetManager
override SCR_EditorManagerEntity GetManager()
Definition
SCR_EditorManagerEntity.c:543
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
DiagMenu
Diagnostic and developer menu system.
Definition
DiagMenu.c:18
SCR_BaseActionsEditorComponentClass::SCR_BaseActionsEditorComponentClass
void SCR_BaseActionsEditorComponentClass(IEntityComponentSource componentSource, IEntitySource parentSource, IEntitySource prefabSource)
Definition
SCR_BaseActionsEditorComponent.c:86
SCR_BaseEditorAction
Definition
SCR_BaseEditorAction.c:25
SCR_BaseEditorAction::CanBeShown
bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
Definition
SCR_BaseEditorAction.c:77
SCR_BaseEditorAction::GetInfo
SCR_UIInfo GetInfo()
Definition
SCR_BaseEditorAction.c:111
SCR_BaseEditorAction::CanBePerformed
bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
Definition
SCR_BaseEditorAction.c:86
SCR_ContextActionsEditorComponentClass
Definition
SCR_ContextActionsEditorComponent.c:3
SCR_ContextActionsEditorComponent
Definition
SCR_ContextActionsEditorComponent.c:16
SCR_ContextActionsEditorComponent::ValidateSelection
int ValidateSelection(bool isInstant)
Definition
SCR_ContextActionsEditorComponent.c:30
SCR_ContextActionsEditorComponent::ActionCanBePerformed
bool ActionCanBePerformed(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
Definition
SCR_ContextActionsEditorComponent.c:106
SCR_ContextActionsEditorComponent::ActionCanBeShown
bool ActionCanBeShown(SCR_BaseEditorAction action, vector cursorWorldPosition, int flags)
Definition
SCR_ContextActionsEditorComponent.c:101
SCR_ContextActionsEditorComponent::EOnEditorActivate
override void EOnEditorActivate()
Definition
SCR_ContextActionsEditorComponent.c:111
SCR_ContextActionsEditorComponent::m_OnMenuOpen
ref ScriptInvoker m_OnMenuOpen
Definition
SCR_ContextActionsEditorComponent.c:17
SCR_ContextActionsEditorComponent::m_LayerManager
SCR_LayersEditorComponent m_LayerManager
Definition
SCR_ContextActionsEditorComponent.c:18
SCR_ContextActionsEditorComponent::m_StateManager
SCR_StatesEditorComponent m_StateManager
Definition
SCR_ContextActionsEditorComponent.c:19
SCR_ContextActionsEditorComponent::EvaluateActions
override void EvaluateActions(notnull array< SCR_BaseEditorAction > actions, vector cursorWorldPosition, out notnull array< ref SCR_EditorActionData > filteredActions, out int flags=0)
Definition
SCR_ContextActionsEditorComponent.c:95
SCR_ContextActionsEditorComponent::EOnEditorDeactivate
override void EOnEditorDeactivate()
Definition
SCR_ContextActionsEditorComponent.c:120
SCR_ContextActionsEditorComponent::GetOnMenuOpen
ScriptInvoker GetOnMenuOpen()
Definition
SCR_ContextActionsEditorComponent.c:25
SCR_LayersEditorComponent
Definition
SCR_LayersEditorManager.c:12
SCR_StatesEditorComponent
Definition
SCR_StatesEditorComponent.c:10
vector
Definition
vector.c:13
EEditorState
EEditorState
Unique editor state.
Definition
EEditorState.c:6
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Editor
Components
Editor
SCR_ContextActionsEditorComponent.c
Generated by
1.17.0