fix: show preset toolbar for generated image result nodes
This commit is contained in:
parent
653525cfda
commit
0e12d4209c
@ -77,6 +77,18 @@ type ActivePanel =
|
|||||||
| null;
|
| null;
|
||||||
|
|
||||||
type ActiveStarterScene = "story-script" | "character-three-view" | "first-frame" | "audio-to-video" | null;
|
type ActiveStarterScene = "story-script" | "character-three-view" | "first-frame" | "audio-to-video" | null;
|
||||||
|
type ActivePresetControlMode =
|
||||||
|
| "story-script"
|
||||||
|
| "character-three-view"
|
||||||
|
| "first-frame"
|
||||||
|
| "audio-to-video"
|
||||||
|
| "story-beat-grid-4"
|
||||||
|
| "multi-view-nine-grid"
|
||||||
|
| "continuous-storyboard-grid-25"
|
||||||
|
| "cinematic-lighting-correction"
|
||||||
|
| "frame-prediction-plus-3s"
|
||||||
|
| "frame-prediction-minus-5s"
|
||||||
|
| null;
|
||||||
type SceneToolbarMenu = "panorama" | "orbit" | "lighting" | "grid" | "hd" | "crop" | null;
|
type SceneToolbarMenu = "panorama" | "orbit" | "lighting" | "grid" | "hd" | "crop" | null;
|
||||||
type ComposerMenu =
|
type ComposerMenu =
|
||||||
| "style"
|
| "style"
|
||||||
@ -1270,6 +1282,18 @@ function isWideImageGenerationFunction(functionKey: string) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOfficialImagePresetFunctionKey(functionKey: string) {
|
||||||
|
return (
|
||||||
|
functionKey === STORY_BEAT_GRID_FUNCTION_KEY ||
|
||||||
|
functionKey === MULTI_VIEW_NINE_GRID_FUNCTION_KEY ||
|
||||||
|
functionKey === CONTINUOUS_STORYBOARD_GRID_FUNCTION_KEY ||
|
||||||
|
functionKey === CINEMATIC_LIGHTING_CORRECTION_FUNCTION_KEY ||
|
||||||
|
functionKey === CHARACTER_THREE_VIEW_FUNCTION_KEY ||
|
||||||
|
functionKey === FRAME_PREDICTION_PLUS_3S_FUNCTION_KEY ||
|
||||||
|
functionKey === FRAME_PREDICTION_MINUS_5S_FUNCTION_KEY
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getPresetGridLayout(functionKey: string) {
|
function getPresetGridLayout(functionKey: string) {
|
||||||
if (functionKey === STORY_BEAT_GRID_FUNCTION_KEY) return { columns: 2, rows: 2 };
|
if (functionKey === STORY_BEAT_GRID_FUNCTION_KEY) return { columns: 2, rows: 2 };
|
||||||
if (functionKey === MULTI_VIEW_NINE_GRID_FUNCTION_KEY) return { columns: 3, rows: 3 };
|
if (functionKey === MULTI_VIEW_NINE_GRID_FUNCTION_KEY) return { columns: 3, rows: 3 };
|
||||||
@ -1615,8 +1639,19 @@ function getPresetMode(node: CloneNode | null | undefined): ActiveStarterScene {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPresetControlMode(node: CloneNode | null | undefined): ActivePresetControlMode {
|
||||||
|
const starterMode = getPresetMode(node);
|
||||||
|
if (starterMode) return starterMode;
|
||||||
|
const functionKey = resolveOfficialImagePresetFunctionKey({
|
||||||
|
fallbackKey: getNodeFunctionKey(node),
|
||||||
|
option: getNodeParams(node).option || node?.draftValues?.toolbarOption,
|
||||||
|
title: node?.title,
|
||||||
|
});
|
||||||
|
return functionKey && isOfficialImagePresetFunctionKey(functionKey) ? functionKey : null;
|
||||||
|
}
|
||||||
|
|
||||||
function isOfficialImageControlNode(node: CloneNode | null | undefined): node is CloneNode {
|
function isOfficialImageControlNode(node: CloneNode | null | undefined): node is CloneNode {
|
||||||
return !!node && (node.kind === "media" || node.kind === "script") && !!getPresetMode(node);
|
return !!node && (node.kind === "media" || node.kind === "script") && !!getPresetControlMode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTargetModuleKind(node: CloneNode): AddModuleKind | null {
|
function getTargetModuleKind(node: CloneNode): AddModuleKind | null {
|
||||||
@ -3420,12 +3455,13 @@ export function LiblibVideoCanvasReplica({ canvasId, isLoading = false }: Liblib
|
|||||||
const runPresetComposerSubmit = useCallback(
|
const runPresetComposerSubmit = useCallback(
|
||||||
async (
|
async (
|
||||||
nodeId: string,
|
nodeId: string,
|
||||||
mode: Exclude<ActiveStarterScene, null>,
|
mode: Exclude<ActivePresetControlMode, null>,
|
||||||
draftPrompt: string,
|
draftPrompt: string,
|
||||||
settings?: ComposerSettings,
|
settings?: ComposerSettings,
|
||||||
) => {
|
) => {
|
||||||
const node = nodes.find((item) => item.id === nodeId);
|
const node = nodes.find((item) => item.id === nodeId);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
if (isOfficialImagePresetFunctionKey(mode)) return;
|
||||||
const incomingNodes = edges
|
const incomingNodes = edges
|
||||||
.filter((edge) => edge.target === nodeId)
|
.filter((edge) => edge.target === nodeId)
|
||||||
.map((edge) => nodes.find((item) => item.id === edge.source))
|
.map((edge) => nodes.find((item) => item.id === edge.source))
|
||||||
@ -4023,7 +4059,7 @@ export function LiblibVideoCanvasReplica({ canvasId, isLoading = false }: Liblib
|
|||||||
|
|
||||||
const isBusy = isLoading || isProjectLoading;
|
const isBusy = isLoading || isProjectLoading;
|
||||||
const selectedPresetControlNode = isOfficialImageControlNode(selectedNode) ? selectedNode : null;
|
const selectedPresetControlNode = isOfficialImageControlNode(selectedNode) ? selectedNode : null;
|
||||||
const selectedPresetMode = getPresetMode(selectedPresetControlNode);
|
const selectedPresetMode = getPresetControlMode(selectedPresetControlNode);
|
||||||
const selectedTargetModuleKind = selectedNode ? getTargetModuleKind(selectedNode) : null;
|
const selectedTargetModuleKind = selectedNode ? getTargetModuleKind(selectedNode) : null;
|
||||||
const selectedTextResourceNode =
|
const selectedTextResourceNode =
|
||||||
selectedNode && getDraftString(selectedNode, "action") === "TEXT_RESOURCE" ? selectedNode : null;
|
selectedNode && getDraftString(selectedNode, "action") === "TEXT_RESOURCE" ? selectedNode : null;
|
||||||
@ -4922,7 +4958,7 @@ function PresetWorkflowControls({
|
|||||||
}: {
|
}: {
|
||||||
anchor: PresetControlAnchor;
|
anchor: PresetControlAnchor;
|
||||||
functionConfig: VideoCanvasFunctionConfig;
|
functionConfig: VideoCanvasFunctionConfig;
|
||||||
mode: Exclude<ActiveStarterScene, null>;
|
mode: Exclude<ActivePresetControlMode, null>;
|
||||||
modelOptions: CanvasModelOption[];
|
modelOptions: CanvasModelOption[];
|
||||||
nodes: CloneNode[];
|
nodes: CloneNode[];
|
||||||
onComposerSubmit: (payload: ComposerSubmitPayload) => void;
|
onComposerSubmit: (payload: ComposerSubmitPayload) => void;
|
||||||
@ -4930,8 +4966,8 @@ function PresetWorkflowControls({
|
|||||||
onPresetSubmit: (prompt: string, settings?: ComposerSettings) => void;
|
onPresetSubmit: (prompt: string, settings?: ComposerSettings) => void;
|
||||||
selectedNode: CloneNode;
|
selectedNode: CloneNode;
|
||||||
}) {
|
}) {
|
||||||
if (mode === CHARACTER_THREE_VIEW_FUNCTION_KEY) {
|
if (isOfficialImagePresetFunctionKey(mode)) {
|
||||||
const definition = getConfiguredFunction(functionConfig, CHARACTER_THREE_VIEW_FUNCTION_KEY);
|
const definition = getConfiguredFunction(functionConfig, mode);
|
||||||
return (
|
return (
|
||||||
<div className="pointer-events-none absolute inset-0 z-30" data-canvas-overlay="true">
|
<div className="pointer-events-none absolute inset-0 z-30" data-canvas-overlay="true">
|
||||||
<CharacterPresetToolbar anchor={anchor} onToolAction={onImageToolAction} />
|
<CharacterPresetToolbar anchor={anchor} onToolAction={onImageToolAction} />
|
||||||
@ -4942,7 +4978,7 @@ function PresetWorkflowControls({
|
|||||||
modelOptions={modelOptions}
|
modelOptions={modelOptions}
|
||||||
nodes={nodes}
|
nodes={nodes}
|
||||||
onSubmit={onComposerSubmit}
|
onSubmit={onComposerSubmit}
|
||||||
referenceThumbnailUrl={getNodeMediaUrl(selectedNode) || CHARACTER_IMAGE_URL}
|
referenceThumbnailUrl={getNodeSourceMediaUrl(selectedNode) || getNodeMediaUrl(selectedNode) || CHARACTER_IMAGE_URL}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user