select all polys with same mat ID than selected polys.

Hi, to be clear : I would like to select by ids like in max rollout "Polygon: Material IDs" but not one Id by one ID.
For exemple I select three polys of an editable poly car model ( one of the body, one of the tyre and one of the Mirror ) , run the script and ALL polys of the body, the tyres and the Mirror are selected.
Thanks

Comments

Comment viewing options

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

Thanks Barigazy, works fine

Thanks Barigazy, works fine :-)
I'm desesperate to see that I will never succeed to do something with array or bitarray....

barigazy's picture

...

Use this function

fn getSelectedFacesIDs = if selection.count == 1 and isKindOf (node = selection[1]) Editable_Poly do
(
	if (faces = node.selectedfaces as bitarray).isEmpty then messagebox "Select some faces of editable poly object!" title:"Warning" beep:off else
	(
		local ids = #{} ; getFaceMatID = polyop.getFaceMatID
		for f in faces do append ids (getFaceMatID node f)
		if GetCommandPanelTaskMode() != #modify do SetCommandPanelTaskMode #modify
		if subobjectLevel != 4 do subobjectLevel = 4
		for i in ids do node.selectByMaterial i clearCurrentSelection:off
	)
)
getSelectedFacesIDs()

bga

Comment viewing options

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