Update scene validation to include current scene entities
This commit is contained in:
@@ -4719,11 +4719,14 @@ function validateProjectDialogue(
|
|||||||
function validateProjectSequence(
|
function validateProjectSequence(
|
||||||
sequence: ProjectSequence,
|
sequence: ProjectSequence,
|
||||||
path: string,
|
path: string,
|
||||||
projectResources: Pick<ProjectDocument, "scenes">,
|
projectResources: Pick<ProjectDocument, "scenes"> & {
|
||||||
|
currentSceneEntities?: SceneDocument["entities"];
|
||||||
|
},
|
||||||
context: ProjectSchedulerValidationContext,
|
context: ProjectSchedulerValidationContext,
|
||||||
diagnostics: SceneDiagnostic[]
|
diagnostics: SceneDiagnostic[]
|
||||||
) {
|
) {
|
||||||
const projectScenes = projectResources.scenes ?? {};
|
const projectScenes = projectResources.scenes ?? {};
|
||||||
|
const currentSceneEntities = projectResources.currentSceneEntities ?? {};
|
||||||
|
|
||||||
if (sequence.title.trim().length === 0) {
|
if (sequence.title.trim().length === 0) {
|
||||||
diagnostics.push(
|
diagnostics.push(
|
||||||
@@ -4772,6 +4775,14 @@ function validateProjectSequence(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetNpc === null) {
|
||||||
|
const candidate = currentSceneEntities[effect.npcEntityId];
|
||||||
|
|
||||||
|
if (candidate?.kind === "npc") {
|
||||||
|
targetNpc = candidate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (targetNpc === null) {
|
if (targetNpc === null) {
|
||||||
diagnostics.push(
|
diagnostics.push(
|
||||||
createDiagnostic(
|
createDiagnostic(
|
||||||
@@ -5207,7 +5218,7 @@ export function validateSceneDocument(
|
|||||||
validateProjectSequence(
|
validateProjectSequence(
|
||||||
sequence,
|
sequence,
|
||||||
path,
|
path,
|
||||||
{ scenes: {} },
|
{ scenes: {}, currentSceneEntities: document.entities },
|
||||||
projectSchedulerValidationContext,
|
projectSchedulerValidationContext,
|
||||||
diagnostics
|
diagnostics
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user