playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
159 stars 28 forks source link

Display names for array entries in Inspector for JSON attributes #210

Open mvaligursky opened 4 years ago

mvaligursky commented 4 years ago

When an array is displayed, we see each entry called [0], [1] ...

Screen Shot 2020-11-02 at 3 05 06 PM

Perhaps if element contains a string attribute, it could be used to enhance it.

For example a first attribute of type string should be used .. so if we have Name: john it would show [0]: John

willeastcott commented 4 years ago

I don't think we can make this assumption. For example, check out the tween script and its first string attibute:

https://github.com/playcanvas/engine/blob/master/examples/assets/scripts/animation/tween.js#L13

It's the name of the event that triggers the tween. I think it'd be pretty weird to have that as the 'name' of the array element.

mvaligursky commented 4 years ago

If people know thata's the rule (like it is in some other engine), they would put the string they want as first. But some more flexible solution we can do would work even better.

yaustar commented 4 years ago

Maybe we can an Editor only field above/below the array size that takes a string for the property in the object of each entry that we would like to display.