diff --git a/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx b/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx index eb867d4d35..f18bfd305a 100644 --- a/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx +++ b/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx @@ -34,7 +34,9 @@ export const ControlPanelSceneObject = () => { const currentSceneObject = appUiState.controlPanel.currentSceneObject; useEffect(()=>{ + // TODO this causes a subtle bug because it renders way too many times. const vectors = appUiState.controlPanel.currentSceneObject.objectVectors + editorEngine?.setSelectedObject(vectors.position, vectors.rotation, vectors.scale) }, [appUiState.controlPanel.currentSceneObject]); diff --git a/app/pages/PageEnigma/js/editor.ts b/app/pages/PageEnigma/js/editor.ts index f5dd7d3b65..e3651cd5b8 100644 --- a/app/pages/PageEnigma/js/editor.ts +++ b/app/pages/PageEnigma/js/editor.ts @@ -24,7 +24,7 @@ import { PointerLockControls } from "three/addons/controls/PointerLockControls.j import { APPUI_ACTION_TYPES } from "../reducers"; import { ClipGroup } from "~/pages/PageEnigma/models/track"; -import { XYZ } from "../../datastructures/common"; +import { XYZ } from "../datastructures/common"; class EditorState { // { // action: "ShowLoadingIndicator" @@ -443,8 +443,8 @@ class Editor { // TO UPDATE selected objects in the scene might want to add to the scene ... async setSelectedObject(position:XYZ,rotation:XYZ,scale:XYZ) { - if (this.selected !=null) { - + if (this.selected !=undefined || this.selected !=null) { + //console.log(`triggering setSelectedObject`) this.selected.position.x = position.x this.selected.position.y = position.y this.selected.position.z = position.z @@ -652,10 +652,15 @@ class Editor { // note the database from the server is the source of truth for all the data. // Test code here const object: THREE.Object3D = await this.activeScene.load_glb( - "m_9f3d3z94kk6m25zywyz6an3p43fjtw", + "m_r7w1tmkx2jg8nznr3hyzj4k6zhfh7d", ); + object.uuid = "CH1"; + // Stick Open Pose Man: m_9f3d3z94kk6m25zywyz6an3p43fjtw + // XBot: m_r7w1tmkx2jg8nznr3hyzj4k6zhfh7d + // YBot: m_9sqg0evpr23587jnr8z3zsvav1x077 + // Load timeline creates the the clips from the datastructure and loads them in here. // load object into the engine for lip syncing //this.lipsync_engine.load_object( @@ -1030,7 +1035,8 @@ class Editor { document.body.removeChild(downloadLink); const data = await this.api_manager.uploadMedia(blob, "render.mp4"); - // Create a link to download the file + // Create a link to download the file stylize video using api .. + //{"success":true,"upload_token":"mu_x9kr5cfafn512pjbygdszvbdpktrr"} payload } @@ -1101,15 +1107,16 @@ class Editor { } } + // This initializes the generation of a video render scene is where the core work happens generateVideo() { console.log("Generating video..."); if (this.rendering) { return; } + this.rendering = true; // has to go first to debounce this.startPlayback(); this.frame_buffer = []; this.render_timer = 0; - this.rendering = true; this.activeScene.renderMode(this.rendering); if (this.activeScene.hot_items) { this.activeScene.hot_items.forEach((element) => { @@ -1146,7 +1153,7 @@ class Editor { this.activeScene.scene.add(this.control); } - // Render the scene to the camera. + // Render the scene to the camera, this is called in the update. renderScene() { if (this.composer != null && !this.rendering && this.rawRenderer) { this.composer.render();