mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
preliminarily, this should work
This commit is contained in:
1 parent
6565dc4cb0
commit
50d7d44f16
3 files changed
+24
-6
No files matched your search
@@ -9,7 +9,7 @@ export const ControlsTopButtons = () => {
|
||||
|
||||
const handleButtonSave = () => {
|
||||
console.log(`SceneName is ${sceneName}`);
|
||||
// editorEngine?.save();
|
||||
editorEngine?.save();
|
||||
};
|
||||
|
||||
const handleButtonCameraView = () => {
|
||||
@@ -24,7 +24,7 @@ export const ControlsTopButtons = () => {
|
||||
};
|
||||
const handleButtonRender = () => {
|
||||
console.log("Saving GLB to server for reference");
|
||||
editorEngine._upload_for_testing();
|
||||
editorEngine?._upload_for_testing();
|
||||
//editorEngine?.togglePlayback();
|
||||
};
|
||||
const handleButtonPlay = () => {};
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { EngineContext } from "./EngineContext";
|
||||
import { ReactNode, useContext, useEffect, useState } from "react";
|
||||
|
||||
import Editor from "~/pages/PageEnigma/js/editor";
|
||||
|
||||
import { EngineContext } from "./EngineContext";
|
||||
import { AppUiContext } from "./AppUiContext";
|
||||
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const EngineProvider = ({ children }: Props) => {
|
||||
const [editor, setEditor] = useState<Editor | null>(null);
|
||||
const [appUiState, dispatchAppUiState] = useContext(AppUiContext);
|
||||
|
||||
useEffect(() => {
|
||||
//componentDidMount
|
||||
@@ -19,7 +24,9 @@ export const EngineProvider = ({ children }: Props) => {
|
||||
);
|
||||
} else {
|
||||
const editor = new Editor();
|
||||
editor.initialize();
|
||||
editor.initialize({
|
||||
dispatchAppUiState
|
||||
});
|
||||
setEditor(editor);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -22,6 +22,7 @@ import { LipSync } from "./lipsync.js";
|
||||
import { LipSyncEngine } from "./lip_sync_engine.ts";
|
||||
import { AnimationEngine } from "./animation_engine.ts";
|
||||
import { faL } from "@fortawesome/pro-solid-svg-icons";
|
||||
import { ACTION_TYPES } from "../reducer/types.js";
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
import("ccapture.js")
|
||||
@@ -117,7 +118,12 @@ class Editor {
|
||||
}
|
||||
|
||||
// Initializes the main scene and ThreeJS essentials.
|
||||
initialize() {
|
||||
/*
|
||||
config :{
|
||||
appUiDispatcher: dispatch function to react app
|
||||
}
|
||||
*/
|
||||
initialize(config) {
|
||||
if (this.can_initailize == false) {
|
||||
return;
|
||||
}
|
||||
@@ -164,6 +170,8 @@ class Editor {
|
||||
|
||||
this.timeline.scene = this.activeScene;
|
||||
|
||||
// setup Callbacks to ReactLand
|
||||
this.appUiDispatcher = config.appUiDispatcher;
|
||||
this._test_demo()
|
||||
}
|
||||
|
||||
@@ -377,6 +385,9 @@ class Editor {
|
||||
//this.audio_engine.playClip("m_f7jnwt3d1ddchatdk5vaqt0n4mb1hg");
|
||||
//console.log(this.selected);
|
||||
|
||||
this.appUiDispatcher({
|
||||
type: ACTION_TYPES.SHOW_EDITOR_LOADER
|
||||
});
|
||||
if (this.selected == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user