add SWF to layer assets in Support tools

This commit is contained in:
Emi Matchu 2020-08-01 22:54:30 -07:00
parent d7d7a345a0
commit fce51875d9
3 changed files with 24 additions and 1 deletions

View file

@ -21,7 +21,7 @@ import {
Spinner,
useToast,
} from "@chakra-ui/core";
import { ExternalLinkIcon } from "@chakra-ui/icons";
import { ChevronRightIcon, ExternalLinkIcon } from "@chakra-ui/icons";
import { OutfitLayers } from "../../components/OutfitPreview";
import SpeciesColorPicker from "../../components/SpeciesColorPicker";
@ -166,6 +166,15 @@ function ItemLayerSupportModal({
No PNG
</Button>
)}
<Button
as="a"
size="xs"
target="_blank"
href={itemLayer.swfUrl}
colorScheme="teal"
>
SWF <ExternalLinkIcon ml="1" />
</Button>
</HStack>
</MetadataValue>
</Metadata>

View file

@ -120,6 +120,7 @@ export const itemAppearanceFragment = gql`
id
svgUrl
imageUrl(size: SIZE_600)
swfUrl # HACK: This is for Support tools, but other views don't need it
bodyId
zone {
id

View file

@ -105,6 +105,15 @@ const typeDefs = gql`
"""
svgUrl: String
"""
This layer as a single SWF, if available.
At time of writing, all layers have SWFs. But I've marked this nullable
because I'm not sure this will continue to be true after the HTML5
migration, and I'd like clients to guard against it.
"""
swfUrl: String
"""
This layer can fit on PetAppearances with the same bodyId. "0" is a
special body ID that indicates it fits all PetAppearances.
@ -308,6 +317,10 @@ const resolvers = {
const zone = await zoneLoader.load(layer.zoneId);
return zone;
},
swfUrl: async ({ id }, _, { swfAssetLoader }) => {
const layer = await swfAssetLoader.load(id);
return layer.url;
},
imageUrl: async ({ id }, { size }, { swfAssetLoader }) => {
const layer = await swfAssetLoader.load(id);