MentalRay Setup Script - Fine in 2012 - Errors in 2013

Hi All,

If anyone can help it would be greatly appreciated.

I have a script for setting up the render settings for MentalRay, it worked great in 2012 but errors out in 2013.

it gives the following error: --Unable to convert: undefined to type: Integer

and highlights line 105: rw=ReadString rwf as integer

below is the full script.

any pointers would be great.

thanks

Sam

  1. macroScript MRay_Render_setup_OR
  2. category:"GSS_Scripts"
  3. (
  4. try closeRolloutFloater theFloater catch()
  5. mfn = maxfilename
  6. if mfn == "" then messagebox "Save the file first fool!!!"
  7. else
  8. (
  9.  
  10. global file_nr = maxfilename[5]+maxfilename[6]
  11. global file_path = pathConfig.convertPathToUnc maxfilepath
  12. global file_path_s = pathConfig.removePathLeaf file_path
  13. global pj_name = substring file_path_s 24 (file_path_s.count-23)
  14. global gi_dir = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\Mray\\cam_"+ file_nr
  15. global fg_dir = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\Mray\\cam_"+ file_nr
  16. global re_dir = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\Renders\\cam_"+ file_nr
  17. global anim_re_dir = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\cam_"+ file_nr
  18. global pj_nr = substring pj_name 1 7
  19. global mr = renderers.current
  20. global rez_w_file_string = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\Mray\\cam_"+ file_nr+"\\cam_"+ file_nr+"_width.ini" as string
  21. global rez_h_file_string = "\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\Mray\\cam_"+ file_nr+"\\cam_"+ file_nr+"_height.ini" as string
  22. global renderengine = mental_ray_renderer()
  23. global rh = ""
  24. global rw = ""
  25. --function that sets render resolution for animations
  26. fn fn_set_render_res_anim res=
  27. (
  28. if res == 576 then
  29. (
  30. renderwidth = 720
  31. renderheight = 576
  32. renderPixelAspect = 1.4222
  33. )
  34. else if res == 720 then
  35. (
  36. renderwidth = 1280
  37. renderheight = 720
  38. renderPixelAspect = 1
  39. )
  40. else if res == 1080 then
  41. (
  42. renderwidth = 1920
  43. renderheight = 1080
  44. renderPixelAspect = 1
  45. )
  46. )
  47. fn fn_set_scene_move_anim_pre_pass =
  48. (
  49. renderengine.FGProjectionMode = 0
  50. renderengine.IlluminationCacheMode =1
  51. renderengine.SkipFinalRender = true
  52. renderengine.PhotonMapUseFile = true
  53. renderengine.PhotonFreeze = false
  54. renderengine.FinalGatherFreeze = false
  55. renderengine.DeleteFinalGatherFile noprompt:true
  56. renderengine.DistributedEnable = false
  57. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  58. deleteFile filename
  59. rendSaveFile = false
  60. rendTimeType = 2
  61. )
  62. fn fn_set_scene_move_anim_final interpolate=
  63. (
  64. renderengine.FGInterpolateNFrames = interpolate
  65. renderengine.IlluminationCacheMode =1
  66. renderengine.PhotonFreeze = true
  67. renderengine.PhotonMapUseFile = true
  68. renderengine.FinalGatherFreeze = true
  69. renderengine.DistributedEnable = false
  70. renderengine.SkipFinalRender = false
  71. rendSaveFile = true
  72. rendTimeType = 2
  73. )
  74. -- function creating two files
  75. fn fn_create_rez_files =
  76. (
  77. createfile rez_w_file_string
  78. createfile rez_h_file_string
  79. )
  80. -- function that writes data to files
  81. fn fn_write_rez_files =
  82. (
  83. rwf = fopen rez_w_file_string "r+"
  84. WriteString rwf (renderwidth as string)
  85. fflush rwf
  86. fclose rwf
  87.  
  88. rhf = fopen rez_h_file_string "r+"
  89. WriteString rhf (renderheight as string)
  90. fflush rhf
  91. fclose rhf
  92. )
  93. --Function to create files containing width and hight data for render resolution
  94. fn fn_create_ren_res_ini =
  95. (
  96. files = getfiles ("\\\datagssk\\shared\\Jobs\\"+pj_name+"\\max\\Mray\\cam_"+ file_nr + "\\*.ini")
  97. if files.count == 0 then
  98. (
  99. fn_create_rez_files()
  100. fn_write_rez_files()
  101. )
  102. else
  103. (
  104. rwf = fopen rez_w_file_string "r+"
  105. rw = ReadString rwf as integer
  106. fclose rwf
  107.  
  108. rhf = fopen rez_h_file_string "r+"
  109. rh = ReadString rhf as integer
  110. fclose rhf
  111. )
  112. )
  113. -- function pulls information from hight and width files
  114. fn fn_get_rez_files =
  115. (
  116. rwf = fopen rez_w_file_string "r+"
  117. rw = ReadString rwf as integer
  118. fclose rwf
  119.  
  120. rhf = fopen rez_h_file_string "r+"
  121. rh = ReadString rhf as integer
  122. fclose rhf
  123. )
  124. --Function to create project directory files
  125. fn create_dir =
  126. (
  127. makedir gi_dir
  128. makedir fg_dir
  129. makedir re_dir
  130. )
  131. --funtion that writes spinner figures to file
  132. fn fn_store_img_res renw renh=
  133. (
  134. rwf = fopen rez_w_file_string "r+"
  135. WriteString rwf (renw as string)
  136. fflush rwf
  137. fclose rwf
  138.  
  139. rhf = fopen rez_h_file_string "r+"
  140. WriteString rhf (renh as string)
  141. fflush rhf
  142. fclose rhf
  143. )
  144. -- function that creates an ambient occlusion shader, The materials also contains the contour map required for contours.
  145. fn fn_create_white_occluded_mat =
  146. (
  147. occludedmaterial = mrMaterial()
  148. occludedmaterial.name = "Occluded material"
  149. occludedmaterial.surface = Ambient_Reflective_Occlusion__3dsmax()
  150. occludedmaterial.surface.samples = 64
  151. occludedmaterial.surface.max_distance = 0.75
  152. occludedmaterial.Contour = contour_shader_simple()
  153. occludedmaterial.Contour.width = 0.1
  154. setMeditMaterial 5 occludedmaterial
  155. )
  156. --function that resuse GI and FG maps for final renders
  157. fn final_render_reuse_FG_GI =
  158. (
  159. renderengine.FinalGatherFreeze = true
  160. renderengine.PhotonFreeze = true
  161. )
  162. -- function that enables GI
  163. fn fn_enable_GI =
  164. (
  165. renderengine.GlobalIllumEnable = true
  166. renderengine.PhotonFreeze = false
  167. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  168. renderengine.PhotonMapFilename = (filename as string)
  169. )
  170. -- function that disables GI
  171. fn fn_disable_GI =
  172. (
  173. renderengine.GlobalIllumEnable = false
  174. )
  175. -- function that enables final gather
  176. fn fn_enable_FG =
  177. (
  178. renderengine.FinalGatherEnable2 = true
  179. renderengine.UseFinalGatherFile = true
  180. filename = fg_dir+"\\cam_"+file_nr+".fgm"
  181. renderengine.FinalGatherFilename = (filename as string)
  182. )
  183. -- function that switches off final gather
  184. fn fn_disable_FG =
  185. (
  186. renderengine.FinalGatherEnable2 = false
  187. )
  188. -- function that sets the global tuning to low settings
  189. fn fn_global_tune_low =
  190. (
  191. renderengine.softshadowsprecision =0.5
  192. renderengine.glossyreflectionsprecision = 0.75
  193. renderengine.glossyrefractionsprecision = 0.75
  194. renderengine.MinimumSamples = -1
  195. renderengine.MaximumSamples = 1
  196. renderengine.RestoreFinalGatherPreset 2
  197.  
  198.  
  199.  
  200.  
  201. )
  202. --funtion that sets the global tuning to high settings
  203. fn fn_global_tune_anim =
  204. (
  205. renderengine.softshadowsprecision = 0.5
  206. renderengine.glossyreflectionsprecision = 0.75
  207. renderengine.glossyrefractionsprecision = 0.75
  208. renderengine.MinimumSamples = -1
  209. renderengine.MaximumSamples = 1
  210. renderengine.RestoreFinalGatherPreset 2
  211. )
  212. --funtion that sets the global tuning to high settings
  213. fn fn_global_tune_high =
  214. (
  215. renderengine.softshadowsprecision =1
  216. renderengine.glossyreflectionsprecision = 1.5
  217. renderengine.glossyrefractionsprecision = 1.5
  218. renderengine.MinimumSamples = 0
  219. renderengine.MaximumSamples = 1
  220. renderengine.RestoreFinalGatherPreset 3
  221. renderengine.filter = 1
  222. renderengine.GaussFilterHeight = 3
  223. renderengine.GaussFilterWidth = 3
  224. )
  225.  
  226. --funtion that sets the global tuning to animation settings
  227. fn fn_global_tune_4a =
  228. (
  229. renderengine.softshadowsprecision =1
  230. renderengine.glossyreflectionsprecision = 1.5
  231. renderengine.glossyrefractionsprecision = 1.5
  232. renderengine.MinimumSamples = 0
  233. renderengine.MaximumSamples = 1
  234. renderengine.RestoreFinalGatherPreset 3
  235. renderengine.filter = 1
  236. renderengine.GaussFilterHeight = 3
  237. renderengine.GaussFilterWidth = 3
  238. )
  239.  
  240.  
  241. -- funtion to set up render for contour lines
  242. fn fn_render_contour =
  243. (
  244. renderengine.EnableContours = true
  245. renderengine.MinimumSamples = 0
  246. renderengine.MaximumSamples = 2
  247. renderengine.filter = 1
  248. renderengine.GaussFilterHeight = 3
  249. renderengine.GaussFilterWidth = 3
  250. renderengine.Contour_Output_Shader = contour_only()
  251. rendOutputFilename = re_dir +"\\cam_"+file_nr+"_contour.tif"
  252. rendSaveFile = true
  253. )
  254. --funtion to set upi render of Ambient Occlusion
  255. fn fn_render_AO =
  256. (
  257. renderengine.MinimumSamples = 0
  258. renderengine.MaximumSamples = 2
  259. renderengine.filter = 1
  260. renderengine.GaussFilterHeight = 3
  261. renderengine.GaussFilterWidth = 3
  262. rendOutputFilename = re_dir +"\\cam_"+file_nr+"_AO.tif"
  263. rendSaveFile = true
  264. )
  265. --function to setup combined Ambient occlusion and Contour lines
  266. fn fn_render_combined =
  267. (
  268. renderengine.EnableContours = true
  269. renderengine.Contour_Output_Shader = contour_composite()
  270. rendOutputFilename = re_dir +"\\cam_"+file_nr+"_combined.tif"
  271. rendSaveFile = true
  272. )
  273. -- function that sets the scene up to render for a non - photoreal render such as ambient occlusion or contour
  274. fn fn_non_render_setup rt=
  275. (
  276. occludedmaterial = mrMaterial()
  277. occludedmaterial.name = "Occluded material"
  278. occludedmaterial.surface = Ambient_Reflective_Occlusion__3dsmax()
  279. occludedmaterial.surface.samples = 64
  280. occludedmaterial.surface.max_distance = 0.75
  281. occludedmaterial.Contour = contour_shader_simple()
  282. occludedmaterial.Contour.width = 0.05
  283. setMeditMaterial 5 occludedmaterial
  284. backgroundcolor = (color 255 255 255)
  285. SceneExposureControl.exposureControl.active = false
  286. renderengine.Enable_Material_Override = true
  287. renderengine.Override_Material = occludedmaterial
  288. fn_disable_FG ()
  289. fn_disable_GI ()
  290. if rt == "contour" then
  291. fn_render_contour()
  292. else if rt == "combined" then
  293. fn_render_combined()
  294. else
  295. fn_render_AO ()
  296. )
  297. -- function that sets scene up with only FG for external scenes as as test render at size specified on dialogue
  298. fn fn_render_fg =
  299. (
  300. fn_disable_GI()
  301. renderengine.FinalGatherBounces = 4
  302. renderengine.FinalGatherReflectionDepth = 5
  303. renderengine.SkipFinalRender = false
  304. renderengine.DistributedEnable = false
  305. renderengine.UseFinalGatherFile = false
  306. renderwidth = (rw * 0.15)
  307. renderheight = (rh * 0.15)
  308. fn_global_tune_low ()
  309. )
  310. -- function that sets scene up with FG and GI for internal scenes as as test render at size specified on dialogue
  311. fn fn_render_gi_fg =
  312. (
  313. fn_enable_GI ()
  314. renderengine.SkipFinalRender = false
  315. renderengine.PhotonMapUseFile = false
  316. renderengine.UseFinalGatherFile = false
  317. renderengine.DistributedEnable = false
  318. renderwidth = (rw * 0.15)
  319. renderheight = (rh * 0.15)
  320. fn_global_tune_low ()
  321. )
  322. --function that set scene up to render just the FG and GI pre final render at 100% of final render size.
  323. fn fn_render_pre_final =
  324. (
  325. fn_enable_GI ()
  326. renderengine.SkipFinalRender = true
  327. renderengine.PhotonMapUseFile = true
  328. renderengine.PhotonFreeze = false
  329. renderengine.FinalGatherFreeze = false
  330. renderengine.DeleteFinalGatherFile noprompt:true
  331. renderengine.DistributedEnable = false
  332. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  333. deleteFile filename
  334. renderwidth = (rw * 0.5)
  335. renderheight = (rh * 0.5)
  336. fn_global_tune_low ()
  337. )
  338. --function that set scene up to render just the FG pre final render at 100% of final render size.
  339. fn fn_render_fg_pre_final =
  340. (
  341. fn_disable_GI ()
  342. renderengine.FinalGatherBounces = 4
  343. renderengine.FinalGatherReflectionDepth = 5
  344. renderengine.SkipFinalRender = true
  345. renderengine.PhotonMapUseFile = true
  346. renderengine.PhotonFreeze = false
  347. renderengine.FinalGatherFreeze = false
  348. renderengine.DeleteFinalGatherFile noprompt:true
  349. renderengine.DistributedEnable = false
  350. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  351. deleteFile filename
  352. renderwidth = (rw * 0.5)
  353. renderheight = (rh * 0.5)
  354. fn_global_tune_low ()
  355. )
  356. --function that sets scene up to render just final render at 100% of final render size using only FG.
  357. fn fn_render_fg_final =
  358. (
  359. fn_disable_GI ()
  360. renderengine.SkipFinalRender = false
  361. renderengine.PhotonFreeze = true
  362. renderengine.PhotonMapUseFile = true
  363. renderengine.FinalGatherFreeze = true
  364. renderengine.DistributedEnable = true
  365. renderwidth = rw
  366. renderheight = rh
  367. rendSaveFile = true
  368. fn_global_tune_high ()
  369. )
  370. --function that sets scene up to render just final render at 100% of final render size using FG and GI.
  371. fn fn_render_fg_gi_final =
  372. (
  373. fn_enable_GI ()
  374. renderengine.SkipFinalRender = false
  375. renderengine.PhotonFreeze = true
  376. renderengine.PhotonMapUseFile = true
  377. renderengine.FinalGatherFreeze = true
  378. renderengine.DistributedEnable = true
  379. renderwidth = rw
  380. renderheight = rh
  381. rendSaveFile = true
  382. fn_global_tune_high ()
  383. )
  384.  
  385. --function that sets scene up to render just final render at 100% of final render size using only FG FOR ANIMATION.
  386. fn fn_render_fg_animation =
  387. (
  388. fn_disable_GI ()
  389. renderengine.SkipFinalRender = false
  390. renderengine.PhotonFreeze = false
  391. renderengine.PhotonMapUseFile = false
  392. renderengine.FinalGatherFreeze = false
  393. renderengine.DistributedEnable = false
  394. renderwidth = rw
  395. renderheight = rh
  396. rendSaveFile = true
  397. fn_global_tune_4a ()
  398. )
  399.  
  400.  
  401. --function that sets scene up to render just final render at 100% of final render size using FG and GI FOR ANIMATION.
  402. fn fn_render_fg_gi_animation =
  403. (
  404. fn_enable_GI ()
  405. renderengine.SkipFinalRender = false
  406. renderengine.PhotonFreeze = false
  407. renderengine.PhotonMapUseFile = false
  408. renderengine.FinalGatherFreeze = false
  409. renderengine.DistributedEnable = false
  410. renderwidth = rw
  411. renderheight = rh
  412. rendSaveFile = true
  413. fn_global_tune_4a ()
  414. )
  415.  
  416.  
  417.  
  418. -- function that sets up the scene for a full render pass
  419. fn fn_render_setup pass=
  420. (
  421. backgroundcolor = (color 0 0 0)
  422. SceneExposureControl.exposureControl.active = true
  423. renderengine.Enable_Material_Override = false
  424. renderengine.EnableContours = false
  425. rendOutputFilename = re_dir +"\\cam_"+file_nr+".tif"
  426. rendSaveFile = false
  427. renderengine.FinalGatherBounces = 2
  428. fn_enable_FG ()
  429. if pass == "fg" then
  430. (fn_render_fg())
  431. else if pass == "gi_fg" then
  432. (fn_render_gi_fg())
  433. else if pass == "fg pre final" then
  434. (fn_render_fg_pre_final())
  435. else if pass == "gi + fg pre final" then
  436. (fn_render_pre_final())
  437. else if pass == "fg final render" then
  438. (fn_render_fg_final())
  439. else if pass == "gi + fg final render" then
  440. (fn_render_fg_gi_final())
  441. else if pass == "fg final animation" then
  442. (fn_render_fg_animation())
  443. else if pass == "gi + fg final animaition" then
  444. (fn_render_fg_gi_animaiton())
  445. )
  446. -- funtion that is called when the 'setup scene' button is pressed; it analyses which radial buttons are selected and directs the secen to be setup accordingly.
  447. fn fn_sc_setup k rt pass=
  448. (
  449. renderengine = mental_ray_renderer()
  450. renderers.current = renderengine
  451. exposurecontrol = mrToneMapExposureControl()
  452. if SceneExposureControl.exposureControl != exposurecontrol then SceneExposureControl.exposureControl != exposurecontrol
  453. renderengine.DistributedEnable = false
  454. renderwidth = (rw * k)
  455. renderheight = (rh * k)
  456. rendTimeType = 1
  457. renderPixelAspect = 1
  458. if rt == "render" then
  459. (
  460. fn_render_setup pass
  461. )
  462. else
  463. (
  464. fn_create_white_occluded_mat ()
  465. fn_non_render_setup rt
  466. )
  467. )
  468.  
  469. --function that sets the scene up for a GI pass in preperation for a static animation
  470. fn fn_set_scene_static_anim_GI=
  471. (
  472. fn_disable_FG ()
  473. fn_enable_GI()
  474. renderengine.PhotonMapUseFile = true
  475. renderengine.SkipFinalRender = true
  476. renderengine.PhotonFreeze = false
  477. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  478. deleteFile filename
  479. renderengine.PhotonMapFilename = filename
  480. renderengine.DistributedEnable = false
  481. rendTimeType = 1
  482. )
  483. --function that sets the scene up for a FG pass in preperation for a static animation
  484. fn fn_set_scene_static_anim_pre_pass path_div=
  485. (
  486. --Set GI settings
  487. renderengine.PhotonMapUseFile = true
  488. renderengine.PhotonFreeze = true
  489. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  490. renderengine.PhotonMapFilename = filename
  491. --SET FG Settings
  492. fn_enable_FG()
  493. renderengine.FGProjectionMode = 0
  494. renderengine.SkipFinalRender = true
  495. renderengine.FinalGatherFreeze = false
  496. renderengine.DeleteFinalGatherFile noprompt:true
  497. filename = fg_dir+"\\cam_"+file_nr+".fgm"
  498. renderengine.FinalGatherFilename = filename
  499. -- set render dialogue settings
  500. rendSaveFile = false
  501. rendTimeType = 2
  502. rendNThFrame = path_div
  503. -- set distributed render
  504. renderengine.DistributedEnable = false
  505. )
  506. --function that sets the scene up for a final render pass for a static animation
  507. fn fn_set_scene_static_anim_final=
  508. (
  509. --set GI Settings
  510. fn_enable_GI()
  511. renderengine.PhotonMapUseFile = true
  512. renderengine.PhotonFreeze = true
  513. filename = fg_dir+"\\cam_"+file_nr+".pmap"
  514. renderengine.PhotonMapFilename = filename
  515. --set FG settings
  516. renderengine.UseFinalGatherFile = true
  517. filename = fg_dir+"\\cam_"+file_nr+".fgm"
  518. renderengine.FinalGatherFilename = filename
  519. renderengine.FinalGatherFreeze = true
  520. --set MR render engine stttings
  521. renderengine.SkipFinalRender = false
  522. --set render dialogue settings
  523. rendOutputFilename = re_dir +"\\cam_"+file_nr+".rpf"
  524. rendSaveFile = true
  525. rendTimeType = 2
  526. rendNThFrame = 1
  527. )
  528.  
  529.  
  530.  
  531. create_dir () -- create folders for output files
  532. fn_create_ren_res_ini () -- either creates text files to hold the render resolution sizes. if none are already available or pulls the data from existing files
  533. ----------------------------------------------------------------------------------------------------------------------------------------
  534. rollout project_settings "Project Settings"
  535. (
  536. Group "Project"
  537. (
  538. edittext project_name "" text:pj_name width:370
  539. )
  540. Group "Files"
  541. (
  542. label gi_dir_lbl "Global Illumination" align:#left
  543. edittext browse_gi_dir_lbl "" text:gi_dir width:320
  544. button browse_gi_dir "Browse" pos:[340,88]
  545.  
  546. label fg_dir_lbl "Final Gather Map" align:#left
  547. edittext browse_fg_dir_lbl "" text:fg_dir width:320
  548. button browse_fg_dir "Browse" pos:[340,130]
  549.  
  550. label re_dir_lbl "Render" align:#left
  551. edittext browse_re_dir_lbl "" text:re_dir width:320
  552. button browse_re_dir "Browse" pos:[340,172]
  553. )
  554. )
  555. rollout still_image_setup "Still Image Setup" width:400 height:440
  556. (
  557. -----User Interface
  558.  
  559. Group "Render Settings"
  560. (
  561. label re_w_lbl "Width" align:#left
  562. spinner re_w range:[0,10000,rw] type:#integer pos:[55,25] fieldwidth:45
  563. label re_h_lbl "Height" align:#left
  564. spinner re_h range:[0,10000,rh] type:#integer pos:[55,45] fieldwidth:45
  565.  
  566. groupbox gb_re_type "Render Type" pos:[120,20] width:280 height:40
  567. radiobuttons rdo_re_type labels:#("Render","Occluded","Contour","Combined") pos:[125,40]
  568.  
  569.  
  570. label lbl3 "\nSelect the type or Indirect Illumination Setup You require:" align:#left width:200 height:40 enabled:true
  571.  
  572. radiobuttons rdo_pass labels:#("FG (Test Render)","GI+FG (Test Render)","FG Calculation (For Final)","GI+FG Calculation (For Final)","Final Render (FG)","Final Render (GI+FG)","Final Animation (FG)","Final Animation (GI+FG)") default:2 columns:2 align:#left enabled:true
  573.  
  574. groupbox gb_pass_rez width:255 height:30 align:#left
  575. radiobuttons rdo_pass_rez labels:#("20%","50%","75%","100%") default:4 pos:[20,175]
  576.  
  577. button si_setup "Setup Scene" width:80 tooltip:"Set up the scene with the parameters chosen" align:#right pos:[310,175]
  578. )
  579. -----Button Actions
  580. ---- File path buttons
  581. On browse_gi_dir pressed do
  582. (
  583. gi_dir = getSavePath initialdir:gi_dir
  584. browse_gi_dir_lbl.text = (gi_dir as string)
  585. )
  586. On browse_fg_dir pressed do
  587. (
  588. fg_dir = getSavePath initialdir:fg_dir
  589. browse_fg_dir_lbl.text = (fg_dir as string)
  590. )
  591. On browse_re_dir pressed do
  592. (
  593. re_dir = getSavePath initialdir:re_dir
  594. browse_re_dir_lbl.text = (re_dir as string)
  595. )
  596. ----- Radio Button Pushed
  597. on rdo_re_type changed state do
  598. (
  599. if rdo_re_type.state > 1 then
  600. (
  601. rdo_pass.state = 0
  602. rdo_pass.enabled = false
  603. lbl3.enabled = false
  604. )
  605. else
  606. (
  607. rdo_pass.state = 2
  608. rdo_pass.enabled = true
  609. lbl3.enabled = true
  610. )
  611. )
  612. -----Render Setup buttons
  613. on si_setup pressed do
  614. (
  615. renderscenedialog.close() -- close render dialogue
  616. -- passses values of dialogue to global variables
  617. rw = re_w.value --gets value of width spinner
  618. rh = re_h.value --gets value of hight spinner
  619. case rdo_pass_rez.state of --gets state of pass resolution as passes a multiplier to local K
  620. (
  621. 1: local k = 0.2
  622. 2: local k = 0.5
  623. 3: local k = 0.75
  624. 4: local k = 1
  625. )
  626. case rdo_re_type.state of --gets state of Render Type as string to local rt
  627. (
  628. 1: local rt = "render"
  629. 2: local rt = "occludded"
  630. 3: local rt = "contour"
  631. 4: local rt = "combined"
  632. )
  633. case rdo_pass.state of --gets state of Render pass as string to local pass
  634. (
  635. 1: local pass = "fg"
  636. 2: local pass = "gi_fg"
  637. 3: local pass = "fg pre final"
  638. 4: local pass = "gi + fg pre final"
  639. 5: local pass = "fg final render"
  640. 6: local pass = "gi + fg final render"
  641. 7: local pass = "fg final animation"
  642. 8: local pass = "gi + fg final animation"
  643. )
  644. -- activates funtions
  645. fn_store_img_res rw rh --stores current spinner values to file.
  646. fn_sc_setup k rt pass -- sets up scene
  647. renderscenedialog.open() -- open render dialogue
  648. )
  649.  
  650. )
  651.  
  652.  
  653. theFloater = newRolloutFloater "MR Render Setups" 420 350
  654. addRollout project_settings theFloater rolledUp:true
  655. addRollout still_image_setup theFloater rolledUp: true
  656.  
  657. )
  658. )
  659. <code>

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

one hint

I wonder how it ever works (in any Max), as there is incorrect function at line 75 (fn_create_rez_files) that use CreateFile() function to create 2 files, but CreateFile() return FileStream that SHOULD be closed.

fn fn_create_rez_files = 
(
fs = createFile rez_w_file_string
close fs -- close FileStream
fs = createFile rez_h_file_string
close fs -- close FileStream
)

If by chance this script works in Max 2012 its probably because that 2 ini files already exist and that function actually never called ;-)

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.