From b405a092e08d11f78662c7d0b146fd41c7abf3b5 Mon Sep 17 00:00:00 2001 From: "clement.hector" Date: Thu, 10 Feb 2022 20:42:33 +0100 Subject: [PATCH] create method hide_all_others_layers --- openpype/hosts/photoshop/api/ws_stub.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openpype/hosts/photoshop/api/ws_stub.py b/openpype/hosts/photoshop/api/ws_stub.py index b8f66332c6..9db8f38a32 100644 --- a/openpype/hosts/photoshop/api/ws_stub.py +++ b/openpype/hosts/photoshop/api/ws_stub.py @@ -327,6 +327,19 @@ class PhotoshopServerStub: ) ) + def hide_all_others_layers(self, layers): + """hides all layers that are not part of the list or that are not + children of this list + + Args: + layers (list): list of PSItem + """ + extract_ids = set([ll.id for ll in self.get_layers_in_layers(layers)]) + + for layer in self.get_layers(): + if layer.visible and layer.id not in extract_ids: + self.set_visible(layer.id, False) + def get_layers_metadata(self): """Reads layers metadata from Headline from active document in PS. (Headline accessible by File > File Info)