This commit is contained in:
Brandon Thomas committed 2024-03-08 18:00:54 -05:00
1 parent 8129f2e46a
commit 36b0d39cdd
1 file changed
+7 -1
@@ -29,7 +29,7 @@ export default function Scene3D({
const iframeRef = useRef<HTMLIFrameElement>(null);
const onMessage = useCallback((event: MessageEvent) => {
if (event.origin !== engineBaseUrl)
return;
@@ -37,9 +37,13 @@ export default function Scene3D({
console.log("engine message received", event.data, event);
if (event.data === "studio-ready") {
console.log("studio-ready message (1)");
const studio = iframeRef.current?.contentWindow;
if (!studio) return;
console.log("studio-ready message (2)");
studio.postMessage("save-scene", engineBaseUrl);
} else if (
typeof event.data === "string"
@@ -69,6 +73,8 @@ export default function Scene3D({
engineUrl += `&objectId=${objectId}`;
}
console.log('installing iframe engine');
return (
<div
className={`${