Resource Checker – Resource Utilities
Background job utilities for resource checking: material parsing, verification, duplicate detection, unused asset scanning, texture export, and asset statistics.
Background job utilities for resource checking: material parsing, verification, duplicate detection, unused asset scanning, texture export, and asset statistics.
Overview
Worker module (~2960 lines) providing async background jobs for all resource checker operations. Parses both .cs and .json material files, runs verification passes, and reports results to the main resourceChecker UI.
Public API
| Function | Signature | Description |
|---|---|---|
M.verifyVersion | M.verifyVersion(path) | Checks for V0 (legacy) materials in path. |
M.verifyDuplicate | M.verifyDuplicate(path, skipCommon) | Finds duplicated material definitions. |
M.fixPID | M.fixPID(path, skipCommon) | Removes deprecated persistent IDs from material files. |
M.checkMatTex | M.checkMatTex(path) | Validates texture mappings in materials. |
M.checkTex | M.checkTex(path) | Checks texture file format and power-of-2 compliance. |
M.checkmissingMats | M.checkmissingMats(path) | Finds missing material references in loaded models. |
M.checkStatic | M.checkStatic() | Lists loaded TSStatic meshes with sizes. |
M.checkForest | M.checkForest() | Lists available forest mesh items. |
M.checkTerrains | M.checkTerrains() | Lists loaded terrain blocks. |
M.checkUnusedMats | M.checkUnusedMats(level) | Finds unused materials in the level. |
M.checkUsedMats | M.checkUsedMats(level) | Lists used materials with size data. |
M.checkUnusedModels | M.checkUnusedModels(level) | Finds unreferenced mesh files. |
M.unusedTextures | M.unusedTextures(level) | Finds unreferenced texture files. |
M.checkColData | M.checkColData(level) | Analyzes collision mesh polygon counts. |
M.removeUnused | M.removeUnused(level, unusType, selected) | Permanently removes unused assets (materials, meshes, or textures). |
M.removeDummy | M.removeDummy(path, skipCommon) | Removes dummy materials from vehicle files. |
M.textureExporter | M.textureExporter(path, outputPath) | Converts DDS textures to PNG. |
M.assetStats | M.assetStats(path) | Comprehensive asset scanning with size breakdown by category. |
M.duplicateData | M.duplicateData(matName) | Fetches duplicate material data for resolver UI. |
M.getProgress | M.getProgress() | Returns current background job progress (0-100). |
M.stopProgress | M.stopProgress() | Cancels all running background jobs. |
M.resaveMaterial | M.resaveMaterial(path) | Re-saves a material file (used after duplicate resolution). |
Internal Helpers
| Function | Description |
|---|---|
parseMaterialFile(fn) | Parses .cs or .json material file |
parseMaterialFiles(files, job) | Batch material parsing with yield |
foreachMaterial(matTable, cb) | Iterates all materials in parsed table |
compactNested(map) | Compacts nested issue maps removing empties |
ensureValidPath(p) | Validates material path format |
Usage Example
-- Called by resourceChecker UI
local resourceUtil = extensions.editor_resourceChecker_resourceUtil
resourceUtil.verifyVersion("/levels/myLevel/")
local progress = resourceUtil.getProgress()Module Variables
matstoRemove(any) - Module variable.shapestoRemove(any) - Module variable.textoRemove(any) - Module variable.matstoRemove(any) - Module variable.checkUnusedMatsworkJob(any) - Module variable.checkUsedMatsworkJob(any) - Module variable.shapestoRemove(any) - Module variable.checkUnusedModelsworkJob(any) - Module variable.textoRemove(any) - Module variable.unusedTexturesworkJob(any) - Module variable.checkColDataworkJob(any) - Module variable.duplicateDataworkJob(any) - Module variable.removeDummyworkJob(any) - Module variable.textureExporterworkJob(any) - Module variable.
Functions
onExtensionLoaded()
Callback for extension loaded event.
Returns: self
onExtensionUnloaded()
Callback for extension unloaded event.
getSimObjects(fileName)
Returns the sim objects.
fileName(string)
Returns: ret
powerOfTwo(x)
Handles power of two.
x(any)
Returns: lg == math.floor(lg)
removeFromForestJson(shape, foresData)
Removes from forest json.
shape(any)foresData(any)
findDuplicates(duplicatelist)
Finds duplicates.
duplicatelist(any)
getMaterialTexFields(mat)
Returns the material tex fields.
mat(any)
Returns: fields
Module Variables
matstoRemove(any) - Module variable.shapestoRemove(any) - Module variable.textoRemove(any) - Module variable.matstoRemove(any) - Module variable.checkUnusedMatsworkJob(any) - Module variable.checkUsedMatsworkJob(any) - Module variable.shapestoRemove(any) - Module variable.checkUnusedModelsworkJob(any) - Module variable.textoRemove(any) - Module variable.unusedTexturesworkJob(any) - Module variable.checkColDataworkJob(any) - Module variable.duplicateDataworkJob(any) - Module variable.removeDummyworkJob(any) - Module variable.textureExporterworkJob(any) - Module variable.
Functions
onExtensionLoaded()
Callback for extension loaded event.
Returns: self
onExtensionUnloaded()
Callback for extension unloaded event.
getSimObjects(fileName)
Returns the sim objects.
fileName(string)
Returns: ret
powerOfTwo(x)
Handles power of two.
x(any)
Returns: lg == math.floor(lg)
removeFromForestJson(shape, foresData)
Removes from forest json.
shape(any)foresData(any)
findDuplicates(duplicatelist)
Finds duplicates.
duplicatelist(any)
getMaterialTexFields(mat)
Returns the material tex fields.
mat(any)
Returns: fields
Additional Exports
M.checkColDataworkJobM.checkUnusedMatsworkJobM.checkUnusedModelsworkJobM.checkUsedMatsworkJobM.duplicateDataworkJobM.findDuplicatesM.getMaterialTexFieldsM.getSimObjectsM.matstoRemoveM.onExtensionLoadedM.onExtensionUnloadedM.powerOfTwoM.removeDummyworkJobM.removeFromForestJsonM.shapestoRemoveM.textoRemoveM.textureExporterworkJobM.unusedTexturesworkJob
See Also
- World Editor Guide - Guide
Rally Editor – Structured Pacenote Form
ImGui form for editing pacenotes in structured audio mode – corner severity, direction, length, radius change, modifiers, and caution levels.
Road Spline Group Manager
Backend manager for road spline groups - handles creation, removal, splitting, joining, serialization, terrain painting, and undo/redo operations.