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

[4.0] Looping tween with two property tweeners stops after first step. #59585

Closed
FluffyBunniesTasteTheBest opened this issue Mar 27, 2022 · 5 comments

Comments

@FluffyBunniesTasteTheBest
Copy link

FluffyBunniesTasteTheBest commented Mar 27, 2022

Godot version

v4.0.alpha.mono.custom_build [3990152]

System information

Ubuntu 2021.10 Vulkan API 1.2.162 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1070

Issue description

Dear Godot team,
the following code snippet is moving a particle effect between two positions using a tween:

public void AddParticleEffect(Vector2 srcPos, Vector2 dstPos)
{
	GPUParticles2D newParticleEffect = particleEffectScene.Instantiate() as GPUParticles2D;
	newParticleEffect.Position = srcPos;
	AddChild(newParticleEffect);
	activeParticleEffects.Add(newParticleEffect);

	Tween moveParticlesTween = newParticleEffect.CreateTween();
	moveParticlesTween.SetTrans(Tween.TransitionType.Sine);
	moveParticlesTween.SetEase(Tween.EaseType.In);
	moveParticlesTween.TweenProperty(newParticleEffect, "position", dstPos, 2);
	moveParticlesTween.TweenProperty(newParticleEffect, "position", srcPos, 2);
	moveParticlesTween.SetLoops();
}

The first time AddParticleEffect() is called, it is working as expected - i.e. the particle effect is moving infinitely.
Calling the same method a second time causes the particle effect to stop after the first step (i.e. after the line moveParticlesTween.TweenProperty(newParticleEffect, "position", dstPos, 2); is done).

Steps to reproduce

The easiest way to reproduce the issue is to run the attached minimal reproduction project and:

  1. Push the start button - you'll see an animation moving left/right infinitely.
  2. Push either the stop or remove button.
  3. Push the start button again. The animation starts to move to the right and then stops. At the time the animation stops, the following error message is logged:
E 0:00:11:0073   step: Infinite loop detected. Check set_loops() description for more info.
  <C++ Error>    Method/function failed. Returning: false
  <C++ Source>   scene/animation/tween.cpp:322 @ step()

Please note that the above calls of TweenProperty() use a two seconds duration, which, according to the docs, should be all right.

Minimal reproduction project

Upload failed, please see here.

@FluffyBunniesTasteTheBest FluffyBunniesTasteTheBest changed the title Looping tween with two property tweeners stops after first step. [4.0] Looping tween with two property tweeners stops after first step. Mar 27, 2022
@Calinou
Copy link
Member

Calinou commented Mar 27, 2022

@FluffyBunniesTasteTheBest The minimal reproduction project didn't upload (likely because you clicked away from the text field while it was still uploading). Try editing your post and upload it again.

Also, please create a minimal reproduction project in GDScript instead of C# for two reasons:

  • Non-Mono builds of Godot are easier to set up and have less moving parts.
  • This rules out C# being the cause of the bug.

@Calinou Calinou added this to the 4.0 milestone Mar 27, 2022
@FluffyBunniesTasteTheBest
Copy link
Author

FluffyBunniesTasteTheBest commented Mar 28, 2022

@Calinou Please excuse me, I don't know GDScript. Sorry also for the failed upload. Here's another try:
TweenTest.zip

@GeorgeS2019
Copy link

GeorgeS2019 commented Apr 17, 2022

Confirmed using TweenTest.zip

Godot4 Mono version

Godot Engine v4.0.alpha.mono.custom_build.3639c27cf

Windows 11

Mono JIT compiler version 6.13.0 (Visual Studio built mono)
Copyright (C) Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       preemptive
        GC:            sgen (concurrent by default)

alt text

E 0:00:27:0085   Tween::step: Infinite loop detected. Check set_loops() description for more info.
  <C++ Error>    Method/function failed. Returning: false
  <C++ Source>   scene\animation\tween.cpp:325 @ Tween::step()

@KoBeWi
Copy link
Member

KoBeWi commented Aug 16, 2022

Can't reproduce in d5d22ab
@FluffyBunniesTasteTheBest Can you confirm? Judging from the error message you posted, a similar bug was fixed, so it should be working now.

GDScript repro btw
TweenTest.zip

@YuriSizov
Copy link
Contributor

Closing per comment above. Please provide more details and an MRP so we can investigate the issue better, if it still occurs.

@YuriSizov YuriSizov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2023
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

5 participants