macroScript Cam_flyer category:"3idee Tools" ( --Modified 10-16-11 by lucky_lowell -- Orignal script by Michiel Quist --see comments below --Camera animator --by Michiel Quist --info@3idee.nl --http://www.3idee.nl --Version: 2 -- --Whats new in version 2: Added amount of frames between camera positions --Whats new in version 1.5: Insert button works -- --This script creates a new animated camera that animates along the scene camera's --Every position ,rotation and FOV is stored in an animation key. --It converts target camera's to free camera's (for now). It also selects hidden camera's (for now) --It lets you render a number of camera's without making numerous network renderjobs --or having to set up the video post every time. ( try(destroyDialog Camanim2)catch() rollout Camanim2 "CamAnim flyer v2" ( -- local variables ----------------------------------- local camset = #() local inscams = #() local listnum = 1 local y = 1 local b = undefined ----------------------------------- -- flyer ----------------------------------- group "Select Group:" ( --dropdownlist grp_list "A. Choose groups to copy" items:(for i in objects where (isGroupHead i) collect i.name as string) --this give me all the groups in the scene which the plane is one of dropdownlist DD_Group "" items:#() button copygroup "Create Copy and delete keys" button btn_UpdateGroups "Update" Width:150 height:25 align:#center ) listbox camlist "Camera's in scene" enabled:false height:6 button getcams "Get camera's / refresh / reset" button moveup "Move up" pos:[12,350] enabled:false width:65 button movedown "Move down" pos:[85,350] enabled:false width:65 button remcam "Remove" pos:[12,375] enabled:false width:65 button inscam "Insert" pos:[85,375] enabled:false width:65 spinner frm_time "InBetweenTime:" range:[0,1000,0] type:#integer align:#left pos:[13,405] width:125 label camn "Camera name:" align:#left edittext camname "" text:"NewAnimCam" enabled:false button createcam "Create animation camera" enabled:false --label tekst1 "Only works with freecams so it" --label tekst2 "converts targetcams to freecams" --label tekst3 "Version 2" --label info3 "(C) 2009 3idee" --label info_4 "www.3idee.nl" ------------------------------------- end of flyer -- the following thanks to tassel local allObj = #() local Groups_Array = #() fn Update_Groups = ( allObj = objects -- as array Groups_Array = for i in allObj where (isGroupHead i and isValidNode i) collect i -- as string DD_Group.items = for i in allObj where (isGroupHead i and isValidNode i) collect i.name -- as string ) on GroupSelector open do Update_Groups() on DD_Group selected i do select Groups_Array[i] on btn_UpdateGroups pressed do Update_Groups() ------------------------------------end of tassel /*on grp_list selected i do ( format "You selected '%'!\n" grp_list.items[i] " and" grp_list.selected youpicked = grp_list.items[i] print youpicked print grp_list.selected + " grp_list.selected" ) */ on copygroup pressed do --action for the button ( --copy (getNodeByName grp_list.selected) -- this creates a bounding box of the group??? theCopy = maxOps.cloneNodes (getNodeByName DD_Group.selected) cloneType:#copy newNodes:&nnl --copy whatever was choosen tmpstr = currenttime as string -- this returns frame number and the letter f for example 25f tmpstr = substring tmpstr 1 (tmpstr.count - 1) --rename the plane with the current frame number prefixed --$.name = junk + $.name --select theCopy --max unlink -- unlink from parent ) fn cam_filt obj = iskindof obj camera on getcams pressed do ( if cameras.count == 0 then ( messagebox "There are no camera's in this scene!!" beep:false camset = #() moveup.enabled = false movedown.enabled = false remcam.enabled = false inscam.enabled = false camname.enabled = false createcam.enabled = false ) else ( for i in cameras do ( if iskindof i camera do ( --i.type = #free ) ) camset = #() camlist.items = for i in 1 to cameras.count collect --if classof cameras[i] == targetobject then dontcollect else cameras[i].name camlist.enabled = true for i in 1 to cameras.count collect ( --if classof cameras[i] == targetobject then dontcollect else camset[i] = cameras[i] print camset[i] ) moveup.enabled = true movedown.enabled = true remcam.enabled = true inscam.enabled = true camname.enabled = true createcam.enabled = true print listnum ) ) on camlist selected sel do ( listnum = sel print sel ) on remcam pressed do ( if listnum > camset.count then messagebox "No camera selected in the list!!" beep:false else deleteitem camset listnum camlist.items= for i in 1 to camset.count collect camset[i].name ) on moveup pressed do ( y=listnum-1 if y < 1 then messagebox "Your on the top of the list!!" beep:false else ( x=camset.count + 1 z=camset[y] append camset z camset[listnum] == camset[x] camset[y] = camset[listnum] camset[listnum] = camset[x] deleteitem camset x camlist.selection = y camlist.items= for i in 1 to camset.count collect camset[i].name listnum = y ) ) on movedown pressed do ( y=listnum+1 if y > camset.count then messagebox "Your on the bottom of the list!!" beep:false else ( x=camset.count + 1 z=camset[y] append camset z camset[listnum] == camset[x] camset[y] = camset[listnum] camset[listnum] = camset[x] deleteitem camset x camlist.selection = y camlist.items= for i in 1 to camset.count collect camset[i].name listnum = y for i in 1 to camset.count do ( print camset[i] ) ) ) on inscam pressed do ( inscams = selectByName title:"Pick camera's to insert" buttontext:"Insert..." filter:cam_filt if inscams != undefined then ( for i in 1 to inscams.count do ( print inscams[i].name ) join camset inscams print camset.count camlist.items= for i in 1 to camset.count collect camset[i].name ) ) on createcam pressed do ( print camname.text b=freecamera name:camname.text () for i in 1 to camset.count do ( set animate on set time ((i-1)+((i-1)*frm_time.value)) print b.position print camset[i].position --b.pos = [camset[i].position.x,camset[i].position.y,camset[i].position.z] b.rotation = camset[i].rotation b.position = camset[i].position b.fov = camset[i].fov set animate off ) setTrajectoryOn b true messagebox ("Your animated camera: " + camname.text + ", is created with trajectory...") if (queryBox "Do you want your render setting adjusted to the new camera duration?" title:"Camera render duration") == true then ( rendStart = 0 rendEnd = (camset.count-1) rendTimeType = 3 renderscenedialog.update() viewport.setcamera b ) ) ) )--end rollout --Update_Groups() createDialog Camanim2 170 600 )--end script