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

StateMachine resource corrupted after dragging transition line to itself #5

Closed
SirPigeonz opened this issue Feb 14, 2021 · 8 comments · Fixed by #8
Closed

StateMachine resource corrupted after dragging transition line to itself #5

SirPigeonz opened this issue Feb 14, 2021 · 8 comments · Fixed by #8
Labels
bug Something isn't working

Comments

@SirPigeonz
Copy link

Hi :)
While testing your addon I found that there might be some bugs with SM resource transitions editing.
If you delete the transition the SM resource is corrupted somehow, and it looses transitions if you switch to the other node or restart the project.

Test Project:
gd-YAFSM_test.zip

How to reproduce:

  • open example project
  • in StateMachine Player node
  • create transition from State3 to State4
  • select root Node2D
  • select StateMachinePlayer node again

What happens: the transition that you just created disappears.

I also get errors:
obraz

Let me know if you will need more info :)

Cheers!

@imjp94
Copy link
Owner

imjp94 commented Feb 14, 2021

After debugging the resource in .tres format, it turns out that the transition doesn't get properly removed, instead, it is transiting to self.
Screenshot 2021-02-15 060023

Which is really weird, as there's no way to connect to self in the editor.
I can confirm this bug, but I can't reproduce it through deleting other transition or replicate the whole StateMachine(then delete transition from State3 to State4).

Do you still happen to remember the steps to create the same bug?
or
Will you still get the same bug, after replicate the StateMachine resource and delete the transition?

@imjp94 imjp94 added the bug Something isn't working label Feb 14, 2021
@SirPigeonz
Copy link
Author

SirPigeonz commented Feb 14, 2021

Good news. I managed to figure out what is the couse of this bug :)

This:

[sub_resource type="Resource" id=6]
script = ExtResource( 3 )
from = "State"
to = "State"
conditions = {

}

I managed to connect the state to itself ;)

I thought you can delete transitions by dragging them away, turns out I just created a transition that shouldn't be valid this way.
It's not visible in graph because the line is probably 0px

@SirPigeonz
Copy link
Author

SirPigeonz commented Feb 14, 2021

Lol we posted at the same time xD

@SirPigeonz
Copy link
Author

SirPigeonz commented Feb 14, 2021

Do you still happen to remember the steps to create the same bug?

You have to create a transition to the other state, then drag it out to the parent state itself :D

@imjp94
Copy link
Owner

imjp94 commented Feb 14, 2021

Do you still happen to remember the steps to create the same bug?

You have to create a transition to the other state, then drag it out to the parent state itself :D

Mind blown, I didn't know such "feature" exist XD

I will fix it once I am free, since it is not a critical bug.
But now there's 2 ways of doing it:

  1. Make it to work as you expected, disconnect when reconnect to self
  2. Cancel the action (just like dragging the transition to empty space)

What do you think?

@imjp94 imjp94 changed the title Disappearing transitions ins SM resource StateMachine resource corrupted after dragging transition line to itself Feb 14, 2021
@SirPigeonz
Copy link
Author

SirPigeonz commented Feb 14, 2021

I think the best option would be to cancel the action like when dragging to empty space.
Delete button is much more obvious way of deleting stuff ;D

Option 1 could lead to annoying behavior when somebody would accidentally drag a transition on the parent and delete it by accident, when his intent was to reconnect it to the other state.

@imjp94
Copy link
Owner

imjp94 commented Feb 14, 2021

Sounds great, thanks for the feedback!

@SirPigeonz
Copy link
Author

Thanks for a great add-on ;P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants