|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| script at render, frame value
|
|
|
Hi, I’ve got a simple script that changes the substitute object according to slidertime. Unfortunately the slidertime doesn’t change while rendering. How can I implement the actual rendered frame number?
|
|
|
|
<del>Try using Maxscript Callbacks. They have a callback for #preRenderFrame and #postRenderFrame that you might find useful.
This is in the MAXScript reference under Callbacks: General Event: Rendering Notifications</del>
EDIT: I take it all back! Tested… giant crash. *tear*
thedour.net
Render 3D @ ScriptSpot.com
|
|
|
|
Gotta love CTDs - especially self-inflicted ones ;)
A quick question for you (apologies to the OP, but it is “on topic”, if tangential to the stated question).
In a normal controller script, e.g. a “scale script” attached to the Scale track of a dummy object, is there any way to tell that max is “rendering” as opposed to “playing” or having the Slider bar scrubbed? A System Global (which I can’t find) maybe?
Reason being, you can do almost anything in one of those scripts, so if it “knew” it was being rendered…
An example might be this thread which clearly alters the topology of the objects and doesn’t crash (or at least I don’t think it does). Something along those lines combined with the Frame and an “isRendering” might do the job.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
I don’t know of anything. I know globals are evil and all that, but…
You could make a script, with pre/post render callbacks, where each toggles a boolean global. isRendering = true/false.
This would have to be in your startup folder or something like that so that the callbacks get registered in each max session… otherwise your controller pointing to “isRendering” will freak out.
Author: thedour
|
| Replied: 06 April 2010 03:09 PM
|
|
|
|
|
|
I’d considered that but was hoping there was a pre-defined means of obtaining the “Max Status” rather than having to do it manually. The overall idea may work though - any “gotcha’s” you can think of which would prevent this working reliably? Always assuming you can do the replacement in such a script - I tried (briefly) creating a new Box at a given time. It wouldn’t render the box, but it appeared as soon as the render ended. Needs more investigation, I think.
Author: Steve_Curley
|
| Replied: 06 April 2010 10:46 PM
|
|
|
|
|
|
I can’t think of gotchas with that. In the SDK, .net under ManagedServices there is a “AnimationFrameChangeListener” class that may be useful (might work at both render time and slider changes).
It may be easier with something like this to simply create a custom “render frames” script… something that would actually stop render, advance slider time (and change mesh as necessary), render next frame, and then at the end combine them into a movie. I kind of do that in my script: <font color=red>Render 3D v1.3</font>, but I’m not breaking render per say; though you can look at the code and see how I’m adding support for .MOV by combining bitmaps.
Author: thedour
|
| Replied: 07 April 2010 06:04 AM
|
|
|
|
|
Maybe the example from the help (How To ... Create a Quick Preview) will help?
macroScript QuickPreview category:"HowTo" (
preview_name = (getDir #preview)+"/quickpreview.avi"
view_size = getViewSize()
anim_bmp = bitmap view_size.x view_size.y filename:preview_name
for t = animationrange.start to animationrange.end do
(
sliderTime = t
dib = gw.getViewportDib()
copy dib anim_bmp
save anim_bmp
)
close anim_bmp
gc()
ramplayer preview_name "" )
[edit] Ok, their is a modification of mxs-help example.
(
objs = #(box, cone, sphere, teapot)
tmp1 = (objs[random 1 4]())
outFile = (getDir #preview)+"/test.avi"
anim_bmp = bitmap renderWidth renderHeight filename:outFile
for t = animationrange.start to animationrange.end do
(
sliderTime = t
tmp2 = (objs[random 1 4]())
instanceReplace tmp1 tmp2
delete tmp2
frame = render()
copy frame anim_bmp
save anim_bmp
)
close anim_bmp
freeSceneBitmaps()
gc()
)
Max 9 through 2009, XP-Pro x64 SP2
ASUS EAH3450 Series (Driver 8.470).
Core 2 Duo E8400 3GHz, 4Gb Ram, DX9.0c.
|
|
|
|
|
|