diff --git a/src/App.jsx b/src/App.jsx index 3b6142ff..73d5eb3d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -93,9 +93,8 @@ async function fetchAnimation(templateInfo) { // create an animation manager for all the traits that will be loaded const newAnimationManager = new AnimationManager(templateInfo.offset) const animationPaths = getAsArray(templateInfo.animationPath); - newAnimationManager.storeAnimationPaths(animationPaths); - - await newAnimationManager.loadAnimation(animationPaths, animationPaths[0].endsWith('.fbx')) + newAnimationManager.storeAnimationPaths(animationPaths, templateInfo.assetsLocation || ""); + await newAnimationManager.loadAnimation(animationPaths, animationPaths[0].endsWith('.fbx'), templateInfo.assetsLocation || "") return newAnimationManager } diff --git a/src/components/Editor.jsx b/src/components/Editor.jsx index 51bd2158..5acf8ace 100644 --- a/src/components/Editor.jsx +++ b/src/components/Editor.jsx @@ -103,7 +103,7 @@ export default function Editor({confirmDialog,animationManager, blinkManager, lo size={56} resolution={2048} numFrames={128} - icon={templateInfo.traitIconsDirectorySvg + item.iconSvg} + icon={ (templateInfo.assetsLocation || "") + templateInfo.traitIconsDirectorySvg + item.iconSvg} rarity={currentTraitName !== item.name ? "none" : "mythic"} onClick={() => { selectOption(item) diff --git a/src/components/Selector.jsx b/src/components/Selector.jsx index 2d963658..53102f2d 100644 --- a/src/components/Selector.jsx +++ b/src/components/Selector.jsx @@ -342,7 +342,7 @@ export default function Selector({confirmDialog, templateInfo, animationManager, } - const baseDir = useTemplateBaseDirectory ? templateInfo.traitsDirectory : ""; + const baseDir = useTemplateBaseDirectory ? (templateInfo.assetsLocation || "") + templateInfo.traitsDirectory : ""; // load necesary assets for the options options.map((option, index)=>{ if (option.selected){ diff --git a/src/components/TraitInformation.jsx b/src/components/TraitInformation.jsx index 41c73ee1..e8f2c220 100644 --- a/src/components/TraitInformation.jsx +++ b/src/components/TraitInformation.jsx @@ -14,6 +14,7 @@ export default function TraitInformation({currentVRM, animationManager}){ const [cullOutDistance, setCullOutDistance] = useState(0); // set from the values of the trait const [cullInDistance, setCullInDistance] = useState(0); const [cullLayer, setCullLayer] = useState(0); + const [animationName, setAnimationName] = useState(animationManager.getCurrentAnimationName()); useEffect(() => { if (currentVRM != null){ @@ -22,6 +23,11 @@ export default function TraitInformation({currentVRM, animationManager}){ setCullInDistance(currentVRM?.data?.cullingDistance[1]||0); } }, [currentVRM]) + + useEffect(()=>{ + //console.log(animationManager.currentAnimationName); + setAnimationName(animationManager.getCurrentAnimationName()); + },[animationManager.currentAnimationName]) const handleCullOutChange = (event) => { @@ -48,15 +54,13 @@ export default function TraitInformation({currentVRM, animationManager}){ } }; - const nextAnimation = () => { - animationManager.loadNextAnimation(); - console.log(animationManager); - console.log("next") + const nextAnimation = async () => { + await animationManager.loadNextAnimation(); + setAnimationName(animationManager.getCurrentAnimationName()); } - const prevAnimation = () => { - animationManager.loadPreviousAnimation(); - console.log(animationManager); - console.log("prev") + const prevAnimation = async () => { + await animationManager.loadPreviousAnimation(); + setAnimationName(animationManager.getCurrentAnimationName()); } return ( @@ -120,7 +124,7 @@ export default function TraitInformation({currentVRM, animationManager}){ className={styles["traitInfoText"]} onClick={prevAnimation} >1 -