Why am I getting this weird error on a PreFrame maxscript I’m trying to run in a 3ds Max job?
The script works perfectly fine in Max, no issues, no errors, but Deadline keeps on complaining! I tried returning a string value, a True, an undefined value… nothing works! Deadline just won’t render the job because it thinks the script didn’t return “success”. What does it even mean?! What does Deadline expect to get returned by the script then?
As a side note, this script should return a value from the scene taken BEFORE each rendered frame (submitted as a PreFrame script) and then write it to the infoStamp (a feature of finalRender), but I’m NOT getting any updates on the infostamp! Only the first frame’s values are being written, then it doesn’t change.
Could this be Deadline related? Or is it a Max issue?
Hi,
Essentially - “–return true if the task has finished successfully, return false to fail the task.”
Check out the “\Deadline\submission\3dsmax\MAXScriptJobTemplate.ms” example (also below), particularly the 2nd to last line:
[code](
local du = DeadlineUtil --this is the interface exposed by the Lightning Plug-in which provides communication between Deadline and 3ds Max
if du == undefined do --if the script is not being run on Deadline (for testing purposes),
(
struct DeadlineUtilStruct --define a stand-in struct with the same methods as the Lightning plug-in
(
fn SetTitle title = ( format “Title: %\n” title ),
fn SetProgress percent = (true),
fn FailRender msg = ( throw msg ),
fn GetJobInfoEntry key = ( undefined ),
fn GetAuxFilename index = ( undefined ),
fn LogMessage msg = ( format “%\n” msg ),
CurrentFrame = ((sliderTime as string) as integer)
)
du = DeadlineUtilStruct() --create an instance of the stand-in struct
)–end if
du.SetTitle "MAXScript Job" --set the job title
du.LogMessage "Starting MAXScript Job..." --output a message to the log
local st = timestamp() --get the current system time
--YOUR SCENE PROCESSING CODE GOES HERE
du.LogMessage ("Finished MAXScript Job in "+ ((timestamp() - st)/1000.0) as string + " sec.") --output the job duration
true --return true if the task has finished successfully, return false to fail the task.
I think you’re trying to add some tech overlay to the rendered frame, such as the frame number? right?
If so, I think you would be better using a “PostFrameScript” as the PreFrameScript is executed before the 3dsMax lighting plugin updates the frame to be rendered I think.
HTH,
Mike
Well, unfortunately, I don’t get any data updates from the scene file, no matter if I submit a Pre or Post frame script.
I still get frame 0 and the frame 0 position of the GeoSphere. The rendered images are correct, but the script’s output is “static” as in it returns values from frame 0, always.
instead of currentTime ?
DeadlineUtil is the interface exposed by the Lightning plugin communicating between Deadline and Max.
.CurrentFrame should contain the frame Deadline is attempting to render.
I thought about mentioning that, but I knew you were smart
What I think happens is that the Max file is loaded (as usual) on frame 0. Max generally saves and loads on frame 0 (which btw. explains why saving an autobackup file causes PFlow to update itself etc.)
I assume that Deadline does not change the scene time, it just calls the RENDERER with the correct time. But the script is evaluated outside of that call (either before or after the renderer is called, hence the “PreFrame” and “PostFrame” naming), and the scene appears to MAXScript to be on frame 0 all the time even though it renders correctly. So you have to enforce your time context when asking for properties, or you would always get the currentTime of 0 instead.