Notifications
Clear all

[Closed] hide unhide rollout

Hi,

thanx for reply.
But I have solved it probably, but just partially.
You are right with your example, just change picked to set :).
Now i have texturemap(not materialbutton) which i picked(set) in new rollout also in (hidden-replaceui:true)diffuse map slot.And when im changing this texturemap its changing also in hidden dif map slot(to see this just unhide ui) and vicaversa.
But now I have another problem.
I need to load bitmaps from old(standard+user def rollouts) material to new user def material. :)When I add i new part of code to old user defined material, the textmap button dont want to take textmaps from diffmap slot.
Probably a have to convert old material to new ones, isnt it?
May I have any other choices?
Mr.Orange

 rdg

Why have you changed ‘picked’ to ‘set’? There is no set event for materialbutton, at least in my reference.
I see that this change updates the gui, but it still doesn’t render? I am confused.

Can please you post a complete example?
I am interested in this topic, but it is ‘annoying (?)’ to guess your code …

Georg

hi, we have soved everything fine.But because of posibityty of some problems with inheriting some information wi will convert old user def mat to new user def material.
It dont functioning properly backward to standart textureMap
Here is principle of code.

--material USERDEF
 
 	
 
 	plugin material MaterialUSER
 		name:"MaterialUSER"
 		classID:#(0x2dd965ff, 0xc686218)
 		extends:standard replaceUI:false version:1 --showInViewport:true
 		
 	(	parameters USERMaps rollout:USERMapsRollOut
 		(
 			DiffuseCheck type:#boolean ui:DiffuseChecker default:false
 			DiffuseValue type:#float ui:DiffuseValuer default:100
 			DiffuseMapp type:#textureMap ui:DiffuseMapper
 			
 			on DiffuseMapp set theMap do
 			(
 				if (theMap != undefined) then
 					DiffuseCheck = true
 				delegate.diffuseMap = theMap
 			)
 		
 			AlphaCheck type:#boolean ui:AlphaChecker default:false
 			AlphaValue type:#float ui:AlphaValuer default:100
 			AlphaMapp type:#textureMap ui:AlphaMapper
 			
 			BumpCheck type:#boolean ui:BumpChecker default:false
 			BumpValue type:#float ui:BumpValuer default:30
 			BumpMapp type:#textureMap ui:BumpMapper
 			
 			on BumpMapp set theMap do
 			(
 				if (theMap != undefined) then
 					BumpCheck = true
 				delegate.BumpMap = theMap
 			)
 			
 			ReflectionCheck type:#boolean ui:ReflectionChecker default:false
 			ReflectionValue type:#float ui:ReflectionValuer default:100
 			ReflectionMapp type:#textureMap ui:ReflectionMapper
 	
 			on ReflectionMapp set theMap do
 			(
 				if (theMap != undefined) then
 					ReflectionCheck = true
 				delegate.ReflectionMap = theMap
 			)
 	
 			RefractionCheck type:#boolean ui:RefractionChecker default:false
 			RefractionValue type:#float ui:RefractionValuer default:100
 			RefractionMapp type:#textureMap ui:RefractionMapper
 	
 			on RefractionMapp set theMap do
 			(
 				if (theMap != undefined) then
 					RefractionCheck = true
 				delegate.RefractionMap = theMap
 			)
 	
 			NormalCheck type:#boolean ui:NormalChecker default:false
 			NormalValue type:#float ui:NormalValuer default:100
 			NormalMapp type:#textureMap ui:NormalMapper
 	
 			Diffuse1Check type:#boolean ui:Diffuse1Checker default:false
 			Diffuse1Value type:#float ui:Diffuse1Valuer default:100
 			Diffuse1Mapp type:#textureMap ui:Diffuse1Mapper
 	
 			Diffuse2Check type:#boolean ui:Diffuse2Checker default:false
 			Diffuse2Value type:#float ui:Diffuse2Valuer default:100
 			Diffuse2Mapp type:#textureMap ui:Diffuse2Mapper
 		)
 		
 						
 		function UserDefCheckBox CheckBox theState =
 		(
 			local Text = CheckBox.caption
 			if (theState) then
 			(
 				if (UserDefTxt == undefined) then
 				(
 					UserDefTxt = Text
 				)
 				else
 				( 
 					iPos = findString UserDefTxt Text
 					if (iPos == undefined) then
 		 		UserDefTxt += "
" + Text;
 				)
 			)
 			else 
 			(
 				local iPos = findString UserDefTxt Text
 				if (iPos != undefined) then
 				(
 					local iLength = Text.count
 		 	if (iPos > 1 and UserDefTxt[iPos-1] == "
") then
 					(
 						iPos = iPos-1
     		    		iLength = iLength+1
 					)
 		 	UserDefTxt = replace UserDefTxt iPos iLength "" 
 				)
 			)
 		)
 		
 		function IsChecked Text =
 		(
 		return (if (UserDefTxt == undefined) then false else ((findString UserDefTxt Text) != undefined))
 		)
 		
 		
 		
 		
 		
 		
 	
 		
 		
 		rollout USERMapsRollOut "USER Maps"
 		(
 			label AmountLabel "Amount" pos:[115,9]
 			
     		checkbox DiffuseChecker "Diffuse map" checked:DiffuseCheck align:#left across:3
 			spinner DiffuseValuer "" type:#integer align:#left width:40
 			mapButton DiffuseMapper "<" align:#right height:16 width:145
 			
     		on DiffuseChecker changed theState do delegate.DiffuseMapEnable = theState
     		on DiffuseValuer changed theValue do delegate.DiffuseMapAmount = theValue
 			
     		checkbox AlphaChecker "Alpha map" checked:AlphaCheck align:#left across:3
 			spinner AlphaValuer "" type:#integer align:#left width:40
 			mapButton AlphaMapper "<" align:#right height:16 width:145
 	
 			on AplhaChecker changed theState do delegate.AplhaMapEnable = theState
 			on AplhaValuer changed theValue do delegate.AplhaMapAmount = theValue
 			
 			checkbox BumpChecker "Bump map" checked:BumpCheck align:#left across:3
 			spinner BumpValuer "" type:#integer align:#left width:40
 			mapButton BumpMapper "<" align:#right height:16 width:145
 	
 			on BumpChecker changed theState do delegate.BumpMapEnable = theState
 			on BumpValuer changed theValue do delegate.BumpMapAmount = theValue
 	
 		checkbox ReflectionChecker "Reflection map" checked:ReflectionCheck align:#left across:3
 			spinner ReflectionValuer "" type:#integer align:#left width:40
 			mapButton ReflectionMapper "<" align:#right height:16 width:145
 	
 		on ReflectionChecker changed theState do delegate.ReflectionMapEnable = theState
 		on ReflectionValuer changed theValue do delegate.ReflectionMapAmount = theValue
 	
 		checkbox RefractionChecker "Refraction map" checked:RefractionCheck align:#left across:3
 			spinner RefractionValuer "" type:#integer align:#left width:40
 			mapButton RefractionMapper "<" align:#right height:16 width:145
 	
 		on RefractionChecker changed theState do delegate.RefractionMapEnable = theState
 		on RefractionValuer changed theValue do delegate.RefractionMapAmount = theValue
 	
     		checkbox NormalChecker "Normal map" checked:NormalCheck align:#left across:3
 			spinner NormalValuer "" type:#integer align:#left width:40
 			mapButton NormalMapper "<" align:#right height:16 width:145
 	
     		-- on NormalChecker changed theState do delegate.NormalMapEnable = theState
     		-- on NormalValuer changed theValue do delegate.NormalMapAmount = theValue
 	
     		checkbox Diffuse1Checker "Diffuse map 1" checked:Diffuse1Check align:#left across:3
 			spinner Diffuse1Valuer "" type:#integer align:#left width:40
 			mapButton Diffuse1Mapper "<" align:#right height:16 width:145
 	
     		checkbox Diffuse2Checker "Diffuse map 2" checked:Diffuse2Check align:#left across:3
 			spinner Diffuse2Valuer "" type:#integer align:#left width:40
 			mapButton Diffuse2Mapper "<" align:#right height:16 width:145
 		)
 	
 		on create do 
 		(  
 			if (not MatGroupsLoaded) then
 			(
 				ReloadMatGroups()
 				MatGroupsLoaded = true
 			)
 		)
 		
 		on load do
 		(
 			if (not MatGroupsLoaded) then
 			(
 				ReloadMatGroups()
 				MatGroupsLoaded = true
 			)
 		)		
 )

Mr.Or.

I ran into the same issue and wasn’t sure why until I found the following in the Maxscript reference:

[left]In a scripted Material plug-in, Material and Map buttons that are associated with a parameter in a parameter block do not call the button’s picked event handler. Instead, you should link the button to a parameter in a parameter block, and use the set handler for the parameter.
[/left]
[left]

[/left]
If you’re writing a scripted material plugin that’s using materialbuttons or mapbuttons and you have those wired to parameters then the picked events for those buttons will not be called.
[left]

[/left]

Page 2 / 2