How to get and create redshift light groups with python?
-
Hi everyone~
How did i create and get redshift light groups with python ? -
Hi,
A part of the information was on the redsfhit forum.
Light group parameter on the light itself is only a string and you can change it as any other string.
Creating the AOV is also straight forward once you have the code ^^. Just be careful with the name you are using for your groups they must match. For the AOV, to activate the checkbox of the lightgroup themself, you must define the parameterREDSHIFT_AOV_LIGHTGROUP_NAMES
with the name of the light group separate by a newline symbol\n
like somyLightGroup1\nAnotherLightGroup\n"
import c4d import c4d.documents import redshift def CreateAOVs(vpRS): aovs = [] # Create a new AOV and define different parameters. aov = redshift.RSAOV() aov.SetParameter(c4d.REDSHIFT_AOV_TYPE, c4d.REDSHIFT_AOV_TYPE_BEAUTY) aov.SetParameter(c4d.REDSHIFT_AOV_ENABLED, True) aov.SetParameter(c4d.REDSHIFT_AOV_NAME, "My Beauty") aov.SetParameter(c4d.REDSHIFT_AOV_LIGHTGROUP_NAMES, "myLightGroup1\nAnotherLightGroup\n") aov.SetParameter(c4d.REDSHIFT_AOV_FILE_ENABLED, True) aov.SetParameter(c4d.REDSHIFT_AOV_FILE_PATH, "C:/MyAOVs/MyBeauty") # Insert the AOV in the list aovs.append(aov) # Set the AOVs list in the Redshift postEffect. return redshift.RendererSetAOVs(vpRS, aovs) def main(): doc = c4d.documents.GetActiveDocument() # Create two ligths and insert them in the document light1 = c4d.BaseObject(1036751) light2 = c4d.BaseObject(1036751) doc.InsertObject(light1) doc.InsertObject(light2) # Define the light group is as simple as setting a string for this parameter light1[c4d.REDSHIFT_LIGHT_LIGHT_GROUP] = "myLightGroup1" light2[c4d.REDSHIFT_LIGHT_LIGHT_GROUP] = "AnotherLightGroup" renderdata = doc.GetActiveRenderData() # Get the Redshift videoPost and render settings vprs = redshift.FindAddVideoPost(renderdata, redshift.VPrsrenderer) if vprs is None: return CreateAOVs(vprs) if __name__=='__main__': main()
Cheers,
Manuel -
@manuel
Cool ! Thank you ~