Closed Ali-RS closed 8 years ago
Textures are exported into the directory define in the render panel, when you select xbuf renderer.
I keep the ticket open, to keep in mind, that the directory should also be configurable into the export side panel.
IMO the addon should be changed to copy the textures in the output folder by default and the loader should try to load them from the same folder of the model first, and only if not available from the root.
IE. if i load maps/mymap/root.xbuf
it will try to load the textures from maps/mymap/Texture/
, if not found it will try with Textures/
Agree with Riccardo.
Disagree.
using the asset root is part of the IDL "spec":
https://github.com/xbuf/xbuf/blob/master/src/main/proto/xbuf/primitives.proto#L32
So in your design i would have to mix all my models data together and be really really really careful to not use the same name twice... And if i want to let users doing their mods i have to tell them: "Here, this is the list of file names i've already used, pick something else, and btw you should also make arrangements with other modders because if you all call the same texture diffuse_map.png it won't load. "
If you want to keep consistency in loaders we can say that xbuf paths have a special keyword <currdir>
and when the loader find it, it knows that it's relative to the model path, while when it find <rootdir>
it knows it is relative to asset root. And then add a checkbox in export panel.
Or even better, just say that the path is relative to root only if it starts with / ie /Textures/ vs local Textures/
Yes, like when you manage your assets folder/library in any game. The asset root is configurable, I use a default one, and one per project.
In a studio, artistes work in a single rooted working directory (with lot of sub-folders). It's similar to the assets folder in a jme project.
About mods, you already have the problem today in jme, you define a list of assets root path, and jme pick the first asset that match (like java classes & classpath).
Yes and the solution is allow relative paths, so people can put everything in they my_model/ path and it won't interfere with anything .
Just one more question: So based on the convention it is not a good idea (or is not possible) to pack textures inside the model, Yes?
@Ali-RS , include texture inside a xbuf "file", is possible and already defined by the format. But it is not implemented by any tools (the blender exporter/preview, assimp converter, the jme importer).
it's possible because the location of info (like texture) inside a data xbuf "file" is done by id, not by name/path choosen by human.
Oops! something is wrong here ! for my model named "Doha" I changed "asset root folder path" in blender render tab to "//........\Textures\Doha\" this is relative address in my jme asset root directory. After exporting to xbuf all the textures copied to that path successfully. So now I have texture for model "Doha" in "assets\Textures\Doha\Textures\" but when i load .xbuf in jme it does not show textures. if I move textures to "assets\Textures" it shows them. What is wrong?
It doesn't work this way, the root path is an information useful only for the exporter, it just tell it where to export the data. The paths will be always relative to the root of the asset folders. So the result you get is not wrong, it fit perfectly the design, that's why it's a BIBGIBIG design flaw :whale2:
It seems i am confused ! So what should I do to have my texture for model "Doha" in this directory "assets\Textures\Doha\" ?
To my understanding, it's not possible
No kidding !!!
The asset root path should also be defined as an asset root path on jme3, by default jme3 define "assets" as an asset root path.
Today, there is a bug in the export texture function of the blender addons: it should keep the path of the textures if the texture in under the asset root path (packed or not). when this bug will be fixed, you could share the texture between blender, gimp/photoshop, awesome texture, substance,... your jme app, until your textures are under the asset root path. If texture are not under asset root, texture is copied to asset_root_path/Textures/texture_filename
I push a fixe, in the blender addon, to keep path of texture already under asset root. So, if you take care of the texture's path in blender( I mean path that are under asset root), you could have this kind of layout:
assets/
+-- Models/
| +-- foo.blend
| +-- foo.xbuf
+-- Textures/
+-- foo/
+-- mytex.png
like this one
assets/
+-- Models/
+-- foo/
+-- foo.blend
+-- foo.xbuf
+-- textures/
+-- mytex.png
the second example should solve the @riccardobl's issue about handling user's map and name collision.
Thanks a lot David.
Tested it and works correctly. So let's close this issue.
It seems that xbuf blender add on replace the paths to be relative to Textures/ inside your asset root. So after exporting to xbuf in Models/ directory i should move the model textures to Texture/ directory to be able to load them on model. see this topic : https://hub.jmonkeyengine.org/t/xbuf-updates-migrating-to-java-physics/35893/20