Notifications
Clear all

[Closed] Visibility of grouped objects?

I’m having some trouble with what SHOULD be a really simple script.

on btn2 pressed do
(

            If

            $ != undefined

            then

            $.visibility = true

            else

            messageBox "Please select an object"

        )

There is also another button that does the same thing, only makes the selected objects visibility false. However, if the selected object(s) are grouped together with something, then only parts of the group become invisible, and what’s really weird, is that when you click the button to make them VISIBLE, then the objects that were never turned invisible…now turn invisible, while the rest turn visible, so they basically switch places.

Is there something that happens to an objects visibility property when it’s grouped? How do I get around this?

5 Replies

I think it should be more like this.


on btn2 pressed do
(

If $ != undefined
(
$.visibility = true

)
else
(
messageBox "Please select an object"
)

)


  

Just filter out the group head(s), something like

on btn2 pressed do
 (
 	if $ != undefined then
 		for i in selection where NOT isGroupHead i do 
 			i.visibility = true
 	else
 		messageBox "Please select an object"
 )

That worked beautifully Swordslayer. Thank you a lot.

Thank you as well viro.

Yep, the objects inherit the group viz-prop so that maybe is a bit more faster –

 for i in selection where isGroupHead i do i.visibility = off 

Only problem with that is that not everything I will be selecting is going to be in a group, only some things.

You’ve all been a great help. I’ve only been learning maxscript for about a month now, so I still don’t know all of the commands.