var res = "group{orientation: 'column', alignment:['fill', 'fill'],\
content: Group{alignment:['fill', 'fill'],\
checks: Panel{orientation: 'column', alignment:['fill', 'fill'], spacing: 2,";
var b, imports = [];
for (var i in seqs)
{
b = !Boolean(seqs[i].lighting);
res += 'c' + imports.length + ":Group{alignment:['fill', 'top'], btn: Checkbox{text: '" + seqs[i].label + "', alignment:['left', 'fill'], enabled:" + b + ', value:' + b + "},\
v: StaticText{text: 'v" + numberFormat(seqs[i].version) + "', alignment:['right', 'fill']}},";
imports.push(seqs[i]);
}
res += "}, scroll: Scrollbar{alignment:['right', 'fill']}},\
footer: Group{alignment:['fill', 'bottom']\
toggle: Button{text: 'Deselect All', alignment:['left', 'fill']},\
okBtn: Button{text: 'Import', alignment:['fill', 'fill']},\
},\
lighting: StaticText{text: '*Disabled entries need their lighting flattened into a single image sequence using the Apply Palette script first.', properties: {multiline: true, resizeable: true}, alignment:['fill', 'fill']},\
},\
}";
$w.grp = $w.add(res);
var grp = $w.grp.content.checks;
var scroll = $w.grp.content.scroll;
scroll.maximumSize[0] = 15;
grp.maximumSize[1] = 800;
//$w.show();
var height = (20 + grp.spacing) * imports.length;
$w.resizeable = grp.resizeable = $w.grp.content.resizeable = true;
var allChecks = function($f)
{
for (var i = imports.length - 1; i >= 0; i--)
$f(grp['c' + i].btn, imports[i], i);
};
var color = $w.graphics.newBrush($w.graphics.BrushType.SOLID_COLOR,[28/255,29/255,26/255], 1);
allChecks(function($b, $m, $i)
{
if ($i % 2) $b.parent.graphics.backgroundColor = color;
});
scroll.onChanging = function()
{
grp.location.y = this.value/100 * (grp.maximumSize.height - height);
$w.onResize();
};
$w.grp.footer.okBtn.onClick = function()
{
var comp = getComp();
if (!comp) return;
app.beginUndoGroup('Import TGAs');
app.beginSuppressDialogs();
allchecks(function($btn, $import)
{
if ($btn.value) TGASequence.import($import.folder, comp);
});
app.endSuppressDialogs(false);
app.endUndoGroup();
$w.close();
};
$w.grp.footer.toggle.onClick = function()
{
if (this.text == 'Deselect All')
{
this.text = 'Select All';
allChecks(function($btn)
{
$btn.value = false;
});
}
else
{
this.text = 'Deselect All';
allChecks(function($btn)
{
$btn.value = true;
});
}
this.active = true;
this.active = false;
};
$w.onClose = function()
{
}
$w.onResizing = $w.onResize = function()
{
this.layout.resize();
};
... View more