How to check BaseVideoPost? (Bug?)
-
On 11/03/2018 at 09:07, xxxxxxxx wrote:
Hello, plugincafe:)
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 2. 3. def main(doc) : 4. 5. doc.StartUndo() 6. 7. renderData = doc.GetActiveRenderData() #Current renderdata 8. aoEffect = c4d.documents.BaseVideoPost(300001045) #Ambient Occlusion 9. renderData.InsertVideoPost(aoEffect) #Add AO to renderdata 10. 11. doc.AddUndo(c4d.UNDOTYPE_NEW, aoEffect) 12. doc.EndUndo() 13. 14. if __name__=='__main__': 15. main(doc) 16. c4d.EventAdd()
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:
Hi,
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.