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

Don't mark cached previously pinned AnimationMixers #102813

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

hpvb
Copy link
Member

@hpvb hpvb commented Feb 13, 2025

AnimationPlayerEditor will hold on to pointers to no-longer existing Nodes that were previously pinned. Make sure to not mark them as dirty if they are not already inside the cache.

This fixes #102108

@hpvb hpvb added this to the 4.4 milestone Feb 13, 2025
@hpvb hpvb requested review from a team as code owners February 13, 2025 16:53
@fire
Copy link
Member

fire commented Feb 13, 2025

Weird the fix has nothing to do with AnimationMixers.

AnimationPlayerEditor will hold on to pointers to no-longer existing
Nodes that were previously pinned. Make sure to not mark them as dirty
if they are not already inside the cache.

This fixes godotengine#102108
}
// If the current pinned node changed update both the old and new node.
if (node_cache.current_pinned_node != pinned_node) {
node_cache.mark_dirty(pinned_node);
node_cache.mark_dirty(node_cache.current_pinned_node);
// get_editing_node() will return deleted nodes. If the nodes are not in cache don't try to mark them.
Copy link
Contributor

@a-johnston a-johnston Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not also fix the upstream issue and null original_node when player is cleared? I think the has checks are unnecessary with that + your additional fixes with nulling current_pinned_node

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies I missed this comment before merging, otherwise I'd have waited for @hpvb to reply first.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, ultimately the current code only uses get_editing_node in two places and both would now be safe handling that pointer but it seems like it would be better to prevent that from being returned in the first place.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this was a release blocker I decided to do a local fix. The current way the editor pinning works is kind of broken, editors can be pinned but the status of whether or not it is pinned is stored in the button toggle state, which gets reset when switching scenes.

The behavior is kind of silly as it is now, and was silly before any of my changes. I'm planning to do a ui fix pr separately to fix the pinning behavior in general.

@akien-mga akien-mga merged commit 25a3b38 into godotengine:master Feb 13, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Editor crash when interacting with a re-opened scene containing an animation player
5 participants