Add "display name" for textures

As it seems, the texture name property serves multiple purposes in Babylon.js.

On the one hand it’s used as tree node item name in the inspector.
On the other hand it serves as url when parsing serialized texture data.
Since Texture.UseSerializedUrlIfAny is false by default, the texture name property has priority over the url property in the parsing process.

In our Combeenation system we have an asset server for textures, resulting in urls as texture names.
Finding certain textures in the inspector is really painful, as the front part is useless.

We added a functionality that crops this front path as soon as the texture gets created.
The inspector appearance is fine now, but the problem is, that serializing the scene and opening it in the sandbox results in missing textures, since the texture name doesn’t contain the root url anymore.

Now my suggestion is to create a dedicated texture property that is only responsible for naming the node tree item in the inspector, e.g. “displayName”
IMO displayName can be set to the name value initially and should be overwriteable any time later.

8 Likes

I vote for it! please do a PR if you want to! I will gladly merge it

@Deltakosh yes, I should be able to implement that

1 Like

Sorry I’m a bit late on the subject since I see you already pushed a PR :stuck_out_tongue:

I was just wondering about this :

I feel like now the result would be :

  • name → Used as both name and URL
  • displayName → Used as display only

Why not focusing this PR on the URL side, in order to create a dedicated url property ?
That way we would have :

  • name → Just the texture name, also used as a display
  • url → Used as URL, and nothing else

That way makes more sense to me, buy maybe I’m missing something :thinking:

Would that be a breaking change?

1 Like

Ah :sweat_smile: . Good point. Maybe ^^

2 Likes

I find the solution from @TheHOF appropriate and useful (and won’t break anything). I shall :+1: this PR.

2 Likes