-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from JakubMarecek/main
added file verifying for scene and questphase
- Loading branch information
Showing
5 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// @type lib | ||
// @name FileValidation_Questphase | ||
|
||
import { | ||
checkIfFileIsBroken | ||
} from "./Internal/FileValidation/00_shared.wscript"; | ||
import { | ||
getPathToCurrentFile | ||
} from '../../Wolvenkit_FileValidation.wscript'; | ||
import * as Logger from 'Logger.wscript'; | ||
|
||
export function validateQuestphaseFile(questphase, _questphaseSettings) { | ||
if (!_questphaseSettings?.Enabled) return; | ||
|
||
if (questphase?.Data?.RootChunk) return validateQuestphaseFile(questphase.Data.RootChunk, _entSettings); | ||
if (checkIfFileIsBroken(questphase, 'questphase')) return; | ||
|
||
const nodeIDs = []; | ||
|
||
for (let i = 0; i < questphase.graph.Data.nodes.length; i++) { | ||
const node = questphase.graph.Data.nodes[i]; | ||
const nodeID = node.Data.id; | ||
|
||
if (nodeIDs.includes(nodeID)) { | ||
Logger.Warning(`There is duplicate ID of two or more nodes: ${nodeID}. File ${getPathToCurrentFile()}`); | ||
} else { | ||
nodeIDs.push(nodeID); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// @type lib | ||
// @name FileValidation_Scene | ||
|
||
import { | ||
checkIfFileIsBroken | ||
} from "./Internal/FileValidation/00_shared.wscript"; | ||
import { | ||
getPathToCurrentFile | ||
} from '../../Wolvenkit_FileValidation.wscript'; | ||
import * as Logger from 'Logger.wscript'; | ||
|
||
export function validateSceneFile(scene, _sceneSettings) { | ||
// check if enabled | ||
if (!_sceneSettings?.Enabled) return; | ||
|
||
if (scene?.Data?.RootChunk) return validateQuestphaseFile(scene.Data.RootChunk, _entSettings); | ||
if (checkIfFileIsBroken(scene, 'scene')) return; | ||
|
||
const nodeIDs = []; | ||
|
||
for (let i = 0; i < scene.sceneGraph.Data.graph.length; i++) { | ||
const node = scene.sceneGraph.Data.graph[i]; | ||
const nodeID = node.Data.nodeId.id; | ||
|
||
if (nodeIDs.includes(nodeID)) { | ||
Logger.Warning(`There is duplicate ID of two or more nodes: ${nodeID}. File ${getPathToCurrentFile()}`); | ||
} else { | ||
nodeIDs.push(nodeID); | ||
} | ||
|
||
if (node.Data.questNode != undefined) { | ||
const questNodeID = node.Data.questNode.Data.id; | ||
if (questNodeID != nodeID) { | ||
Logger.Warning(`Node ID doesn't match with quest node definition in node: ${nodeID}. File ${getPathToCurrentFile()}`); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters