PDA

View Full Version : Iray maxscript access?


loran
10-06-2010, 10:08 AM
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

diffx
10-06-2010, 10:48 AM
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).

Kameleon
10-06-2010, 11:32 AM
Don't forget that any changes to the render scene dialog need to be done with it closed or else they wont stick.

loran
10-06-2010, 12:23 PM
Thank you!

renderscenedialog.update() to update render dialog changes ;)

http://loran-cg.blogspot.com/2010/10/iray-manager-maxscript.html

Kameleon
10-07-2010, 10:31 PM
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 :-D 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 :-D

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
)

loran
10-08-2010, 07:49 AM
Thank you Artur! I update my blog :)
http://loran-cg.blogspot.com/2010/10/iray-manager-maxscript.html

Kameleon
10-08-2010, 09:06 AM
Thanks loran! But it seems the link still points out to version 1.1

Did you like the rewrote?

loran
10-08-2010, 01:50 PM
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 :)

Kameleon
10-08-2010, 03:24 PM
Yeah, I'm already using it in a project :-D

Kameleon
10-15-2010, 07:52 PM
iray Manager v1.3 is out! check it out at : http://dimensao3.com/al/

http://www.dimensao3.com/al/portfolio_scripts/irayManagerV1.3.jpg

Kameleon
10-18-2010, 06:19 PM
Hey guys! iray Manager v1.4 is out! check it out at : http://dimensao3.com/al/

Please report any bugs/problems/suggestions you may have.

http://www.dimensao3.com/al/portfolio_scripts/irayManagerV1.4.jpg

loran
10-20-2010, 07:41 AM
cool :bounce: ! Saving settings is a cool option but I don't think usefull showing all the option in a list. All this informations are ever readable above. It can be confusing for non experts.

Kameleon
10-20-2010, 09:59 AM
No, the options in the list are the options embeded in the file, the options on the UI are the current options upon local rendering.

CGTalk Moderation
10-20-2010, 09:59 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.