query jit.gl.material for textures
Hi
I wonder if it is possible to query jit.gl.material on its textures. I want to create a little tool that allows me to copy the jit.gl.material's properties to the internal material of a drawgroup inside a jit.gl.model. sending "getdiffuse_texture" to jit.gl.material gives me an error.
the material editor is using lua to do something similar, but with the lack of lua documentation this code looks wizardly, besides it seems to copy the stored texture into a matrix in order to display it. but I would like to have the texture reference.
the problem could be easily solved if it was possible to reference a complete jit.gl.material to a drawgroup, but I havent found any hint's for this, eventhough the "getmaterial_dict $1" gives me a dict that looks awfully similar to the content of jit.gl.material.
you can send the message "export_material" to a jit.gl.material object, save the material file to disk, and then send the message "import_material" prepended with "sendmaterial" followed by the drawgroup index, to import that material to the gl.model drawgroup.
let me know if that doesn't do what you need.
referencing external gl.material objects from a gl.model drawgroup is not currently supported, but consider your feature request registered.
Rob, thanks for this quick answer. I am looking for a solution that is more interactive (I wanna animate some of the material properties).
So To be on the safe side:
Is there a way to query the jit.gl.material for its textures? When I import a jittermaterial and some textures (diffuse map or bump map) are included, how can I access them? I assume on import they will be converted into textures, right? If I can query the material for its textures, than I can pass all the material properties and textures to the drawgroup properties and textures.
the material file defines what textures are used. you can query that using dict tools or javascript upon import.
probably I phrased my question wrong: Is there a way to query jit.gl.material for the texture references (i.e. jit_gl_texture xxxxx_diffuse_tex) it creates and uses after the import of a material file? It is possible to set it via "diffuse_texture " but its not possible to query it via "getdiffuse_texture".
these are messages, so no, there is no way to query them after the fact.
can you not just capture and store any texture input to the gl.material yourself?
can you not just capture and store any texture input to the gl.material yourself?
absolutely. If its not possible then I will do just that. and maybe I will write my own jitter material importer, that would solve that problem :-)
thank you.
Why it doesn't work when I import a .PNG file into jit.gl.material? Because I tried to export material and it turned out to be a PNG file.
If PNG is not supported, that type of file can be imported?
Thanks.
Png is supported. Post a patch.