feat: 收口角色动作资产发布前端与验证文档
This commit is contained in:
@@ -111,6 +111,10 @@ export type CharacterAnimationDraftPayload = {
|
||||
loop: boolean;
|
||||
frameWidth: number;
|
||||
frameHeight: number;
|
||||
frameCount?: number;
|
||||
applyChromaKey?: boolean;
|
||||
sampleStartRatio?: number;
|
||||
sampleEndRatio?: number;
|
||||
previewVideoPath?: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import {
|
||||
buildAnimationClipFromVideoSource,
|
||||
type DraftAnimationClip,
|
||||
} from '../asset-studio/characterAssetWorkflowModel';
|
||||
import { generateCharacterAnimationDraft } from '../asset-studio/characterAssetWorkflowPersistence';
|
||||
import type { CharacterAnimationGenerationPayload } from '../asset-studio/characterAssetWorkflowPersistence';
|
||||
|
||||
@@ -17,7 +13,7 @@ export function useRoleAnimationWorkflow() {
|
||||
animationPromptText: string;
|
||||
characterBriefText: string;
|
||||
role: EditableCustomWorldRole;
|
||||
}): Promise<DraftAnimationClip> => {
|
||||
}) => {
|
||||
const { actionConfig, animationPromptText, characterBriefText, role } =
|
||||
params;
|
||||
|
||||
@@ -53,20 +49,22 @@ export function useRoleAnimationWorkflow() {
|
||||
throw new Error('当前自定义世界动作工坊只支持图生视频方案。');
|
||||
}
|
||||
|
||||
return buildAnimationClipFromVideoSource(result.previewVideoPath, {
|
||||
animation: actionConfig.animation,
|
||||
return {
|
||||
fps: actionConfig.fps,
|
||||
loop: actionConfig.loop,
|
||||
frameWidth: 192,
|
||||
frameHeight: 256,
|
||||
frameCount: actionConfig.frameCount,
|
||||
applyChromaKey: true,
|
||||
sampleStartRatio: actionConfig.loop ? 0.12 : 0,
|
||||
sampleEndRatio: actionConfig.loop ? 0.94 : 1,
|
||||
});
|
||||
previewVideoPath: result.previewVideoPath,
|
||||
};
|
||||
};
|
||||
|
||||
const publishAnimationClipForRole = async (params: {
|
||||
actionConfig: CustomWorldAiActionConfig;
|
||||
clip: DraftAnimationClip;
|
||||
clip: Awaited<ReturnType<typeof generateAnimationClipForRole>>;
|
||||
role: EditableCustomWorldRole;
|
||||
}) => {
|
||||
const { actionConfig, clip, role } = params;
|
||||
@@ -80,11 +78,15 @@ export function useRoleAnimationWorkflow() {
|
||||
visualAssetId: role.generatedVisualAssetId,
|
||||
animations: {
|
||||
[actionConfig.animation]: {
|
||||
framesDataUrls: clip.frames,
|
||||
framesDataUrls: [],
|
||||
fps: clip.fps,
|
||||
loop: clip.loop,
|
||||
frameWidth: clip.frameWidth,
|
||||
frameHeight: clip.frameHeight,
|
||||
frameCount: clip.frameCount,
|
||||
applyChromaKey: clip.applyChromaKey,
|
||||
sampleStartRatio: clip.sampleStartRatio,
|
||||
sampleEndRatio: clip.sampleEndRatio,
|
||||
previewVideoPath: clip.previewVideoPath,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -62,7 +62,6 @@ import {
|
||||
type ScenePresetInfo,
|
||||
WorldType,
|
||||
} from '../../types';
|
||||
import { buildAnimationClipFromVideoSource } from '../asset-studio/characterAssetWorkflowModel';
|
||||
import {
|
||||
type CharacterAnimationGenerationPayload,
|
||||
generateCharacterAnimationDraft,
|
||||
@@ -3832,28 +3831,19 @@ function RoleSkillEditorModal({
|
||||
throw new Error('当前技能动作预览仅支持图生视频生成。');
|
||||
}
|
||||
|
||||
const clip = await buildAnimationClipFromVideoSource(
|
||||
generationResult.previewVideoPath,
|
||||
{
|
||||
animation: AnimationState.ATTACK,
|
||||
fps: 10,
|
||||
loop: false,
|
||||
frameCount: 8,
|
||||
applyChromaKey: true,
|
||||
},
|
||||
);
|
||||
|
||||
const publishResult = await publishCharacterAnimationAssets({
|
||||
characterId: role.id,
|
||||
visualAssetId: role.generatedVisualAssetId,
|
||||
animations: {
|
||||
[actionKey]: {
|
||||
framesDataUrls: clip.frames,
|
||||
fps: clip.fps,
|
||||
loop: clip.loop,
|
||||
frameWidth: clip.frameWidth,
|
||||
frameHeight: clip.frameHeight,
|
||||
previewVideoPath: clip.previewVideoPath,
|
||||
framesDataUrls: [],
|
||||
fps: 10,
|
||||
loop: false,
|
||||
frameWidth: 192,
|
||||
frameHeight: 256,
|
||||
frameCount: 8,
|
||||
applyChromaKey: true,
|
||||
previewVideoPath: generationResult.previewVideoPath,
|
||||
},
|
||||
},
|
||||
updateCharacterOverride: false,
|
||||
|
||||
Reference in New Issue
Block a user