Notifications
Clear all

[Closed] Call mentalray and rename file

Hey ppl

I’m quite new to scripting, i’ve only made few small macros for short procedors.
I’m tring to make a macro to setup a scene for rendering occllusion pass with mental ray.
Most of it is running nice already but i can’t find a way to make two things:
1)change the renderer from scanline to mentalray- the macro recorder does’nt print a line for this action and i could’nt find it on the script reference.
2)I want the script to save the scene under a new name. Lets say my scene name is “My_Project”, i’d like it to rename to “My_Project_Occ”.
this is where i’ve got by now:

(

max unfreeze all

select lights

delete selection

actionMan.executeAction 0 “40029” – Render: Environment Dialog Toggle

backgroundColor = color 255 255 255

actionMan.executeAction 0 “40029” – Render: Environment Dialog Toggle

lightLevel = 0

envEffectsDialog.Close()

max mtledit

macros.run “Medit Tools” “clear_medit_slots”

meditMaterials[1].name = “Occ_Shader”

meditMaterials[1].Diffuse = color 255 255 255

meditMaterials[1].ambient = color 255 255 255

meditMaterials[1].Diffuse = color 255 255 255

meditMaterials[1].ambient = color 255 255 255

meditMaterials[1].selfillumMap = Ambient_Reflective_Occlusion__base ()

meditMaterials[1][#Maps][#Self_Illumination__Ambient_Reflective_Occlusion__ base____Ambient_Reflective_Occlusion__base].Samples = 128

max select all

$.material = meditMaterials[1]

print “Occllusion setup Done”

)

any help will be [font=David][font=David][color=white][font=Verdana]appreciated![/font][/font][/color][/font]

2 Replies
renderers.current = Mental_Ray_Renderer() -- set renderer to Mental Ray
 savepath = replace (maxfilepath + maxfilename) ((findstring (maxfilepath + maxfilename) ".max")) 1 "_Occ." -- Creates a new string to savefile based on current file name and location
 savemaxfile savepath -- save the new file

Let me know if you have any issues with that.

Hope this helps some,
-Eric

Thanks man, it helps alot!