How can I select my top path and turn off clipping?
-
bretlinford
How can I select my top path and turn off clipping?
How can I select my top path and turn off clipping with javascript? Some of the top layers are named differently so I can't say "path 1". Thanks!
-
Mike Hale
How can I select my top path and turn off clipping?
Selecting the top path regardless of name is easy, but that may not be the clipping path. The only way I know to turn off a clipping mask in Photoshop is to delete the mask. This finds the clippingPath, makes a copy in case it is needed to reapply the clipping, then deletes the path.
Code: Select allvar clippingPathIndex = hasClippingPathIndex();
if(clippingPathIndex !=-1){
var clippingPathItem = app.activeDocument.pathItems[clippingPathIndex];
clippingPathItem.duplicate();
clippingPathItem.remove();
}
function hasClippingPathIndex(){// returns -1 if no clipping path
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
return desc.getObjectValue(stringIDToTypeID('clippingPathInfo')).getInteger(stringIDToTypeID('clippingPathIndex'));
};
if(hasClippingPathIndex()==-1) alert('clippingMask removed');
And if you know of way manually to release a clipping path without removing the path, please let me know.
EDIT: now that I think about it the layer name shouldn't matter for clippingPaths. If you meant clipping mask or clipping group then to release the top layer you could do..
Code: Select allactiveDocument.artLayers[0].grouped = false;
Code: Select allvar clippingPathIndex = hasClippingPathIndex();
if(clippingPathIndex !=-1){
var clippingPathItem = app.activeDocument.pathItems[clippingPathIndex];
clippingPathItem.duplicate();
clippingPathItem.remove();
}
function hasClippingPathIndex(){// returns -1 if no clipping path
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
return desc.getObjectValue(stringIDToTypeID('clippingPathInfo')).getInteger(stringIDToTypeID('clippingPathIndex'));
};
if(hasClippingPathIndex()==-1) alert('clippingMask removed');
And if you know of way manually to release a clipping path without removing the path, please let me know.
EDIT: now that I think about it the layer name shouldn't matter for clippingPaths. If you meant clipping mask or clipping group then to release the top layer you could do..
Code: Select allactiveDocument.artLayers[0].grouped = false;