Hi,
I have the need in my project to make use of a custom chain of AssetLocator to retrieves my assets. These can get encrypted assets from an HTTP server, caches them locally, and more.
However, I found that Tonegodgui actually uses the class loader directly to load its style sheets (although uses AssetManager for everything else). I would like these to be treated as any other asset, so have patched Screen and created a new StyleLoader class to achieve this.
The patch can be found here.
Note, there is one gotcha. The StyleLoader is added to the AssetManager the first time a Screen is constructed. However, because the file name used for styles does not follow the same pattern as Meshes, I believe there is a potential for problems. This is best explained perhaps looking at the asset manager configuration file (if this were to be used instead of directly registering the new loader against the asset manager instance).
[java]
LOADER com.jme3.scene.plugins.ogre.MeshLoader : meshxml, mesh.xml
LOADER com.jme3.scene.plugins.ogre.SkeletonLoader : skeletonxml, skeleton.xml
LOADER tonegod.gui.core.StyleLoader : xml
[/java]
Note that both meshes and skeletons both have special suffixes. IF there were any other XML assets that get loaded this way, they would always go through style loader. As it stands this doesnāt matter, because there are no other XML types used, but tonegodgui should not assume this.
So being as Tonegodgui is native to JME3, I believe it should probably follow the same pattern, e.g. for the default style map, default.style.xml (or something). The same would go for any included component XML files.
On a side note, I wonder if itās possible to have a way of using relative paths for assets pointed to in style files. Currently styles are not relocatable because of this.
RR