Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.5.1] [4.0.rc1] Calling GPUParticles3D.restart() from AnimationPlayer doesn't seem to have an effect on the Editor #73043

Open
hmans opened this issue Feb 10, 2023 · 7 comments

Comments

@hmans
Copy link

hmans commented Feb 10, 2023

Godot version

3.5.1, 4.0.rc1

System information

macOS, Apple M1

Issue description

Resetting a GPU particle effect by invoking its restart() function from an animation call track doesn't seem to work.

In the attached MRP, I have a one-shot GPU particle effect that is supposed to play at the start of my animation. For this, I've set up the animation to do two things:

  • Set emitting to true (this works)
  • Call restart(), in case the effect is still emitting when the animation starts

But the call to restart() doesn't seem to have any effect.

Notes:

  • I observed this in both 3.5.1 and 4.0.rc1. The attached MRP uses Godot 3.5.1.
  • It doesn't matter where on the animation timeline I call restart(), it never does anything.
  • This makes working on visual effects composed from multiple layered one-short particle effects difficult because now when you hit Shift-D to restart the animation, the effects who were still emitting at that time will not restart.
  • Setting the call track mode to "immediate" (instead of "deferred") didn't have an impact.
  • I don't know if CPU particles are also affected.

Screen recording:

Screen.Recording.2023-02-10.at.16.31.03.mov

Steps to reproduce

  • Open the attached MRP
  • Edit the animation timeline
  • Hit Shift-D to start the animation
  • Hit it again a few times to restart it while it's still playing

Minimal reproduction project

MRP-Godot3-VFX-Timeline.zip

@hmans
Copy link
Author

hmans commented Feb 10, 2023

Just want to confirm that explicitly clicking on "Restart" in the GPU particles toolbar has the intended effect (even while the effect is still playing), both in 3.5.1 and 4.0.

image

@TokageItLab
Copy link
Member

I remember @reduz saying something earlier about the necessity of a TrackType for particles.

@hmans
Copy link
Author

hmans commented Feb 10, 2023

A quick update. It seems that what's happening here is that Call Method tracks will only actually call methods when the scene or game is being run, but not within the editor. Which probably makes sense (you wouldn't want to run queue_free() while editing, etc.).

The documentation unfortunately doesn't mention this (at least I couldn't find anything about it), so if this is by design, I think the documentation should be updated accordingly.

Maybe a toggle can be edited to keyframe events in Method Call tracks so that, when set, the method is also invoked from within the editor?

Either way, the issue remains that it's extremely difficult to work on animations that orchestrate a number of one-shot particle effects. Being able to restart particle effects through animations would improve things significantly.

@hmans
Copy link
Author

hmans commented Feb 10, 2023

For anyone finding this, here's a quick and dirty workaround:

Step 1: create a custom class that extends GPUParticles3D and adds a new virtual property:

@tool

class_name HackedGPUParticles3D
extends GPUParticles3D

@export var hacked_emitting : bool:
  get: return emitting
  set(v):
    emitting = v
    restart()

Step 2: Use this for your GPU particle effects, or change the types of existing GPUParticle3D nodes to it (might require a scene reload/editor restart.)

Step 3: Instead of using a Call Method track, use a normal Property track, and set that property to true.

@TokageItLab TokageItLab added this to the 4.x milestone Feb 10, 2023
@clayjohn
Copy link
Member

The fact that methods won't be called when running in the editor should be well documented (and possibly should be communicated to the user in editor).

At the very least it should be added to the docs here: https://docs.godotengine.org/en/latest/tutorials/animation/animation_track_types.html#call-method-tracks

@TokageItLab
Copy link
Member

At the very least it should be added to the docs here

Indeed... I'll keep that in mind as I'm organizing the animation documentation now.

@TokageItLab TokageItLab changed the title [3.5.1] [4.0.rc1] Calling GPUParticles3D.restart() from AnimationPlayer doesn't seem to have an effect [3.5.1] [4.0.rc1] Calling GPUParticles3D.restart() from AnimationPlayer doesn't seem to have an effect on the Editor Feb 10, 2023
@hmans
Copy link
Author

hmans commented Feb 11, 2023

I'll leave this for you to decide, but in the interest of reducing noise here, maybe this issue should be rewritten or closed in favor of other (possibly new) issues, to better reflect the actual potential changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants