As in title. How can I hide for example that items:
Is that a custom material definition? What does it look like?
There is no way to do thisâŚ
Thatâs funny because I was thinking of a way to store meta data with our j3m or j3md files for an editor purpose and, tbh I have not yet found a satisfying solution.
The obvious choice is to store meta data in the files themselves (for example in comments store some data that would allow to group the textures fields or hide them), But this data is completely irrelevant and useless for the engine itself and for your game, will clutter the file, and will probably produce some unnecessary loading overhead of the files.
The other choice is to have a separate file with this data⌠Thatâs what is done in the sdk with j3o btw (we have .j3odata), but these files are hidden to you and if you lose them, discard them in any way, or just move your original file in another folder, you loose your meta data. Itâs usually kind of complicated to keep track on a file when you canât see it.
So Iâm shamelessly use your post to open the discussion about this, What you monkeys reading this think of those solutions, which one would you use, and above all⌠do you have another, more satisfying solution.
This sort of thing doesnât belong in core for the reasons stated. The engine has no use for it and our typical policy is that editor-specific things should be external. I think thatâs a good policy because it rapidly slides down a slippery slope (what about localization? What about generated documentation? etc.)
Better if this is meta-data (like a properties or json file) that you could associate with your material simply by naming/placement convention.
But Iâm curious, what is the general use-case for having material parameters in your shader that you donât want to use?
Material parameters that are set by the engine, for example the shadow maps.
You will never assign them in the editor thatâs something done at runtime.
Also you could want to group attributes in the UI depending on some criteria. (same example shadow maps could be in a shadow section along with all shadow related parameters). All this dynamically, without having to develop a custom UI for each material definition of course.
Another example is for the shader node editor. I store the position of the nodes in a meta data file that is stored in a hidden subfolder of the project. But the issue is that you can loose it, and if the link to the original file relies on a naming convention, you have to update that when you move/rename the original file. Thatâs a bit cumbersome tbh, and doesnât prevent 100% the loss of the meta data file.
Thatâs why I suggested a completely visible file.
So the typical convention might be:
MyMaterial.j3md
MyMaterial.vert
MyMaterial.frag
MyMaterial.metaData
All located together. Forgetting to copy one of those is a problem no matter what⌠but at least itâs not hiding.
Also, i already donât like the fact that our j3m are not self contained and contains absolute paths, and that when you move a file, itâs broken. Thatâs another issue of course, but adding yet another separate file, that you canât really track will dig this hole a bit more.
But yeah⌠visible files maybe could be a solution.
You mean absolute paths within your assets folder?
Thatâs like everything else in JME⌠a pain, but consistent at least. Iâve often wished for a more flexible asset location system⌠would smooth over a lot of asset import woes.
I couldnât agree more.
But I guess thatâs another story
I donât know how its made âinsideâ but maybe one little option (comment or something) can tell SDK to not show in material list but still be usable in engine (as shadowsmaps)?
We would like to avoid dirtying up material files with 100 special little comments for editors that arenât needed when you deploy your game. So will do some sort of metadata file (that can be easily stripped from distributions).
OSX stores metadata in a directory structure - maybe that could be a convention the SDK and IDE could make use of. Iâm thinking like âterrainlighting.j3mâ is a directory and contains the file âterrainlighting.j3mâ and related metdata files. The SDK does not have to enforce this in any way (I hope) but when loading the j3m it could check if it is a directory and load the file from the directory.
When loading things from the classpath, you have no idea if something is a directory just by name⌠just that you canât get it.
With a metadata file, you can easily look up related files on the classpath just like all other assets.
You are correct ofc but you can try the convention first and if that fails just try the ordinary way.
private void load(final String assetName) throws ResourceNotFoundException, IOException {
URL resource = getClass().getResource("/assets/" + assetName + "/" + assetName);
if (resource != null) {
// Cool, maybe there are metadata files an editor can make use of
URL metaResource = getClass().getResource("/assets/" + assetName + "/" + assetName + ".meta");
if (metaResource != null) {
System.out.println("Found some metadata");
}
} else {
resource = getClass().getResource("/assets/" + assetName) ;
if (resource != null) {
System.out.println("Old school asset file");
}
}
if (resource == null) {
throw new ResourceNotFoundException("Unable to find asset: " + assetName) ;
}
}
That doesnât seem any better to me than just looking for the extensions one is interested in. For every user who finds it convenient to have everything in one directory, there will be one user who wonders why a directory has a file name. Never mind that to add metadata to an existing file you now have to do a bunch of directory juggling.
Not a fan, personally.
For renaming/moving around a directory can help to keep everything together. inside that directory all the different files have the same name.
MyFooMaterial/
Material.frag
Material.vert
Material.meta
âŚ
Maybe that solves the problem you discuss here? Maybe not
Seems a pretty huge confusing price to pay for a teeny tiny microscopic convenience of not having to ctrl+click all of the files you want when dragging.
Not to mention that itâs a CORE change to support editor metadata and weâve already discussed we are 100000% not making core changes to support editor metadata. Editors are on their own.
So if the engine has to be hacked to load âLighting.j3md/Lighting.j3mdâ instead of âLighting.j3mdâ (why am I the only one that finds that absurd?) itâs not going to fly.
What about materials that share the same .frag or .vert?
I donât know why you find that absurd - canât help you there
But I think you missed something because it shouldnât be âinsteadâ. Core could try the directory name-mumbo jumbo first and if that does not work it can fall back to the current behavior. The Core should not load metadata files, it only have to follow the same naming convention when looking for assets. Editors can use the naming convention to predict where metadata files are and load them however they like.
Shared shader files - exactly the same as now. It must of course be a backwards compatible change.
So, requirement number one: we will not be making core changes to support any editors.
âŚthat pretty much rules the subdirectory thing out. Itâs ugly and it has no real use other than shoving random metadata files in.
If you want to put all of your material files into a single subdirectory then do that. There is no reason to confusingly name that subdirectory with a redundant .j3md name.