kandashi / custom-token-animations Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Clicking on a scene where there's at least one token with "Represented Actor" set to "None" CTA throws:
foundry.js:2499 TypeError: Cannot read property 'data' of null
at Function.AddTweens (CTA.js:166)
at CTA.js:127
at Hooks._call#hook=canvasPan (libWrapper-errors.js:190)
at Function._call (foundry.js:2496)
at C.๐call_wrapped [as call_wrapped] (libWrapper-wrapper.js:441)
at Function.๐Hooks._call#lib-wrapper (libWrapper-errors.js:205)
at Function.๐Hooks._call#0 (libWrapper-wrapper.js:142)
at Function.callAll (foundry.js:2456)
at Canvas.pan (foundry.js:10439)
at Canvas._initializeCanvasPosition (foundry.js:10314)
Describe the bug
When creating an animation, it rotates off center if the scale is > 1.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Animation should rotate around the token with the center of the animation centered on the token.
Screenshots
Settings:
Expected position:
Actual Position:
Environment:
Additional context
I ran the debugger in the Chrome console and checked the code in the RenderAnim function. I think the textureSize variable should be multiplied by the scale variable. Caveat: I'm not primarily a Javascript developer, so please take that with a grain of salt. If I alter the value manually when debugging it works, but I don't know what side effects it could have.
Not sure if this can happen without Automated Animations, but it looks like this line is crashes when the flag isn't set:
Custom-Token-Animations/src/CTA.js
Line 290 in 21dad7c
Looks like it and the next line should put the "|| []
" inside the .from()
call:
Array.from(token.data.flags["Custom-Token-Animations"]?.anim || [])
Would be great to have some documentation on how you recommend setting up AA and CTA to work together
When i try to use generated Macro made by CTA i receive this error
Make your normal configurations
Save to macro.
Try to use this macro in the same token or another token
Expected behavior
A clear and concise description of what you expected to happen.
Environment:
Even when it's not flagged as such, probably no check to force it above, I'd guess it's racing somehow when drawing a new token.
https://www.screencast.com/t/nqYvAXhmL
Since updating to Foundry 0.8.x, the "apply as equipment" option seems to not render any visible overlay at all.
Verified currently with Foundry 0.8.7, Pathfinder 2 as the system (currently 2.4.0), and only Custom Token Animations 0.2.51 and socketlib 1.0.7 loaded.
Additionally, and perhaps related, in Foundry 0.7.x, deleting an equipment effect didn't seem to work properly. The effect would still be visible unless the token was re-rendered through something like a canvas re-render (switching maps or calling a console command, for instance). My workaround at the time was to apply the token's image as an equipment on itself, then remove it, allowing it to look normal even without a full rerender. I took that approach due to a different bug in non-equipment effects.
This error is tossed into the console at alarming speeds when you switch a scene and come back while an animation with rotation is playing.
When I added the animation, the settings I used were CTA.addAnimation(token, textureData, true, "anim name", null);
with this texture data:
(file path omitted cuz it doesn't seem relevant in my testing)
let textureData = {
texturePath: "textureGoesHere.png",
scale: "0.33",
speed: 2,
multiple: 3,
rotation: "rotation",
xScale: 0.5,
yScale: 0.5,
belowToken: false,
radius: 0.5,
opacity: 1,
tint: 16777215,
equip: false
}
Switching scenes away and back causes the animation in question to freeze as well.
EDIT: Okay after much experimentation, I've discovered that checking "Render Underneath Token" is permanently broken if you ever also apply "Permanent on Actor" and "Apply as Equipment" at the same time. Render Underneath Token only works if you never apply those other two.
Foundry v11.304
The module "Custom-Token-Animations" contains dependencies using "name" which is deprecated in favor of "id"
The module "Custom-Token-Animations" contains "dependencies" which is deprecated in favor of "relationships.requires"
The module "Custom-Token-Animations" is using the old flat core compatibility fields which are deprecated in favor of the new "compatibility" object
Greetings! First off what a fantastic module. I have been waiting for something like this for awhile, other modules touch on some of this modules abilities but no where near as good. As the title suggestions, I don't always have time to set up everyone's potential auras they might want. I have a player who has a lot of tokens they can summon, shape shifts etc being a Druid and would love to allow players the opportunity to use this module. I love how FX module has integrated this into the Permission Configuration(see screenshot below) and allowing certain players to have this permission, this would be perfect to allow some but not all players the ability to use this module.
Describe the bug
A macro that calls for removing an animation by name using the CTA.removeAnimByName function or checks via the "hasAnim" function will generate an uncaught error in a promise with the text "token.getFlag is not a function."
To Reproduce
Steps to reproduce the behavior:
0. Create a new world (I'm using the PF2e system) and activate the Custom Token Animation module (and its prerequisite).
Expected behavior
The functions should return whether a token has the animation (or not) or remove the named animation, respectively, and not generate an error in the console.
Environment:
Additional context
Removing the animations through the CTA picker works fine.
To replicate. I used this generated macro where I was testing with a file in the Foundry system path.
let textureData = {
texturePath: "icons/anvil.png",
scale: "1",
speed: 0,
multiple: 1,
rotation: "static",
xScale: 0.5,
yScale: 0.5,
belowToken: false,
radius: 2,
opacity: 1,
tint: 16777215,
equip: false,
lock : false
}
if(CTA.hasAnim(token, "testanvil")){
CTA.removeAnimByName(token, "testanvil", false, true)
}
else {
CTA.addAnimation(token, textureData, false, "testanvil", null)
}
Just running the remove animation function by itself also errors out.
CTA.removeAnimByName(token, "testanvil", false, true)
when replicating to macro, splitting the scale produces the following:
scale: x,y,
should stringify those values and produce:
scale:"x,y",
so that the macro runs out of the box rather than throwing an error.
As per title, if the image of an existing token on canvas is changed, the animations are not re-drawn.
Hi.
Please remove the foundry vtt warning.
Replace "compatibleCoreVersion":"0.9.0" by "compatibleCoreVersion":"9".
Docs: https://gitlab.com/foundrynet/foundryvtt/-/issues/5635
Custom-Token-Animations/src/CTA.js
Line 148 in 35b567c
Custom-Token-Animations/src/CTA.js
Line 192 in 35b567c
Custom-Token-Animations/src/CTA.js
Line 276 in 35b567c
FVTT 0.7.9
DND5E 1.2.4
CTA 0.1.04
When Updating a pre-existing CTA configuration, the data form doesn't populate the Number of Copies field with the previously configured value, so an effect initially created with multiple copies (like a rotating Ioun Stone halo with multiple instances of the stone graphic) has to have the # of copies manually re-specified during the editing process.
There seems to be a syntax error preventing the module from functioning. I have done a home brew fix by changing lines (adding an extra set of () )
245 let tokenFlags = Array.from((token.data.flags["Custom-Token-Animations"]?.anim) || [])
246 let actorFlags = Array.from((token.actor.data.token.flags["Custom-Token-Animations"]?.anim) || [])
290 let tokenFlags = Array.from((token.data.flags["Custom-Token-Animations"]?.anim) || [])
291 let actorFlags = Array.from((token.actor.data.token.flags["Custom-Token-Animations"]?.anim) || [])
I think its an issue with the Optional Chaining (I only just learnt this term!) with Array.from function trying to iterate an "undefined" in my case.
I guess there is going to be an issue with the line 273 syntax but I have not tested it.
Ignore me if this is incorrect as I don't really know much about coding.
one of your input fields in the "Pick Animation Effects" of CTA behaves differently then the rest, resulting in some headaches for non americans/ok/austrialian people
the scale entry only works if I input decimals with a . seperator
the others take both, and even convert a . into a , when reopening it
Kandashi (He/Him) โ Today at 14:41
yeah, otherwise it will interpret it as a split x/y scale
Tupsi โ Today at 14:42
oh you mean I could scale differntly x and y size?
ah cool
just tried 1,5 and see it now
my problem was i only wanted to downscale the image, so always tried something with a zero at x
resulting always in no image at all (of course)
Kandashi (He/Him) โ Today at 14:43
yeah yeah, i see the issue
Tupsi โ Today at 14:43
makes sense, now, so thanks for clarifying that
Kandashi (He/Him) โ Today at 14:43
maybe I can use a / instead of a ,
Tupsi โ Today at 14:44
that woud seems more logical, at least to me.
or just add it to the note, that you can enter x,y
Kandashi (He/Him) โ Today at 14:44
its on the github but not the prompt
Tupsi โ Today at 14:44
but for germans 0.5/0.7 makes more sense then 0.5,0.7
Kandashi (He/Him) โ Today at 14:45
yup yup
ill do that in the next release
Tupsi โ Today at 14:45
thank you!
I'm attempting to apply an overlay on tokens (a frame that indicates how dangerous the monster is). If I apply the same image to another token that is a different size, the existing image(s) on the previous token(s) will change sizes to match (larger or smaller, depending on the relative size of the most recent token to get the image). Naming the effect a different name doesn't change the outcome as long as it's the same image. This doesn't happen if it is applied as equipment, but that doesn't appear to currently work in Foundy 0.8.x. It also happens if I'm applying via the API using a macro or configuring it through the GUI options.
Verified currently with Foundry 0.8.7, Pathfinder 2 as the system (currently 2.4.0), and only Custom Token Animations 0.2.51 and socketlib 1.0.7 loaded. Had the issue with earlier versions in Foundry 0.7.x, but the equipment option was my workaround
In the below images, the claw overlay was applied to three tokens of different sizes, set as a static image with a scale of 1 (and different animation effect names for all 3). In the first image, the largest token was the most recently applied. In the second image, I opened the existing effect on the smallest token using the "update" button, hit "create" to save without making any changes, and slightly panned the canvas to trigger the updated render.
Default settings were used, effects don't appear to properly position themselves onto the token.
https://streamable.com/bk9nvw
I'm using Custom Token Animations with DAE firing and ItemMacro. I can get the animations on the token great. When the removeAnimByName fires I get an error for id being undefined. I have a console log in the script and have confirmed that a token object is being passed into the functions. Here is what I have for the snippet
if(args[0]==="off"){
console.log(myToken);
await CTA.removeAnimByName(myToken, "extraFire", false, true);
await CTA.removeAnimByName(myToken, "auraFire", false, true);
}
this is what the add function looks like to show that the names match
if(args[0]==="on"){
await CTA.addAnimation(myToken,extraFireData,false,"extraFire", false);
await CTA.addAnimation(myToken,auraData,false,"auraFire", false);
}
I'm using Automated Animations and your module to create Auras that fire off when a Character Feature is being used. When this happens, a popup appears that has a single button on it, which says: "Remove CTA Effect." This works flawlessly except in the situation where the Feature you're using requires a Saving Throw. If that's the case, and you're using MidiQOL to automate Saving Throws, the Aura Fires off twice, and can't be removed, and the button window can't even be closed without refreshing Foundry. Disabling MidiQOL seems to fix the problem, as does removing the Saving Throw component of the item.
One of the things I've wanted to do with TMFX is to be able to update an existing animation so that I can remove it but have fade out instead of abruptly kill the effect.
Without having a custom effect, any updates to the token's FX restart the animation so depending on which effect I'm using it's super hard to just fade it out when removing it.
Example use case - add a blood effect but fade out on removal instead of just going abruptly from "bloody" to "normal".
All the above is from the perspective of using TMFX, and I've talked to a lot of people about trying to figure out a good way to accomplish this. I know this isn't supposed to replace TMFX, but if you could include a way to "kill" an animation by fading it out that would be awesome.
Applied a Darkness Effect from JB2A assets, it's a webm file. Set scale to 4 (also tried 6), static image check, radius 1, number of copies 1, position on X scale 0.5, position on y scale 0.5, asset opacity 1, render underneath token: check! (all following options unchecked)
But that's where the problem starts, the webm effect renders above all tokens always. I'd really like it to be below tokens. Attempted toggling render underneath off and on again, no success.
In the native Foundry App. Version 10.291.
Attempted with all other modules disabled (except socketlib)
Using version 0.2.51
Bug: After the latest update, removing effects only occurs for the client that initiates the Effect Deletion, and the effects persist on other connected clients until a refresh.
Feature Request: With the new permissive option, can you create a backdoor in the CTA.addAnimation() call to allow application of CTA effects on un-owned tokens? (re: Hunter's Mark applying the CTA effect on targeted token) Or, perhaps a way to apply the effect as the GM?
When removing an animation, the setting for "fade animations" is ignored.
Regardless if it is checked or not, the animations will always fade over 2 seconds when removed with the dialogue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.