mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 12:23:20 +00:00
PageScene: drop orphaned stylize state
Strip the stylize fields that nothing reads anymore now that the
StyleMoreOptions / StyleSelection UI is gone. From PageSceneStore:
selectedArtStyle, upscale, faceDetail, styleStrength, lipSync,
cinematic, enginePreProcessing, globalIPAMediaToken, adapterImage,
positivePrompt, negativePrompt, isUserInputPositive,
isUserInputNegative, showNegativePrompt — and the matching setters
+ resetSceneGenerationMetadata. Drop the styleList / ArtStyle
imports; both go unused here.
From editor.ts: drop negative_prompt, art_style,
engine_preprocessing, generation_options, globalIpAdapterImage.
Keep positive_prompt — PromptBox3D writes it via setEnginePrompt
(PageEditor.tsx) and save_manager round-trips it.
Trim save_manager.loadFromJson to the prompt-only path (legacy
saves with stylize keys load fine; the now-removed if-guards just
silently ignored them anyway). Trim SceneMetadata to
{ positivePrompt, cameraAspectRatio } and the matching
SceneGenereationMetaData interface.
ControlsTopButtons.handleResetScene drops its now-removed store
call.
This commit is contained in:
1 parent
8af4657393
commit
0ca91e29b7
6 files changed
+4
-167
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { CameraAspectRatio, EditorStates } from "./enums";
|
||||
import { AssetType, AssetFilterOption, ArtStyle } from "~/enums";
|
||||
import { styleList } from "./styleList";
|
||||
import { AssetType, AssetFilterOption } from "~/enums";
|
||||
|
||||
export type SceneObjectKind = "object" | "character" | "shape";
|
||||
|
||||
@@ -110,22 +109,6 @@ interface PageSceneState {
|
||||
errorDialogTitle: string;
|
||||
errorDialogMessage: string;
|
||||
|
||||
// generation / stylize
|
||||
selectedArtStyle: ArtStyle;
|
||||
upscale: boolean;
|
||||
faceDetail: boolean;
|
||||
styleStrength: number;
|
||||
lipSync: boolean;
|
||||
cinematic: boolean;
|
||||
enginePreProcessing: boolean;
|
||||
globalIPAMediaToken: string | null;
|
||||
adapterImage: string | null;
|
||||
positivePrompt: string;
|
||||
negativePrompt: string;
|
||||
isUserInputPositive: boolean;
|
||||
isUserInputNegative: boolean;
|
||||
showNegativePrompt: boolean;
|
||||
|
||||
// ----- actions -----
|
||||
|
||||
// scene
|
||||
@@ -169,23 +152,6 @@ interface PageSceneState {
|
||||
toggleEditorLetterBox: (next?: boolean) => void;
|
||||
setErrorDialog: (title: string, message: string) => void;
|
||||
setShowErrorDialog: (show: boolean) => void;
|
||||
|
||||
// generation / stylize
|
||||
setSelectedArtStyle: (style: ArtStyle) => void;
|
||||
setUpscale: (v: boolean) => void;
|
||||
setFaceDetail: (v: boolean) => void;
|
||||
setStyleStrength: (n: number) => void;
|
||||
setLipSync: (v: boolean) => void;
|
||||
setCinematic: (v: boolean) => void;
|
||||
setEnginePreProcessing: (v: boolean) => void;
|
||||
setGlobalIPAMediaToken: (t: string | null) => void;
|
||||
setAdapterImage: (s: string | null) => void;
|
||||
setPositivePrompt: (p: string) => void;
|
||||
setNegativePrompt: (p: string) => void;
|
||||
setIsUserInputPositive: (v: boolean) => void;
|
||||
setIsUserInputNegative: (v: boolean) => void;
|
||||
setShowNegativePrompt: (v: boolean) => void;
|
||||
resetSceneGenerationMetadata: () => void;
|
||||
}
|
||||
|
||||
export const usePageSceneStore = create<PageSceneState>((set, get) => ({
|
||||
@@ -222,21 +188,6 @@ export const usePageSceneStore = create<PageSceneState>((set, get) => ({
|
||||
errorDialogTitle: "Error!",
|
||||
errorDialogMessage: "Something went wrong.",
|
||||
|
||||
selectedArtStyle: styleList[0].type,
|
||||
upscale: false,
|
||||
faceDetail: true,
|
||||
styleStrength: 0.8,
|
||||
lipSync: false,
|
||||
cinematic: true,
|
||||
enginePreProcessing: false,
|
||||
globalIPAMediaToken: null,
|
||||
adapterImage: null,
|
||||
positivePrompt: "",
|
||||
negativePrompt: "",
|
||||
isUserInputPositive: false,
|
||||
isUserInputNegative: false,
|
||||
showNegativePrompt: false,
|
||||
|
||||
// scene actions
|
||||
addObject: (obj) =>
|
||||
set((s) => ({ objects: [...s.objects, obj] })),
|
||||
@@ -325,35 +276,4 @@ export const usePageSceneStore = create<PageSceneState>((set, get) => ({
|
||||
showErrorDialog: true,
|
||||
}),
|
||||
setShowErrorDialog: (show) => set({ showErrorDialog: show }),
|
||||
|
||||
// generation / stylize actions
|
||||
setSelectedArtStyle: (style) => set({ selectedArtStyle: style }),
|
||||
setUpscale: (v) => set({ upscale: v }),
|
||||
setFaceDetail: (v) => set({ faceDetail: v }),
|
||||
setStyleStrength: (n) => set({ styleStrength: n }),
|
||||
setLipSync: (v) => set({ lipSync: v }),
|
||||
setCinematic: (v) => set({ cinematic: v }),
|
||||
setEnginePreProcessing: (v) => set({ enginePreProcessing: v }),
|
||||
setGlobalIPAMediaToken: (t) => set({ globalIPAMediaToken: t }),
|
||||
setAdapterImage: (s) => set({ adapterImage: s }),
|
||||
setPositivePrompt: (p) => set({ positivePrompt: p }),
|
||||
setNegativePrompt: (p) => set({ negativePrompt: p }),
|
||||
setIsUserInputPositive: (v) => set({ isUserInputPositive: v }),
|
||||
setIsUserInputNegative: (v) => set({ isUserInputNegative: v }),
|
||||
setShowNegativePrompt: (v) => set({ showNegativePrompt: v }),
|
||||
resetSceneGenerationMetadata: () =>
|
||||
set({
|
||||
positivePrompt: "",
|
||||
negativePrompt: "",
|
||||
isUserInputPositive: false,
|
||||
isUserInputNegative: false,
|
||||
showNegativePrompt: false,
|
||||
selectedArtStyle: styleList[0].type,
|
||||
upscale: false,
|
||||
faceDetail: false,
|
||||
styleStrength: 0.8,
|
||||
lipSync: false,
|
||||
cinematic: false,
|
||||
enginePreProcessing: false,
|
||||
}),
|
||||
}));
|
||||
-1
@@ -41,7 +41,6 @@ export const ControlsTopButtons = () => {
|
||||
};
|
||||
|
||||
const handleResetScene = () => {
|
||||
usePageSceneStore.getState().resetSceneGenerationMetadata();
|
||||
editorEngine?.changeRenderCameraAspectRatio(
|
||||
CameraAspectRatio.HORIZONTAL_3_2,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { getArtStyle } from "~/enums/ArtStyle";
|
||||
import { SceneGenereationMetaData as SceneGenerationMetaData } from "~/pages/PageScene/models/sceneGenerationMetadata";
|
||||
import Editor from "./editor";
|
||||
import { usePageSceneStore } from "../PageSceneStore";
|
||||
@@ -10,15 +9,6 @@ export const getSceneGenerationMetaData = (
|
||||
const s = usePageSceneStore.getState();
|
||||
return {
|
||||
positivePrompt: editorEngine.positive_prompt,
|
||||
negativePrompt: editorEngine.negative_prompt,
|
||||
artisticStyle: getArtStyle(editorEngine.art_style.toString()),
|
||||
cameraAspectRatio: s.cameraAspectRatio,
|
||||
globalIPAMediaToken: s.globalIPAMediaToken || undefined,
|
||||
upscale: s.upscale,
|
||||
faceDetail: s.faceDetail,
|
||||
styleStrength: s.styleStrength,
|
||||
lipSync: s.lipSync,
|
||||
cinematic: s.cinematic,
|
||||
enginePreProcessing: s.enginePreProcessing,
|
||||
};
|
||||
};
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from "./cameraMath";
|
||||
import { TransformControls } from "./TransformControls.js";
|
||||
import Scene from "./scene.js";
|
||||
import { APIManager, ArtStyle } from "./api_manager.js";
|
||||
import { APIManager } from "./api_manager.js";
|
||||
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
||||
import { RenderPass } from "three/addons/postprocessing/RenderPass.js";
|
||||
import { OutlinePass } from "three/addons/postprocessing/OutlinePass.js";
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
} from "~/signals";
|
||||
|
||||
import { outlinerState, updateObjectPanel } from "../signals";
|
||||
import { IGenerationOptions } from "../models/generationOptions";
|
||||
import { SceneGenereationMetaData } from "../models/sceneGenerationMetadata";
|
||||
import { MediaUploadApi } from "~/Classes/ApiManager";
|
||||
import { SceneManager } from "./scene_manager_api";
|
||||
@@ -137,8 +136,6 @@ class Editor {
|
||||
containerResizeObserver: ResizeObserver | undefined;
|
||||
|
||||
positive_prompt: string;
|
||||
negative_prompt: string;
|
||||
art_style: ArtStyle;
|
||||
rawRenderPass: RenderPass | undefined;
|
||||
generating_preview: boolean = false;
|
||||
|
||||
@@ -158,11 +155,6 @@ class Editor {
|
||||
mouse_controls: MouseControls | undefined;
|
||||
save_manager: SaveManager;
|
||||
|
||||
generation_options: IGenerationOptions;
|
||||
|
||||
// just a passive the image to be uploaded. we store the token and use that in snapshots.
|
||||
globalIpAdapterImage: File | undefined;
|
||||
|
||||
media_upload: MediaUploadApi;
|
||||
|
||||
sceneManager: SceneManager | undefined;
|
||||
@@ -171,7 +163,6 @@ class Editor {
|
||||
///////////////////////////////////////////////
|
||||
|
||||
public outliner_feature_flag: boolean;
|
||||
public engine_preprocessing: boolean = false; // this is to do preprocessing also called render fast.
|
||||
|
||||
///////////////////////////////////////////////
|
||||
///////////////////////////////////////////////
|
||||
@@ -267,23 +258,10 @@ class Editor {
|
||||
this.current_scene_media_token = null;
|
||||
this.current_scene_glb_media_token = null;
|
||||
|
||||
// stylization parameters
|
||||
this.positive_prompt =
|
||||
"((masterpiece, best quality, 8K, detailed)), colorful, epic, fantasy, (fox, red fox:1.2), no humans, 1other, ((koi pond)), outdoors, pond, rocks, stones, koi fish, ((watercolor))), lilypad, fish swimming around.";
|
||||
this.negative_prompt = "";
|
||||
this.art_style = ArtStyle.Anime2DFlat;
|
||||
|
||||
this.generation_options = {
|
||||
faceDetail: false,
|
||||
upscale: false,
|
||||
styleStrength: 1.0,
|
||||
lipSync: false,
|
||||
cinematic: false,
|
||||
globalIpAdapterImageMediaToken: null,
|
||||
};
|
||||
|
||||
this.media_upload = new MediaUploadApi();
|
||||
this.globalIpAdapterImage = undefined; // used to display when loading in the app. and to serialize to an image token
|
||||
// TODO REMOVE
|
||||
this.outliner_feature_flag = true;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ const showEditorLoader = (message?: string) =>
|
||||
const hideEditorLoader = () =>
|
||||
usePageSceneStore.getState().hideEditorLoader();
|
||||
import Editor from "./editor";
|
||||
import { getArtStyle } from "~/enums";
|
||||
import { cameras, selectedCameraId, Camera } from "../signals/camera";
|
||||
|
||||
export type EditorInitializeConfig = {
|
||||
@@ -232,47 +231,11 @@ export class SaveManager {
|
||||
selectedCameraId.value = scene_json.selectedCameraId;
|
||||
}
|
||||
|
||||
// For Remixing Scenes.
|
||||
// this calls the signal function to propagate the data to the UI
|
||||
// Restore scene generation metadata into the Zustand store
|
||||
{
|
||||
const store = usePageSceneStore.getState();
|
||||
if (scene_json.positivePrompt && scene_json.positivePrompt !== "") {
|
||||
store.setPositivePrompt(scene_json.positivePrompt);
|
||||
store.setIsUserInputPositive(true);
|
||||
}
|
||||
if (scene_json.negativePrompt && scene_json.negativePrompt !== "") {
|
||||
store.setNegativePrompt(scene_json.negativePrompt);
|
||||
store.setIsUserInputNegative(true);
|
||||
store.setShowNegativePrompt(true);
|
||||
}
|
||||
if (scene_json.artisticStyle) {
|
||||
store.setSelectedArtStyle(scene_json.artisticStyle);
|
||||
}
|
||||
if (scene_json.upscale) store.setUpscale(scene_json.upscale);
|
||||
if (scene_json.faceDetail) store.setFaceDetail(scene_json.faceDetail);
|
||||
if (scene_json.styleStrength) store.setStyleStrength(scene_json.styleStrength);
|
||||
if (scene_json.lipSync) store.setLipSync(scene_json.lipSync);
|
||||
if (scene_json.cinematic) store.setCinematic(scene_json.cinematic);
|
||||
if (scene_json.enginePreProcessing)
|
||||
store.setEnginePreProcessing(scene_json.enginePreProcessing);
|
||||
}
|
||||
// these propogate the values into the editor
|
||||
if (scene_json.globalIpAdapterImageMediaToken) {
|
||||
// this should be populated right after
|
||||
usePageSceneStore
|
||||
.getState()
|
||||
.setGlobalIPAMediaToken(scene_json.globalIpAdapterImageMediaToken);
|
||||
}
|
||||
// Restore prompt text into the editor (PromptBox3D will pick it up
|
||||
// through the editor's positive_prompt field).
|
||||
if (scene_json.positivePrompt) {
|
||||
this.editor.positive_prompt = scene_json.positivePrompt;
|
||||
}
|
||||
if (scene_json.negativePrompt) {
|
||||
this.editor.negative_prompt = scene_json.negativePrompt;
|
||||
}
|
||||
if (scene_json.artisticStyle) {
|
||||
this.editor.art_style = getArtStyle(scene_json["artisticStyle"]);
|
||||
}
|
||||
if (scene_json.cameraAspectRatio) {
|
||||
//editor propagation
|
||||
this.editor.changeRenderCameraAspectRatio(scene_json.cameraAspectRatio);
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
import { ArtStyle } from "~/enums";
|
||||
import { CameraAspectRatio } from "../enums";
|
||||
|
||||
export interface SceneGenereationMetaData {
|
||||
artisticStyle: ArtStyle;
|
||||
positivePrompt: string;
|
||||
negativePrompt: string;
|
||||
|
||||
cameraAspectRatio: CameraAspectRatio;
|
||||
globalIPAMediaToken: string | undefined;
|
||||
|
||||
upscale: boolean;
|
||||
faceDetail: boolean;
|
||||
styleStrength: number;
|
||||
lipSync: boolean;
|
||||
cinematic: boolean;
|
||||
|
||||
enginePreProcessing: boolean;
|
||||
}
|
||||
Reference in new issue
Block a user