Skip to content

Commit

Permalink
set name to download model
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Nov 2, 2023
1 parent 10f65ff commit 8fd8045
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/Optimizer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import FileDropComponent from "../components/FileDropComponent"
import { getFileNameWithoutExtension } from "../library/utils"
import { loadVRM, addVRMToScene } from "../library/load-utils"
import { downloadVRM } from "../library/download-utils"
import { getFileNameWithoutExtension } from "../library/utils"

function Optimizer({
animationManager,
Expand All @@ -20,6 +21,7 @@ function Optimizer({
} = React.useContext(SceneContext)

const [currentVRM, setCurrentVRM] = useState(null);
const [nameVRM, setNameVRM] = useState("");

const { playSound } = React.useContext(SoundContext)
const { isMute } = React.useContext(AudioContext)
Expand All @@ -33,7 +35,7 @@ function Optimizer({
console.log("merge and download logic");
console.log(currentVRM);
const vrmData = currentVRM.userData.vrm
downloadVRM(model, vrmData,"test",null,4096,1,true, null, true)
downloadVRM(model, vrmData,nameVRM,null,4096,1,true, null, true)
}

// const debugMode = () =>{
Expand All @@ -46,14 +48,18 @@ function Optimizer({
const handleAnimationDrop = async (file) => {
const animName = getFileNameWithoutExtension(file.name);
const path = URL.createObjectURL(file);

await animationManager.loadAnimation(path, true, "", animName);
}

const handleVRMDrop = async (file) =>{
const path = URL.createObjectURL(file);
const vrm = await loadVRM(path);
const name = getFileNameWithoutExtension(file.name);

setNameVRM(name);
setCurrentVRM(vrm);
console.log(vrm);


addVRMToScene(vrm, model)
//setUploadVRMURL(path);
Expand Down

0 comments on commit 8fd8045

Please sign in to comment.