Refactor validation functions to include context parameter
This commit is contained in:
@@ -4736,7 +4736,8 @@ function validateProjectDialogue(
|
|||||||
function validateProjectSequence(
|
function validateProjectSequence(
|
||||||
sequence: ProjectSequence,
|
sequence: ProjectSequence,
|
||||||
path: string,
|
path: string,
|
||||||
document: Pick<ProjectDocument, "dialogues"> & SceneDocument,
|
dialogues: Pick<ProjectDocument, "dialogues">,
|
||||||
|
context: ProjectSchedulerValidationContext,
|
||||||
diagnostics: SceneDiagnostic[]
|
diagnostics: SceneDiagnostic[]
|
||||||
) {
|
) {
|
||||||
if (sequence.title.trim().length === 0) {
|
if (sequence.title.trim().length === 0) {
|
||||||
@@ -4767,10 +4768,15 @@ function validateProjectSequence(
|
|||||||
|
|
||||||
switch (step.type) {
|
switch (step.type) {
|
||||||
case "controlEffect":
|
case "controlEffect":
|
||||||
validateControlEffect(step.effect, `${stepPath}.effect`, document, diagnostics);
|
validateProjectSchedulerEffect(
|
||||||
|
step.effect,
|
||||||
|
`${stepPath}.effect`,
|
||||||
|
context,
|
||||||
|
diagnostics
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "startDialogue":
|
case "startDialogue":
|
||||||
if (document.dialogues.dialogues[step.dialogueId] === undefined) {
|
if (dialogues.dialogues.dialogues[step.dialogueId] === undefined) {
|
||||||
diagnostics.push(
|
diagnostics.push(
|
||||||
createDiagnostic(
|
createDiagnostic(
|
||||||
"error",
|
"error",
|
||||||
@@ -4789,8 +4795,8 @@ function validateProjectSequence(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validateProjectResources(
|
function validateProjectResources(
|
||||||
document: Pick<ProjectDocument, "materials" | "assets" | "dialogues" | "sequences"> &
|
document: Pick<ProjectDocument, "materials" | "assets" | "dialogues" | "sequences">,
|
||||||
SceneDocument,
|
context: ProjectSchedulerValidationContext,
|
||||||
diagnostics: SceneDiagnostic[]
|
diagnostics: SceneDiagnostic[]
|
||||||
) {
|
) {
|
||||||
const seenIds = new Map<string, string>();
|
const seenIds = new Map<string, string>();
|
||||||
@@ -4863,7 +4869,7 @@ function validateProjectResources(
|
|||||||
}
|
}
|
||||||
|
|
||||||
registerAuthoredId(sequence.id, path, seenIds, diagnostics);
|
registerAuthoredId(sequence.id, path, seenIds, diagnostics);
|
||||||
validateProjectSequence(sequence, path, document, diagnostics);
|
validateProjectSequence(sequence, path, document, context, diagnostics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user