Notifications
Clear all

[Closed] Blur's Collapse Sub Object Material – Batch?

Hey Guys,

I have a quick question that I hope some of you Max Script gurus can help me with. I am fairly new to Max (long time Maya user) and do not know MS enough to tackle this. Is frustrating cause I know how I would go about it in Maya.

Basically I want to use Blur’s wonderful CollapseSubObjectMaterial script, on all objects that are selected. We have several scenes that have around 500 objects and this script needs to be run on them. And of couse time is of the essence and anything that could speed this up would be appreciated. I envision the workflow to be:
[ol]
[li]Select all objects, toss them into an array.[/li][li]Run CollapseSubObjectMaterial, use the object name from the array as the “Picked” obect.[/li][li]Run Collapse Material.[/li][li]Ignore any errors and move onto next object.[/li][/ol]Does anyone know if this can be easily done? Or maybe it already has been?

Thanks for all of your help!

2 Replies

A Quick shot… this worked on a selection of 4 boxes…

The Dialog still comes up, but it then runs over all the objects in the current selection doing the function from each button…


(
#include "$Scripts\\BlurScripts\\CollapseSubObjectMaterial.ms"

for SelObj in Selection do
	(
	prepare_mesh SelObj
	my_obj = SelObj
	collapse_material()
	)
)

Kramsurfer!!! Thank you very much for the help! This worked like a charm. I added a try/catch to the script in order to skip over objects that have a single material. Here’s the code incase someone out there needs it as well.

#include “$Scripts\BlurScripts\CollapseSubObjectMaterial.ms”

for SelObj in Selection do
try
(
prepare_mesh SelObj
my_obj = SelObj
collapse_material()
)
catch (print “Single Material Object Skipped.”)

Thanks again!