Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Select CatParent in MaxScript

Select CatParent in MaxScript

Anonymous
Not applicable
785 Views
6 Replies
Message 1 of 7

Select CatParent in MaxScript

Anonymous
Not applicable

How i can check if my object in the selection is a CatParent and not a CatBone?

 

Thanks

 

0 Likes
786 Views
6 Replies
Replies (6)
Message 2 of 7

Steve_Curley
Mentor
Mentor
Assuming a single object selected:-
if classof selection[1] == CatParent then
   -- it's a cat parent
else
   -- it's not

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 7

Anonymous
Not applicable

Yes! I have just one object selected. 

 

Great, i will try this!

 

Thanks

0 Likes
Message 4 of 7

Anonymous
Not applicable

Works fine! Thanks!

 

What is the number 1 inside of selection[] ?

And, do you know the diference between Cat_Parent and CatParent?

 

 

 

0 Likes
Message 5 of 7

Steve_Curley
Mentor
Mentor
Selection is an inbuilt array (well, technically a collection, but...) so if there's only 1 item selected it is in the 1st element of the array. [1] is an array index. Essentially the same using "$" i.e. classof $

Select an object, open the Maxscript Listener and type in "classof $" - if the selected object is a CatParent then that is what is displayed - literally. Also, the help has no entries for "Cat_Parent" but does for "CatParent" which is a bit of a clue 🙂

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 6 of 7

Anonymous
Not applicable

Cool, 

 

I understood, i was using $.

 

I tryed different ways ex.:

if $.category == CatParent then

if $.category == Cat_Parent then

if $category... etc

 

But the key was classOf 🙂

 

Next step is to parse the string of layer name of cat to set the timeline range 🙂

 

Iam very newbie in maxscript, so i have some doubts

 

Thanks for help!

0 Likes
Message 7 of 7

Steve_Curley
Mentor
Mentor
Category is a somewhat different animal. Think of them as "groups" of objects of a similar type. A Box is part of the "#Standard_Primitives" category, a CatParent is part of the "#CAT_Objects" category and so on. Categories have their uses (they're used by the Display Panel "Hide by Category" for example) but aren't really specific enough for what you need in this instance.

Usage would be :- if $.category == #Standard_Primitives then...

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes