[codesyntax lang=”python”]
#****************************************************** # Creates a pair of cameras in a vue scene for # rendering stereo position images # # - vuestereocamera.py # - By Mark Caldwell # - Version 0.1 # - 3rd September 2007 # - Copyright Mark Caldwell 2007 # - Tested with Vue 6.5 Infinite # # How to use in 3 easy steps # # 1. Download this file onto your computer # # 2. Position a camera where you want to render a # stereo image for and make sure it's your selected # camera # # 3. Then run script and wait for it to work # To run it go to Python -> Run Python Script # Then locate the file on your computer # #****************************************************** #------------------------------------------------------ # Get Input and Test Value is a positive floating point #------------------------------------------------------ def TestValAngle (messagetxt,titletxt,default): hit=-2 val=-1 while hit<0: try: if float(val)>0: hit=1; elif hit==-2: val=Prompt (messagetxt,default,true,titletxt) hit=-1 else: val=Prompt ("Error: Value must an positive number\n\n"+messagetxt,val,true,titletxt) except: hit=-1 val=Prompt ("Error: Value must an positive number\n\n"+messagetxt,val,true,titletxt) return float(val) #------------------------------------------------------ # Convert Degrees to Radians #------------------------------------------------------ def degtorad(deg): rad=deg*(math.pi/180) return rad #-------------------------------------------- # Start of Main Code #-------------------------------------------- import math separation=TestValAngle ('Eye Separation','Eye Separation','6.5') camX=StoreCamera () SwitchCamera (camX) SelectByType(VuePython.VUEBasicObject.VOT_Camera) cam = GetSelectedObjectByIndex(0) pos=cam.Position() rot=cam.GetRotationAngles() y=(math.sin(degtorad(rot[2]))*separation)+pos[1] x=(math.cos(degtorad(rot[2]))*separation)+pos[0] cam.SetPosition(x,y,pos[2]) #---------------------------------------------- # End of Script #----------------------------------------------
[/codesyntax]