Notifications
Clear all

[Closed] Adding a PreRender script

Hello everyone!

This might be a noob question, but can’t figure this out. I’m quite new to MAXscript, and i have this simple problem:
I’m trying to make a script which renders from multiple cameras, and I would like to run a Pre-render script before every camera, which rotates planes (cutout people) facing the camera.

For the rotating I have a script “rotPeople”, which is loaded from an mcr file. If I run it from MAX manually (I hit X, and type “rotPeople”) it runs OK.

Now I try to make this a Pre-render script, so I in the listener I type:

callbacks.addScript #PreRender “rotPeople”

the listener output says “OK”.
But when I hit render, the script does not run, the planes don’t rotate.

If I try:

callbacks.addScript #PreRender filename:”<file path>”
the listener output also says “OK”.

But when hitting render, I get an error saying: “–Runtime error: fileIn: can’t open file – <file path> “

What am I doing wrong?

Thanks for the help,
sassom

4 Replies
(
	global RotPeople 
	fn RotPeople =
	(	
            --here you can just put the function for rotation    
	)	
	callbacks.removeScripts id:#preRenderrotPeople
	callbacks.addScript #preRender "RotPeople()" id:#preRenderrotPeople
)

Thanks for the help, this worked!

Also, I figured out that when referring to an .ms file, I can’t define it with a single string, but only by using the function:
pathConfig.appendPath <foldername> <filename>

So this method worked as well.

Sometimes using this method, i get an error. My code looks something like this:

global filepath
filepath = path_string
fn save_cc =
(
vfbcontrol #saveglobalccpreset filepath
)

callbacks.addScript #postrender “save_cc()”

Sometimes I get a popup window with this message:
callbacks.setScript “wanted 1, got 3”

Some other time I run the same script, and it works.

What causes this?

Why you just add script and don’t remove it back?