-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from danyyil-pelekhatyi/charater-save-load-42
Merged. Added Local Save for VRM on Character Model Settings.
- Loading branch information
Showing
19 changed files
with
419 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,66 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
import { clsx } from "clsx"; | ||
import { BasicPage } from "./common"; | ||
import { vrmList } from '@/paths'; | ||
import { thumbPrefix } from './common'; | ||
import { updateConfig } from "@/utils/config"; | ||
import { TextButton } from "@/components/textButton"; | ||
import { VrmData } from '@/features/vrmStore/vrmData'; | ||
|
||
export function CharacterModelPage({ | ||
viewer, | ||
vrmUrl, | ||
setVrmUrl, | ||
vrmHash, | ||
vrmList, | ||
setVrmHash, | ||
setSettingsUpdated, | ||
handleClickOpenVrmFile, | ||
}: { | ||
viewer: any; // TODO | ||
vrmUrl: string; | ||
setVrmUrl: (url: string) => void; | ||
vrmHash: string; | ||
vrmList: VrmData[], | ||
setVrmHash: (hash: string) => void; | ||
setSettingsUpdated: (updated: boolean) => void; | ||
handleClickOpenVrmFile: () => void; | ||
}) { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<BasicPage | ||
|
||
<BasicPage | ||
title={t("Character Model")} | ||
description={t("character_desc", "Select the Character to play")} | ||
> | ||
<div className="rounded-lg shadow-lg bg-white flex flex-wrap justify-center space-x-4 space-y-4 p-4"> | ||
{ vrmList.map((url) => | ||
<button | ||
key={url} | ||
onClick={() => { | ||
viewer.loadVrm(url); | ||
updateConfig("vrm_url", url); | ||
setVrmUrl(url); | ||
setSettingsUpdated(true); | ||
}} | ||
className={clsx( | ||
"mx-4 py-2 rounded-4 transition-all bg-gray-100 hover:bg-white active:bg-gray-100 rounded-xl", | ||
vrmUrl === url ? "opacity-100 shadow-md" : "opacity-60 hover:opacity-100" | ||
)} | ||
> | ||
<img | ||
src={`${thumbPrefix(url)}.jpg`} | ||
alt={url} | ||
width="160" | ||
height="93" | ||
className="m-0 rounded mx-4 pt-0 pb-0 pl-0 pr-0 shadow-sm shadow-black hover:shadow-md hover:shadow-black rounded-4 transition-all bg-gray-100 hover:bg-white active:bg-gray-100" | ||
/> | ||
</button> | ||
)} | ||
</div> | ||
<TextButton | ||
className="rounded-t-none text-lg ml-4 px-8 shadow-lg bg-secondary hover:bg-secondary-hover active:bg-secondary-active" | ||
onClick={handleClickOpenVrmFile} | ||
> | ||
{t("Load VRM")} | ||
</TextButton> | ||
</BasicPage> | ||
<div className="rounded-lg shadow-lg bg-white flex flex-wrap justify-center space-x-4 space-y-4 p-4"> | ||
{ vrmList.map((vrm) => | ||
<button | ||
key={vrm.url} | ||
onClick={() => { | ||
viewer.loadVrm(vrm.url); | ||
updateConfig("vrm_hash", vrm.getHash()); | ||
setVrmHash(vrm.getHash()); | ||
setSettingsUpdated(true); | ||
}} | ||
className={clsx( | ||
"mx-4 py-2 rounded-4 transition-all bg-gray-100 hover:bg-white active:bg-gray-100 rounded-xl", | ||
vrm.url === vrmHash ? "opacity-100 shadow-md" : "opacity-60 hover:opacity-100" | ||
)} | ||
> | ||
<img | ||
src={vrm.thumbUrl} | ||
alt={vrm.url} | ||
width="160" | ||
height="93" | ||
className="m-0 rounded mx-4 pt-0 pb-0 pl-0 pr-0 shadow-sm shadow-black hover:shadow-md hover:shadow-black rounded-4 transition-all bg-gray-100 hover:bg-white active:bg-gray-100" | ||
/> | ||
</button> | ||
)} | ||
</div> | ||
<TextButton | ||
className="rounded-t-none text-lg ml-4 px-8 shadow-lg bg-secondary hover:bg-secondary-hover active:bg-secondary-active" | ||
onClick={handleClickOpenVrmFile} | ||
> | ||
{t("Load VRM")} | ||
</TextButton> | ||
</BasicPage> | ||
|
||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.