X Tutup
Skip to content

Replace Inspector pending stack usage with loop#107947

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
lodetrick:inspector-pending
Oct 30, 2025
Merged

Replace Inspector pending stack usage with loop#107947
Repiteo merged 1 commit intogodotengine:masterfrom
lodetrick:inspector-pending

Conversation

@lodetrick
Copy link
Contributor

Currently, the variable used to store variables with pending changes to update the inspector dock is stored as a HashSet. This likely had a reason in the past, but in the current state of the codebase, this is only treated incorrectly like a stack. In other words, a HashSet is being used like a stack, but with the memory cost of a HashSet.

This PR changes the type of pending to a Vector to be more in line with the current use of the variable.

@AThousandShips AThousandShips requested a review from a team June 25, 2025 07:29
@AThousandShips AThousandShips added this to the 4.x milestone Jun 25, 2025
@lodetrick lodetrick force-pushed the inspector-pending branch from aa0c2f4 to 21c4121 Compare June 25, 2025 17:19
@KoBeWi KoBeWi modified the milestones: 4.x, 4.6 Jun 25, 2025
@lodetrick
Copy link
Contributor Author

lodetrick commented Jun 28, 2025

I'm having second thoughts on this... the set datatype would be useful for reducing repeat calls for when a user changes the same property multiple times in one update cycle (which is around twice a second, I don't know the specific number). For example when playing an animation in the editor, numeric properties can be interpolated every process frame, while the inspector is only updated every ten or twenty. Unless I'm missing something this is probably the reason why the pending variable is a HashSet.

@KoBeWi thoughts on whether the tradeoff is important?

@KoBeWi
Copy link
Member

KoBeWi commented Jul 3, 2025

I checked and not sure if there is a way to trigger duplicate property updates. pending is only used for properties changed within the inspector, external changes (animation, tool scripts) don't use it. Quickly changing a property results in a single update per frame.

Although the main improvement in this PR is getting rid of this weird stack-like usage, which makes no sense. That change is independent from the type of pending, so you could revert it back to HashSet, while keeping the new loop (HashSet can be iterated too AFAIK).

@lodetrick lodetrick force-pushed the inspector-pending branch from 21c4121 to c40853e Compare July 4, 2025 05:16
@lodetrick
Copy link
Contributor Author

lodetrick commented Jul 4, 2025

I reduced the PR to just remove the stack-like pattern for pending. I'm more happy with it now, although I didn't realize that pending was only for changes within the inspector. It also seems to be called with notify_property_list_changed, which can be determined by the user.

@lodetrick lodetrick changed the title Change Inspector pending type to Vector Replace Inspector pending stack usage with loop Jul 4, 2025
@lodetrick lodetrick force-pushed the inspector-pending branch from c40853e to fbd51de Compare July 4, 2025 21:32
@Repiteo Repiteo merged commit 638366b into godotengine:master Oct 30, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 30, 2025

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.

4 participants

X Tutup