Just curious why there’s no scene.getTextureByName() when we have getMaterialByName(), getSoundByName(), getMeshByName() etc?
I figure there’s a good reason for this. I just can’t think what it is
Just curious why there’s no scene.getTextureByName() when we have getMaterialByName(), getSoundByName(), getMeshByName() etc?
I figure there’s a good reason for this. I just can’t think what it is
Is Texture a construct anywhere in babylon? I can only recall ever working with materials I think.
I think i might use textureName for the file location. Not sure.
Okay I just looked it up, yeah it is a thing. So my best guess is that it isn’t something maybe that is relevant somehow to realtime manipulation. Like so by the time it matters in realtime it is already part of a material ready to be plastered on some geometry or something?
It just seems like something you would hold closer to your heart than having exposed to a realtime rendering environment perhaps.
Well mostly because we did not do it All good if you want to send a PR to add it
Was this ever added? I did not see it in docs. If not +1 for need.
I’m game, he’s a little PR for it modeled after getTextureByUniqueId.
Is there a way to pass a reference to the original texture instead of making a copy (passing by value)? This would save resources and simplify the scene tree.
let texture = scene.getTextureByName(textureName);
xxx.material.diffuseTexture = texture ;
To me expected behavior would be grabbing a reference to the original, but both your method and what I tossed in always return value, and the texture tree always shows a second texture. So, I assume it is passing value. Maybe this is just how Babylon works.
Can you make a little playground showing a duplicate texture in the inspector? Ideally by just creating one texture? I’ve never noticed a texturing being duplicated before, so a PG would def help to understand the issue better.
Strange, it must be in my code somewhere.
It indeed does work fine
https://playground.babylonjs.com/#ZMCFYA#175
Looks like I have some debugging to do.
Nothing else to see here. You did great. Thanks.
Merged, coming to the nightly build in a few hours.