[Closed] Checking renderer
Hi! My scripting knowledge is rather limited
Ive tried to create this simple script, witch checks if the current rendrerer is set to mental ray or not.
However, it purposes the question even if the renderer is set to mental ray.
if renderers.current != mental_ray_renderer do
(
if querybox "Switch to Mental Ray?" title:"switcher" beep:true then
(
renderers.current = mental_ray_renderer()
) else pushprompt "nope"
)
Any help or input is highly appreciated!
thanks
-theo
Just a little push:
When assigning (correctly)
renderers.current = mental_ray_renderer()
you are creating an INSTANCE of the CLASS mental_ray_renderer.
This means that mental_ray_renderer is a constructor of a class (a form of a function that creates a new instance of the class). This is why
renderers.current != mental_ray_renderer
will never return false, because the left-hand side
renderers.current
contains a class instance, while the right-hand side contains the class itself, and they are always unequal.
The right expression would be
classof renderers.current != mental_ray_renderer
I would suggest reading the (rather funny, I wrote it on a Valentine’s day) explanation in the MAXScript documentation entitled “The Wonderful World of Classes and Class Instances”.
Have fun with MAXScript!
Thanks a bunch Bobo!
I have been reading alot in the maxscript helpfiles, but i keep jumping back and fourth between all the subjects, it is very well written and have been very helpfull to me.
Ok, better dig into it again
thanks
-theo