Notifications
Clear all

[Closed] $.rotation.controller.x_rotation.keys not working when accessed via a variable?

Possibly via “Indexed Access to Animateable Properties?”

ie

tst = $[#transform][#rotation]
SubAnim:Rotation

tst.isanimated
true

[font=Verdana]EDIT …oops, too late
[/font]

no, not too late, drdubosc. Funny I was reading about this method before ZeBoxx2 posted his answer.

It looks like another good method to get the same results. I was using it with numbers, instead of #tranform and #rotation, since I’m not very familiar with the # character yet.

Oh, good. I’m still straining my head trying to work out what the code behind this behaviour of properties must look like, so I can get a mental picture of it. An overload of “=”, perhaps. Just a phase. It will pass :).

as far as * goes, it’s the dereferencing operator, otherwise you’re just left with another reference, while you need the value of it.

Basically the whole referencing thing is a powerful (albeit somewhat confusing-at-first) method of getting a value at the time you dereference the reference. This is different from variables in that variables are static. It’s similar to a function, in that regard, but without the need for defining a function.

e.g.


fn selRadius = ( $.radius )
selRadius()

myRadius = $.radius
26.223
selRadius()
26.223
myRadiusRef = &$.radius
(prop radius* (%"getDollarSel"()))

$.radius = 10
10

myRadius
26.223
selRadius()
10.0
myRadiusref
(prop radius* (%"getDollarSel"()))
*myRadiusRef
10.0

Of course a function (or an UI element’s callbacks code bock) is much more flexible as you can make calculations, put in conditional tests, etc. But sometimes, a reference is all you need and it’s much more light-weight.

thanks ZeBoxx2 for that deeper explanation.

In the end I went with $[#transform][#rotation], it works perfectly with what I’m trying to do and it’s simple enough.

Now if I can just figure out how the # character is working in this expression… I know # character is used for arrays, but I can’t see exactly how it works here.

In Maxscript the # refers to a Name Literal. You can look it up in the Maxscript Help for more info.

-Eric

1 Reply
(@whitemage)
Joined: 10 months ago

Posts: 0

thank you in pointing me to the right direction

Page 2 / 2