This PR https://github.com/godotengine/godot/pull/104451 introduced
a tricky regression. Canvas item transforms could risk not being
updated for multiple frames due to the conditional on the line
in this commit. Before the "approx_pos|size_changed" fix, the
transform would get updated incidentally either way. But now there's
a gap where (pos_changed && !size_changed) may not be true for a few
frames and there's nothing else left to trigger a transform update.
The fix is quite simple, for updating the canvas item transform
we remain trigger happy around position changes, but respect the
approx_size_changed.
The set_position method computes the anchors/offsets to match a
rectangle at the given position with size "size_cache". However, when
the Control's combined minimum size is larger than the size obtained
through the offsets and anchors, "size_cache" is set to be as large as
the combined minimum size. Therefore, when position is set while the
combined minimum size is larger than the rectangle given by the anchors
and offsets, it would resize these two fields, which would then stop
the Control from shrinking when its combined minimum size decreased. To
fix this, set_position now uses the size given by the offsets and
anchors instead of the "size_cache" field. This way, the rectangle
denoted by the offsets and anchors is simply moved, without being
resized, enabling the Control to shrink automatically when its combined
minimum size decreases. I also added a test case to ensure that the
Control shrinks correctly after setting its position while it has a
larger custom minimum size than the one obtained through the offsets
and anchors.
This introduces two new booleans approx_pos_changed and approx_size_changed which are the pos_changed and size_changed booleans that are immune to floating point errors.
This aims to fix two bugs in one shot. #93832 and #48935
Closes: godotengine/godot-proposals#4439.
Allows viewing the default values of the currently used theme item
in the Inspector.
For theme item properties of resource type, editing the default
resource does not make sense. Use **Make Unique** to create a copy
before editing.
It's hard to tell at first glance under what circumstances `is_top_level_control()`
returns `true`. So it's hard to decide when to use this method. And it seems to be
just a helper function for `Control::get_root_parent_control()`.
`is_top_level_control()` seems to only return `true` during entry and exit of canvas.
Changes to reduce the latency between changing node selection in the editor and seeing the new node reflected in the Inspector tab
- Use Vector instead of List for ThemeOwner::get_theme_type_dependencies and related functions
- Use Vector instead of List for ThemeContext::themes, set_themes(), and get_themes()
- Add ClassDB:get_inheritance_chain_nocheck to get all parent/ancestor classes at once, to avoid repeated ClassDB locking overhead
- Update BIND_THEME_ITEM macros and ThemeDB::update_class_instance_items to use provided StringNames for call to ThemeItemSetter, instead of creating a new StringName in each call
These changes reduce the time taken by EditorInspector::update_tree by around 30-35%