Render to Texture Issue - Renaming Existing Elements

Hello everyone, thanks for taking the time to read.

I’m trying to make a script that will alter some scene/material/uv parameters and rename all the existing render to texture elements of a given object into a specific path.

The first part of the script works great but I have really hit a brick wall with something so simple as changing a path and filename…

I’m having really weird issues, the code below only works occasionally. Sometimes it works 5 times in a row and sometimes not even once.

Should this code work?

sMapFolder= "C:\\1\\BakeOutput"
 
some other  stuff
 
...
 
The actual bake preparation function:
 
		np = $.INodeBakeProperties
		myElement = np.GetBakeElement 1
 
		fType = getFilenameType myElement.fileName
 
		myElement.fileName = sMapFolder+"\\"+("some string")+(ftype)

I have tried all I could think off but I’m unable to debug the issue, it’s really inconsistent. Funny thing, the RTT_Data array actually shows the correct path and the Listener shows the path and filename that was supposed to be applied.

Btw, the render elements are manually inserted, they vary from object to object, that is why they are not being added via maxscript.

Any tips would be great.

Thanks!

Comments

Comment viewing options

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

Just

Just make myElement.filenameUnique = true. Wish I knew that before spending so much time digging around the RTT scripts

Technical Artist @amplifycreates

Comment viewing options

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