Purge Empty Layers

1 vote
Version: 
1.0
Date Updated: 
06/04/2015

This script deletes all empty layers. In max 2015 (at this time) it can keep ALL nested layers (user prompt) if any one of them has objects on it. In other words, if a user chooses "Yes" at the query, ONLY layers with NO children AND no objects will be deleted. All nested hierarchies are maintained down to the last layer that has objects in it. Choosing "No" at the prompt will unnest all layers and delete all empty layers. When using a version of max prior to 2015, the script will simpy delete any empty layers. There are no nesting options in previous versions of the Layer Manager. See the examples below.

Query option when executing the macroscript

Query option when executing the macroscript. Note: This will only show when using Max 2015.

 

The results of the Layer Explorer after running the script when the "Keep Nested Layers" option is chosen.

 

The results of the Layer Explorer after running the script on the same scene when the user chooses NOT to keep nested layers.

See the included README.txt file for installation instructions.

Reminder, this is a macroscript for quick execution from the UI.

I want to send a shoutout to user LoneRobot where he posted a quick help script for similar functionality a while back. A line of his code reminded me about the "by" descriptor for use in "for" loops. I used his method of cycling through  a loop backwards setting the "by" option to -1. Thanks!

Version Requirement: 
3ds max 2010 - 2015

Comments

Comment viewing options

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

Thanks

it helped me a lot

e.ov's picture

thank you

Thanks for usefull script. And for selector "keep nested layers" - it' s very usefull.

character animator

Comment viewing options

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