PDA

View Full Version : Max script being random in evaluation ?


johanflood
01-21-2008, 08:44 AM
I am going trough a bunch of files and I want to make a screengrab of the object in each file. I want to have a unified appereance ot the objects. The following function is used within a larger script and when I run it in the listener it works fine. As soon as I incorporate the function into the larger script it seems like some steps are missing. There is no error reports even if I remove the disable screen redraw but it does not seem to change the fov of the camera for example. Is there a more efficient/reliable way of doing this ?



function getScreengrab Inputobject =
(
if isValidNode Inputobject do
(
screencapture
disableSceneRedraw()
select Inputobject
CenterPivot Inputobject -- mapped method
InputObject.pos=[0,0,0]
IsoMatrix = (matrix3 [0.70931,-0.405152,0.576829] [0.704897,0.407688,-0.58044] [0,0.818317,0.574768] [-0.236806,-0.543412,-241.063])
max unhide all
max hide inv
max zoomext sel
viewport.setLayout #layout_1
viewport.setType #view_persp_user
viewport.setTM IsoMatrix
viewport.SetShowEdgeFaces false
viewport.SetRenderLevel #smoothhighlights
viewport.setGridVisibility #all false
thumboutPath = (outputPath+"\\"+GetMaxShortFileName()+"_screengrab.jpg")
max zoomext sel-- zoom in
macros.run "Lights and Cameras" "Camera_CreateFromView"
camerascreen = viewport.getCamera()
camerascreen.fov = 27
enableSceneRedraw()
forceCompleteRedraw()
screenCapture=gw.getViewportDib()
ScreenCapture.filename = thumboutPath
save ScreenCapture quiet:true
)
),


thanks,

Johan

RustyKnight
01-21-2008, 08:54 AM
It's kind of hard to tell fully, it might be having problems on particular objects or scenes.

One question though, is the statement "screencapture" a function? If it is, it should end with closed brackets ie "screencapture()"

Shane

johanflood
01-21-2008, 09:23 AM
thanks for the reply. I have run the same objects trough in the listener and that work fine so it is rather confusing.

btw screencapture is a variable.

RustyKnight
01-21-2008, 09:35 PM
Okay, if the function is operating in isolation, then there may be an issue with the script somewhere else and it is only manifesting itself here...

Get out the format commands...

Shane

CGTalk Moderation
01-21-2008, 09:35 PM
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.