feat(ui): render the scene sharing dialogs and bar from a store

createSceneDialog keeps its builder but publishes the dialog's lines,
fields, buttons and status to a scene sharing store; SceneDialog.vue,
teleported to the body from the scene panels view, draws the same modal
with the same styles and opens it with Cancel focused. The EDIT DETAILS /
SHARE SCENE bar is drawn by that view while sharing offers it. The status
directive is shared with Provider Settings, and the two QA scripts that
drove the old DOM read the new dialog.
This commit is contained in:
Sameh Khamis committed 2026-10-31 18:37:14 -07:00
1 parent fe963a1219
commit 9d9eb267c5
15 files changed
+842 -355

No files matched your search

+66 -58
View File
@@ -89,12 +89,13 @@ export function createSceneSharing(director) {
await job();
} catch (error) {
if (alive(owner))
dialog.status.textContent =
dialog.setStatus(
error?.name === 'SceneDocumentError'
? error.message
: t(
'Could not complete this action. Check the file, references and selected assets.',
);
),
);
} finally {
if (alive(owner)) busy = false;
}
@@ -157,33 +158,38 @@ export function createSceneSharing(director) {
if (!alive(owner)) return;
staged = input;
inventory(input);
dialog.status.textContent = t('Ready to import');
dialog.setStatus(t('Ready to import'));
dialog.text(
t(
'Apply replaces the current project. Export your current project first if you want to keep both.',
),
);
const apply = dialog.button(t('Apply import'), () =>
run(owner, async () => {
if (expected !== currentProject()) throw new Error('Project changed');
apply.disabled = true;
const ok = await director.importProjectFile(file, {
prepared: input,
expectedProject: expected,
signal: owner.signal,
});
if (alive(owner)) {
if (ok) close();
else {
apply.disabled = false;
dialog.status.textContent = t(
'Import was not applied. The current project may have changed.',
);
const apply = dialog.button(
t('Apply import'),
() =>
run(owner, async () => {
if (expected !== currentProject())
throw new Error('Project changed');
apply.disabled = true;
const ok = await director.importProjectFile(file, {
prepared: input,
expectedProject: expected,
signal: owner.signal,
});
if (alive(owner)) {
if (ok) close();
else {
apply.disabled = false;
dialog.setStatus(
t(
'Import was not applied. The current project may have changed.',
),
);
}
}
}
}),
}),
{ hook: 'data-director-apply-import' },
);
apply.dataset.directorApplyImport = '';
});
}
function edit() {
@@ -241,9 +247,9 @@ export function createSceneSharing(director) {
JSON.parse(shotText.value),
);
sceneText.value = json(details);
dialog.status.textContent = t('Anchor added to draft');
dialog.setStatus(t('Anchor added to draft'));
}),
dialog.body,
{ place: 'body' },
);
dialog.button(
t('Set move start to current camera'),
@@ -277,11 +283,11 @@ export function createSceneSharing(director) {
details,
);
shotText.value = json(details);
dialog.status.textContent = t(
'Move added to draft; destination remains the shot camera',
dialog.setStatus(
t('Move added to draft; destination remains the shot camera'),
);
}),
dialog.body,
{ place: 'body' },
);
dialog.button(
t('Use ordinary flight'),
@@ -292,37 +298,39 @@ export function createSceneSharing(director) {
delete details.move;
shotText.value = json(details);
} catch {
dialog.status.textContent = t('Invalid shot JSON');
dialog.setStatus(t('Invalid shot JSON'));
}
},
dialog.body,
{ place: 'body' },
);
const apply = dialog.button(t('Apply details'), () =>
run(owner, async () => {
if (expected !== currentProject()) throw new Error('Project changed');
const project = editSceneDetails(
original,
scene.id,
shot.id,
JSON.parse(sceneText.value),
JSON.parse(shotText.value),
);
const ok = await director.importProjectFile(
{
name: 'scene details',
text: async () => stringifySceneDocument(project),
},
{
prepared: { project, assets: director._bundleAssets.snapshot() },
expectedProject: expected,
signal: owner.signal,
selection: { sceneId: scene.id, shotId: shot.id },
},
);
if (alive(owner) && ok) close();
}),
dialog.button(
t('Apply details'),
() =>
run(owner, async () => {
if (expected !== currentProject()) throw new Error('Project changed');
const project = editSceneDetails(
original,
scene.id,
shot.id,
JSON.parse(sceneText.value),
JSON.parse(shotText.value),
);
const ok = await director.importProjectFile(
{
name: 'scene details',
text: async () => stringifySceneDocument(project),
},
{
prepared: { project, assets: director._bundleAssets.snapshot() },
expectedProject: expected,
signal: owner.signal,
selection: { sceneId: scene.id, shotId: shot.id },
},
);
if (alive(owner) && ok) close();
}),
{ hook: 'data-director-apply-details' },
);
apply.dataset.directorApplyDetails = '';
}
function share() {
let project;
@@ -361,13 +369,13 @@ export function createSceneSharing(director) {
});
const files = dialog.input(t('Choose data-pack files'), '', {
type: 'file',
multiple: true,
});
files.multiple = true;
const folder = dialog.input(t('Or choose a data-pack folder'), '', {
type: 'file',
multiple: true,
directory: true,
});
folder.multiple = true;
folder.setAttribute('webkitdirectory', '');
dialog.button(t('Download asset bundle'), () =>
run(owner, async () => {
const selected = [...files.files, ...folder.files];
@@ -410,7 +418,7 @@ export function createSceneSharing(director) {
);
if (alive(owner)) {
download(text, 'scene.gevbundle.json');
dialog.status.textContent = t('Asset bundle downloaded');
dialog.setStatus(t('Asset bundle downloaded'));
}
}),
);