Open rambda opened 1 year ago
Couldn't the _to_string()
method be reused for this?
It displays as "Object ID: xxxxx", because it's property of type ObjectID, not Object.
Couldn't the
_to_string()
method be reused for this?
I ignored the existence of _to_string() because I myself, in practice, often use print(object) to output extremely long strings in Output that fully indicate the current state of the object, because it is convenient. But the inspector dock has limited space. On second thought, it's better to use _to_string() to do this. I can define my own get_debug_string()
Just ran in to this problem on a similar task. Using objects is cleaner than dictionaries but then the debugger unhelpfully shows object IDs.
Glad someone wrote this up! 100% would be awesome. And I like the idea of inspector_string
because it makes it clear what it's for. At first I was confused by resource_name
until I read the docs.
I think I also ran into this. I am working with Resource classes and instances. When I print them, I get things like Resource#-9223372003401005752
, but in the debugger it's Object ID: 922....xxx
where xxx
is not the same ending as 752
.
In other words, I can't tell if this is the same object (in the debugger vs the print outs) or some kind of duplicate. It's confusing.
You can inspect the object in debugger and see its path.
You can inspect the object in debugger and see its path.
Better would be—how can I print the ObjectID for a given object (like a Resource) such that it will match what the debugger is showing. The path thing is too many clicks away.
A default could be to replace "Object ID" with the class name (if available)?
... but I'd really appreciate the ability to customise the inspector string representation of the object, as described above.
Describe the project you are working on
trying to porting inkgd to godot 4.
Describe the problem or limitation you are having in your project
Uneasy to debug. Objects are shown as Object ID: ** (instance id) and there are too many of them. You'll have to click it to know what's inside the object. (Also clicking any object will trigger every properties of this object. It will trigger some error which won't happen when playing without debugging. Costs some time to handle these errors, not good for prototyping. )
It's better if an Object can show custom information in the inspector, like actual class name, and even some simplified info about its content.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The goal is this: (similar to
Resource.resource_name
)Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Some intuitive ways:
Object.inspector_string
_to_inspector_string()
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
It's core. Also I'm pretty sure a similar proposal has existed for a long time, as this behavior has existed since the day one debugger existed. But I just can't find it.