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