[CS2] layer.opacity 100% bug

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

SzopeN

[CS2] layer.opacity 100% bug

Post by SzopeN »

Making the script backward compatible with CS2 is really frustrating... :/ Active layer opacity is set to 100%.

Code: Select all$.writeln(app.activeDocument.activeLayer.opacity)
// 100

app.activeDocument.activeLayer.opacity=app.activeDocument.activeLayer.opacity
// Throws an error: Specified value greater than maximum allowed value

$.writeln(app.activeDocument.activeLayer.opacity==100)
// false (?!)

$.writeln(app.activeDocument.activeLayer.opacity==100.00000000000001)
// true (?!!)

$.writeln(app.activeDocument.activeLayer.opacity-.00000000000001)
// 100 (still)

app.activeDocument.activeLayer.opacity=app.activeDocument.activeLayer.opacity-.00000000000001;
// OK

// so the final solution when reading layer opacity...
var op = Math.min(app.activeDocument.activeLayer.opacity,100);
// it is faster than if and ?:

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

xbytor

[CS2] layer.opacity 100% bug

Post by xbytor »

I documented this one somewhere before. This was one of the more painful PS bugs I've come across.
SzopeN

[CS2] layer.opacity 100% bug

Post by SzopeN »

xbytor wrote:I documented this one somewhere before. This was one of the more painful PS bugs I've come across.
I've done quick forum search for 'cs2 opacity 100%' but found nothing
xbytor

[CS2] layer.opacity 100% bug

Post by xbytor »