Uploaded GLB yesssss

This commit is contained in:
Michael Chung committed 2024-03-22 17:55:32 -04:00
1 parent df7616a1be
commit 4fc89350e6
4 files changed
+36 -36

No files matched your search

+10 -10
View File
@@ -1,9 +1,9 @@
import { v4 as uuidv4 } from 'uuid';
class MediaUploadManager {
constructor(sessionToken) {
this.baseUrl = "https://api.fakeyou.com";
this.sessionToken = sessionToken;
constructor() {
//this.baseUrl = "https://api.fakeyou.com";
this.baseUrl = "http://localhost:12345"
}
async uploadMedia(blob, fileName) {
@@ -21,7 +21,7 @@ class MediaUploadManager {
method: 'POST',
credentials: "include",
headers: {
"accept": "application/json",
"Accept": "application/json",
},
body: formData,
});
@@ -33,22 +33,22 @@ class MediaUploadManager {
return response.json(); // or handle the response as appropriate
}
async uploadGLB(blob, fileName) {
const url = `${this.baseUrl}/v1/upload/engine_asset`;
async uploadGLB(blob) {
const url = `${this.baseUrl}/v1/media_files/upload/engine_asset`;
let uuid = uuidv4();
const formData = new FormData();
formData.append('uuid_idempotency_token', uuid);
formData.append('file_name', fileName);
formData.append('file_bytes', blob);
formData.append('media_file_subtype', 'sceneimport');
formData.append('file', blob);
formData.append('source','file');
formData.append('media_file_subtype', 'scene_import');
formData.append('media_file_class', 'scene');
const response = await fetch(url, {
method: 'POST',
credentials: "include",
headers: {
"accept": "application/json",
"Accept": "application/json",
},
body: formData,
});
+5 -3
View File
@@ -17,10 +17,12 @@ class SaveManager {
console.log(scene);
let save_json = {"glb": gltf, "audio": audio_manager.clips, "timeline": timeline}
console.log(save_json);
let blob = new Blob([JSON.stringify(gltf)], {type: 'application/json'})
let blobUrl = URL.createObjectURL(blob);
scene_callback(blob);
// TODO: give the file name via a modal.
const file = new File([JSON.stringify(gltf)], "test.glb", {type: 'application/json'});
let blobUrl = URL.createObjectURL(file);
scene_callback(file);
let a = document.createElement('a');
+19 -19
View File
@@ -18,25 +18,25 @@ export default function IdealEnigma(){
return <PageEnigma />
if(submitted){
return <PageEnigma />
}else{
return(
<div className="w-full flex justify-center content-center">
<form
className="mt-20 flex flex-col content-center"
onSubmit={handleSubmit}
>
<label className='text-white'>
Riddle:
</label>
<input type="text" value={riddle} onChange={handleInput} />
<br/>
<Button type="submit" className='text-white'>Submit</Button>
</form>
</div>
// if(submitted){
// return <PageEnigma />
// }else{
// return(
// <div className="w-full flex justify-center content-center">
// <form
// className="mt-20 flex flex-col content-center"
// onSubmit={handleSubmit}
// >
// <label className='text-white'>
// Riddle:
// </label>
// <input type="text" value={riddle} onChange={handleInput} />
// <br/>
// <Button type="submit" className='text-white'>Submit</Button>
// </form>
// </div>
);
}
// );
// }
}
+2 -4
View File
@@ -1,6 +1,4 @@
// Write unsubcribe and run the remainder of the clip tech.
class Clip {
name: string
startOffset: number
@@ -8,7 +6,7 @@ class Clip {
lengthOfClip: number
scrubberEndingPosition: number
constructor(name: string, startOffset: number, lengthOfClip: number,unsubscribe) {
constructor(name: string, startOffset: number, lengthOfClip: number) {
this.startOffset = startOffset
this.lengthOfClip = lengthOfClip
this.name = name
@@ -147,7 +145,7 @@ function CheckIfClipsPlayAllTogether() {
}
CheckIfBasicClipWorks()
// CheckIfTwoClipsAtTheSameTimeWorks()
CheckIfTwoClipsAtTheSameTimeWorks()
// CheckIfTwoClipsOneAfterAnotherWorks()
// CheckIfTimeLineStopBeforeClipPlays()
// CheckIfTimeLineStartAfterClipPlays()