Open silvative opened 3 months ago
+1 here. A feature like this would make my life much easier when trying to give art to unlinked/actorless tokens. Right now I have to use the inspector to get the image URL, copy it, and manually edit it to use the right dynamic-token art.
To solve my problem, though, there could be an alternate solution: allow dragging a character art piece onto a token, to update that token's image source (defaulting to dynamic ring if it has ring enabled). if the token has a linked actor, you can continue and ask whether to set that actor's art too or not.
(note: if this feature is added, when the page is in "token mode", make it copy the frameless image rather than the image-with-frame-included!)
If anyone else is impatient like me, here's a macro that copies the currently selected gallery character's art and then sets it in a token. You can edit/shorten the code, if you just want the art to be copied to clipboard or something.
const selectedImgInGallery = $('div.preview.selected figure img')[0]
if (!selectedImgInGallery) return ui.notifications.error("Open the Character Gallery and select a character first")
const localImgThumbnailSrc = selectedImgInGallery.src
const startIdx = localImgThumbnailSrc.indexOf("modules/")
const cleanSrc = localImgThumbnailSrc.substr(startIdx)
const cleanHost = localImgThumbnailSrc.substr(0, startIdx)
const selectedTokens = canvas.tokens.controlled
if (!selectedTokens.length) return ui.notifications.error("Select at least one token!")
const module = game.modules.get("pf2e-tokens-characters")
const sourcesData = module.DATA.SOURCES.flatMap(s => s.data)
const charData = sourcesData.find(dat => dat.art.thumb === cleanSrc)
const artData = charData.art
const newScale = artData.scale ?? 1
const newTexture = cleanHost + artData.subject
const updates = selectedTokens.map(tok => ({
_id: tok.id,
ring: {
enabled: true,
effects: 1 | tok.document.ring.effects,
subject: {
scale: newScale,
texture: newTexture,
},
},
texture: {
scaleY: newScale,
},
}))
await canvas.scene.updateEmbeddedDocuments("Token", updates)
As in, button go here
Click on it to copy the image path so you can place it in a journal or something