Skip to content

Commit

Permalink
validate a trait is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Oct 31, 2023
1 parent c02df68 commit d77fc8b
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions src/components/Selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,30 +175,34 @@ export default function Selector({confirmDialog, uploadVRMURL, templateInfo, ani
},[selectedOptions])

const loadCustom = (url) => {

const option = {
item:{
id:"custom_" + currentTraitName,
name:"Custom " + currentTraitName,
directory:url
},
trait:templateInfo.traits.find((t) => t.name === currentTraitName)
}
effectManager.setTransitionEffect('switch_item');
loadOptions([option], false, false, false).then((loadedData)=>{
URL.revokeObjectURL(url);
let newAvatar = {};
loadedData.map((data)=>{
newAvatar = {...newAvatar, ...itemAssign(data)}
if (currentTraitName){
const option = {
item:{
id:"custom_" + currentTraitName,
name:"Custom " + currentTraitName,
directory:url
},
trait:templateInfo.traits.find((t) => t.name === currentTraitName)
}
effectManager.setTransitionEffect('switch_item');
loadOptions([option], false, false, false).then((loadedData)=>{
URL.revokeObjectURL(url);
let newAvatar = {};
loadedData.map((data)=>{
newAvatar = {...newAvatar, ...itemAssign(data)}
})
const finalAvatar = {...avatar, ...newAvatar}
setTimeout(() => {
if (Object.keys(finalAvatar).length > 0) {
cullHiddenMeshes(finalAvatar)
}
}, effectManager.transitionTime);
setAvatar(finalAvatar)
})
const finalAvatar = {...avatar, ...newAvatar}
setTimeout(() => {
if (Object.keys(finalAvatar).length > 0) {
cullHiddenMeshes(finalAvatar)
}
}, effectManager.transitionTime);
setAvatar(finalAvatar)
})
}
else{
console.log("Please select a trait first");
}
}

const uploadTrait = async() =>{
Expand Down

0 comments on commit d77fc8b

Please sign in to comment.