We found a good workaround! We now made a custom commandline plugin where we can add our own arguments. And it works great. If anybody in the future has this issue you can always contact us and we will help.
Thanks again everybody for all the help!
Would still love if you guys can create something that enabled you to change assets paths with python.
Hopefully it can be added to the feature list.
Thank you very much for this respond.
The method below is something we tried in the past but it's not updating all types of materials and assets. We got many unexpected results with this. It never works correctly it seems. And because you need to use the prober ID it faces the same limitations.
wrt textures used in external materials whose parameters are not handled using Cinema 4D parameters description (see Octane materials definition) it's up to the external renderer vendor to eventually provide a python API to access and manipulate their materials
Yes we are fully aware of this. But this is all not needed in my option. If we go to the project asset inspector and manually change the path of the file. No matter if it's octane a node material or an object in the scene. The path will update inside C4D. With that in place it sounds very easy to be able to update the path with Python.
With the SetAllAssets() command pass the same dictionary back just with adjusted paths. This was just my idea but there probably way beter solutions for this. The goal is, adjust path of the assets inspector.
For our render farm (Drop & Render) we upload a project from a user and render this on our farm. For this all assets of the project must of course be relinked or need to be relative.
To do this we have special script that run and can change any path before the jobs starts running. But one thing is currently not possible. (Or not so far I know of) And that is changing the paths that are in the project asset inspector. You can get all assets with GetAllAssets() or GetAllTextures() but there is no SetAllAssets where you can give it a dictionary back. Our current workaround is that we always duplicate and save the project before uploading to make all paths relative. With the a function like above this would not be necessary anymore and we can upload without any extra steps.
We tried multiple workarounds, looping over all textures for example. You can get pretty far, but node materials have no python accessibility and some third party render engine are pretty hard to get the textures. For example Cycles4D does not have a python functions.
Long story short. It would be so powerful for us if we can adjust all assets in the Project Asset Inspector with something like SetAllAssets. I know a few more people have requested it, is this something you guys can create?
Thanks in advance!
Thank you for the response, we are trying out a few others methods now. There is not much confidential, it just comes down to our current queue manager software and workflow methods here, and with that this option from Zipit is not ideal.
Thank you very much for all the support guys, I will update this post when we know more.
This is exactly what I also need, only just for Python.
Thanks Zipit and PluginStudent,
@PluginStudent I already use the Pluginmessage function, see example below.
def PluginMessage(id, data):
if id == c4d.C4DPL_COMMANDLINEARGS:
argstring = ' '.join(sys.argv)
if "- customsubs" in argstring:
But than you have the problem that is not running before the -render command just like you said. It all about the order of operations I think. Cinema needs to wait until the script is done before starting the render.
@zipit Very interesting and something to look at. I already have another workaround. I can set a RenderDocument function in the script. Meaning I will do everything from the script. Making the adjustments and also the rendering. Skipping the whole -render.
But I like to do it with the method above for many reason to long to explain:D Something like this must be possible right? Or maybe not
I'm trying to run a python script before running a command line render. For example, change the subdivisions of a scene before you render the project.
The problem is the order of operations. The example below doesn't work.
The custom script is called -customsubs and works with the C4DPL_COMMANDLINEARGS function.
"C:\Program Files\MAXON\Cinema 4D R21\Commandline.exe" -render%userprofile%\Desktop\test.c4d -frame 0 0 -oimage %userprofile%\Desktop\test -omultipass %userprofile%\Desktop\test_mp -oformat TIFF -customsubs
I found a user with a similar problem but he is using C++ and this method of priorities is not working with python as far as I know.
Link to user with same problem
So the questions is: How can I run a custom python script before the -render command?
Did some testing, it seems there is a bug with the intersection selection. It does not work correctly when you enable "hide new lines" previously this was working.
In the file I added you can see the incorrect intersection. If you turn off hide new lines it seems to work again. But this was previously working with this option turned on.
Hopefully Maxon can fix this issue.
Hi mp5gosu & Andreas,
Thanks for the help! This should do the trick!
I need to convert this to Python, since I don't know C++, should start learning that soon.
Any help with this would be awesome of course!
And thanks for the change to the new workflow, will keep this in mind!:)