How to group materials and textures into parent nodes for better organization?

When generating multiple instances of similar meshes, I typically create a node using new TransformNode and add each new mesh to this node using mesh.parent. Is there a way to achieve a similar structure for instances of StandardMaterial and DynamicTexture?
This would make it easier to perform a dispose() all and improve visibility in the scene explorer panel.

you can store them in any type of javascript collection , array , object , map ,set etc…

Yes, I am aware of that, and I currently manage them using arrays and objects. However, it doesn’t create a node structure in the scene explorer (Debug Inspector), resembling a tree of materials groups. I was wondering if there is a way to achieve a similar hierarchy for materials and textures as we can do with meshes using TransformNode to enhance the organization within the scene explorer panel.

Unfortunately there are no workarounds at the moment. I am not opposed to introduce a way to group things for the inspector maybe through inspectableCustomProperties or equivalent ?


Thank you for your response. I believe that implementing a feature to group materials/textures in code and, consequently, in the inspector would be a valuable addition. This enhancement could significantly improve the organization and management of scenes, not only for debugging but also for real-time inspection of which new materials and textures are created.

If it’s possible to display the elements of an array containing multiple materials in the scene explorer panel with inspectableCustomProperties, that would already be very helpful!

Oh I am more thinking of an extra category name which could be used to group elements ?

1 Like

MaterialNode and TextureNode

like TransformNode for mesh

That would have no functional use other than to display them grouped in the inspector. So making “Nodes” for them would have no real world use and they are not comparable to the TransformNode for meshes. @sebavan’s solution though sounds like it would get you what you need if you are trying to group them in the inspector under different expandable drop downs under materials and textures.


Yes, it’s mainly for visual organization. I had a code bug creating materials and textures in real-time, so an inspector tree organization would simplify things. While it could be useful for large scenes, at the moment, it may not be a top priority. Thanks!

@rafaelj I ll glady merge the contribution if you are willing to add it. It should be one more string in the Inspectable properties and a bit of changes in the tree generation of the inspector.

1 Like