godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.14k stars 21.17k forks source link

AnimationNodeTransition gives no error message when you give it a String instead of an int #69570

Closed eh-jogos closed 1 year ago

eh-jogos commented 1 year ago

Godot version

4.0 beta7

System information

Manjaro Linux using i3, Vulkan

Issue description

This cropped up while I was doing an MRP for another bug, about methods at the last frame of animations not being called depending on the animation duration, when using AnimationTree with AnimationNodeStateMachine. (https://github.com/godotengine/godot/issues/64644)

@TokageItLab asked if I could test using AnimationTree but not the StateMachine node, and I tried it both with AnimationNodeOneShot and AnimationNodeTransition, but I couldn't make the AnimationNodeTransition work at all.

The problem was that I had renamed my "states" in the AnimationNodeTransition and I was seeing a nice, human readable list both on the AnimationTree editor as well as in the inspector: image image

And so I was trying to set _anim_tree["parameters/Transition/current"] to a string. When That didn't work I though "Oh silly me, we have StringName now!" and tried that as well, with no success. This also didn't print any errors, it just didn't work. Later @TokageItLab helped me out explaining I should be using int instead and suggested I open an usability issue for it, which I'm finally doing.

Going a bit more on my process thought before Tokage helped me out, I guess I did miss out that the actual properties in the AnimationNodeTransition inspector had their indexes out there: image

But what I actually searched for was some kind of documentation, and there was no tooltip for the property on the AnimationTree (not sure it is possible to add tooltips on those) for me to see the expected type: image

And no hints to how to use it on AnimationNodeTransition Doc page image

And neither in the linked tutorial for AnimationTree that is referencered in that page, which in regards to this Transition Node is just a couple of sentences and basically the same thing you can read in the AnimationNodeTransition Doc page, there is no example and no mention that you should actually look for the current property added to the AnimationTree.

image

I think updating the Docs would probably be enough to solve this, but maybe these would also help:

I think any of the above would have naturally steered me in the right direction, adding the error being the easiest one probably? I didn't know if this should be reported as a bug or a proposal as it feels more like an enhancement request rather then a bug, so I ended up writing it here.

Steps to reproduce

Just create a new scene with one AnimationPlayer with any animation, one AnimationTree, and create an AnimationNodeTransition in it. Add your animation to it and try to set the current property in the AnimationTree through code, but try giving it the name "state 0" (or whatever you've renamed it to) instead of the int 0.

It will not work but also not give any error

Minimal reproduction project

N/A

anvilfolk commented 1 year ago

Could you double check with beta 9? The other issue that seemed similar to this one appears to have been fixed :)

eh-jogos commented 1 year ago

@anvilfolk I'm very sorry, I've only seen your comment today, must have let the email notification slip past me.

Just tested it with beta12, still silent error when executing, it accepts the string value and even prints it, which is the first part of the print bellow, where I hardcoded every transition to the string "reset" and you can see it on every other print line: image

The bottom part of the print is an error line that appears on the editor whenever I try to assign a string to the AnimationNodeTransition current property: image

I guess it's not silent anymore but it's also not very readable? I mean, I know what I'm doing purposefully wrong here and still can't understand anything of what this error message is trying to tell me. It also doesn't point to any line on my script but to a cpp error, so unless I have the Output panel open while typing and see it appear there at the moment I type, I'll never know what line on my code triggered it.

So I don't know, doesn't seem like its fixed yet.

TokageItLab commented 1 year ago

See also #71418

eh-jogos commented 1 year ago

@TokageItLab

See also #71418

Is there an easy way to download artifacts generated by the PR? I'm cloning it now to build it and test, but was wondering if there was an easier way?

TokageItLab commented 1 year ago

Unfortunately, I know of few such way. A large organization may have pre-built custom Godot to share with their own group, but basically you have to clone and build it.

eh-jogos commented 1 year ago

No problem! It's at 90% of the build process now!

akien-mga commented 1 year ago

You can download CI artifacts: https://docs.godotengine.org/en/stable/community/contributing/testing_pull_requests.html

eh-jogos commented 1 year ago

You can download CI artifacts: https://docs.godotengine.org/en/stable/community/contributing/testing_pull_requests.html

Oooh! Thats awesome, thanks!

eh-jogos commented 1 year ago

@TokageItLab Just finished updating the script and testing it with #71418 and I have good news and weird news.

About having an useful error msg, it's a success I think! The error message I got was (because I made a typo on purpose to test it): image

Still doesn't point to the gdscript file, but it is much more readable and with the new properties for AnimationNodeTransition I think it's easier to not make mistakes or understand this error message in context.

But, whenever I select the AnimationPlayer Node in the Scene tab, it crashes with this error:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.custom_build (9685429dced6279eeb368369a0f1bf3359f9d6ba)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x38a00) [0x7f08de1a3a00] (??:0)
[2] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x4aeae44) [0x5627447d3e44] (??:0)
[3] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x26c9449) [0x5627423b2449] (??:0)
[4] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x4acc9c4) [0x5627447b59c4] (??:0)
[5] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x2b6bc17) [0x562742854c17] (??:0)
[6] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x4ac8779) [0x5627447b1779] (??:0)
[7] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x4ac8abc) [0x5627447b1abc] (??:0)
[8] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0x2c06ebf) [0x5627428efebf] (??:0)
[9] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0xb08ac4) [0x5627407f1ac4] (??:0)
[10] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0xab0a51) [0x562740799a51] (??:0)
[11] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0xaa2ea9) [0x56274078bea9] (??:0)
[12] /usr/lib/libc.so.6(+0x23290) [0x7f08de18e290] (??:0)
[13] /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7f08de18e34a] (??:0)
[14] /mnt/WORK_SSD/Godot/source_togake/bin/godot.linuxbsd.editor.x86_64(+0xaaed45) [0x562740797d45] (??:0)
-- END OF BACKTRACE --
================================================================

