Notifications
Clear all

[Closed] Render Element properties

Hi guys!

I’m trying to access render elements with MXS at the moment and I’m a bit of a nub when it comes to MXS.

What I’m trying to acheive is creating elements via a loop which will end up creating passes.

So far things are going well but I’ve hit a hitch. I’m struggling to change specific properties of a render element.

Here is my test code so far:


re = maxOps.GetCurRenderElementMgr()
eType = alpha
eName = "test"
eEnable = on
renderOut = "c:\	est.jpg"
re.addrenderelement (eType elementname:eName enabled:eEnable)
re.SetRenderElementFilename(0) renderOut

Now this is fine assuming the element is added to an empty list ensuring the index is at 0.
I see two solutions for this but can’t work out the code or if it’s possible.

  1. Can I set the index of the newly created element as it’s created? I’ve tried an “index:1” type thing in the addrenderelement operation but it doesn’t work.
  2. Can I set the render element’s output path as it’s being created?

When it comes to this type of thing where the macro recorder not listening to these types of operations, how do you usually get around this? I’ve managed to find a few properties (eg the enabled:on property) but it’s always a guessing game for me…

Any help is appreciated!

Cheers

2 Replies

You can set the output using a helper function to get the element index:


  fn getRenderElementIndex re element = (
    	index = undefined
    	i = 0
    	while i < re.NumRenderElements() and index == undefined do (
    		if ((re.GetRenderElement i)== element) do index = i
    		i += 1
    	)
    	index
    )

    re = maxOps.GetCurRenderElementMgr()
    eType = alpha
    eName = "test"
    eEnable = on
    renderOut = "c:\	est.jpg"
    element = (eType elementname:eName enabled:eEnable)
    re.AddRenderElement element
    re.SetRenderElementFilename(getRenderElementIndex re element) renderOut
    

Regards

Great thanks! I’ll give it a shot.