15 dependencies[
"NMOMap"] = {
"NormalPower"};
16 dependencies[
"DetailNormalMap"] = {
"DetailNormalPower"};
17 dependencies[
"GlobalNMOMap"] = {
"NormalPower"};
18 dependencies[
"MudNMOMap"] = {
"MudDetNormal"};
19 dependencies[
"NMO_4"] = {
"DetNormal_4"};
20 dependencies[
"NMO_3"] = {
"DetNormal_3"};
21 dependencies[
"NMO_2"] = {
"DetNormal_2"};
22 dependencies[
"NMO_1"] = {
"DetNormal_1"};
23 dependencies[
"MaskMap"] = {
"MaskRedScale",
"MaskGreenScale",
"MaskBlueScale"};
24 dependencies[
"NTCMap"] = {
"NormalPower"};
25 dependencies[
"NMOMap2"] = {
"NormalPower2"};
26 dependencies[
"DetailNormalMap2"] = {
"DetailNormalPower2"};
29 for(
int i = 0; i < dependencies.Count(); i++)
31 string mapVarname = dependencies.GetKey(i);
33 if(mat.GetVarIndex(mapVarname) != -1)
38 array<string> depParam = dependencies.Get(mapVarname);
40 foreach(
string paramVarname: depParam)
43 mat.Get(mapVarname, mapValue);
44 mat.Get(paramVarname, paramValue);
45 mat.GetDefaultAsString(paramVarname, defaultValue);
47 if(mapValue ==
"" && (paramValue !=
"" && paramValue !=
"0" && paramValue != defaultValue))
49 material_validator.reports.Insert(paramVarname +
" was directly set but " + mapVarname +
" is missing");
50 material_validator.severity.Insert(2);
53 else if(mapValue !=
"")
56 GetValue(mat,paramVarname, paramValue);
60 material_validator.reports.Insert(mapVarname +
" was directly set but " + paramVarname +
" is 0");
61 material_validator.severity.Insert(2);
73 suffixToSlots[
"BCR"] = {
"BCRMap",
"BCR_1",
"BCR_2",
"BCR_3",
"BCR_4",
"MudBCRMap",
"DirtBCRMap",
"BCRMap2",
"EmissiveMap"};
74 suffixToSlots[
"NMO"] = {
"NMOMap",
"NMO_1",
"NMO_2",
"NMO_3",
"NMO_4",
"MudNMOMap",
"NMOMap2",
"GlobalNMOMap",
"DetailNormalMap",
"DetailNormalMap2"};
75 suffixToSlots[
"N"] = suffixToSlots.Get(
"NMO");
76 suffixToSlots[
"MCR"] = {
"MCRMap",
"GlobalMCRMap",
"GlobalMCMap",
"MacroMap"};
77 suffixToSlots[
"NHO"] = suffixToSlots.Get(
"NMO");
78 suffixToSlots[
"MC"] = suffixToSlots.Get(
"MCR");
79 suffixToSlots[
"MC"].Insert(
"GlobalMCMap");
80 suffixToSlots[
"NTC"] = {
"NTCMap"};
81 suffixToSlots[
"MLOD"] = {
"BCRMap"};
82 suffixToSlots[
"VFX"] = {
"VFX",
"VFXMap"};
83 suffixToSlots[
"MASK"] = {
"MaskMap",
"Mask_2",
"Mask_3",
"Mask_4",
"DirtMaskMap",
"MudMaskMap",
"SubsurfaceMask"};
84 suffixToSlots[
"A"] = {
"OpacityMap",
"HeightMap"};
85 suffixToSlots[
"CRM"] = {
"CamoCRMMap"};
86 suffixToSlots[
"EM"] = {
"EmissiveMap",
"ProjectionMap"};
87 suffixToSlots[
"H"] = {
"HeightMap",
"PuddleHeightMap"};
99 array<string> slots = connections.Get(suffix);
102 if(slots && !slots.Contains(slot))
104 material_validator.reports.Insert(
"Texture with suffix " + suffix +
" is in " + slot);
105 material_validator.severity.Insert(3);
116 array<string> DefaultProperties = {
"ZEnable",
"ZBias",
"Cull",
"Sort",
"SortBias",
"CastShadow",
"ReceiveShadow",
"OccludeRain",
117 "OccludeWetness",
"AddWetness",
"DisableFog",
"DisableInteriorProbes",
"TCModFuncs",
"NoDecals",
"EnableClutter",
"ClutterThresholdAngle",
118 "CrossFade",
"WetnessScale",
"PorosityScale",
"CustomWetnessChannel",
"SlidingDropsVisibility" };
120 array<string> allDefaultProperties = {
"ZEnable",
"ZBias",
"Cull",
"Sort",
"SortBias",
"CastShadow",
"ReceiveShadow",
"OccludeRain",
"OccludeWetness",
121 "AddWetness",
"DisableFog",
"DisableInteriorProbes",
"TCModFuncs",
"NoDecals",
"EnableClutter",
"ClutterThresholdAngle",
"CrossFade",
122 "WetnessScale",
"PorosityScale",
"CustomWetnessChannel",
"SlidingDropsVisibility",
"ZWrite",
"AlphaTest",
"AlphaMul",
"BlendMode",
"AllowUserAlphaBias",
"BisableUserAphaInShadow",
"ManualCascadesShadows"};
123 string matClass = cont.GetClassName();
124 for(
int i = 0; i < cont.GetNumVars(); i++)
126 string var = cont.GetVarName(i);
128 if(allDefaultProperties.Contains(var) && cont.IsVariableSetDirectly(var))
130 material_validator.reports.Insert(var +
" doesn't match the default settings");
131 material_validator.severity.Insert(1);
140 cont.Get(varName, value);
142 if(!cont.IsVariableSetDirectly(varName) && value ==
"")
144 cont.GetDefaultAsString(varName, value);
153 array<string> slots = {};
156 for(
int i = 0; i < cont.GetNumVars(); i++)
158 string var = cont.GetVarName(i);
160 cont.Get(var, value);
162 if(value.Contains(
".edds"))
165 if(value.EndsWith(
" 0"))
167 value = value.Substring(0, value.Length() - 2);
171 string guid = value.Substring(0,18);
172 string guidtest = Workbench.GetResourceName(guid);
175 material_validator.reports.Insert(cont.GetResourceName() +
" has a wrong guid!");
176 material_validator.severity.Insert(3);
181 ResourceManager resourceManager = Workbench.GetModule(ResourceManager);
182 MetaFile meta = resourceManager.GetMetaFile(value.GetPath());
185 material_validator.reports.Insert(
"Metafile for " + value +
"(" + var +
") couldn't be found!");
186 material_validator.severity.Insert(3);
193 string extension = cfg.GetClassName().Substring(0,3);
195 Workbench.GetAbsolutePath(value.GetPath(),absPath);
197 absPath.Replace(
"edds",extension);
208 material_validator.abs_textures.Insert(absPath);
210 string suffix =
FilePath.StripPath(value);
212 suffix = suffix.Substring(suffix.LastIndexOf(
"_")+1, suffix.LastIndexOf(
".") - suffix.LastIndexOf(
"_")-1);
216 if(suffix[suffix.Length() - 1].ToInt())
218 suffix = suffix.Substring(0,suffix.Length()-1);
221 CheckSlots(slot,suffix, material_validator);
230 array<string> properties = {
"NormalPower",
"MudDetNormal",
"DetNormal_1",
"DetNormal_2",
"DetNormal_3",
"DetNormal_4",
"DetailNormalPower",
"DetailNormalPower2",
231 "DetailMaskSharpness",
"DetailMaskOffset",
"DetailMaskUVScale",
"NormalPower2",
"RoughnessScale2",
"MetalnessScale2",
"RoughnessScale",
"MetalnessScale",
232 "MudRoughness",
"MudMetalness",
"Roughness1",
"Metalness_1",
"Roughness_2",
"Metalness_2",
"Roughness_3",
"Metalness_3",
"Roughness_4",
"Metalness_4",
233 "AO_1",
"AO_2",
"AO_3",
"AO_4",};
234 foreach(
string property: properties)
238 if(cont.GetVarIndex(property) != -1)
240 cont.Get(property,value);
241 if(value !=
"" || cont.IsVariableSetDirectly(property))
246 cont.GetLimits(cont.GetVarIndex(property),limitMin,limitMax, step);
247 float newMin = limitMax * (min / 100);
248 float newMax = limitMax * (max / 100);
249 if((value.ToFloat() < newMin || value.ToFloat() > newMax) && (value.ToFloat() != 0))
251 material_validator.reports.Insert(property +
" is out of limitation(" + newMin +
"-" + newMax +
")");
252 material_validator.severity.Insert(2);
264 for(
int i = 0; i < cont.GetNumVars(); i++)
266 string var = cont.GetVarName(i);
268 if(cont.GetObject(var) != empty)
272 if(uvTiling.GetClassName() ==
"MatUVTransform")
274 string tilingU, tilingV;
275 GetValue(uvTiling,
"TilingU", tilingU);
276 GetValue(uvTiling,
"TilingV", tilingV);
278 if(tilingU != tilingV)
280 material_validator.reports.Insert(
"UV Tiling on " + var +
" is not uniform.");
281 material_validator.severity.Insert(2);
284 if(MinTiling > tilingU.ToFloat() || MaxTiling <
Math.AbsFloat(tilingU.ToFloat()))
286 material_validator.reports.Insert(
"UV Tiling on " + var +
" is out of limitation, U = " + tilingU);
287 material_validator.severity.Insert(2);
289 if(MinTiling > tilingV.ToFloat() || MaxTiling <
Math.AbsFloat(tilingV.ToFloat()))
291 material_validator.reports.Insert(
"UV Tiling on " + var +
" is out of limitation, V = " + tilingV);
292 material_validator.severity.Insert(2);
298 cont.Get(var, value);