How would i go about adding a render element with python?
In maxscript
r = maxOps.GetCurRenderElementMgr()
r.AddRenderElement(CMasking_Mask)
And in python
r = MaxPlus.RenderSettings.GetCurrentRenderElementManager() r.AddRenderElement()
Pythons AddRenderElement calls for the Class_ID, but i have zero idea how to get hold of that.
Cheers,
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
So I've managed to add a standard render pass, in this case Alpha
rndr_elem_mgr = MaxPlus.RenderSettings.GetCurrentRenderElementManager() alpha_elem = MaxPlus.Factory.CreateRenderElement(MaxPlus.ClassIds.alpha) rndr_elem_mgr.AddRenderElement(alpha_elem)
With that, how would i add render elements from 3rd party renderers? CMasking_Mask from Corona for instance.
Again, it works in maxscript with
r = maxOps.GetCurRenderElementMgr() r.AddRenderElement (CMasking_Mask elementname:"CMasking_Mask")
Cheers,
If there's no predefined ClassID, construct the ClassID yourself with MaxPlus.Class_ID(idA, idB)
You can get the ClassID parts in the listener with CMasking_Mask.classID
Fantastic. That's a much better way. The solution i knocked together calling Maxscript from python and string format for params that i needed. But i'd much prefer to run straight python.
maxscript = """ r = maxOps.GetCurRenderElementMgr() r.AddRenderElement (CMasking_Mask elementname:"CMasking_Mask_{}" mode:1 objectROn:true objectR:{} objectGOn:true objectG:{} objectBOn:true objectB:{}) """.format(inc, id[0], id[1], id[2]) MaxPlus.Core.EvalMAXScript(maxscript)
Thanks again,
Can't find what you're looking for? Ask the community or share your knowledge.