Photoshop: Layer effects scripting - 10 bugs - AM code

  • 5
  • Problem
  • Updated 10 months ago
  • (Edited)
I worked on script for removing unused effects. Instead I found total chaos. I found 10 bugs and I found that is impossible to do script which will work correctly.

Here is list of sh*ts
  1. you can't remove layer style/effect if app.doForcedProgress() dialog is shown
  2. you can't remove e.g. second drop-shadow from three even if script listener records code with list item index... it always removes first
  3. you can't use code for removing style/single-effect if all effects are disabled or main visibility is disabled. In photoshop you can do it, but recorded code in script listener doesn't works
  4. if I clear style with drag and drop fx icon to recycle bin, it removes style and keep blending options... but code recorded in script listener doesn't
  5. there is no posibility read options if mask hides effects... so if you read descriptor, change values and set descriptor, it always reset these settings to default values
  6. action "paste layer effect and keep advanced blending" is incorectly recorded in script listener
  7. if you remove multiple dropshadow effects and last dropshadow remaining you can't remove it with AM code. (It's no longer list of shadows but single shadow.)
  8. same situation from point 7 is in case that you want/show hide effect
  9. using modified descriptor for removing style has same bug as point 3. ...you just can't set "enabled=false" and "present=false" for all effects
  10. show/hide all effects doesn't works whole style visibility is disabled... there are three states of visibility icon. "white - Visible", "grayed - hidden", "invisible - hidden"
And some other bugs I don't remeber now.

I tried to read style descriptor, modify apply
> I can't beacause bugs: 5, 3

I tried to remove effects one by one
> I can't bugs 2
So I did some sorting if there is multiple effects of same kind and layer visibility changes
> Doesn't works - bugs 7,8,3

logged: bug ID: PS-9050
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
  • pissed

Posted 1 year ago

  • 5
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
Seems to that I finally found something what maybe is not messed up. I can create empty layer and move whole style or partial effect to new layer and then delete it. If empty layer already has style then whole styles are replaced with new. Single effects are replaced. Multi effect are added to existing and has limit of 10 effects.

1) it doesn't reset advanced blending
2) I can pick which e.g. drop shadow I want by specific index
3) Looks like doesn't matter if whole style or partial effects are visible
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
If you want remove unused style and effects you have two cases:
1) you want remove whole style
2) you want remove one effect from style

So you can
1)
a) create new empty layer without effects and style
b) move style from current layer to new layer. So you removed whole style from current layer
c) repeat for another layer or remove empty layer

2)
a) create new empty layer without effects and styles
b) move single effect of style from current layer to new empty layer. So you removed single effect from current layer style
c) repeat for another effect in style or another layer or you can remove new empty layer itself. Make sure that there is less than 10 multi-effects if you want move effect

But it's not yet properly tested.

---
What you wrote could work. But it depends what you want to keep. Moving whole style replace all effects in both layers.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
Anyway if style has zero effects or all effects has boolean property present=false then whole style is removed. So you can remove partial effects until there are some and finaly whole style is removed. But it takes more time. Something about 30-40ms per effect.
Photo of Max Johnson

Max Johnson, Champion

  • 488 Posts
  • 235 Reply Likes
Thank you for the clarification! I'm sure it will save me and others a lot of headache till this can get sorted out.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
Maybe they will be saved from pain if they decide just don't do anything advanced with effects or don't care about zero bug tolerance. Otherwise... good luck they will need it a lot :-D
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
Max: my theory was confirmed. Script works as I said. http://bereza.cz/ps/ (Clear hidden effects 1.1 )

It's slower than version 1.0 but it seems to be bulletproof from CS6 to CC2017
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 807 Posts
  • 187 Reply Likes
bug #11 - you can move style/effect even if layer is locked.

Normally you can't do it. 
Simplest thing how to verify this is recording action without locks and then lock layers and run action.
Photo of Max Johnson

Max Johnson, Champion

  • 488 Posts
  • 235 Reply Likes
Any idea if some of these were fixed in 2018? 
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 806 Posts
  • 187 Reply Likes
Logged bug ID: PS-9050 has same untouched state since it's creation. So I don't think it's fixed. I will test it in next weeks/months.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 806 Posts
  • 187 Reply Likes
I think some of these bugs were fixed in CC2018.1

looks like 2, 4 are fixed. And I quickly tried some other but looks like no improvement, but I didn't tested all with precisely.