Skip to content

Properly show negative ObjectID properties#120644

Open
YeldhamDev wants to merge 1 commit into
godotengine:masterfrom
YeldhamDev:guess_they_can_be_negative
Open

Properly show negative ObjectID properties#120644
YeldhamDev wants to merge 1 commit into
godotengine:masterfrom
YeldhamDev:guess_they_can_be_negative

Conversation

@YeldhamDev

Copy link
Copy Markdown
Member

What problem(s) does this PR solve?

Additional information

ObjectIDs of RefCounted objects use their first bit to flag themselves as such. This means that their ID will show as a negative value. This PR fixes EditorPropertyObjectID assuming that they're always positive.

@YeldhamDev YeldhamDev added this to the 4.8 milestone Jun 25, 2026
@YeldhamDev YeldhamDev requested a review from a team as a code owner June 25, 2026 16:52
@YeldhamDev YeldhamDev added bug topic:editor cherrypick:4.7 Considered for cherry-picking into a future 4.7.x release labels Jun 25, 2026
@YeldhamDev YeldhamDev force-pushed the guess_they_can_be_negative branch from 6a94dbb to f63eb34 Compare June 25, 2026 16:53
@AThousandShips

Copy link
Copy Markdown
Member

This might not be the correct solution I'd say, the value isn't negative it just becomes a negative value when parsed through Variant, it should probably be displayed as positive everywhere. The value is always positive, the most significant bit is used to signal ref counted though, the resulting value isn't negative and it'll be incorrectly displayed strictly speaking

@YeldhamDev

Copy link
Copy Markdown
Member Author

The thing is that if you use something like get_instance_from_id(), you will need to pass the negative value for it to work.

@AThousandShips

Copy link
Copy Markdown
Member

How is that relevant though? They aren't persistent so why would you ever copy it from the inspector into a variable? It's not valid across sessions, is anyone actually doing that?

@YeldhamDev

Copy link
Copy Markdown
Member Author

What I mean is that while internally it is always a positive value, for the stuff users interact with it is not. And showing it as a positive is technically lying to them.

@AThousandShips

Copy link
Copy Markdown
Member

Not really, and by that logic we should change the representation of all unsigned values to be signed, but I don't see how it matters because the value isn't useful in practice when in the inspector, you can't use it, so why is displaying the value incorrectly needed?

@YeldhamDev

Copy link
Copy Markdown
Member Author

Not really, and by that logic we should change the representation of all unsigned values to be signed

What even is this comparison?

but I don't see how it matters because the value isn't useful in practice when in the inspector, you can't use it, so why is displaying the value incorrectly needed?

Because everywhere else it's displayed like this. print(), get_instance_id(), the inspector title... For the user, the "incorrect" value is the correct one.

@AThousandShips

AThousandShips commented Jun 25, 2026

Copy link
Copy Markdown
Member

Regardless I'm against this change because it's not correct to the value, and how it's printed is irrelevant IMO as the value isn't used from here

But won't reject it but I don't think it's appropriate based on the justifications

Regardless I don't think it's appropriate to cherry pick this enhancement, or call it a bug

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

Labels

bug cherrypick:4.7 Considered for cherry-picking into a future 4.7.x release topic:editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EditorDebuggerRemoteObject in Inspector shows ObjectID with wrong signedness

2 participants