ScriptSpot

Script

SubMaterial Picker

By sinokgr · 2017-11-03

Version
1.0
Date updated
2017-11-03
Votes
3
Downloads
Description

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…

Comments (12)

TOO GOOOD . . . . . !

sketchupmaster · 2025-03-29

THANK YOU SO MUCH . . . . . :)

499748065 · 2018-09-18

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.

thanks

harumscarum · 2017-11-09

musthave tool - thanks!

cool!

harumscarum · 2017-11-08

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 · 2017-11-08

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

SME.open()

thank younow it works with

harumscarum · 2017-11-08

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 · 2017-11-09


	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
			
		)

	)

Amazing tool!

harumscarum · 2017-11-07

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)

.

jahman · 2017-11-08

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

titane357 · 2017-11-05

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

just gonna add keywords here ;)

robobear510 · 2017-11-03

material id picker to material, works on slate editor, tested on max 2018.3 with octane render, great job..

- autodesk, look at this and implement it into 2018.4, simple way to pick materials in a multimaterial object.. which always needs edit poly, click on polygon and then select the one you want.. 3 clicks less

..wander if autodesk peoples check this page at all, cause they should

stick to the process and proper channels..

vusta · 2017-11-03

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