5class EBTConfigPlugin : WorkbenchPlugin
12 protected ref array<ref BlenderPathContainer> m_aBlenderPaths;
15 protected bool m_bCopyToClipboard =
false;
17 protected bool shouldReload =
true;
19 protected static EBTConfigPlugin s_Instance;
23 protected static ref ParamEnumArray s_RegisteredBlenderExecutables = {NO_EXECUTABLE_ENUM};
25 static ref ParamEnumArray GetRegisteredBlenderExecutables()
27 return s_RegisteredBlenderExecutables;
30 void EBTConfigPlugin()
38 return s_Instance.m_bCopyToClipboard;
41 static void UpdateRegisteredBlenderExecutables()
43 s_RegisteredBlenderExecutables.Clear();
45 int len = s_Instance.m_aBlenderPaths.Count();
49 s_RegisteredBlenderExecutables.Insert(NO_EXECUTABLE_ENUM);
53 for (
int i = 0; i < len; i++)
55 string path = s_Instance.m_aBlenderPaths[i].m_sPath;
56 if (
path !=
string.Empty)
59 if (BlenderPathContainer.GetTitleFromPath(
path, title))
60 s_RegisteredBlenderExecutables.Insert(
new ParamEnum(title, i.ToString()));
64 if (s_RegisteredBlenderExecutables.Count() == 0)
66 s_RegisteredBlenderExecutables.Insert(NO_EXECUTABLE_ENUM);
70 static bool HasBlenderRegistered()
72 UpdateRegisteredBlenderExecutables();
75 if (s_RegisteredBlenderExecutables[0].
m_Key ==
"None")
77 Print(
"No blender executable set! Please set one in EBT Config!",
LogLevel.WARNING);
86 static bool GetBlenderPathFromEnumIndex(
int index, out
string path)
88 ref array<ref BlenderPathContainer> pathContainers = s_Instance.m_aBlenderPaths;
90 if (!
FileIO.FileExists(pathContainers[
index].m_sPath))
92 Print(pathContainers[
index].m_sPath +
" does not exist! Please select a valid path in EBT Config.",
LogLevel.WARNING);
100 static bool GetDefaultBlenderPath(out
string path)
102 return GetBlenderPathFromEnumIndex(s_Instance.m_iDefaultPath,
path);
109 protected void ButtonUpdateDropdownMenu()
119 EBTConfigPlugin.HasBlenderRegistered();
120 shouldReload =
false;
121 Workbench.ScriptDialog(
"EBT Config",
"",
this);
137 void BaseContainerCustomTitleBlenderVersion(
string propertyName)
149 BlenderPathContainer.GetTitleFromPath(
path, title);
150 EBTConfigPlugin.HasBlenderRegistered();
157class BlenderPathContainer
159 [
Attribute(
"", uiwidget: UIWidgets.FileNamePicker,
desc:
"Absolute path to your blender.exe",
params:
"exe FileNameFormat=absolute",
category:
"Path")]
164 static bool GetTitleFromPath(
string path, out
string title)
168 title =
"Unassigned";
172 if (!FileIO.FileExists(
path))
174 title =
"Non Existing";
178 array<string> splitString = {};
179 path.Split(
"\\", splitString,
true);
181 if (splitString.Count() < 2)
183 title =
"Invalid Path";
188 title = splitString[splitString.Count() - 2];
void ParamEnum(string key, string value, string desc="")
BaseContainerCustomCheckIntWithFlagTitleField m_sPropertyName
Attribute for setting UIInfo's name property as (Localized) custom title.
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
class SCR_BaseManualCameraComponent _WB_GetCustomTitle(BaseContainer source, out string title)