4 [
Attribute(
desc:
"Array of all possible bloodtypes with randomization weight. Keep combined randomization weight at 100 for ease of use",
category:
"Data")]
11 data.Insert(assetType);
18[
WorkbenchPluginAttribute(name:
"Validate Asset", wbModules: {
"ResourceManager"},resourceTypes: {
"fbx",
"xob"} , awesomeFontCode: 0xf0ad, description:
"Validates checks on FBX on various issues that can be tedious and time-consuming to verify manually",
category:
"EBT Validation")]
24 [
Attribute(
"", uiwidget:
UIWidgets.FileNamePicker,
desc:
"Must be defined if FBX report is wanted!! Path to a folder where temporary log file will be stored.",
params:
"folders FileNameFormat=absolute",
category:
"Path")]
25 string log_file_folder_path;
27 static ref array<string> allFbxs =
new array<string>;
44 filter.fileExtensions = {
"conf"};
45 filter.searchStr = {
"AssetTypes"};
47 array<string> addons = {};
49 foreach(
string addon : addons)
55 array<string> configFiles = {};
58 if(configFiles.Count() != 0)
65 if(configData != null)
67 array<string> configDataArr = {};
68 configData.
GetData(configDataArr);
69 for (
int i = 1; i <= configDataArr.Count(); i++)
83 if (Workbench.ScriptDialog(
"Validate FBXs",
"Select one FBX file you want to validate, also possible to select whole folder",
this))
85 if(resources.Count() == 0)
87 Print(
"No fbx file selected. Please select at least one fbx file in the resource browser.",
LogLevel.WARNING);
90 else if(resources.Count() > 1)
92 Print(
"Validating multiple FBXs at once is not supported yet! Please select only one FBX.",
LogLevel.WARNING);
100 Workbench.GetAbsolutePath(resources[0].GetPath(),fbxPath);
102 if (fbxPath.EndsWith(
".xob"))
103 fbxPath.Replace(
".xob",
".fbx");
105 string log_file = log_file_folder_path;
108 log_file +=
"/MQA_Log.txt";
111 log_file.Replace(
"\\",
"/");
112 if (
FileIO.FileExists(log_file))
114 FileIO.DeleteFile(log_file);
118 if (!EBTConfigPlugin.HasBlenderRegistered())
120 Print(
"Blender is not registered in EBT Config, skipping a few checks");
125 EBTEmatUtils ematUtils =
new EBTEmatUtils();
126 bool meta = ematUtils.GetMaterials(resources[0].GetPath(), materials);
128 for(
int i = 0; i < materials.Count(); i++)
133 BlenderOperatorDescription operatorDescription =
new BlenderOperatorDescription(
"modelqa");
134 operatorDescription.blIDName =
"ebt.mqa_report_background";
135 operatorDescription.AddParam(
"log_file_path",log_file);
136 operatorDescription.AddParam(
"fbx_path", fbxPath);
137 operatorDescription.AddParam(
"asset_type",
s_AssetTypes.Get(Type).m_Key);
139 StartBlenderWithOperator(operatorDescription,
true);
149 if (Workbench.ScriptDialog(
"Validate FBXs",
"Select one or multiple FBX files you want to validate, also possible to select whole folder",
this))
151 ResourceManager resourceManager = Workbench.GetModule(ResourceManager);
152 array<ResourceName> resources = {};
153 resourceManager.GetResourceBrowserSelection(resources.Insert,
true);
155 if(resources.Count() == 0)
157 Print(
"No fbx file selected. Please select at least one fbx file in the resource browser.",
LogLevel.WARNING);
160 else if(resources.Count() > 1)
162 Print(
"Validating multiple FBXs at once is not supported yet! Please select only one FBX.",
LogLevel.WARNING);
169 Workbench.GetAbsolutePath(resources[0].GetPath(),fbxPath);
171 if (fbxPath.EndsWith(
".xob"))
172 fbxPath.Replace(
".xob",
".fbx");
174 string log_file = log_file_folder_path;
177 log_file +=
"/MQA_Log.txt";
180 log_file.Replace(
"\\",
"/");
181 if (
FileIO.FileExists(log_file))
183 FileIO.DeleteFile(log_file);
188 if (!EBTConfigPlugin.HasBlenderRegistered())
190 Print(
"Blender is not registered in EBT Config, skipping a few checks");
195 EBTEmatUtils ematUtils =
new EBTEmatUtils();
196 bool meta = ematUtils.GetMaterials(resources[0].GetPath(), materials);
198 for(
int i = 0; i < materials.Count(); i++)
202 BlenderOperatorDescription operatorDescription =
new BlenderOperatorDescription(
"modelqa");
203 operatorDescription.blIDName =
"ebt.mqa_report_background";
204 operatorDescription.AddParam(
"log_file_path",log_file);
205 operatorDescription.AddParam(
"fbx_path", fbxPath);
206 operatorDescription.AddParam(
"asset_type",
s_AssetTypes.Get(Type).m_Key);
208 StartBlenderWithOperator(operatorDescription,
true);
232 void FBXReportToolRequest()
242 void FBXReportToolResponse()
265 array<string> errors =
new array<string>;
266 int warning_count = 0;
272 while (fRead.ReadLine(fLine) != -1)
274 string logLevel = fLine.Substring(0,3);
276 string reportLine = fLine.Substring(3,fLine.Length()-3);
277 reportLine.Replace(
"'",
string.Empty);
291 errors.Insert(reportLine);
302 string summary =
"\n";
304 summary +=
string.ToString(
"------------ VALIDATION SUMMARY ------------\n");
305 summary +=
string.ToString(
"Errors - (" + errors.Count() +
")\n");
307 Print(
string.
ToString(
"------------ VALIDATION SUMMARY ------------"));
309 for (
int i = 0; i < errors.Count(); i++)
311 summary +=
string.ToString(errors[i] +
"\n");
314 summary +=
string.ToString(
"Warnings - (" + warning_count +
")\n");
315 summary +=
string.ToString(
"Infos - (" + info_count +
")\n");
318 System.ExportToClipboard(summary);
void ParamEnum(string key, string value, string desc="")
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_AICombatMoveRequestBase GetRequest()
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
bool GetData(inout array< string > data)
ref array< string > m_aAssetTypes
base classes for filtering in server browser
Object holding reference to resource. In destructor release the resource.
Object used for holding filtering params for ResourceDatabase.SearchResources() method.
static void FillAssetTypes()
static const ref ParamEnum DEFAULT_ENUM
override void OnResourceContextMenu(notnull array< ResourceName > resources)
static ref ParamEnumArray GetAssetTypes()
static ref ParamEnumArray s_AssetTypes
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
FileMode
Mode for opening file. See FileSystem::Open.
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.