On 11/03/2018 at 09:07, xxxxxxxx wrote:
I want to add some effects to my render settings such as AO, Hair render, GI, etc.
Logically, these effects should be added only once but if I'm executing this via Python script, it's adding these render settings, again and again.
for example, in this code, I'm adding AO effect to my render settings.
1. import c4d
3. def main(doc) :
7. renderData = doc.GetActiveRenderData() #Current renderdata
8. aoEffect = c4d.documents.BaseVideoPost(300001045) #Ambient Occlusion
9. renderData.InsertVideoPost(aoEffect) #Add AO to renderdata
11. doc.AddUndo(c4d.UNDOTYPE_NEW, aoEffect)
14. if __name__=='__main__':
When I'm manually performing this action via render settings, C4D hides this option from Effects popup menu since it's already added.
But when I'm doing this via my python script, it generates multiple AO effects. Seems like this is a bug/limitation.
I would like to check if the desired effect is already added to the render settings but they only option that I found is RenderData.GetFirstVideoPost()
I wonder if it is possible to find the desired effect and execute the code only if that effect is not added.
On 12/03/2018 at 03:05, xxxxxxxx wrote:
actually you are already half way there. Get the first VideoPost via GetFirstVideoPost() and then iterate through all via GetNext() comparing it's type ID (GetType()).
While in C++ documentation, the BaseVideoPost manual actually has a code snippet doing exactly this and shouldn't be hard to do the same in Python. Which is not supposed to mean, you shouldn't ask, if you run into problems, of course.
On 12/03/2018 at 03:21, xxxxxxxx wrote:
I forgot: This is not a bug at all.