How to delete one of the material in the sub-material !

How to delete one of the material in the sub-material !

Anonymous
Not applicable
2,752 Views
7 Replies
Message 1 of 8

How to delete one of the material in the sub-material !

Anonymous
Not applicable

How to delete one of the sub-material by maxscript like the delete button on the multi/sub-object rollout。20170412114852.png

I used  deleteitem $.material.materiallist 2,but the result is  not what I want !

I need some helps! 

0 Likes
Accepted solutions (1)
2,753 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

I'm not offering mxs help but if your aim is to clean out unused sub-mats...then there's this:

 

https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/3DSMa...

 

 

Message 3 of 8

blakestone
Collaborator
Collaborator

what about this : 

 

deleteItem ($.material.materialIDList) 2 
Message 4 of 8

Anonymous
Not applicable

I tried but the result is different from the delete button. see below

2.png3.png4.png

0 Likes
Message 5 of 8

Anonymous
Not applicable

That is a good way.

Many thanks !

0 Likes
Message 6 of 8

blakestone
Collaborator
Collaborator
Accepted solution

This should do the trick...

It's basically re-assigning materials before the delete.

 

 

(
	local id = 3 -- the matid to be deleted
	local mat = $.material

	with undo on (
		for i = id to mat.materialList.count - 1 do (
			mat.materialList[i] = mat.materialList [i+1]
		)
		deleteItem mat.materialIDList id
	)
)
Message 7 of 8

Alfred.DeFlaminis
Alumni
Alumni

Hello @Anonymous and welcome to the community,

 

Did the posts by @blakestone and/or @Anonymous help solve this issue for you?  Are you all set now?  If so, would you please mark any posts that had the solution in them by clicking "Accept as Solution" for me, please?  Thanks very much!  This way the next person with this question can benefit from the great work that Blakestone and Vusta have done here.  


Best Regards,

0 Likes
Message 8 of 8

Alfred.DeFlaminis
Alumni
Alumni

Hello @Anonymous,

 

I just wanted to follow up here, any thoughts on my previous post?

Best Regards,

0 Likes