How to count the number of Groups in selection


#1

Hi all,

I have a script as below, but I don’t know that how can I count the number of Groups.
Actually, I want to count the Groups and make the length of the Keyframe.

My code :

– Set length of the Keyframe by Counting of Groups

(
head_group = #()
for grp in (selection as array) where (isgrouphead grp) and not (isGroupMember grp) do (print (append head_group grp).count)

)

grpcount = ???
framelength = 2*grpcount

animationRange = interval 0 framelength
sliderTime = 0f
)


#2

I’m not sure I understood you correctly, but are you looking for something like this?

groupHeads = (for obj in Helpers where (isGroupHead obj == true) collect obj)
animationRange = interval 0 groupHeads.count

#3

Prefect,
Thank you so much for your help