mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
fix bug with studio + glb files
This commit is contained in:
1 parent
3a1e4dbc31
commit
8620615ef2
1 file changed
+17
-4
+17
-4
@@ -6,6 +6,7 @@ import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle";
|
||||
import { useParams } from "react-router-dom";
|
||||
import Scene3D from "components/common/Scene3D/Scene3D";
|
||||
import { EngineMode } from "components/common/Scene3D/EngineMode";
|
||||
import { SplitFirstPeriod } from "utils/SplitFirstPeriod";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -13,7 +14,12 @@ interface Props {
|
||||
}
|
||||
|
||||
function StorytellerStudioListPage(props: Props) {
|
||||
const { mediaToken } = useParams<{ mediaToken: string }>();
|
||||
// NB: The URL parameter might be a raw media token (for .scn.ron files), or it might
|
||||
// have an appended suffix to assist the engine in loading the correct scene format.
|
||||
// For example, this is a valid "mediaTokenSpec": `m_zk0qkm1tgsdbh6e3c9kedy34vaympd.glb`
|
||||
const { mediaToken : mediaTokenSpec } = useParams<{ mediaToken: string }>();
|
||||
|
||||
const { base: mediaToken, maybeRemainder: maybeExtension } = SplitFirstPeriod(mediaTokenSpec);
|
||||
|
||||
usePrefixedDocumentTitle("Storyteller Studio");
|
||||
|
||||
@@ -23,13 +29,20 @@ function StorytellerStudioListPage(props: Props) {
|
||||
|
||||
let assetDescriptor;
|
||||
|
||||
if (mediaToken) {
|
||||
// We should prefer to start the onboarding flow with an existing scene, but if
|
||||
// one is unavailable, we should show the sample room.
|
||||
if (maybeExtension !== undefined) {
|
||||
assetDescriptor = {
|
||||
storytellerSceneMediaFileToken: mediaToken
|
||||
sceneImportToken: mediaToken,
|
||||
extension: maybeExtension,
|
||||
};
|
||||
} else if (mediaToken) {
|
||||
assetDescriptor = {
|
||||
storytellerSceneMediaFileToken: mediaToken,
|
||||
};
|
||||
} else {
|
||||
assetDescriptor = {
|
||||
objectId: "sample-room.gltf"
|
||||
objectId: "sample-room.gltf",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user