Notifications
Clear all

[Closed] [MaxScript] MultiMaterial-like scripted plugin

Hi All,

I’m experimenting with a scripted material plugin, and I want to expose the material array (tab) of material.
Exposing Mtl1 and Mtl2 works fine. But when it comes to the #materialtab, I can’t figure out how to expose it in the material editor. I’m mainly concerned for the node knobs, in the material editor. As an alternative, I was wondering if there is a way to dynamically add parameters in the parameters block so I can treat them as “single” materials? I can dynamically update the UI so, that’ would be fine.

image

plugin material TestMtl name:"Test Material" classID:#(695421,446582) extends:Standard replaceUI:true version:1
(
	
	parameters main rollout:properties_ro (
		Mtl1 type:#material ui:mtl1_btn
		Mtl2 type:#material ui:mtl2_btn
		Mtls type:#materialTab tabSizeVariable:true
	)
	
	rollout properties_ro "Properties"
	(
		materialbutton mtl1_btn "Render material" width:300 
		materialbutton mtl2_btn "Render material" width:300
	)
	
)
13 Replies

any ideas on this one?

Do you mean something like this?

plugin material TestMtl name:"Test Material" classID:#(695421,446582) extends:Standard replaceUI:true version:1
(
	
	parameters main rollout:properties_ro
	(
		Mtls type:#materialTab tabSize:3 tabSizeVariable:true ui:(mtl1_btn, mtl2_btn, mtl3_btn)
	)
	
	rollout properties_ro "Properties"
	(
		materialbutton mtl1_btn "Render material" width:300 
		materialbutton mtl2_btn "Render material" width:300
		materialbutton mtl3_btn "Render material" width:300
	)
	
)

that (with the parenthesis) I didn’t know! Great stuff, many thanks @PolyTools3D!
One question though. If I want to add/remove materials in the MaterialTab, is there a dynamic way where I can change the UI parameter?
My goal is to be able to add/remove materials similar to the Multi-Material.

To resize a tab you can use the count property or set an index:

tab.count = N
or
tab[N] = X

Don’t know though if it will work well with materialTab/materialButton.

I probably didn’t explained it properly.
In your example, you manually pre-defined the ui property to this value of (mtl1_btn, mtl2_btn, mtl3_btn).
How can you add/remove other ui controls when you change the size of the tab? How can you dynamically set the ui to two buttons ui:(mtl1_btn, mtl2_btn) or four buttons ui:(mtl1_btn, mtl2_btn, mtl3_btn, mtl4_btn) programable?

I don’t know if it is possible to dynamically add/remove UI elements from a tab parameter.

What you can do is to set them to undefined and show/hide the associated control. But that won’t change the tab size.

Yeah, I wonder how they do it in the multi-material?

You can take a look at the source “multi.cpp”.

You lost me somewhere at the .cpp
OK, I might collect my courage and try that. Many thanks for all your replies.

Page 1 / 2