Loading j3o with sub-spatials from external locator path

Hi,

I want to load a spatial (TerrainQuad) from a file from a registered FileLocator path.
The terrain quad has child geometries that should be instances of a j3o file in my projects assets.
Each of these children has been cloned (Spatial.clone()) in my custom editor and the whole quad is saved using a BinaryExporter to an external path.

Now the issue is this:
The loading of the quad basically works, the terrain is there and you can see the sub-geometries. But they don’t have any material assigned to them! I did set the material of the source j3o file for the cloned geometries in the Scene Composer. If I print out the materials name (or asset name) it says “null”! Why are they not being loaded?
The strange thing is that when I open the saved quads j3o file in the Scene Composer it loads the materials correctly!

I think there is some problem with loading the main parent j3o from an external locator which than has to load the child geometries from my projects compiled assets. Am I missing something?
Is this even possible?
What is the correct way to instance objects for saving a j3o (think of a map terrain quad with trees of the same source Tree.j3o on it)?

The assetmanager that is loading the file has to have access to the same assets at the same paths that were used when it was saved (j3m, images etc.).

Thanks for the hint!

I’ve double checked it, but I still can’t see what’s wrong.
Even if I save the file to the assets directory so that all relative paths should be identical, it won’t load the materials. The strange thing is that it works perfectly in the Scene Composer!

And why is it loading the geometries correctly? Or does it save each geometry into the j3o? In that case it would be a waste of space and not what I want. I just want the parent quad to hold a reference to other j3o spatials that are loaded once and instanced where needed (because every tree model is the same for example).

Also I thought that the asset manager wouldn’t care about paths when everything is compiled to binary, but that just may be a mis-assumption on my side…

And if it can’t find the materials, why is it not throwing an AssetNotFoundException?

Edit:
Ok, stop, I’ve fixed it.
It was some left over code after loading that was applying the terrain material to the quad, and obviously to all sub-spatials. Is it true that setMaterial is recursive to all child geometries?
Anyways after removing that bit of code it works now!