5 private SCR_AttributesManagerEditorComponent m_AttributesManager;
6 private ref array<ResourceName> m_CategoryConfigs;
7 private ref array<ref SCR_EditorAttributeCategory> m_Categories;
9 protected void InitCategories()
11 array<SCR_BaseEditorAttribute> attributes =
new array<SCR_BaseEditorAttribute>;
12 m_AttributesManager.GetEditedAttributes(attributes);
14 m_CategoryConfigs =
new array<ResourceName>;
15 m_Categories =
new array<ref SCR_EditorAttributeCategory>;
16 array<int> priorities =
new array<int>;
21 ResourceName categoryConfig = attribute.GetCategoryConfig();
22 if (m_CategoryConfigs.Find(categoryConfig) == -1)
25 Resource categoryContainer = BaseContainerTools.LoadContainer(categoryConfig);
26 if (!categoryContainer)
28 Print(
string.Format(
"Error loading category '%1'!", categoryConfig), LogLevel.ERROR);
35 Print(
string.Format(
"SCR_EditorAttributeCategory not found in %1!", categoryConfig), LogLevel.ERROR);
40 int priority =
category.GetPriority();
42 int count = m_CategoryConfigs.Count();
43 bool breakCalled =
false;
45 for (
int c = 0; c < count; c++)
47 if (priority > priorities[c])
57 m_CategoryConfigs.InsertAt(categoryConfig,
index);
62 m_CategoryConfigs.Insert(categoryConfig);
64 priorities.Insert(
category.GetPriority());
70 void RemoveAutoClose()
72 if (m_AttributesManager)
74 m_AttributesManager.GetOnAttributesConfirm().Remove(CloseSelf);
75 m_AttributesManager.GetOnAttributesCancel().Remove(CloseSelf);
79 override void OnMenuOpen()
81 m_AttributesManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent,
true));
82 if (!m_AttributesManager)
85 m_AttributesManager.GetOnAttributesConfirm().Insert(CloseSelf);
86 m_AttributesManager.GetOnAttributesCancel().Insert(CloseSelf);
92 attributesUI.InitWidget(m_CategoryConfigs, m_Categories);
96 override void OnMenuClose()