See… at best this completely missed the point. At worst, you were yelling at me that I should have known what you meant. I interpreted it as the former. I think Normen was trying to point out that it could be interpreted as the latter.
@pspeed Yeah OK I got you, but in my object creation process, I’ve been applying materials to SPATIALS (not geometries) for months and it works perfectly, except for BatchNode, stating (like I wrote earlier) something like “You have to set the material before batching.” or something close to this, I could dig the exception if it’s needed, but the only way I could make the BatchNode shut up about it is to apply the material directly on the GEOMETRY instead of the SPATIAL.
Here’s how EVERY SINGLE other object gets their material on my scene (except for the BatchNode, which throws an exception at this point):
@ghoust I reuse materials for hundreds of objects. My class creates 1 new material at the beginning (like “grassMaterial” or “flowerMaterial”) and then assigns them after creating all the geometries.
EDIT: …but in the case of the BatchNode we’re talking about, instead of assigning the material to the parent spatial, I had to assign the material to individual geometries BEFORE batching of course, else it would crash.
Writing a simple test case is only partially about helping us help you. 90% of it is that most of the time the test case will work just fine. Then you can work on either tweaking your code to be more like the test case (or probably in this instance) tweaking the test code until it breaks like your app does. Once that happens then you will have either learned what the issue is or you can then post some complete code here for us to look at.
@.Ben. said:
@pspeed Yeah OK I got you, but in my object creation process, I've been applying materials to SPATIALS (not geometries) for months and it works perfectly, except for BatchNode, stating (like I wrote earlier) something like "You have to set the material before batching." or something close to this, I could dig the exception if it's needed, but the only way I could make the BatchNode shut up about it is to apply the material directly on the GEOMETRY instead of the SPATIAL.
Here’s how EVERY SINGLE other object gets their material on my scene (except for the BatchNode, which throws an exception at this point):
I got mixed between the SPATIAL and the NODE, I’m sorry about this, but I don’t think it’s relevant in this issue, or is it…?
It must be. If you set a material on a spatial then it internally traverses the entire scene graph under that spatial and sets the material on the geometries. That may be relevant. At any rate, there is no such thing as a “node with a null material” and thinking like that will only confuse you. The fact that you can set a material on a spatial is just a convenient (and confusing) utility method.