How do I access Redshift AOV settings from Python?
-
So once I have the BasicVideoPost object for the Redshift settings:
rdata = doc.GetActiveRenderData() vpost = rdata.GetFirstVideoPost() assert vpost.GetType() == 1036219
How do I access the data highlighted in red in the gui screencap below?
Querying the REDSHIFT_RENDERER_AOV_COUNT:
num_aovs = vpost[c4d.REDSHIFT_RENDERER_AOV_COUNT]
yields 3, as I would expect, but from there I don't know how to get/set the settings data for any of those three AOVs.
Update: I noticed relevant constants in vprsrenderer.h called REDSHIFT_RENDERER_AOV_LAYER_FIRST and REDSHIFT_RENDERER_AOV_LAYER_LAST, but trying to access any data using these results in a traceback:
aov_layer = vpost[c4d.REDSHIFT_RENDERER_AOV_LAYER_FIRST] Traceback (most recent call last): File "console", line 1, in <module> AttributeError: Parameter value not accessible (object unknown in Python)
-
Hi @jcooper, thanks for reaching out us
With regard to your question, the code below should help you getting things sorted out
import c4d import c4d.documents import redshift def PrintAOVs(vpRS): aovs = redshift.RendererGetAOVs(vpRS) for aov in aovs: print("-----------------------------------------------------------") print("Name :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_NAME)) print("Type :%d" % aov.GetParameter(c4d.REDSHIFT_AOV_TYPE)) print("Enabled :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_ENABLED) else "No")) print("Multi-Pass :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_MULTIPASS_ENABLED) else "No")) print("Direct :%s" % ("Yes" if aov.GetParameter(c4d.REDSHIFT_AOV_FILE_ENABLED) else "No")) print("Direct Path :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_FILE_PATH)) #print("Direct Effective Path :%s" % aov.GetParameter(c4d.REDSHIFT_AOV_FILE_EFFECTIVE_PATH)) # Available from 2.6.44/3.0.05 def main(): doc = c4d.documents.GetActiveDocument() renderdata = doc.GetActiveRenderData() # Get the Redshift videoPost and render settings vprs = redshift.FindAddVideoPost(renderdata, redshift.VPrsrenderer) if vprs is None: return PrintAOVs(vprs) if __name__=='__main__': main()
Last but not the least, I recommend to check also the Redshift official forum where it's likely that questions like yours could have been already answered.
Best, R
-
Wow, thanks for the example, @r_gigante.
Was it always possible to import a
redshift
module? Or is there any info from which version on (C4D / Redshift) this is possible!?Thanks,
Lasse