Problem with timeSpanStart
Posted: September 12th, 2011, 5:26 am
I'm trying to set the timeSpanStart in the RQ, but I'm having some problems. If I create five compositions with composition display start frames set to 1, 101, 202, 303, 404 and add them to the render que with the attached script, I get different results. For example, if I say that the first frame to render should be 450 I get the following results: Comp1 = 249, Comp101 = 249, Comp202 = 249, Comp303 = 250, Comp404 = 250. Maybe I'm missing something obvious here, but why am I not getting the same results? Is there a floating number rounding problem?
Code: Select all
var myPalette = buildUI(this);
if(myPalette != null && myPalette instanceof Window) {
myPalette.show();
}
function buildUI (thisObject) {
if(thisObject instanceof Panel) {
var myPalette = thisObject;
}else{
var myPalette = new Window ("palette", "test", undefined, {resizeable:true});
}
if(myPalette != null) {
var res =
"Group { \
orientation: 'row', \
alignment: ['fill', 'fill'], \
alignChildren: ['left', 'top'], \
left: Group { \
orientation: 'column', \
one: Group { \
orientation: 'row', \
alignment: ['left', 'top'], \
firstFrame: EditText {size: ['100', '25']}, \
} \
} \
right: Group { \
orientation: 'row', \
alignment: ['right', 'top'], \
testButton: Button {text: 'Add composition',}, \
} \
}";
myPalette.grp = myPalette.add(res);
myPalette.layout.layout(true);
myPalette.layout.resize()
myPalette.resizing = myPalette.onResize = function () {this.layout.resize()};
myPalette.grp.right.testButton.onClick = function () {
test (myPalette);
}
}//if(myPalette != null) {
return myPalette;
} //buildUI
function test (palObject) {
if(app.project.selection == 0){
alert("Please select a composition");
return;
}
var myComp = app.project.activeItem;
var compStart = myComp.displayStartTime; // Composition start frame.
var frame = palObject.grp.left.one.firstFrame.text
var fis = myComp.frameDuration*frame; // frame in seconds.
app.project.renderQueue.items.add(myComp);
var lastInRQ = app.project.renderQueue.numItems;
var startSec = fis - compStart;
app.beginSuppressDialogs();
app.project.renderQueue.item(lastInRQ).timeSpanStart = startSec;
app.endSuppressDialogs(false);
}//function renderFunction (palObject) {