合并主分支
解决合并冲突
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
DEFAULT_EDITOR_SCENE_STYLE_PRESET,
|
||||
resolveEditorSceneStylePresetByLabel,
|
||||
} from '../../../packages/shared/src/contracts/editorScene';
|
||||
import { formatImageSizeValue } from './ImageCanvasEditorModel';
|
||||
import type {
|
||||
CanvasGenerationDialogState,
|
||||
@@ -207,6 +211,44 @@ export function createGenerateDialogDraft({
|
||||
};
|
||||
}
|
||||
|
||||
export function createSceneGenerationDialogDraft({
|
||||
canvasSize,
|
||||
viewport,
|
||||
}: {
|
||||
canvasSize: CanvasSize;
|
||||
viewport: CanvasViewport;
|
||||
}): Omit<CanvasGenerationDialogState, 'id'> {
|
||||
const worldCenter = getViewportWorldCenter({ canvasSize, viewport });
|
||||
const imageModel = DEFAULT_IMAGE_MODEL;
|
||||
const aspectRatio = '16:9';
|
||||
const imageSize = '1K';
|
||||
const placeholderSize = resolveEditorImageGenerationPixelSize({
|
||||
model: imageModel,
|
||||
aspectRatio,
|
||||
imageSize,
|
||||
});
|
||||
return {
|
||||
mode: 'scene',
|
||||
prompt: '',
|
||||
status: 'idle',
|
||||
composerOpen: true,
|
||||
generationReferences: [],
|
||||
sceneStylePreset: DEFAULT_EDITOR_SCENE_STYLE_PRESET,
|
||||
sceneCustomStyle: '',
|
||||
imageModel,
|
||||
aspectRatio,
|
||||
imageSize,
|
||||
placeholder: {
|
||||
x: worldCenter.x - placeholderSize.width / 2,
|
||||
y: worldCenter.y - placeholderSize.height / 2,
|
||||
width: placeholderSize.width,
|
||||
height: placeholderSize.height,
|
||||
originalWidth: placeholderSize.width,
|
||||
originalHeight: placeholderSize.height,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function shouldUseSpecPlaceholderValues(specType: SpecGenerationType) {
|
||||
return specType === 'character' || specType === 'ui';
|
||||
}
|
||||
@@ -472,6 +514,7 @@ const USER_PROMPT_INPUT_TITLES = new Set(
|
||||
'快速编辑提示词',
|
||||
'重绘提示词',
|
||||
'动作描述',
|
||||
'画面内容',
|
||||
].map((title) => title.toLowerCase()),
|
||||
);
|
||||
|
||||
@@ -636,6 +679,9 @@ function resolveGeneratedSourceDialogMode({
|
||||
if (sourceLayer.assetKind === 'character') {
|
||||
return 'character';
|
||||
}
|
||||
if (sourceLayer.assetKind === 'scene') {
|
||||
return 'scene';
|
||||
}
|
||||
if (sourceLayer.assetKind === 'ui-design') {
|
||||
return 'ui-design';
|
||||
}
|
||||
@@ -1463,6 +1509,33 @@ export function createSameSourceGenerationDialogDraft({
|
||||
);
|
||||
}
|
||||
|
||||
if (sourceMode === 'scene') {
|
||||
const fields = getGenerationInputFieldValues(sourceLayer);
|
||||
const styleLabel = fields.get('视觉风格');
|
||||
const sceneStylePreset =
|
||||
sourceDialog?.sceneStylePreset ??
|
||||
resolveEditorSceneStylePresetByLabel(styleLabel);
|
||||
return placeDraftBesideSourceLayer(
|
||||
restoreSharedImageOptions(
|
||||
{
|
||||
...createSceneGenerationDialogDraft({ canvasSize, viewport }),
|
||||
prompt,
|
||||
sourceLayerId: sourceLayer.id,
|
||||
sceneStylePreset,
|
||||
sceneCustomStyle:
|
||||
fields.get('自定义画风') ?? sourceDialog?.sceneCustomStyle ?? '',
|
||||
generationReferences:
|
||||
sourceDialog?.mode === 'scene'
|
||||
? (sourceDialog.generationReferences ?? [])
|
||||
: [],
|
||||
},
|
||||
sourceLayer,
|
||||
sourceDialog,
|
||||
),
|
||||
sourceLayer,
|
||||
);
|
||||
}
|
||||
|
||||
if (sourceMode === 'video') {
|
||||
const draft = createVideoRedrawGenerationDialogDraft(sourceLayer);
|
||||
if (!draft) {
|
||||
@@ -1950,6 +2023,7 @@ export function appendGenerationReference(
|
||||
}
|
||||
if (
|
||||
dialog?.mode === 'generate' ||
|
||||
dialog?.mode === 'scene' ||
|
||||
dialog?.mode === 'quick-edit' ||
|
||||
dialog?.mode === 'icon' ||
|
||||
dialog?.mode === 'ui-design'
|
||||
@@ -2110,6 +2184,7 @@ export function hideGeneratedLayerComposerAfterBlur(
|
||||
dialog: GenerateDialogState | null,
|
||||
): GenerateDialogState | null {
|
||||
return (dialog?.mode === 'generate' ||
|
||||
dialog?.mode === 'scene' ||
|
||||
dialog?.mode === 'spec' ||
|
||||
dialog?.mode === 'character' ||
|
||||
dialog?.mode === 'icon' ||
|
||||
@@ -2132,6 +2207,7 @@ export function closeGenerateComposerDialog(
|
||||
dialog: GenerateDialogState | null,
|
||||
): GenerateDialogState | null {
|
||||
return dialog?.mode === 'generate' ||
|
||||
dialog?.mode === 'scene' ||
|
||||
dialog?.mode === 'spec' ||
|
||||
dialog?.mode === 'character' ||
|
||||
dialog?.mode === 'icon' ||
|
||||
|
||||
Reference in New Issue
Block a user