Giter Site home page Giter Site logo

custom-token-animations's People

Contributors

kandashi avatar ms-pbs avatar p4535992 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

custom-token-animations's Issues

Tokens with Represented Actor set to None

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)

Animation shows off center when scale > 1

Describe the bug
When creating an animation, it rotates off center if the scale is > 1.

To Reproduce
Steps to reproduce the behavior:

  1. Click "Add Animation" button on the Foundry UI
  2. Click on "Add New" (or "Update" to change parameters of an existing)
  3. Set as follows:
    Scale: 2
    Speed of Rotation: 10
    Radius of Rotation: 0
    Copies: 1
    X Scale: 0.5
    Y Scale: 0.5
  4. Click "Create"

Expected behavior
Animation should rotate around the token with the center of the animation centered on the token.

Screenshots
Settings:
image
Expected position:
image
Actual Position:
image

Environment:

  • Windows 10
  • Browser Chrome 97.0.4692.71
  • Foundry Version 9.242
  • Module Version 0.2.7
  • All Modules Disabled: Yes
  • Module List if no:

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.

Crash during Automated Animations

Not sure if this can happen without Automated Animations, but it looks like this line is crashes when the flag isn't set:

let tokenFlags = Array.from(token.data.flags["Custom-Token-Animations"]?.anim) || []

Looks like it and the next line should put the "|| []" inside the .from() call:

Array.from(token.data.flags["Custom-Token-Animations"]?.anim || [])

Error hen generating a macro.

When i try to use generated Macro made by CTA i receive this error
image

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:

  • OS: windows 10
  • Browser chrome, Brave
  • Foundry Version v9
  • Module Version idk but sure is the last
  • All Modules Disabled: Yes

Apply as Equipment seems to have stopped working with Foundry 0.8.x

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.

[Bug] Error "Cannot set property 'rotation' of null" when changing scenes

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.

BUG: Render Underneath Token does not work

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.

v11 - Compatibility warnings

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

Feature Request: Allow players access to this module

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.

https://gyazo.com/b0df2e64134219cc5bdaea00f3e66abc

removeAnimByName and hasAnim give "token.getFlag is not a function" errors

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).

  1. Add an animation to a token using the built-in CTA Animation Picker GUI (I picked, from the Core Data for easy replication, icons\anvil.png).
  2. Use the CTA Animation Picker GUI to replicate to Macro.
  3. Run the Macro, then hit F12 to bring up the console.
  4. See error

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.

Screenshots
image

Environment:

  • OS: Windows 11
  • Browser: Foundry VTT built-in Electron
  • Foundry Version 9 build 238
  • Module Version 0.2.7, with socketlib 1.0.9
  • All Modules Disabled: Yes, except for CTA and socketlib
  • Module List if no:
  • System: Pathfinder 2nd Edition 3.0.1.9499

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)

token.getFlag needs to be changed to token.document.getFlag

let flags = tokenInstance.getFlag("Custom-Token-Animations", "anim") ? tokenInstance.getFlag("Custom-Token-Animations", "anim") : []

let anims = token.getFlag("Custom-Token-Animations", "anim")

let tokenFlags = Array.from(token.getFlag("Custom-Token-Animations", "anim") || [])

Update doesn't recall prior setting of "Number of Copies"

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.

Error Applying Animations to Token via Macro Calls

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.

change independant x,y to x/y to accomadate european users

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!

Image changes size if used on another token of different size

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.
image
image

Adding two animations at once results in error at time of remove (addAnimation is not async)

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);
}

BUG: Issue with MidiQOL/Automated Animations when requiring a Saving Throw.

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.

Fade out an effect

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.

Render Under Token not working

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

Feature Request: Permissive Override Bug: Removing Effect for Connected Clients

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?

[Bug] Fade Animations on Remove setting ignored

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.