A Simple Render Queue Script
Hello, people!
I have enough background in programming (C, C#, Python, ActionScript, Haskell, Go, Fortran, Assembly MIPS, Prolog...) and I want to make a script or plugin that is quite similar to a Render Queue, but one that requires the least human input.
This is the plan:
1. I have a .txt file with the path to the scenes like this:
C:\scene_1.dufC:\scene_2.dufC:\scene_3.duf
2. The script will locate and open this file
3. Open the scene from the first line and remove it from the .txt
4. Render the scene
5. Store the render png or jpg in a specific folder
6. Repeat steps 3 to 5 until the .txt file is empty.
I believe it's doable because there are a few other plugins in the Daz Store that do this (except they require human input to generate the render queue).
The .txt file is already being generated by a Python script that I already have.
Thanks in Advance,
Oppai-Man
Comments
Well, first use / and not \ as your folder separator in the text file (or use \\). The samples in http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#general1 should help with the actual rendering. http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/assetiomgr_dz covers loading a file from a location.
Awesome!
I managed to:
I still need to learn the following:
This is my code so far
DzFile http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/file_dz will handle loading the file, then you just need to parse it (actually, DzFile has an option to read a line so if you have a path per line that should do you).
Assuming that double-clicking a Pythion script would run it you could use this sample to show how to get the OS to perform the default action for your Python script http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/general_ui/display_document_dynamic/start
Thanks!
I managed to read a .txt file line by line with this code:
Using the OS to double click a file was so easy with a single line of code:
I just had to write a .bat file that would actually invoke the Python script.
I think I have everything I need for now to build my Render Queue Script. Time to build it!
I need to learn two more things:
2. there isn't a memory of the order in which cameras were used so if you don't mean the current camera I'm not sure it can be done procedurally.
1. I have a couple of scripts that should show how to achieve this, if you can follow my less than exemplary coding
https://www.dropbox.com/s/r492h6pmwxwhbzv/CameraPicker.zip?dl=0
https://www.dropbox.com/s/gxvyefaoptw701e/Camera steppers.zip?dl=0
I was coding and a curiosity came up: Do we have access to Linting, autocomplete and other nice-to-have IDE features? I'm coding in the "Script IDE" Pane right now.
I'm trying to access this sample script that "Sanitizes my file path", but I get a "Permission Denied" error message.
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/general/sanitize_file_path/start
Another question: How do I stop an ongoing process? In the CMD, I can Ctrl+C to Interrupt a process or close the cmd window. How do I do something similar in Daz Script?
We had more features in DS 2, but when the script support changed with the Qt update for DS 3 we lost most of them. Autocomplete was certainly one, and very useful.
https://www.daz3d.com/forums/discussion/comment/4911536/#Comment_4911536
Me too.
My script for rendering static scenes is working fine so far! Thanks, Richard!
Now I want to add the ability to render animations, but selecting the start and end frames.
I looked into the documentation. These frame render settings seem to be controled by "startTime" and "endTime", which depend on the FPS of the Timeline Pane.
How do I get the FPS number from the Timeline pane? Or as an alternative, how to directly set the start frame and end frame as
You can get the interval between successive frames from DzScene http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/scene_dz#a_1a8b20c9c5f04e0fa79e7bd5335f87dc39
It worked like a charm! :)
Is there an easy way to set "Max Samples" and "Max Time" from Daz Script? I found this sample script, but it's not clear how can I read and modify these propertier.
You would, I think, need to find the property - you can see the label in the pane and get the name from Parameter Settings via the gear icon on the right of the property widget.
The only piece of script I was missing to modify these properties was the following
With this extra script, and this this sample script, I'm capable of rendering scenes either as previews (small number of samples), or as they were intended to be rendered.
I use Visual Studio Code with TypeScript and mantain my own typings.
Is there a way to "shut up" these log.txt errors from apearing in my script log
It's okay that these errors exist, but the problem is that my print() debugs are gettings lost in the middle of those.
Not as far as I am aware. Could you create a separate log file of your own, and just use the standard one for logging the creation/closing of the special file?
Is there a way to use Daz Script to disable or enable the use of Canvases? This would make my render queue much smarter.
No, or not in a published (and so stable) form. It might be possible to get the pane and then find the relevant control, but that could well change in future updates. I don't haev a link to hand but finding cotnrols in panes has been didcussed here in the past if you wish to pursue that course, at your own risk.
That sounds like something that might consume a lot of time and a little bit hacky. I'll prioritize scripts that are easier to implement.
I had another idea. I can create a few "Render Settings Presets" beforehand, one for enabling canvas, and another for disabling canvas, and merge them into the scene using Daz Script.
What Daz Script can I use to merge a Render Settings Preset into the scene?
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz#a_1a73a08387feb791dd038d0a2030b6cc9a
For anyone that might need to make a Render Queue Script, I learned one extra thing to share.
Your script has to sleep for a few seconds after opening a scene, wait until Daz starts rendering the scene on the viewport so it can fix clothing fitting problems, and then you can finally start rendering.
Also, In my script I added a call to Garbage Collection (cg()) just because I felt the memory usage was unusually high after running the script for a while