beside other things I am currently working on an automated asset importer which automatically converts my blender models (creates tangents, automatically adds particle effects, user properties a.s.o ), textures, … to jme file format.
I also want to create the external material definitions and for obvious reasons I would prefer to have them in the j3m format instead of the binary format using BinaryExporter.
But so far I couldn’t find any implementation for this (store material to j3m file format) apart from the “EditableMaterialFile” implementation within the SDK.
Is there anything in the core that I am missing? I only found the J3MLoader but no corresponding “writer”.
Should I use the implementation in the SDK? Or write my own and contribute it? Or are there any other plans - especially within the context that the SDK is no part of the “core” anymore?
The only reason against copying it into my project is, that then I would also need to migrate any new features also in “my” j3m writer. Which I try to avoid and which is exactly the reason why i am asking;) Don’t get my wrong - i don’t think that maintaining it myself would be a big problem, but just not my preferred solution…
I thought the common use case would be to also provide a command-line pipeline to import external models (like blender) into the jme project. Because personally I don’t like to do the same manual steps over and over again, whenever importing a new model/scene. But maybe thats only me and not common;) Or I am simply wrong;)
Anyway, thanks for your reply and willingness to help!
What you could do is make your own exporter.
WE have 2 examples of exporter : BinaryExporter and XMLExporter. They are both in com.jme3.plugin.
The binary one is the most commonly used as it’s responsible of saving the scenegraph to j3o.
You could make one that exports Material to J3m.
Yes - this is basically what I meant with “write my own and contribute it”. And using the JmeExporter interface might be the nicest way to do it. But I haven’t verified yet, if this is possible or if there is anything missing.
Ok, so I will do this and post the source afterwards - then anybody can grab it.
Btw - I’ve used the JmeExporter interface but this results in a lot of unsupported/not required methods, because the interface is more for a generic exporter and the j3m format is quite specific to materials… Anyway, it works;)
According to the wiki, J3M supports true/false. See the “Data Types” section
Boolean (basic Java type) true or false
Anyway, I’ve changed true/false to On/Off in the AdditionalRenderState section. Should I also do it in the MaterialParameters? I am asking because all the examples in the wiki use “UseMaterialColors : true” instead of “UseMaterialColors : On”
Edit: Btw - the “true” from “UserMaterialColors” also comes from the MatParam class
Looks like getValueAsString() needs to be fixed to take into account the changes to texture modes / quotes. The On / Off thing I meant only for RenderState, material parameters which are boolean use true and false like you mentioned.
I guess you “only” changed it in the repo? I am using the binaries from jcenter. So I would need to download the latest engine source, build it and change the dependencies in my project, i guess… Is there any other way, like nightly binaries from jcenter or something like this?
oh ok I thought you were running against master. Nevermind.
The more I think about it , the more I think this getAsString code should be in the exporter. IMO it’s the responsibility of the exporter to properly format data to to the proper output format.
It’s a bit as if we had a getAsXml or a getAsJson to export to xml and json…