ScriptSpot

Forum topic · General Scripting

group properties issue

By ce89 · 2012-08-29

Description

I am trying to check if there is only one "main/top level" group present in my maxfile. Basically i want to check that everything has been grouped at a top level and doesn't consist of 10's, possibly 100's of of objects.

I cannot seem to work out how to check that the group count for the current scene is not equal to 1.

Hopefully it looks something like. Tried many variations but a bit confused now on what options to try.

if groupHead.count != 1 do (
messagebox "more than one group present"
)

Any help would be much appreciated.

Comments (2)

kimarotta · 2012-08-29

maybe...


group_arr = for o in objects where isValidNode o AND isGroupHead o collect o

if group_arr.count != 1 do (
messagebox "more than one group present"
)

ce89 · 2012-08-29

Thanks for the quick reply Kimarotta,

It seems to work for objects that are grouped seperatley, but if i have groups within a top level group it still thinks there are more than one group present. If all scene groups are grouped at a top level i was wanting it to only see it as one group.

Hope this makes sense.