Notifications
Clear all

[Closed] How to do this?

I am trying ot write a script for unhiding and unfreezing all the objects including layers
my code is like this
It should basically select every object including helpers, shapes, geometry …

Here I am trying on simple boxes

  for o in selection where not(o.layer.on) and (o.layer.unfreeze )  do o.layer.on = true
  (
      select $box*

unhide selection dolayer:true
unfreeze selection dolayer:true
)

This is working fine but I have to run the same code for 3 times to get what I desire
anything wrong with this code???

Thanks in advance

3 Replies
1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

U.S.S. Speed approach is correct, but I might also add


unfreeze o doLayer:true

as well, just to be sure.

The reason, I think, your original code is having problems is the fact that you are only look at layers that are off and unfrozen, which may be limiting your results…

Shane

I’ve just check this :



		Everything = ($objects) as array
		
		for o in Everything do
		(
			unhide o doLayer:True
			unfreeze o
		)

And it appears to work fine.

Little note, I learned the hard way to not use “select” in a maxscript. Maybe I was doing it wrong, but it always slowed my script to hell when it was called too often.

just to add a bit more to what has already been said:

i think the simplest and fastest way would take only 2 lines

unfreeze objects doLayer:true
 unHide objects doLayer:true

if you also want to select everything, use

select objects