Open GambetTV opened 2 years ago
I may have a conflict with another module, but the HUD is visible and working only when I'm GM. The button to access token selection is not present when I log in as the player/owner.
same here
I tried to make a pull request as the fix is quite trival but was unable.
Line 68 needs to changed to const imageDataTab = html.find('.tab[data-tab="appearance"]')
As that tab was renamed in v9
Line 68 needs to changed to
const imageDataTab = html.find('.tab[data-tab="appearance"]')
As that tab was renamed in v9
I tried that change manually and cleared cache but the GM vs Player views still differ - maybe I've misconfigured something.
I don't even get the Randomize Wildcard Images check box in Foundry v9.
When I try to use the wild card, I get the following error in the console.
@GrumpyVader it looks like some other module is also fiddling with the token config dialog. Try disabling all modules apart from Token HUD Wildcard to see if it works.
It seems that the players need the "Use File Browser" permission in order for the extra button to appear on the token HUD. This is due to a change in core Foundry. I raised a bug report for it here... https://gitlab.com/foundrynet/foundryvtt/-/issues/6575
Updating the code manually to enable the default image options still gives me an issue to where it doesn't respect the selection. It will still be random even with a default set.
@shirkie I noticed that too, it's actually a problem in v0.8 too. I actually have a fix for it, but I'm not at my PC right now to post it.
@cs96and That's great news! I would LOVE to get that from you whenever you have time! Glad i wasn't the only one experiencing it. Thank you in advance.
Here's the fix for the default token. On line 52 of main.js, replace this...
_hookPreTokenCreate () {
Hooks.on('createToken', (parent, options, userId) => {
const defaultValue = parent?.actor?.data?.token?.flags['token-hud-wildcard'] ? parent.actor.data.token.flags['token-hud-wildcard'].default : ''
if (defaultValue !== '' && parent?.actor?.data?.token?.randomImg) {
const dimensions = getTokenDimensions(parent, defaultValue)
let updateInfo = { img: defaultValue, ...dimensions }
parent.object.document.update(updateInfo)
}
})
},
With this...
_hookPreTokenCreate () {
Hooks.on('preCreateToken', (parent, data, options, userId) => {
const defaultValue = parent?.actor?.data?.token?.flags['token-hud-wildcard'] ? parent.actor.data.token.flags['token-hud-wildcard'].default : ''
if (defaultValue !== '' && parent?.actor?.data?.token?.randomImg) {
const dimensions = getTokenDimensions(parent, defaultValue);
let updateInfo = { img: defaultValue , ...dimensions };
mergeObject(data, updateInfo);
parent.data.update(updateInfo);
}
})
},
That works wonderfully! Thank you for posting it!
I'm so sorry, i missed all these notifications.
oh damn that's awesome. Gonna try to include it in a new version soon, I haven't updated to foundry v9
Gonna update foundry today and check the fix during the week to make a new version.
Note there are two separate fixes above. @SirTman's fix is the fix to make it work with v9.
My fix actually fixes #24.
Also, you can improve on @SirTman's fix, to make it compatible with both v0.8 and v9...
const imageDataTab = html.find('.tab[data-tab="appearance"],.tab[data-tab="image"]')
Also, if there's a way to fix the current v9 requirement of having to give players File Browser permissions for them to be able to change their own tokens that would be ideal.
@GambetTV that relies on fixing core foundry... https://gitlab.com/foundrynet/foundryvtt/-/issues/6575
Gonna try to add the fixes during this week, probably before friday. Regarding the issue with file picker, that definitely gonna have to wait unti there is a solution on the core side
Here's the fix for the default token. On line 52 of main.js, replace this...
_hookPreTokenCreate () { Hooks.on('createToken', (parent, options, userId) => { const defaultValue = parent?.actor?.data?.token?.flags['token-hud-wildcard'] ? parent.actor.data.token.flags['token-hud-wildcard'].default : '' if (defaultValue !== '' && parent?.actor?.data?.token?.randomImg) { const dimensions = getTokenDimensions(parent, defaultValue) let updateInfo = { img: defaultValue, ...dimensions } parent.object.document.update(updateInfo) } }) },
With this...
_hookPreTokenCreate () { Hooks.on('preCreateToken', (parent, data, options, userId) => { const defaultValue = parent?.actor?.data?.token?.flags['token-hud-wildcard'] ? parent.actor.data.token.flags['token-hud-wildcard'].default : '' if (defaultValue !== '' && parent?.actor?.data?.token?.randomImg) { const dimensions = getTokenDimensions(parent, defaultValue); let updateInfo = { img: defaultValue , ...dimensions }; mergeObject(data, updateInfo); parent.data.update(updateInfo); } }) },
This fix works perfectly but I can't make the other one actually work. Need to check it a bit more
Oh ok,yeah I get the second fix, I was mixing it up
Hey guys, bit of an update, thanks to @cs96and for reporting the issue on getTokenImages it was added to the dev pipeline and apparently fixed for version 10 prototype 1. So I have high hopes we will recover full functionality of the module
The module works for the most part in v9, but one critical aspect of it is no longer supported, which is you can no longer define a default token image. I suspect this is because of the updates done to the Token Configuration menu, as the layout now is significantly different.