pick material button

hello,
I try to find a button te get a material. okay, there's the materialbutton. but once picked you cannot modify the material. also you can't drag and drop it in the materiallib or copy it. I've made a copy material button (mat = meditMaterials[spnMatSlot.value]) but not exactly what I want.. so does anyone knows how i can gat such a getmaterial button? thanx

Comments

Comment viewing options

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

where is the problem?

What you mean by "once picked you cannot modify the material"? If your MaterialButton is named for example matBtn1 then the picked material is stored in it #material property, so to access it just say: matBtn1.materail.

As for the drag-n-drop, yep, no such feature for any of the scripted rollouts controllers, but where is the problem?

The MaterialButton just popup Mat/Map Browser dialog and there you can specify from where to pick the material (library, editor, active slot, scene, selected object, or even from new).

Well, if you want to control the Mat/Map Browser dialog then you'll need regular ui Button and call to materialBrowseDlg and mtlBrowser.browseFrom.

Here is an examples, but check the help file for detals.

-- call stored material in MaterialButton
if IsKindOf matBtn1.materail Material then
(
	case ClassOf matBtn1.materail of
	(
		Standard  : matBtn1.materail.diffuse = red
		DxMaterial: matBtn1.materail.k_d = red
		default   : messageBox "Unsupported material type"
	)
)
else messageBox "No stored material" title:"My Tool"
 
-- using materialBrowseDlg()
myMat = materialBrowseDlg #mats #instanceOnly
mtlBrowser.browseFrom #mtlLibrary

my recent MAXScripts RSS (archive here)

jos's picture

a more userfriendly approach

thanx for reply Anubis. yes I know calling the materialBrowseDlg.
I was wondering if there was a drag and drop possibility.
it's not a problem that i can't get it working,
but more user-friendly.. sorry if I wasn't clear enough
is it possibly with the sdk?

Anubis's picture

ok ;)

yep, with the sdk drag-n-drop is built-in.

my recent MAXScripts RSS (archive here)

Comment viewing options

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