godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Add a way for Objects to show a custom string representation in the Inspector dock

Open rambda opened this issue 2 years ago • 9 comments

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) mockup

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Some intuitive ways:

  1. Add a string property for Object to represent it (with custom information) in the Inspector dock. E.g. Object.inspector_string
  2. Add a virtual method. Override this method to customize the inspector string. Should return the given property's value, or null if the property should be handled normally. E.g. _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.

rambda avatar Jan 31 '23 12:01 rambda