Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#327: Creer un validator de blendMode sur les layers dans photoshop #43

Conversation

hfarre
Copy link
Contributor

@hfarre hfarre commented Mar 11, 2024

Fix quadproduction/issues#327

Permet de valider si les layers sont bien en mode de fusion normal et les groupes en transfert sur photoshop

@hfarre hfarre assigned hfarre and BenSouchet and unassigned hfarre Mar 11, 2024
Change the validator description
Meilleure methode de récuperation du nom de classe
if not self.is_active(context.data):
return

PASSTHROUGH = "passThrough"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selon moi ici il faut retirer PASSTHROUGH et NORMAL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En considérant qu'on garde le transfert d'info par str, on peut conserver ces var ou pas du coup ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


for layer in layers:
layerDict = {}
if (layer.group and layer.blendMode != PASSTHROUGH) or (not layer.group and layer.blendMode != NORMAL):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Et ici faire if (layer.group and layer.blendMode != BlendMode.PassThrough) or (not layer.group and layer.blendMode != BlendMode.NormalBlend):

(Voir https://github.com/loonghao/photoshop-python-api/blob/main/photoshop/api/enumerations.py#L91 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il y a une logique typeIDToStringID(desc.getEnumerationValue(stringIDToTypeID('mode'))); pour obtenir une string, voir si il y a la même pour avoir un id (int)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comme vu dans la pr sur OpenPype, il n'y a pas de lien entre les classes et fonction dans le jsx et celles du py, les ID des blendModes ne correspondent pas entre l'api jsx et l'api python de Photoshop.
En passant par un eval('BlendMode.' + blendModeName.toUpperCase()), on va conserver la transmission d'info par str je pense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

layerDict = {}
if (layer.group and layer.blendMode != PASSTHROUGH) or (not layer.group and layer.blendMode != NORMAL):
layerDict["actualBlendMode"] = layer.blendMode
layerDict["defaultBlendMode"] = PASSTHROUGH if layer.group else NORMAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passer ici un id une non une string

@BenSouchet
Copy link
Contributor

Pas hésiter à demander conseils ou avis à @Guilhemz

typeStr = "Group" if layer.group else "Layer"
msg = "{}\n\n The {} {} is set to {}.".format(msg, typeStr, layer.name, layer.blendMode)

else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

le else dans cette boucle semble inutile

@BenSouchet BenSouchet changed the base branch from main to release/1.8.0 March 19, 2024 09:08
@BenSouchet BenSouchet merged commit 5926137 into release/1.8.0 Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants