I’m giving the Export Layers script some love, particularly I want to add the ability to save other file formats, notably EXR. Since the script just calls node.save() (docs) under the hood, it’s ridiculously simple to do: all you do is change the file name to "foo.tiff" to say tiffs, "foo.kra" to save a Krita file, etc.
But with EXR, though node.save("somelayer.exr", ...) produces valid EXR files, they’re blank (black). If you turn off batch mode it brings up the EXR save dialog for each layer, and that works, so I’m guessing that the exportConfiguration parameter that you’re supposed to pass to node.save() is incorrect. Does anyone know how to set it for automatic saving of EXRs?
When you use the dialog, the configuration you last used will show up in your kirtarc file in XML format. If you convert that into an InfoObject, it will work same as the dialog. In this case only parameter for InfoObject is flatten.
I’ve saved as an EXR, then saved the .kra file and extracted the contents but I can’t find anything in the XML in the Krita file. Is it supposed to be in maindoc.xml or documentinfo.xml, or somewhere else?
The kritarc is Krita’s configuration-file in %LOCALAPPDATA%.
Michelist
Oh, I’m so dumb. I assumed that kritarc was a typo. Thanks.
It actually works out better to do the first save not in batchmode, so that the user can adjust the settings, then go into batch mode for all subsequent saves. Is there a method in the api where I can get the export configuration preferences that the first save generates?
I’m trying print(Krita.readSetting("ExportConfiguration-application", "x-extension-exr", "")) and I just get “1000”
You can access kritarc data via readSetting, for exr it will be ExportConfiguration-application/x-extension-exr
Effectively ExportConfiguration-%MIME-TYPE YOU SAVE%
so:
xml = Krita.instance().readSetting(None,'ExportConfiguration-application/x-extension-exr',None)
Edit: Groups are marked with square brackets, not dashes/slashes
Great, I’m on track. Thanks. Part of my trouble is that I’m using the Scripter script to run code snippets and I didn’t realise you have to save the script before you run it, so it was giving me results from a previous script. That is such an annoying design.
So now I have my XML I just have to parse it and turn it into an infoobject
You don’t need to save it to run the script, but previous results will show until you clear it
Maybe if you save a file before that happens? Don’t use save so wouldn’t know