Adding object ID to element name

selection[i].gbufferchannel = i
element = MatteRenderElement()
element.elementName = (selection[i].name)
element.gbufID = i

I am looking to convert a piece of code to give the element name as the object ID + the object name. The rest works fine. I have tried this below as well as other variations with no luck. I have looked through the maxscript help files but not being very experienced scripter cant figure it out.

element.elementName = (selection[i].gbufID + _ + selection[i].name)

I would like it to read something like "51_box001"

Any help would be much appreciated.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

selection[1].gbufferchannel =

selection[1].gbufferchannel = 1
element = MatteRenderElement()
element.elementName = (selection[1].name)
element.gbufID = 1
element.elementName = ((element.gbufID as string)+ "_" + selection[1].name)

gbufID is a properti of MatRenderElement(). It is not a properti of geometry object.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.