Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Need help! Maxscript Beginner
  RSS 2.0 ATOM  

Need help! Maxscript Beginner
Rate this thread
 
26323
 
Permlink of this thread  
avatar
  • Total Posts: 3
  • Joined: 18 March 2009 02:06 AM

Hi I’m trying to get a test to work but cannot for the life of me get it to work. How to I get scan to test TRUE in this case?

scan = Default_Scanline_Renderer()
test = renderers.current

scan == test

I’m trying to write a script that checks your current renderer and if it’s SCANLINE switches to MR and creates an Ambient Occlusion material and enables the material overide with the AO material active & if the current renderer is detected as NOT being that SCANLINE, do something else - Not sure what yet :)

------------------------------------------
mental = mental_ray_renderer()
scan = default_scanline_renderer()

if renderers.current == scan then

(
lights.enabled = false
renderers.current = mental
mental.FinalGatherEnable2 = false
meditMaterials[10].name = “AO”
meditMaterials[10].selfillumMap = Ambient_Reflective_Occlusion__3dsmax ()
meditMaterials[10].useSelfIllumColor = on
mental.Enable_Material_Override = true
mental.Override_Material = meditmaterials[10]
)


else messagebox “Error”

----------------------------------

Any help woudl be great!

Regards,

Ben



Regards,

Ben :)

Replies: 0
avatar

Your logic isn’t evaluating true because each object is the same class, but a separate instance.  I think :)

To make it evaluate properly, you need logic like:

if (classof renderers.current == Default_Scanline_Renderer)



Replies: 0
avatar

Hi Kevin,

I tried your idea. It worked! Thanks. Now when I run the script with MR as my renderer the material override won’t switch on. Weird!

This is what I put in the else statement :

else

(

lights.enabled = false
mental.FinalGatherEnable2 = false
meditMaterials[10].name = “AO”
meditMaterials[10].selfillumMap = Ambient_Reflective_Occlusion__3dsmax ()
meditMaterials[10].useSelfIllumColor = on
mental.Enable_Material_Override = true
mental.Override_Material = meditmaterials[10]

)

basically the same as above but without switching to MR as it’s already the current renderer.

Regards,

Ben



Regards,

Ben :)

Replies: 0
avatar

I’m not sure exactly with the way you’re doing it, but I imagine it’s because mental isn’t set to the current renderer instance in your ‘else’ case.  You could add a line

mental renderers.current

at the beginning of your else, probably, or just reference the current renderer directly.

if classof renderers.current == Default_Scanline_Renderer do (
    
renderers.current mental_ray_renderer()
)

renderers.current.FinalGatherEnable2 false
meditMaterials[10]
.name "AO"
meditMaterials[10].selfillumMap Ambient_Reflective_Occlusion__3dsmax ()
meditMaterials[10].useSelfIllumColor on
renderers
.current.Enable_Material_Override true
renderers
.current.Override_Material meditmaterials[10]


Replies: 0