X Tutup
Skip to content

Fix layers property editor last bit value in tooltip#112173

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
kleonc:editor_property_layer_grid_fix_last_bit_tooltip
Nov 12, 2025
Merged

Fix layers property editor last bit value in tooltip#112173
Repiteo merged 1 commit intogodotengine:masterfrom
kleonc:editor_property_layer_grid_fix_last_bit_tooltip

Conversation

@kleonc
Copy link
Member

@kleonc kleonc commented Oct 29, 2025

  • Replaced 1 << shift to 1u << shift to not rely on auto casting to unsigned (and to be more explicit). In most cases the change is not really needed as auto casting would happen, but in case of string formatting for the tooltips there was no auto casting to unsigned, hence %d format string produced a negative value for the last bit.
Before After
QP1D7vcCGl lVRsmlgS2Y
Before After
Godot_v4 5 1-stable_win64_fqFwcvLkx3 godot windows editor dev x86_64_Mm2AsDYyQs
  • I've also changed the indicator for "no hovered index" from INT32_MAX to UINT32_MAX, and factored it out to HOVERED_INDEX_NONE constant. In fact any unsigned value greater than 31 could be used as such indicator, it was just a little bit puzzling why specifically INT32_MAX == 0x7FFFFFFF was used. Given hovered_index is uint32_t I think using UINT32_MAX == 0xFFFFFFFF makes just a little more sense.

@kleonc kleonc added this to the 4.6 milestone Oct 29, 2025
@kleonc kleonc requested a review from a team October 29, 2025 17:58
if (renamed_layer_index == INT32_MAX) {
return;
}
ERR_FAIL_INDEX(renamed_layer_index, names.size());
Copy link
Member Author

Choose a reason for hiding this comment

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

renamed_layer_index should always be valid here, would be a bug if it isn't, hence changed to error.

@kleonc kleonc force-pushed the editor_property_layer_grid_fix_last_bit_tooltip branch from d14b516 to 8490bca Compare November 12, 2025 13:56
@kleonc kleonc requested a review from Calinou November 12, 2025 13:57
@kleonc kleonc force-pushed the editor_property_layer_grid_fix_last_bit_tooltip branch from 8490bca to c31b92b Compare November 12, 2025 13:59
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Code looks good to me.

@Repiteo Repiteo merged commit 4eb11cc into godotengine:master Nov 12, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 12, 2025

Thanks!

@kleonc kleonc deleted the editor_property_layer_grid_fix_last_bit_tooltip branch November 12, 2025 23:31
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.

3 participants

X Tutup