Editing specific bitmap offset, output and other proproties

Heya

I've went over this for past 2 hours with not much luck. The closes I was is when I found some of Bobo's suggestions on forum. In any case if some1 could help me out that would be amazing.

I'm trying to access a specific bitmap that is located in
Mental ray >
Environment map > Environment/Background Switcher > Environment / Reflections> Bitmap- offset, Output amount and other parameters.

I tried by going directly :

sceneMaterials["IBL_Map"].Properties.reference.output.output_amount = 5.53 

But that errors out. I also tried to somehow make this line usable

rootScene[#SME][#View1][#IBL_Map__IBL_Basic_Studio_hdr].Properties.reference.coords.U_Offset = 0.05

But that dont work either.

How can I follow up hierarchy of an node and get to that specific bitmap? I know that going by name search wont work as I can have more than 1 bitmap with that name. But maybe it could work not sure.

I want to hock up a spinner for easy control of my IBL. Does any1 have any idea how to access that parameter?

Regards

Dariusz

Comments

Comment viewing options

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

...

Amazing work! Thanks for sharing :)

Dariusz's picture

Ok so I hit another wall

Ok so I hit another wall :-)

When I restart max and start from fresh scene I'm missing few nodes and my script crashes ehh

Anyway can some suggest a fix for missing values? - The script wont start because the value for spinner dont exist because the envi node don't exist.

global tete=1
rollout studio "Studio Settings" width:343 height:501
(
 
	on studio open do
	(
		try( -- TEMPORARY FIX
		if(tete = scenematerials["IBL_Main"].environment_shader.output.output_amount) != undefined then tete else
		(
			tete = 1
			)
		)catch()
		)
 
 
	button btn_Create_IBL "Create IBL" pos:[8,8] width:144 height:24
	button btn_Delete_IBL "Delete IBL" pos:[160,8] width:144 height:24
 
	spinner spn_Intensity "" pos:[80,39] width:72 height:16 range:[0,10000,tete] scale:0.1
pixamoon's picture

oki oki

I see you have Create button... (so you want to use script to create and edit material...)
Than your script should check first if material "IBL_Main" exist... you can use if map != undefined then .... or try()catch() to check it. If material doesn't exist script will turn off spinner or more rollout items. See in code below.

When button Create "IBL_Main" is pressed - script will create material and turn on spinner.

I think it can look this way:

rollout studio "Studio Settings" width:343 height:501
(
	button btn_Create_IBL "Create IBL" pos:[8,8] width:144 height:24
	button btn_Delete_IBL "Delete IBL" pos:[160,8] width:144 height:24
	spinner spn_Intensity "" pos:[80,39] width:72 height:16 range:[0,10000,1] scale:0.1
 
	on studio open do 
		(
			if scenematerials["IBL_Main"] != undefined then 
				spn_Intensity.value = scenematerials["IBL_Main"].environment_shader.output.output_amount 
			else 
				spn_Intensity.enabled = false
 
			--- OR ---
			--try(spn_Intensity.value = scenematerials["IBL_Main"].environment_shader.output.output_amount)catch(spn_Intensity.enabled = false)
		)
 
	on spn_Intensity changed state do 
		(
			if scenematerials["IBL_Main"] != undefined then scenematerials["IBL_Main"].environment_shader.output.output_amount = spn_Intensity.value else Messagebox "Can't find \"IBL_Main\""
 
			--- OR ---	
			--try(scenematerials["IBL_Main"].environment_shader.output.output_amount = spn_Intensity.value)catch(Messagebox "Can't find \"IBL_Main\"")
		)
 
	on btn_Create_IBL pressed do (  
		-- CREATE IBL_Mat
		-- use your code here
 
		-- TURN ON SPINNER
		spn_Intensity.enabled = true
		)
 
	on btn_Delete_IBL pressed do (  )
)
createdialog studio

So first I would declare all items in rollout with default values, than use "on open..." if map exist it load spiner value otherwise it will turn off spinner.

Hope it helps.
Cheers,
Pixamoon

Dariusz's picture

Hey mate Thanks I cant

Hey mate

Thanks I cant believe I mist it ! I had to reference the switch shader and then I could've sub reverence the bitmap parameters as you've showed me. Oh dear thanks!!!!

pixamoon's picture

no prob

no prob man :) Happy I could help!
Pixamoon

pixamoon's picture

mr Enviroment/Background Switcher properties

Hey,

If you do:

print (getpropnames scenematerials["IBL_Map"])

you will get properies names:
#Background
#environment
#background_connected
#background_shader
#background_paramName
#environment_connected
#environment_shader
#environment_paramName
#TheList
#Shader_Version

Bitmap holders are: background_shader and environment_shader
so the code can look:

scenematerials["IBL_Map"].background_shader.output.output_amount = 5.53
or
sceneMaterials["IBL_Map"].background_shader.coords.U_Offset = 0.05

Hope this helps,
Pixamoon

Comment viewing options

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