Using Clear()?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Using Clear()?

Post by Dodgy »

Hiya,

I'm trying to clear the bone pos channel, but I keep getting an error. here is what I'm doing:

mybone.fAnimPos:Clear()

as
mybone.fAnimPos:StoreValue()

works, and Clear is in the same class as StoreValue, so I thought they'd be the same....
Anyone use this and can tell me how to get it to work?

Thanks,
Mike
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Re: Using Clear()?

Post by Rudiger »

Dodgy wrote:Hiya,

I'm trying to clear the bone pos channel, but I keep getting an error. here is what I'm doing:

mybone.fAnimPos:Clear()

as
mybone.fAnimPos:StoreValue()

works, and Clear is in the same class as StoreValue, so I thought they'd be the same....
Anyone use this and can tell me how to get it to work?

Thanks,
Mike
When I was updating my Nudge scripts for version 7, I noticed that the Clear method now requires an integer argument whereas before it didn't require any arguments at all. The first value I tried was 0, which appeared to work at first, but I noticed some problems when the layer was shifted by the Sequencer. As a wild guess, I then tried layer:TotalTimingOffset(), and it seemed to do the trick, at least for my particular use of it.

You can try this value as well, but realise that it's a total guess on my part, and I have no idea what this parameter is actually for. Otherwise, you can try emailing Mike Clifton and ask him what parameter we should provide for this method.
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Post by Dodgy »

Thanks Rudiger, I'll try emailing him and let you know the response. This is for a complementary script for Morph dials, to key the phoneme bone using a papagayo dat file.
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

Dodgy wrote:Thanks Rudiger, I'll try emailing him and let you know the response. This is for a complementary script for Morph dials, to key the phoneme bone using a papagayo dat file.
Neat!
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Post by Dodgy »

The rest of it works already, I just need to clear the animation channel before applying the keys. I could just cycle through and delete them by hand, but it'd be nice to know why this doesn't work, or if it's a bug.
Dodgy
Posts: 207
Joined: Sat Jan 13, 2007 8:01 pm
Location: Sydney
Contact:

Post by Dodgy »

Try using:

mybone.fAnimPos:Clear(0)

A channel always needs at least one keyframe to store the initial
value. The number you pass to the Clear function tells the channel
what frame to keep as the only one. Typically, this is frame 0.

-Mike
It works, so I'm going to upload the script soon as I can get an ftp connection :P
Post Reply