I've (very poorly) written a script that selects objects by the active material, sorts those that are in a group, opens those groups & then finally re-selects them.
Mat = meditmaterials[medit.GetActiveMtlSlot()] MatObj = #() -- Collect all objects with material applied for i in $* do ( if i.material == Mat then append MatObj i ) if MatObj.count == 0 then print "Nothing has this material you fool!" -- Seperate objects that are in a group ObjNum = MatObj.count GroupedObj = #() for s = 1 to ObjNum do ( if isGroupMember MatObj[s] then (append GroupedObj MatObj[s]) else false ) -- Opens all groups ObjCount = GroupedObj.count progressStart "Opening Groups" for y = 1 to ObjCount do ( select MatObj max group open progressupdate (100.0*y/ObjCount) ) progressEnd() select MatObj
It works, but I know that the last part (Opens all groups) isn't as efficient as it should be.
Firstly it loops through the MatObj array & tries to open the selection for every grouped object - not for every group.
Secondly, I couldn't find a cleaner way to open a group other than 'max group open'. Is there any way to select/find the group node & manipulate it?
Thirdly, I am terrible at maxscript, I was only able to cobble this together thanks to Bobo's fantastic 'Maxscript for the Masses' DVD... So any other improvements or advice would be greatly appreciated.