Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
EditablePrefabsLabel_Size.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseContainerCustomTitleEnum
(
EEditableEntityLabel
,
"m_Label"
)]
2
class
EditablePrefabsLabel_Size
:
EditablePrefabsLabel_Base
3
{
4
[
Attribute
()]
5
protected
float
sizeXS
;
6
7
[
Attribute
()]
8
protected
float
sizeS
;
9
10
[
Attribute
()]
11
protected
float
sizeM
;
12
13
[
Attribute
()]
14
protected
float
sizeL
;
15
16
[
Attribute
()]
17
protected
float
sizeXL
;
18
19
[
Attribute
()]
20
protected
bool
m_IgnoreY
;
21
22
[
Attribute
()]
23
protected
bool
m_DebugPrintSize
;
24
25
//------------------------------------------------------------------------------------------------
26
override
bool
GetLabelValid
(
WorldEditorAPI
api,
IEntitySource
entitySource,
IEntityComponentSource
componentSource,
string
targetPath,
EEditableEntityType
entityType, notnull array<EEditableEntityLabel> authoredLabels, out
EEditableEntityLabel
label)
27
{
28
// Skip groups & authored compositions (SLOTSIZE label)
29
if
(entityType ==
EEditableEntityType
.GROUP ||
ContainsSlotSizeLabel
(authoredLabels))
30
return
false
;
31
32
ResourceName
prefab = entitySource.GetResourceName();
33
34
vector
prefabBoundsMin =
vector
.One *
float
.MAX;
35
vector
prefabBoundsMax =
vector
.One * -
float
.MAX;
36
37
GetEntitySourceBounds
(api, entitySource, prefabBoundsMin, prefabBoundsMax);
38
39
if
(
m_IgnoreY
)
40
{
41
prefabBoundsMin[1] = 0;
42
prefabBoundsMax[1] = 0;
43
}
44
45
vector
prefabBounds = prefabBoundsMax - prefabBoundsMin;
46
47
float
prefabSize = prefabBounds.Length();
48
49
if
(
m_DebugPrintSize
)
50
Print
(
string
.Format(
"%1"
, prefabSize),
LogLevel
.DEBUG);
51
52
if
(prefabSize == 0)
53
{
54
Print
(
"Calculated editable entity size is 0"
,
LogLevel
.NORMAL);
55
return
false
;
56
}
57
58
if
(prefabSize >=
sizeXL
)
59
label =
EEditableEntityLabel
.SIZE_XL;
60
else
if
(prefabSize >=
sizeL
)
61
label =
EEditableEntityLabel
.SIZE_L;
62
else
if
(prefabSize >=
sizeM
)
63
label =
EEditableEntityLabel
.SIZE_M;
64
else
if
(prefabSize >=
sizeS
)
65
label =
EEditableEntityLabel
.SIZE_S;
66
else
67
label =
EEditableEntityLabel
.SIZE_XS;
68
69
if
(
ContainsSizeLabel
(authoredLabels))
70
{
71
// Authored labels contains size label and differs from calculated label, show warning
72
if
(!authoredLabels.Contains(label))
73
Print
(
"Calculated size "
+
typename
.EnumToString(
EEditableEntityLabel
, label) +
" differs from authored size label"
,
LogLevel
.WARNING);
74
75
// Dont add calculated label if authored size label exists.
76
return
false
;
77
}
78
79
return
true
;
80
}
81
82
//------------------------------------------------------------------------------------------------
83
protected
bool
ContainsSlotSizeLabel
(notnull array<EEditableEntityLabel> authoredLabels,
EEditableEntityLabel
optSizeLabelCheck =
EEditableEntityLabel
.NONE)
84
{
85
// AuthoredLabels contains any SlotSize label
86
return
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_FLAT_SMALL) ||
87
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_FLAT_MEDIUM) ||
88
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_FLAT_LARGE) ||
89
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_ROAD_SMALL) ||
90
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_ROAD_MEDIUM) ||
91
authoredLabels.Contains(
EEditableEntityLabel
.SLOT_ROAD_LARGE);
92
}
93
94
//------------------------------------------------------------------------------------------------
95
protected
bool
ContainsSizeLabel
(notnull array<EEditableEntityLabel> authoredLabels,
EEditableEntityLabel
optSizeLabelCheck =
EEditableEntityLabel
.NONE)
96
{
97
// AuthoredLabels contains any size label
98
return
authoredLabels.Contains(
EEditableEntityLabel
.SIZE_XL) ||
99
authoredLabels.Contains(
EEditableEntityLabel
.SIZE_L) ||
100
authoredLabels.Contains(
EEditableEntityLabel
.SIZE_M) ||
101
authoredLabels.Contains(
EEditableEntityLabel
.SIZE_S) ||
102
authoredLabels.Contains(
EEditableEntityLabel
.SIZE_XS);
103
}
104
105
//------------------------------------------------------------------------------------------------
106
protected
string
GetFileName
(
ResourceName
prefab)
107
{
108
string
name =
FilePath
.StripPath(prefab);
109
return
FilePath
.StripExtension(name);
110
}
111
112
//------------------------------------------------------------------------------------------------
113
protected
void
GetEntitySourceBounds
(
WorldEditorAPI
api,
IEntitySource
source, out
vector
boundsMin, out
vector
boundsMax)
114
{
115
IEntity
entity = api.SourceToEntity(source);
116
if
(!entity)
117
return
;
118
119
VObject
object
= entity.
GetVObject
();
120
if
(
object
)
121
{
122
string
ext;
123
FilePath
.StripExtension(
object
.GetResourceName(), ext);
124
if
(ext ==
"xob"
)
125
{
126
vector
entityMin, entityMax;
127
//Print("EntityPos check: " + entity.GetWorldTransformAxis(3));
128
entity.
GetWorldBounds
(entityMin, entityMax);
129
//entityMin = entity.CoordToParent(entityMin);
130
//entityMax = entity.CoordToParent(entityMax);
131
132
boundsMin[0] =
Math
.Min(boundsMin[0], entityMin[0]);
133
boundsMin[1] =
Math
.Min(boundsMin[1], entityMin[1]);
134
boundsMin[2] =
Math
.Min(boundsMin[2], entityMin[2]);
135
136
boundsMax[0] =
Math
.Max(boundsMax[0], entityMax[0]);
137
boundsMax[1] =
Math
.Max(boundsMax[1], entityMax[1]);
138
boundsMax[2] =
Math
.Max(boundsMax[2], entityMax[2]);
139
}
140
}
141
142
//Print(string.Format("BoundsMin: %1, BoundsMax: %2", boundsMin, boundsMax), LogLevel.NORMAL);
143
144
int
childrenCount = source.GetNumChildren();
145
for
(
int
i = 0; i < childrenCount; i++)
146
{
147
GetEntitySourceBounds
(api, source.GetChild(i), boundsMin, boundsMax);
148
}
149
}
150
}
EEditableEntityLabel
EEditableEntityLabel
Definition
EEditableEntityLabel.c:2
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition
SCR_CampaignHintStorage.c:22
EditablePrefabsLabel_Base
Definition
EditablePrefabsLabel_Base.c:3
EditablePrefabsLabel_Size
Definition
EditablePrefabsLabel_Size.c:3
EditablePrefabsLabel_Size::sizeXL
float sizeXL
Definition
EditablePrefabsLabel_Size.c:17
EditablePrefabsLabel_Size::GetLabelValid
override bool GetLabelValid(WorldEditorAPI api, IEntitySource entitySource, IEntityComponentSource componentSource, string targetPath, EEditableEntityType entityType, notnull array< EEditableEntityLabel > authoredLabels, out EEditableEntityLabel label)
Definition
EditablePrefabsLabel_Size.c:26
EditablePrefabsLabel_Size::sizeXS
float sizeXS
Definition
EditablePrefabsLabel_Size.c:5
EditablePrefabsLabel_Size::sizeL
float sizeL
Definition
EditablePrefabsLabel_Size.c:14
EditablePrefabsLabel_Size::sizeS
float sizeS
Definition
EditablePrefabsLabel_Size.c:8
EditablePrefabsLabel_Size::GetFileName
string GetFileName(ResourceName prefab)
Definition
EditablePrefabsLabel_Size.c:106
EditablePrefabsLabel_Size::ContainsSizeLabel
bool ContainsSizeLabel(notnull array< EEditableEntityLabel > authoredLabels, EEditableEntityLabel optSizeLabelCheck=EEditableEntityLabel.NONE)
Definition
EditablePrefabsLabel_Size.c:95
EditablePrefabsLabel_Size::m_IgnoreY
bool m_IgnoreY
Definition
EditablePrefabsLabel_Size.c:20
EditablePrefabsLabel_Size::m_DebugPrintSize
bool m_DebugPrintSize
Definition
EditablePrefabsLabel_Size.c:23
EditablePrefabsLabel_Size::ContainsSlotSizeLabel
bool ContainsSlotSizeLabel(notnull array< EEditableEntityLabel > authoredLabels, EEditableEntityLabel optSizeLabelCheck=EEditableEntityLabel.NONE)
Definition
EditablePrefabsLabel_Size.c:83
EditablePrefabsLabel_Size::sizeM
float sizeM
Definition
EditablePrefabsLabel_Size.c:11
EditablePrefabsLabel_Size::GetEntitySourceBounds
void GetEntitySourceBounds(WorldEditorAPI api, IEntitySource source, out vector boundsMin, out vector boundsMax)
Definition
EditablePrefabsLabel_Size.c:113
FilePath
Definition
FilePath.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetWorldBounds
proto external void GetWorldBounds(out vector mins, out vector maxs)
IEntity::GetVObject
proto external VObject GetVObject()
Returns visual object set to this Entity. No reference is added.
IEntitySource
Definition
IEntitySource.c:13
Math
Definition
Math.c:13
ResourceName
Definition
ResourceName.c:13
VObject
Visual object.
Definition
VObject.c:14
WorldEditorAPI
Definition
WorldEditorAPI.c:13
vector
Definition
vector.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
EEditableEntityType
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
Definition
EEditableEntityType.c:6
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
WorkbenchGame
Editor
EditablePrefabsComponent
LabelsConfig
EditablePrefabsLabel_Size.c
Generated by
1.17.0