Create warning message for the rendering engine in use

Hi man :)

I have write this quick code when I want change the engine renders...

(
	renderers.current = Default_Scanline_Renderer()
	print renderers.current as string
	messagebox "Chosen Scanline Render" title:"Michele71 Tools" beep:true
)

...but I did not understand as write a message on which engine is in use.

Logical Flow:

I have in use MentalRay or Scanline renders engine
I run the script and I have a first messagebox "The actual Engine renders is (name of the Rendering in use)",
Later appears to a second messagebox "Chosen (new name rendering engine) Render"

How do?

Thanks in advance for your help appreciated :)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

OK.Here some functions that

OK.
Here some functions that I use in RTTAssist

local rendererChange -- renderer 'when' callback
 
--	check wich renderer is active
		function ActiveRenderer =
		(
			local renderer = renderers.current
			local rendererClass = classof renderer
			local txt
			if rendererClass == Default_Scanline_Renderer then
			(
				activeRender = "scanline"
			)
			else
			(	
				if (rendererClass == mental_ray_renderer) then
				(
					activeRender = "mRay"
				)
				else
					activeRender = "Unknown Renderer Type"
			)
			activeRender
		)
 
--	change renderers for filtering settings
		function UpdateFilterSettings =
		(
			local renderer = renderers.current
			local rendererClass = classof renderer
			local txt
			if rendererClass == Default_Scanline_Renderer then
			(
				lb_scanline.bitmap = (openBitmap (url+"miauuITscanlineActive.png"))
				lb_mRay.bitmap = (openBitmap (url+"miauuITmentalRay.png"))
				txt = "G.Supersampler: "
				if renderer.globalSamplerEnabled then
					append txt renderer.globalSamplerClassByName
				else
					append txt "None"
			)
			else if (rendererClass == mental_ray_renderer) then
			(
				lb_scanline.bitmap = (openBitmap (url+"miauuITscanline.png"))
				lb_mRay.bitmap = (openBitmap (url+"miauuITmentalRayActive.png"))
				txt = "Samples per pixel: "
				local n = amax renderer.MinimumSamples 0
				local m = amax renderer.MaximumSamples 0
				append txt ((4^n) as string)
				txt += " - " +(((4^m) as string))
			)
			else
				txt = "Unknown Renderer Type"
 
			lb_filteringOptions.text = txt
		)
		function RendererPropChanged =
		(
			UpdateFilterSettings()
		)
		function RendererChanged =
		(
			deleteChangeHandler rendererChange 
			rendererChange = when parameters renderers.current change do RendererPropChanged()
			UpdateFilterSettings()
		)
 
on miauuRTTassist open do
		(
			--	monitor renderer change
			rendererChange = when parameters renderers.current change do RendererPropChanged()
			callbacks.addscript #postRendererChange "miauuRTTassist.RendererChanged()" id:#miauuRTTassist_rendererChange
			callbacks.addscript #postRendererChange "miauuRTTassist.RendererChanged()" id:#miauuRTTassist_rendererChange
			UpdateFilterSettings()
                )
 
on miauuRTTassist close do
		(
			deleteChangeHandler rendererChange 
			callbacks.removeScripts id:#miauuRTTassist_rendererChange
                )

The first function will show you the active render edgune. The next will monitor the render change while your script is active.
Hope this help.

Michele71's picture

Thank you very much miauu :)

Thank you very much miauu :) This is what I was looking for! Certainly I have to "bend" the function of what is to me, but it is very useful starting.

Thanks again Miauu, That was really nice

Michele

miauu's picture
miauu's picture

Why you need 2

Why you need 2 messageboxes?

If I understand correctly what will happen:
1. Run the script.
2. appear messagebox: "The actual Engine renders is (name of the Rendering in use)"
3. User press OK and immediately appear second messagebox: "Chosen (new name rendering engine) Render"

If this is the scenario then this code will do the job

(
	messagebox "The actual Engine renders is" title:""
	messagebox "Chosen render" title:""
)

Max will show the first messagebox and execution of the script will stop. When you press OK in the messagebox rollout max will continue with the script execution and will show the second messagebox.
Messagebox is modal, so every time when the messagebox is shown the execution of the script stops until the user press OK button.

Also you can use custom rollout with modal set to true.

Michele71's picture

I try to explain better.

I try to explain better. :)

The real problem is knowing how to recognize the rendering engine that is currently in use.

If you are using Scanline, when you exchange with MentalRay you have the first messagebox. With the second messagebox, is activated the MentalRay.

Now in my script, I had no problems in changing the render engine, but i want know the rendering engine which is used at that moment...your explanation mentioned above, I know about :)

I hope I explained myself better ... I'm sorry for my bad English.

Anyway, thank you for your quick help Miauu :) :)

miauu's picture

What event will

What event will trigger
messagebox "Chosen Scanline Render" title:"Michele71 Tools" beep:true

Michele71's picture

Will trigger the type of

Will trigger the type of rendering engine not in use at that time...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.