The above is when I test with the version I compiled from source, with the version I downloaded from here: https://nightly.link/TokageItLab/godot/workflows/linux_builds/restart-anim-tree everything is the same except it crashes silently when I select the AnimationPlayer node.

I've updated the repository I was using for the method tracks MRP: https://github.com/eh-jogos/godot4_method_track_bugs

@akien-mga I am signed in to github but I could not see the artifacts button as described in the documentation page image

I was only able to download the artifact using the nightly.link method described in the documentation. I don't know maybe something changed in github or having a github account is not enough and I have to be a contributor to see the link?

Also, should I report any of these two problems (the crash, the difference with the documentation) in separate issues?

TokageItLab commented 1 year ago

@eh-jogos Probably that crash is caused by https://github.com/godotengine/godot/pull/69357. See https://github.com/godotengine/godot/issues/69848#issuecomment-1345247960.

akien-mga commented 1 year ago

I am signed in to github but I could not see the artifacts button as described in the documentation page

Yeah it seems like the UI changed. Now you need to click on the "Linux builds" section in the left panel, and then scroll all the way down: https://github.com/godotengine/godot/actions/runs/3923404706

image

I'll open an issue about it on the docs. Edit: Done https://github.com/godotengine/godot-docs/issues/6625

eh-jogos commented 1 year ago

I am signed in to github but I could not see the artifacts button as described in the documentation page

Yeah it seems like the UI changed. Now you need to click on the "Linux builds" section in the left panel, and then scroll all the way down:

oh wow, should have scrolled just a bit more! Thanks!

eh-jogos commented 1 year ago

@eh-jogos Probably that crash is caused by #69357. See #69848 (comment).

@TokageItLab You're right! I fixed that in december in the main project I'm working on and completely forgot to do that in this MRP when I was updating it today! Testing it again after fixing the tracks and it worked fine!