[Closed] Change render using MAXScript
i created a simple GUI with just two buttons…i want to make the buttons to change Renderers…like we do in Assign renderer…
how can i change the render engines like “Final Render” and “Mental-Ray” with a click of button??
Look up “Renderers” in the Maxscript Help. The first link should give you all the information you need. You will need to figure out the RendererClass name of the plugin and then set renderers.current equal to that RendererClass.
-Eric
thanks for the reply PiXeL_MoNKeY…i actually figured that out and created one right after posting my first post…but i want to create something more cool…for example i dont have Final render installed…but i want to create a button for FR…so when i click that i want a messagebox saying “you dont have FR installed”…how can i do that???
You would have to get someone who has Final Render installed to tell you the RenderClass name is. Then test against it, something like:
if (final_render_class_here()) == undefined then messagebox ("you dont have FR installed")
-Eric
i tried it but am getting “– Type error: Call needs function or class, got: undefined”
this was how i used:
on btn4 pressed do
(
if (Quicksilver_Hardware_Renderer()) == undefined then
(
messagebox "sorry"
)
else
(
renderers.current = Quicksilver_Hardware_Renderer()
)
)
am i doing something wrong??
a new Thread started here
That was my bad in the code, remove the () after the RendererClass name in the if line:
on btn4 pressed do
(
if [i][b]([b]Quicksilver_Hardware_Renderer[/b])[/b][/i] == undefined then
(
messagebox "sorry"
)
else
(
renderers.current = Quicksilver_Hardware_Renderer()
)
)
Personally I wouldn’t go through that here. During the initialization of the script I would check for each renderer, then enable the button if the renderer is found.
-Eric
You would use the on rollout open event, check the state of each RendererClass, then set the state of the button if defined. Something like:
on rollout_name open do (
btn4.enabled = false
if (Quicksilver_Hardware_Renderer) != undefined then (
btn4.enabled = true
)
)
-Eric
i used this to enable renderer buttons…but the problem is i can assign it to only one button…if i assign it to another button the previous is disabled…any idea why??
rollout test “renderers”
(
button btn1 “Vray”
button btn2 “QuickSilver”on test open do ( btn1.enabled = false if (Vray) != undefined then ( btn1.enabled = true )
)
on test open do ( btn2.enabled = false if (Quicksilver_Hardware_Renderer) != undefined then ( btn.enabled = true ) )
)
createdialog test
if i set
(
btn1.enabled = true
if (Vray) != undefined then
(
btn1.enabled = false
)
i can still click it…
That may be because you are working on an old instance of the rollout. See my post in the other thread about destroying the dialog before you define and create it. That way any time an existing dialog is open it will be closed before the new one opens.
-Eric
Hi. I want to make the same script so here code :buttrock:
-- script for quickly change render settings
-- create by Bondar Igor :)
if (( mainRoll != undefined) and ( mainRoll.isdisplayed)) do
(destroyDialog mainRoll ) -- test if dialog exist
fn checkRender nSearch = -- function check if render installed
(
theRenderer = for obj in RendererClass.classes where \
(matchPattern (obj as string) pattern:nSearch) -- check if the name in nSearch variable exist
collect obj
if theRenderer.count ==1
then renderers.current = theRenderer[1]()
else
(messageBox "render not installed")
)
rollout mainRoll "ChangeSetting"
(
group "Change Render" -- define change render buttons
(
button butScanline "Scanline" align:#left across:2 width:70 height:20
button butMR "Mental Ray" align:#left width:70 height:20
button butVray "Vray" align:#left across:2 width:70 height:20
button butKrakatoa "Krakatoa" align:#right width:70 height:20
)
on butScanline pressed do
(
varScan = "*Scanline*"
checkRender varScan
)
on butMR pressed do
(
varMR = "*mental_ray*"
checkRender varMR
)
on butVray pressed do
(
varVray = "V_Ray_Adv*"
checkRender varVray
)
on butKrakatoa pressed do
(
varKrakat = "*Krakatoa*"
checkRender varKrakat
)
)
createDialog mainRoll 175 450