Per-pass scripts

Per-pass scripts

Postby duke » Thu Jun 28, 2012 6:41 am

I'm trying to make a script that sets the camera clipping range, but I can't work out how to restore/reverse what i've done for other passes.

Here's what i've got at the moment - how do I explicitly respond to the Pre and Post evals (post i'd restore the settings)

Code: Select all
renderCamera = viewport.getcamera()
cameraNear = if(renderCamera.nearClip == undefined) then renderCamera.clip_near else  renderCamera.nearClip
cameraFar = if(renderCamera.farClip == undefined) then renderCamera.clip_far else rendercamera.farClip

print (renderCamera.Name)

near = 0.01
far = 50

setNearFar renderCamera near far

fn setNearFar camera near far =
   setNear camera near
   setFar camera far

fn setNear camera val =
   if(camera.nearClip != undefined) then
      camera.nearClip = val
   else if(camera.clip_near != undefined) then
      camera.clip_near = val

fn setFar camera val =
   if(camera.farClip != undefined) then
      camera.farClip = val
   else if(camera.clip_far != undefined) then
      camera.clip_far = val
Posts: 7
Joined: Thu Dec 18, 2008 5:51 am

Re: Per-pass scripts

Postby RGhost » Mon Jul 02, 2012 7:21 am

You can try store original clipping data in Global scope and then restore from it.
Royal Ghost |
Posts: 11
Joined: Wed Nov 03, 2010 9:33 am
Location: Moscow/Russia

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests