[CS2] layer.opacity 100% bug

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

Moderators: xbytor, DavideBarranca, Paul MR

SzopeN

[CS2] layer.opacity 100% bug

Postby SzopeN » Thu Aug 06, 2009 12:17 am

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 ?:



xbytor

[CS2] layer.opacity 100% bug

Postby xbytor » Fri Aug 07, 2009 3:40 am

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

Postby SzopeN » Fri Aug 07, 2009 4:44 pm

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

Postby xbytor » Fri Aug 07, 2009 4:51 pm

Here ya go:
http://ps-scripts.com/bb/viewtopic.php? ... pacity+100


Return to “Photoshop Scripting Bugs and Anomalies”

Who is online

Users browsing this forum: No registered users and 1 guest