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

Fix Object encoded as id in dictionaries to be represented as int in the inspector. #94610

Conversation

ajreckof
Copy link
Member

Fix #92533

So I add some time to check this morning and here is the full explanation of what is happening. First getting the value is something hard on a Dictionary since you have values but also two new values and in addition we wish to add keys wich would even more complicate the thing. So Instead of having two places that would do the logic I put in one place. This is the difference with Array.
Now for why this make it fails. This linked to the code @KoBeWi pointed to. This piece of code seems to be needed as EditorPropertyObjectID seems to need an int and not an Object. Keeping it will make dictionnary handle it as an int and removing it will cause inconsistency as Kobewi showed but also more hard errors such as this one when clicking to edit the button.
Capture d’écran 2024-07-22 à 09 30 00
Hence we need to separate the two while keeping it as coupled as possible (for easier maintenance and easier addition of key editing) this is why I created a new function keeping it without the bit of code that causes problem and _get just calls the new function and then do the code that is needed only there.

An alternative solution would be to outright remove the problematic code and just make EditorPropertyObjectID handle Object directly instead of int. This seems like a cleaner solution and what I would have preferred to be done but this has more potential to have unexpected consequences which wouldn't be possible for 4.3.

@akien-mga akien-mga added this to the 4.3 milestone Jul 22, 2024
@akien-mga akien-mga requested a review from KoBeWi July 22, 2024 08:03
@AThousandShips AThousandShips changed the title Fix Object encoded as id in dictionnaries to be represented as int in the inspector. Fix Object encoded as id in dictionaries to be represented as int in the inspector. Jul 22, 2024
@akien-mga akien-mga merged commit 23a1104 into godotengine:master Jul 23, 2024
18 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.

Resource on dictionary not represented correctly in the inspector. It shows as a number instead of an object
3 participants