[Closed] Iray maxscript access?
I want to access Iray advanced parameters like Material Override but there is no docuumentation about it and nothing show up in the maxscript listener.
thankyou
Hi Loran,
You could try “show renderers.current” (show is short for showproperties). It will give you this:
show renderers.current
.durationInSeconds : integer
.durationPasses : integer
.durationMode : enum
.displacementView : boolean
.displacementSmoothing : boolean
.displacementEdgeLength : float
.displacementMaximum : float
.displacementSubdivisionLevel : integer
.overrideMaterialEnabled : boolean
.overrideMaterial : material
.lightBouncesLimited : boolean
.lightBouncesMaximum : integer
.imageFilterType : enum
.imageFilterWidth : float
.hardwareReport : string
.version : string
So renderers.current.overrideMaterialEnabled would get/set the Material Override.
Note: setting the value doesn’t update the renderer interface (yet).
Don’t forget that any changes to the render scene dialog need to be done with it closed or else they wont stick.
Thank you!
renderscenedialog.update() to update render dialog changes
http://loran-cg.blogspot.com/2010/10/iray-manager-maxscript.html
Hey loran, I saw a guy asking for multiple gpu support and I started to take a look at your script… and ended up re-writing almost all of it I hope you don’t mind, I tagged it as v1.2. it supports up to 4 GPU’s and the user can deselect the GPU 1 (which is the system gpu) and leave only the other’s doing the work… at least that’s the theory behind it
Hope you dont mind, cheers!
--v1.2
(
rollout MR_rollout ":: IRay manager ::"
(
global systinf = sysinfo.cpucount
local m = mental_ray_string_options
local lsitem = 1
label hh ":: I R A Y M A N A G E R 1.2 ::" align:#center
group ""
(
label h0a "Set Iray Renderer and" align:#left offset:[3,0]
label h0b "MentalRay Material Editor" align:#left offset:[3,-5]
button rdr "SETUP IRAY"width:172 height:30 offset:[0,0]
)
checkbutton chkCPU "CPU" checked:true width:80 offset:[-47,0]
checkbutton chkGPU "GPU" checked:true width:80 offset:[45,-26]
group ""
(
label h1 " Choose the GPU's you want to use"align:#left
label h2 " and the number of CPU threads" align:#left offset:[0,-5]
multilistbox lstGPU "GPU" items:#("GPU 1","GPU 2","GPU 3", "GPU 4") selection:#(1) height:4 across:2
spinner corenumb "CPU:" range:[1,systinf,systinf] type:#integer fieldwidth:30
)
checkbox chkCLAY "CLAY RENDER" checked:false offset:[40,10]
button rdr2 "Render Active View" width:162 height:40 offset:[-1,10]
hyperlink hl "::::: L o r a N // 2010 :::::" address:"http://loran-cg.blogspot.com/" color:(color 50 150 255)
hoverColor:(color 50 150 255) visitedColor:(color 50 150 255) align:#center offset:[0,10]
--ACTION
fn setIrayOptions =
(
clearlistener()
if chkCPU.state == true then
(
print "CPU Enabled"
m.addoption "iray threads" corenumb.value
)
else
(
print "CPU Disabled"
m.addoption "iray threads" 0
)
if chkGPU.state == true then
(
print "GPU Enabled"
sdevs = ""
gdevs = lstgpu.selection as array
--for i=0 to lstGPU.items.count-1 do print
for i=1 to gdevs.count do
(
sdevs+=(gdevs[i]-1) as string
if i!=gdevs.count then sdevs+=" "
)
mental_ray_string_options.addoption "iray devices" sdevs
)
else
(
print "GPU Disabled"
mental_ray_string_options.addoption "iray devices" ""
)
)
on MR_rollout open do
(
setIrayOptions()
)
--IRAY RENDERER + MR Material Editor--
on rdr pressed do
(
local rdso = false
if RenderSceneDialog.isOpen() then
(
rdso = true
renderSceneDialog.Close()
)
renderers.medit_locked = false
ir =mental_ray_iray_Renderer()
mr=mental_ray_Renderer()
renderers.current = ir
renderers.medit = mr
if rdso == true then renderSceneDialog.Open()
)
on rdr2 pressed do
(
max quick render
)
on chkCPU changed state do
(
if chkGPU.state != false then
(
setIrayOptions()
) else chkCPU.state = true
)
on chkGPU changed state do
(
if chkCPU.state != false then
(
setIrayOptions()
) else chkGPU.state = true
)
on corenumb changed value do setIrayOptions()
on lstGPU selected val do
(
lsitem=val
tt=lstgpu.selection as array
)
on lstGPU selectionEnd do
(
if lstGPU.selection.isEmpty then lstGPU.selection=lsitem
setIrayOptions()
)
--CLAY RENDER--
on chkCLAY changed theState do
(
if theState then
(
claymat= Arch___Design__mi()
claymat.name = "Clay Override"
claymat.diff_color = color 255 255 255
claymat.refl_weight = 0
renderers.current.overrideMaterialEnabled = true
renderers.current.overrideMaterial = claymat
renderSceneDialog.commit()
renderscenedialog.update()
)
else
(
renderers.current.overrideMaterialEnabled = false
renderSceneDialog.commit()
renderscenedialog.update()
)
)
)--end
createDialog MR_rollout 200 420
)
Thank you Artur! I update my blog
http://loran-cg.blogspot.com/2010/10/iray-manager-maxscript.html
Thanks loran! But it seems the link still points out to version 1.1
Did you like the rewrote?
link is corrected now. Yes, I didn’t check the way you rewrote, just give a quick try to it and see it works fine
thank you again man. I think this is a usefull toolset for every Iray users