Unique name for each rendered frame


Hi all,

I could use some help with a special issue.
I´d like to render an animation. Each frame of the animation contains only one object with an unique name.
It is important that the rendered image has the same name as the object in that frame. Otherwise it would be really time-consuming to figure out which object is in which image.

Is there a way to do this with maxscript (or dotNet)?
I know i can go to each frame, create a output name and render it.
But then i will end up with hundredths of renderjobs.

Any chance i can do this with only one renderjob?
For instance replace the default extension(001, 002,…) with the name of the object?

Thanks a lot.


Just thinking of the top of my head you might try a post render script that just renames frames based on the object that was in the frame.


Thanks for the idea, viro.
I´ll give it a try.


You know I have a script that renders one object in selection out at a time. Not sure if it will work for your needs but it might. Let me know if your interested and I will post it.


i’m interested :slight_smile:
if i knew how you call render for some object i would show how to use .net FileSystemWatcher for some file checking (renaming) tasks.


I highly doubt this wil be that interesting to you Denis. I’m just taking a selection of objects and unhiding them one at a time.

$objects.primaryVisibility = false
if $ != undefined then 
for i = 1 to $.count do
local fileName = getFilenameFile rendOutputFilename
local fileExt = getFilenameType rendOutputFilename
local fPath = getFilenamePath rendOutputFilename 
local render_Output = (fPath + filename + "_" + $[i].name + fileExt)
$[i].primaryVisibility = true
render outputFile:render_Output
$[i].primaryVisibility =false
messagebox "Nothing was selected"
$objects.primaryVisibility = true 


Thanks viro.
I´m kinda busy atm, but i´ll check it out a little bit later.


this is not a batch render. it’s easy. you can rename the files after render finish. only thing that you has to know when it be happen :wink:

ok. the FileSystemWatcher it’s exactly for that:

try(fw.Dispose()) catch()
fn fileWatcherOnChanged s e = 
	format "%: path:% name:%
" (e.changeType.toString()) e.FullPath e.name
	if doesfileexist e.FullPath do
		id = genClassID returnValue:on
		name = (getfilenamepath e.FullPath) + (trimright e.name "0123456789") + "_" + (id as string) + (getfilenametype e.FullPath)
		act = renamefile e.FullPath name
		format "	%: % -> %
" act e.name id
fn fileWatcherOnDeleted s e = 
	format "%: path:% name:%
" (e.changeType.toString()) e.FullPath e.name
fn fileWatcherOnRenamed s e = 
	format "%: path:% name:%
" (e.changeType.toString()) e.FullPath e.name
fn fileWatcherOnCreated s e = 
	format "%: path:% name:%
" (e.changeType.toString()) e.FullPath e.name
fn setFileSystemWatcher path: pattern:"*.*" name:"" active:on = --if doesfileexist path do
	fw = dotnetobject "System.IO.FileSystemWatcher"
	dotnet.setLifetimeControl fw #dotnet
	if path == unsupplied do fw.Path = @"c:	emp\preview\" 
	if pattern == unsupplied do fw.Filter = "*.tga"
	dotnet.addeventhandler fw "Changed" fileWatcherOnChanged
--	dotnet.addeventhandler fw "Deleted" fileWatcherOnDeleted
	dotnet.addeventhandler fw "Renamed" fileWatcherOnRenamed
--	dotnet.addeventhandler fw "Created" fileWatcherOnCreated
	fw.EnableRaisingEvents = active
fw = setFileSystemWatcher()

try to render anything in “c: emp\preview” directory which i’m watching…

File exist issue with maxscript

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.