Skip to content

Commit 012a402

Browse files
committed
better validation for external materials
1 parent 5e932a9 commit 012a402

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

Scripts/Internal/FileValidation/00_shared.wscript

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export function stringifyPotentialCName(cnameOrString, _info = '', suppressSpace
109109
* @param _info info string for the user
110110
* @param allowEmpty suppress warning if depot path is unset (partsOverrides will target player entity)
111111
* @param suppressLogOutput suppress log output (because they'll be gathered in other places)
112-
* @param isSoft It's okay if soft references start with an * and don't contain substitution
113112
*
114113
* @return true if the depot path exists and can be resolved.
115114
*/
@@ -135,6 +134,7 @@ export function checkDepotPath(_depotPath, _info, allowEmpty = false, suppressLo
135134

136135
// check if the path has uppercase characters
137136
if (hasUppercase(depotPath)) {
137+
hasUppercasePaths = true;
138138
return false;
139139
}
140140

@@ -152,13 +152,13 @@ export function checkDepotPath(_depotPath, _info, allowEmpty = false, suppressLo
152152
}
153153

154154
// ArchiveXL 1.5 variant magic requires checking this in a loop
155-
const archiveXlResolvedPaths = getArchiveXlResolvedPaths(stringifyPotentialCName(depotPath));
155+
const archiveXlResolvedPaths = getArchiveXlResolvedPaths(depotPath);
156156
let ret = true;
157157

158158
let warnAboutSubstitution = false;
159159
switch (getPathToCurrentFile().split('.').pop()) {
160160
case 'ent':
161-
warnAboutSubstitution = entSettings.warnAboutSubstitution;
161+
warnAboutSubstitution = entSettings.warnAboutIncompleteSubstitution;
162162
break;
163163
case 'mesh':
164164
warnAboutSubstitution = meshSettings.enabled;
@@ -170,40 +170,39 @@ export function checkDepotPath(_depotPath, _info, allowEmpty = false, suppressLo
170170
if (archiveXlResolvedPaths.length > 1 && !!archiveXlResolvedPaths.find(p => wkit.FileExists(p) && p.includes("base"))) {
171171
return;
172172
}
173-
173+
174174
archiveXlResolvedPaths.forEach((resolvedPath) => {
175175
if (getPathToCurrentFile() === resolvedPath) {
176176
if (!suppressLogOutput) {
177-
Logger.Error(`${info}Depot path ${resolvedPath} references itself. This _will_ crash the game!`);
177+
Logger.Warning(`${info}Depot path ${resolvedPath} references itself. This _will_ crash the game! (Ignore this irf everything works)`);
178178
}
179179
ret = false;
180180
return;
181181
}
182-
// all fine
183-
if (wkit.FileExists(resolvedPath)) {
184-
return;
185-
}
186182

187-
if (suppressLogOutput) {
183+
// all fine, or we don't care
184+
if (wkit.FileExists(resolvedPath) || suppressLogOutput) {
188185
return;
189186
}
190-
191-
// File does not exist
192-
ret = false;
193187

188+
// ignore ArchiveXL hair profiles
194189
if (resolvedPath.startsWith("archive_xl\\characters\\common\\hair\\textures\\hair_profiles")) {
195190
ret = true;
196191
return;
197192
}
193+
198194
if (warnAboutSubstitution && shouldHaveSubstitution(resolvedPath, true)) {
195+
ret = false;
199196
Logger.Info(`${info}${resolvedPath}: substitution couldn't be resolved. It's either invalid or not yet supported in wkit.`);
200197
return;
201198
}
202199

203200
if (!!currentMaterialName) {
201+
ret = false;
204202
Logger.Info(`${info}${resolvedPath}: substitution couldn't be resolved. It may not be defined yet, or the file is in a different mod.`);
205203
return;
206204
}
205+
ret = false;
207206
Logger.Warning(`${info}${resolvedPath} not found in project or game files`);
208207
})
209208
return ret;

Scripts/Internal/FileValidation/mesh_and_morphtarget.wscript

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from "../../Wolvenkit_FileValidation.wscript";
1313
import * as FileValidation from "../../Wolvenkit_FileValidation.wscript";
1414
import * as TypeHelper from '../../TypeHelper.wscript';
15+
import * as Logger from '../../Logger.wscript';
1516
import {getArchiveXlResolvedPaths} from "./archiveXL.wscript";
1617
import {material_getMaterialPropertyValue, validateMaterialKeyValuePair} from "./material_and_shaders.wscript";
1718
import {JsonStringify} from "../../TypeHelper.wscript";
@@ -354,14 +355,12 @@ export function _validateMeshFile(mesh, meshPath) {
354355
}
355356
}
356357

357-
if (meshSettings.checkExternalMaterialPaths) {
358-
mesh.externalMaterials ||= [];
359-
for (let i = 0; i < mesh.externalMaterials.length; i++) {
360-
const material = mesh.externalMaterials[i];
361-
checkDepotPath(material?.DepotPath, `externalMaterials[${i}]`);
362-
}
358+
mesh.externalMaterials ||= [];
359+
for (let i = 0; i < mesh.externalMaterials.length; i++) {
360+
const material = mesh.externalMaterials[i];
361+
checkDepotPath(material?.DepotPath, `externalMaterials[${i}]`);
363362
}
364-
363+
365364
let numSubMeshes = 0;
366365

367366
// Create RenderResourceBlob if it doesn't exist?

0 commit comments

Comments
 (0)