PDA

View Full Version : Scripted custom attributes keyability


Duncs
03-04-2009, 04:30 PM
Hey everyone, I'm having a problem with a character I'm rigging in Max 2009.

I have a bunch of scripted custom attributes to drive animation on the limbs (IK/FK blending and snapping etc.) and the following code works great - it's taken mainly from Paul Neale's online tutorials and rigging DVDs.

The problem occurs when I reload the scene - although the spinners seem to function correctly, I can no longer set keys / undo changes and none of the properties that have been wired to them update...


ca=attributes armCtrls
(
parameters params rollout:armRoll
(
ikfk type:#float ui: ikfkSp
up type:#float ui: upSp
mid type:#float ui: midSp
low type:#float ui: lowSp
ikRefNodes type:#maxObjectTab tabSize:0 tabSizeVariable:true
fkRefNodes type:#maxObjectTab tabSize:0 tabSizeVariable:true
)

rollout armRoll "Arm Controls"
(
group "IK FK Blending"
(
spinner ikfkSp "IK FK" range:[0,100,0]
button ikBtn "Snap IK to FK"
button fkBtn "Snap FK to IK"
)

on ikBtn pressed do
(
ikRefNodes[4].node.transform = fkRefNodes[4].node.transform
ikRefNodes[3].node.transform = fkRefNodes[3].node.transform
)

on fkBtn pressed do
(
fkRefNodes[1].node.transform = ikRefNodes[1].node.transform
fkRefNodes[2].node.transform = ikRefNodes[2].node.transform
)

group "Curve Controls"
(
spinner upSp "Top influence" range:[1,200,100]
spinner midSp "Mid influence" range:[1,200,100]
spinner lowSp "Low influence" range:[1,200,100]
)
)

)

custAttributes.add $.modifiers[1] ca

append $.modifiers[1].ikRefNodes (nodeTransformMonitor node:$upArmBone_IK forwardTransformChangeMsgs:false)
append $.modifiers[1].ikRefNodes (nodeTransformMonitor node:$lowArmBone_IK forwardTransformChangeMsgs:false)
append $.modifiers[1].ikRefNodes (nodeTransformMonitor node:$elbowCtrl_IK forwardTransformChangeMsgs:false)
append $.modifiers[1].ikRefNodes (nodeTransformMonitor node:$wristCtrl_IK forwardTransformChangeMsgs:false)

append $.modifiers[1].fkRefNodes (nodeTransformMonitor node:$upArmCtrl_FK forwardTransformChangeMsgs:false)
append $.modifiers[1].fkRefNodes (nodeTransformMonitor node:$lowArmCtrl_FK forwardTransformChangeMsgs:false)
append $.modifiers[1].fkRefNodes (nodeTransformMonitor node:$elbowTarg_FK forwardTransformChangeMsgs:false)
append $.modifiers[1].fkRefNodes (nodeTransformMonitor node:$armNub_FK forwardTransformChangeMsgs:false)


Hopefully this is a simple omission on my part, any suggestions would be greatly appreciated.

Thanks in advance

eek
03-04-2009, 04:37 PM
Just add the parameter animatable:true

e.g

ikfk type:#float ui: ikfkSp animatable:true

Duncs
03-04-2009, 04:41 PM
Hey eek, thanks so much for the speedy response.

I was hoping it would be something simple like this but, unfortunately, I still have the same problem. When I first run the script, all the attributes work fine. I can set keys and undo. However, when I reload the scene the keys are still there but the spinner values no longer change! Also, if I now turn on 'auto key' and change the spinner values, no keys are set...

Duncs
03-04-2009, 05:15 PM
I've just tried this in a new scene containing only a box - exactly the same problem using the simplified code below

ca = attributes testAttrib
(
parameters params rollout:testRoll
(
testIt type:#float ui:testSp
)

rollout testRoll "Test Roll"
(
spinner testSp "test spinner"
)
)

custAttributes.add $.modifiers[1] ca

Duncs
03-04-2009, 05:26 PM
Getting weirder and weirder...

If I restart max and then load my scene it works fine!

Dimich
03-04-2009, 08:58 PM
I've just tried this in a new scene containing only a box - exactly the same problem using the simplified code below

ca = attributes testAttrib
(
parameters params rollout:testRoll
(
testIt type:#float ui:testSp
)

rollout testRoll "Test Roll"
(
spinner testSp "test spinner"
)
)

custAttributes.add $.modifiers[1] ca

Hey Duncs,

What eek meant is this line:

parameters params rollout:testRoll
(
testIt type:#float ui:testSp
)

So you should have:
parameters params rollout:testRoll
(
testIt type:#float ui:testSp animatable:#true
)

cheers

Duncs
03-04-2009, 09:02 PM
Cheers for the response Dimich,

That's exactly what I tried on the original script but it didn't make any difference... Suppose I'll have to just restart Max each time I load a new scene - not ideal!

Other people seem to have posted with similar issues so at least I'm not the only one experiencing this problem but I can't find any threads where a conclusion has been reached as to why it might happen.

cyberdogs7
03-04-2009, 09:27 PM
Are you using SP1 on 2009? I have noticed that if you have a scripted CA on a modifier and that modifier is instanced on multiple nodes, on a save and reload the 'connection' of the instancing between the modifiers is lost and any parameters that where wired get trashed also. Example:

you have IK/FK switch CA on an attribute holder and that modifier is instanced to all 3 arm controls. Save the scene and reload it and the modifiers will say they are instanced still, but if you change that value on one and then click a different node with that modifier, or even un-select and re-select the same node, you will notice all the values have been reset back to default.

You can see how this would effect your keying also, since you are not really storing anything other then defaults.

Upgrading to SP1 solved this for me, but when I ran into this I swore off MAX until it was fixed. Hope this fixes your issue.

Duncs
03-04-2009, 10:01 PM
cyberdogs7 thanks so much man, I just upgraded to SP1 and it seems the problem is fixed.

Dimich
03-04-2009, 10:48 PM
We use 2k8 here, but this issue explains the weird problem I had with some of my rigs when having to deal with 2k9 :bounce:

cyberdogs7
03-06-2009, 07:06 PM
Glad I could help, cause I know when I ran in to this problem I wanted to take a shotgun my computer. Very frustrating stuff.

CGTalk Moderation
03-06-2009, 07:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.