Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

adding render elements with python?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1168 Views, 3 Replies

adding render elements with python?

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,

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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,

Message 3 of 4
Swordslayer
in reply to: Anonymous

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

Message 4 of 4
Anonymous
in reply to: Swordslayer

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.

Post to forums  

Autodesk Design & Make Report