Difference between "$" and "$selection"

polycounter lvl 11
Offline / Send Message
SimonT polycounter lvl 11
I tried Google but it's hard to google "$" - So i wasn't successful. :) I#M using 3Ds Max 2011 64Bit

I always thought $ and $selection give you the same result: the current selection.

BUT

If you have e.g. a box linked to another box, select the blue one and execute the code below, you'll get different results:

Capture01_1.jpg

Code with $
for obj in $ do print obj
Result
$Box:Box01Parent @ [0.000000,0.000000,0.000000]
$Box:Box01Child @ [20.000000,0.000000,0.000000]

Code with $selection
for obj in $selection do print obj
Result
$Box:Box01Parent @ [0.000000,0.000000,0.000000]

Interesting

If you have the same situation but twice, and you select both parents, the results are equal for both code variations:

Capture02.jpg

Code with $
for obj in $ do print obj
Result
$Box:Box01Parent @ [0.000000,0.000000,0.000000]
$Box:Box01Parent @ [0.000000,21.652542,0.000000]

Code with $selection
for obj in $selection do print obj
Result
$Box:Box01Parent @ [0.000000,0.000000,0.000000]
$Box:Box01Parent @ [0.000000,21.652542,0.000000]

Why is this important?

For example if you've a script which moves objects around. In this example i add +10 to the x axis and in one case the linked box moves relative, in the other example it moves too far:

caputre03.gif

Is this a bug? Or did i just misunderstand the system?

Replies

Sign In or Register to comment.