SubMaterial Picker

3 votes
Version: 
1.0
Date Updated: 
11/03/2017

Hi All,

That's a small tool that allows you to pick a sub material from viewport instead of the multimaterial. It automatically loads the material in SME or CME (depending on what you have open). Holding "Shift", will act similar to default picker and it will load the source material.

This tool request came from Krešimir Jelušić on the Facebook group Stack (for more visit the link below). Dave Wortley (aka fb.me/MaxMadeEasy) also contributed with ideas and code. There is still some room from improvement but I'm not sure if I will have the time.

https://www.facebook.com/groups/stackthis/permalink/539754503037717/?com...

AttachmentSize
submaterialpicker.mcr2.63 KB

Comments

Comment viewing options

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

Can you change it to a button

Can you change it to a button with an interface? It seems that it is more comfortable to select the object first and then click the button.

harumscarum's picture

thanks

musthave tool - thanks!

jahman's picture

.

just change
if not SME.isOpen() do SME.open()
to
SME.open()

harumscarum's picture

cool!

sorry to bother you - it is only open SME if it closed instead maximize - is it possible to make it both - open when closed and maximize when minimized

Thanks!

jahman's picture

.

	fn setMaterial theMat = (
 
		if mateditor.mode == #advanced then (
 
			if not SME.isOpen() do SME.open()
			if SME.GetNumViews() == 0 do (
 
				tabIndex = SME.createView "View1"
				SME.activeView = tabIndex
			)
 
			local nodePos = [0,0]
			local selView = sme.GetView sme.ActiveView
 
			selView.CreateNode theMat &nodePos
			SME.setMtlInParamEditor theMat
 
			-- max 2014 and above
			selView.SetSelectedNodes theMat
			selView.ZoomExtents type:#selected
 
			/*
			-- any max version (may not work when several max instances are running)
			sme_hwnd = for m in (windows.getChildrenHWND 0) where m[4] == "NodeJoeMainWindow" and m[5] == "Slate Material Editor" do exit with m[1]
 
			if sme_hwnd != undefined do (
 
				windows.sendmessage sme_hwnd 0x6 0x2 0 -- WM_ACTIVATE
				actionMan.executeAction 369891408 "40072" -- zoom selected
 
			)*/
 
 
		) else (
 
			meditMaterials[medit.GetActiveMtlSlot()] = theMat
 
		)
 
	)
harumscarum's picture

thank younow it works with

thank you
now it works with SME minimized, but would it be possible to add material to SME (and open it) even if it closed?

jahman's picture

.

As far as I know there's no way to determine if selected mtl is in "hide unused slots" mode without getting the state of the button.

Put this after line 9 and reevaluate the original macro

-- max 2014 and above
selView.SetSelectedNodes theMat
selView.ZoomExtents type:#selected
harumscarum's picture

Amazing tool!

Thank you!
Would it be possible to open SME when the material is picked, then select picked material and zoom to it (and hide unused nodeslots for picked material)

titane357's picture

Thank you very much for this

Thank you very much for this !!! Such a big time saver !!! Cheers

vusta's picture

stick to the process and proper channels..

join queue over there and fill out this rigmaroll...

Comment viewing options

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