mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-08-16 15:30:59 +00:00
Fixed error when no layer was selected at the time of creating the probe.
This commit is contained in:
@@ -36,9 +36,16 @@ yColorProbe_data.res = "window { \
|
||||
|
||||
function yColorProbe(){
|
||||
//It works with Sampled layers at a 100% scale only.
|
||||
|
||||
app.beginUndoGroup('Create ColorProbe');
|
||||
sel = app.project.activeItem.selectedLayers[0];
|
||||
|
||||
try
|
||||
{
|
||||
sel = app.project.activeItem.selectedLayers[0];
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
sel = undefined;
|
||||
}
|
||||
|
||||
myNull = app.project.activeItem.layers.addNull();
|
||||
myNull.transform.anchorPoint.setValue([50,50]);
|
||||
@@ -59,8 +66,10 @@ function yColorProbe(){
|
||||
myNull.source.height=30;
|
||||
myNull.source.width=30;
|
||||
myNull.anchorPoint=(15,15);
|
||||
myNull("Effects")('sampledLayer')(1).setValue(sel.index)
|
||||
|
||||
if(sel!==undefined){
|
||||
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
||||
}
|
||||
app.endUndoGroup();
|
||||
return 'ok'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user