PDA

View Full Version : Jscript-Current Frame


dwigfor
05-12-2006, 12:53 AM
Hi all,

I was following a tutorial for creating scripts for the Synoptic Editor, but it was written in VBScript. I can figure out everythin except what the equivalent of VBscripts' FC , current frame.

Issue arrises when setting a key. I need to change it from setting a key on frame 1 to the current frame. Only thing I could find in the docs was either in VBScript, or I did find one instance where it mentioned Playback Control, but I didn't think that was right.

Thanks for the help.. I went and redid the script into VBScript, but I'd really like to do it in Jscript.

-Dave

Stoehr
05-12-2006, 12:56 AM
I use this:

function saveKey(in_obj)
{
SetMarking("MarkingSet");
SaveKey();
}

And it saves a key at the current frame.

doctorbob
05-12-2006, 06:55 AM
var fc = getValue("PlayControl.Current");


chrisg

kimaldis
05-12-2006, 06:57 AM
first of all, Fc *isn't* the value of the current frame in any of the scripting languages. It's an expression variable.

use getvalue( "playcontrol.current" ) to get the current frame. Here's a few tips:-

watch what happens in the history pane when you change frames. Setting the current frame gives a good clue to how you might then get it.

The same applies to setting keys.

The SDK documentation is your friend. Learning to use it will save you much time and much misunderstanding. For example, looking up Savekey will tell you that savekey by default sets keys at the current frame, so you don't need the current frame anyway. (SaveKey ([InputObjs], [Time], [Value], [Tolerance])


And it's easy too. just position cursor over the word in the text editor and hit F1. You'll get a good synopsis plus examples.

In the example below, changing the marking set is unecessary and could cause problems for a user who isn't realising his marking set is being changed without his knowing. Better use the the inputobject arg in setkey:

setkey( "kine.local.posx", null, 1 ); // set pos x to 1 at current framed

or

setkey( "kine.local.posx", 5, 1 ); // at frame 5

CGTalk Moderation
05-12-2006, 06:57 AM
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.