libreflow.extensions.sk.export-psd-layers 1.1.5__tar.gz → 1.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/CHANGELOG.md +11 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5/src/libreflow.extensions.sk.export_psd_layers.egg-info → libreflow_extensions_sk_export_psd_layers-1.1.7}/PKG-INFO +12 -1
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow/extensions/sk/export_psd_layers/__init__.py +214 -8
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow/extensions/sk/export_psd_layers/_version.py +3 -3
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7/src/libreflow.extensions.sk.export_psd_layers.egg-info}/PKG-INFO +12 -1
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/MANIFEST.in +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/README.md +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/setup.cfg +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/setup.py +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow/__init__.py +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow/extensions/__init__.py +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow/extensions/sk/__init__.py +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow.extensions.sk.export_psd_layers.egg-info/SOURCES.txt +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow.extensions.sk.export_psd_layers.egg-info/dependency_links.txt +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow.extensions.sk.export_psd_layers.egg-info/requires.txt +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/src/libreflow.extensions.sk.export_psd_layers.egg-info/top_level.txt +0 -0
- {libreflow_extensions_sk_export_psd_layers-1.1.5 → libreflow_extensions_sk_export_psd_layers-1.1.7}/versioneer.py +0 -0
|
@@ -19,6 +19,17 @@ Types of changes
|
|
|
19
19
|
|
|
20
20
|
## [Unreleased]
|
|
21
21
|
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
* Warning message when publishing regarding resolution and colour depth.
|
|
25
|
+
* Message in the window when creating a new working copy.
|
|
26
|
+
|
|
27
|
+
## [1.1.6] - 2025-08-07
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
* Export resized to psd canvas - makes the action less prone to crash from a lack of RAM
|
|
32
|
+
|
|
22
33
|
## [1.1.5] - 2025-07-03
|
|
23
34
|
|
|
24
35
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libreflow.extensions.sk.export_psd_layers
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7
|
|
4
4
|
Home-page: https://gitlab.com/lfs.coop/libreflow/libreflow_launcher
|
|
5
5
|
Author: Thomas Thiebaut
|
|
6
6
|
Author-email: autor@les-fees-speciales.coop
|
|
@@ -50,6 +50,17 @@ Types of changes
|
|
|
50
50
|
|
|
51
51
|
## [Unreleased]
|
|
52
52
|
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
* Warning message when publishing regarding resolution and colour depth.
|
|
56
|
+
* Message in the window when creating a new working copy.
|
|
57
|
+
|
|
58
|
+
## [1.1.6] - 2025-08-07
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
* Export resized to psd canvas - makes the action less prone to crash from a lack of RAM
|
|
63
|
+
|
|
53
64
|
## [1.1.5] - 2025-07-03
|
|
54
65
|
|
|
55
66
|
### Fixed
|
|
@@ -12,8 +12,16 @@ from libreflow.baseflow.file import (
|
|
|
12
12
|
FileRevisionNameChoiceValue,
|
|
13
13
|
UploadPNGToKitsu,
|
|
14
14
|
PublishAndRenderPlayblast,
|
|
15
|
+
PublishFileAction,
|
|
16
|
+
UploadAfterPublishValue,
|
|
17
|
+
CreateWorkingCopyAction,
|
|
15
18
|
)
|
|
16
19
|
from psd_tools import PSDImage
|
|
20
|
+
from psd_tools.psd import PSD
|
|
21
|
+
|
|
22
|
+
from libreflow.baseflow.task import Task
|
|
23
|
+
from libreflow.baseflow.task_manager import CreateTaskDefaultFiles
|
|
24
|
+
from libreflow.baseflow.users import PresetValue, PresetSessionValue, PresetChoiceValue
|
|
17
25
|
|
|
18
26
|
|
|
19
27
|
class ExportPSDLayers(flow.Action):
|
|
@@ -182,9 +190,31 @@ class ExportPSDLayers(flow.Action):
|
|
|
182
190
|
|
|
183
191
|
folder_name = os.path.basename(render_revision.get_path())
|
|
184
192
|
|
|
193
|
+
# frame_bbox = (0, 0, 0, 0)
|
|
194
|
+
|
|
195
|
+
# frame_layer = psb.find("white")
|
|
196
|
+
|
|
197
|
+
# if frame_layer is None:
|
|
198
|
+
# raise Exception("FRAME LAYER NOT FOUND")
|
|
199
|
+
# else:
|
|
200
|
+
# frame_bbox = frame_layer.bbox
|
|
201
|
+
|
|
202
|
+
# if frame_bbox == (0, 0, 0, 0):
|
|
203
|
+
# raise Exception("Frame Layer has no bounding box")
|
|
204
|
+
|
|
205
|
+
# # Substract by 10pixels (width and height) in order to remove border margin
|
|
206
|
+
# # frame_bbox = (
|
|
207
|
+
# # frame_bbox[0] + 5,
|
|
208
|
+
# # frame_bbox[1] + 5,
|
|
209
|
+
# # frame_bbox[2] - 5,
|
|
210
|
+
# # frame_bbox[3] - 5,
|
|
211
|
+
# # )
|
|
212
|
+
|
|
213
|
+
# print(frame_bbox)
|
|
214
|
+
|
|
185
215
|
for layer in reversed(psb):
|
|
186
216
|
# Remove invalid characters
|
|
187
|
-
layer_name = layer.name
|
|
217
|
+
layer_name = layer.name.replace(' ','-')
|
|
188
218
|
match_invalid = re.search(r"[~\"#%&*:<>?/\\{|}]+", layer.name)
|
|
189
219
|
if match_invalid:
|
|
190
220
|
layer_name = layer_name.replace(match_invalid.group(0), '')
|
|
@@ -196,10 +226,8 @@ class ExportPSDLayers(flow.Action):
|
|
|
196
226
|
|
|
197
227
|
session.log_info(log_format.format(message=f'Exporting layer {layer_name}'))
|
|
198
228
|
|
|
199
|
-
print(layer.visible)
|
|
200
229
|
if not layer.visible:
|
|
201
230
|
layer.visible = True
|
|
202
|
-
print(layer.visible)
|
|
203
231
|
# psb.save(source_revision.get_path())
|
|
204
232
|
|
|
205
233
|
# Push layer in correct JSON data
|
|
@@ -207,7 +235,7 @@ class ExportPSDLayers(flow.Action):
|
|
|
207
235
|
layer_name
|
|
208
236
|
)
|
|
209
237
|
|
|
210
|
-
image = layer.composite(viewport=psb.
|
|
238
|
+
image = layer.composite(viewport=psb.viewbox)
|
|
211
239
|
image.save(output_path)
|
|
212
240
|
|
|
213
241
|
|
|
@@ -253,7 +281,7 @@ class ExportPSDLayers(flow.Action):
|
|
|
253
281
|
utils_layer = psb.find("_utils")
|
|
254
282
|
if utils_layer : utils_layer.visible = False
|
|
255
283
|
|
|
256
|
-
image = psb.composite(force=True)
|
|
284
|
+
image = psb.composite(viewport=psb.viewbox,force=True)
|
|
257
285
|
image.save(output_path)
|
|
258
286
|
|
|
259
287
|
session.log_info(log_format.format(message='Export complete'))
|
|
@@ -404,6 +432,10 @@ class ExportPSDLayersBatch(flow.Action):
|
|
|
404
432
|
class PublishandExportPSD(PublishAndRenderPlayblast):
|
|
405
433
|
ICON = ('icons.libreflow', 'publish')
|
|
406
434
|
|
|
435
|
+
_shot = flow.Parent(5)
|
|
436
|
+
_sequence = flow.Parent(7)
|
|
437
|
+
_film = flow.Parent(9)
|
|
438
|
+
|
|
407
439
|
def allow_context(self, context):
|
|
408
440
|
return (
|
|
409
441
|
context
|
|
@@ -411,7 +443,56 @@ class PublishandExportPSD(PublishAndRenderPlayblast):
|
|
|
411
443
|
and self._file.format.get() in ["psd", "psb"]
|
|
412
444
|
)
|
|
413
445
|
|
|
446
|
+
def get_bg_layout(self):
|
|
447
|
+
source_file = None
|
|
448
|
+
shot_entity = (
|
|
449
|
+
self.root()
|
|
450
|
+
.project()
|
|
451
|
+
.films[self._film.name()]
|
|
452
|
+
.sequences[self._sequence.name()]
|
|
453
|
+
.shots[self._shot.name()]
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
bg_layout_task = shot_entity.tasks["bg_layout"]
|
|
457
|
+
if bg_layout_task.files.has_file("bg_layout", "psb"):
|
|
458
|
+
# Get the file path as parent
|
|
459
|
+
source_file = bg_layout_task.files["bg_layout_psb"].get_head_revision()
|
|
460
|
+
|
|
461
|
+
return source_file
|
|
462
|
+
|
|
414
463
|
def get_buttons(self):
|
|
464
|
+
msg = "<h2>Publish and Export Preview</h2>"
|
|
465
|
+
|
|
466
|
+
if "bg_color" in self._file.name():
|
|
467
|
+
bg_layout_file = self.get_bg_layout()
|
|
468
|
+
bg_layout_psb = PSDImage.open(bg_layout_file.get_path())
|
|
469
|
+
working_copy_path = self._file.get_working_copy().get_path()
|
|
470
|
+
psb = PSDImage.open(working_copy_path)
|
|
471
|
+
|
|
472
|
+
if psb.size != bg_layout_psb.size:
|
|
473
|
+
msg += (f"""<h3><font color=#D66500>
|
|
474
|
+
Does not conform to the size of bg_layout.
|
|
475
|
+
</font></h3>
|
|
476
|
+
<h4><font color=#D66500>
|
|
477
|
+
BG_layout size = {bg_layout_psb.size}
|
|
478
|
+
</font></h4>
|
|
479
|
+
""")
|
|
480
|
+
|
|
481
|
+
if psb.depth != 16:
|
|
482
|
+
msg += (
|
|
483
|
+
"<h3><font color=#D66500>"
|
|
484
|
+
"This file is not in 16-bit format."
|
|
485
|
+
"</font></h3>"
|
|
486
|
+
"<h4><font color=#D66500>"
|
|
487
|
+
"To convert to 16 Bits/Channel, choose `Image > Mode > 16 Bits/Channel`."
|
|
488
|
+
"</font></h4>"
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
self.message.set(msg)
|
|
492
|
+
return ["Cancel"]
|
|
493
|
+
|
|
494
|
+
self.message.set(msg)
|
|
495
|
+
|
|
415
496
|
return ["Publish and Export Preview", "Cancel"]
|
|
416
497
|
|
|
417
498
|
def _configure_and_render(self, revision_name, upload_after_publish):
|
|
@@ -492,7 +573,7 @@ class ExportPSDPreview(flow.Action):
|
|
|
492
573
|
|
|
493
574
|
output_path = f"{os.path.splitext(file_path)[0]}.png"
|
|
494
575
|
|
|
495
|
-
image = psb.composite()
|
|
576
|
+
image = psb.composite(viewport=psb.viewbox)
|
|
496
577
|
image.save(output_path)
|
|
497
578
|
|
|
498
579
|
return output_path
|
|
@@ -517,7 +598,7 @@ class ExportPSDPreview(flow.Action):
|
|
|
517
598
|
utils_layer = psb.find("_utils")
|
|
518
599
|
if utils_layer : utils_layer.visible = False
|
|
519
600
|
|
|
520
|
-
image = psb.composite(force=True)
|
|
601
|
+
image = psb.composite(viewport=psb.viewbox,force=True)
|
|
521
602
|
|
|
522
603
|
image.save(output_path)
|
|
523
604
|
|
|
@@ -548,7 +629,7 @@ class ExportPSDPreview(flow.Action):
|
|
|
548
629
|
frame_bbox[3] - 5,
|
|
549
630
|
)
|
|
550
631
|
|
|
551
|
-
image = psb.composite()
|
|
632
|
+
image = psb.composite(viewport=psb.viewbox)
|
|
552
633
|
image = image.crop(frame_bbox)
|
|
553
634
|
image.save(output_path)
|
|
554
635
|
|
|
@@ -688,6 +769,129 @@ class UploadPSDPreview(UploadPNGToKitsu):
|
|
|
688
769
|
rev.set_status("on_kitsu")
|
|
689
770
|
|
|
690
771
|
|
|
772
|
+
class PublishPSDFile(PublishFileAction):
|
|
773
|
+
|
|
774
|
+
_task = flow.Parent(3)
|
|
775
|
+
_shot = flow.Parent(5)
|
|
776
|
+
_sequence = flow.Parent(7)
|
|
777
|
+
_film = flow.Parent(9)
|
|
778
|
+
|
|
779
|
+
def __init__(self, name, parent):
|
|
780
|
+
super(PublishPSDFile, self).__init__(parent, name)
|
|
781
|
+
|
|
782
|
+
def get_bg_layout(self):
|
|
783
|
+
source_file = None
|
|
784
|
+
shot_entity = (
|
|
785
|
+
self.root()
|
|
786
|
+
.project()
|
|
787
|
+
.films[self._film.name()]
|
|
788
|
+
.sequences[self._sequence.name()]
|
|
789
|
+
.shots[self._shot.name()]
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
bg_layout_task = shot_entity.tasks["bg_layout"]
|
|
793
|
+
if bg_layout_task.files.has_file("bg_layout", "psb"):
|
|
794
|
+
# Get the file path as parent
|
|
795
|
+
source_file = bg_layout_task.files["bg_layout_psb"].get_head_revision()
|
|
796
|
+
|
|
797
|
+
return source_file
|
|
798
|
+
|
|
799
|
+
def get_buttons(self):
|
|
800
|
+
self.check_default_values()
|
|
801
|
+
|
|
802
|
+
msg = "<h2>Publish</h2>"
|
|
803
|
+
|
|
804
|
+
working_copies = self._file.get_working_copies()
|
|
805
|
+
if working_copies:
|
|
806
|
+
user_names = [wc.user.get() for wc in working_copies]
|
|
807
|
+
user_names = ["<b>" + n + "</b>" for n in user_names]
|
|
808
|
+
msg += (
|
|
809
|
+
"<h3><font color=#D66500><br>"
|
|
810
|
+
"This file is currently being edited by one or more users ({})."
|
|
811
|
+
"</font></h3>".format(", ".join(user_names))
|
|
812
|
+
)
|
|
813
|
+
|
|
814
|
+
if "bg_color" in self._file.name():
|
|
815
|
+
bg_layout_file = self.get_bg_layout()
|
|
816
|
+
bg_layout_psb = PSDImage.open(bg_layout_file.get_path())
|
|
817
|
+
working_copy_path = self._file.get_working_copy().get_path()
|
|
818
|
+
psb = PSDImage.open(working_copy_path)
|
|
819
|
+
|
|
820
|
+
if psb.size != bg_layout_psb.size:
|
|
821
|
+
msg += f"""<h3><font color=#D66500>
|
|
822
|
+
Does not conform to the size of bg_layout.
|
|
823
|
+
</font></h3>
|
|
824
|
+
<h4><font color=#D66500>
|
|
825
|
+
BG_layout size = {bg_layout_psb.size}
|
|
826
|
+
</font></h4>
|
|
827
|
+
"""
|
|
828
|
+
|
|
829
|
+
if psb.depth != 16:
|
|
830
|
+
msg += (
|
|
831
|
+
"<h3><font color=#D66500>"
|
|
832
|
+
"This file is not in 16-bit format."
|
|
833
|
+
"</font></h3>"
|
|
834
|
+
"<h4><font color=#D66500>"
|
|
835
|
+
"To convert to 16 Bits/Channel, choose `Image > Mode > 16 Bits/Channel`."
|
|
836
|
+
"</font></h4>"
|
|
837
|
+
)
|
|
838
|
+
|
|
839
|
+
self.message.set(msg)
|
|
840
|
+
return ["Cancel"]
|
|
841
|
+
|
|
842
|
+
self.message.set(msg)
|
|
843
|
+
|
|
844
|
+
return ["Publish", "Cancel"]
|
|
845
|
+
|
|
846
|
+
class CreateWorkingCopy(CreateWorkingCopyAction):
|
|
847
|
+
def __init__(self, parent, name):
|
|
848
|
+
super(CreateWorkingCopy, self).__init__(parent, name)
|
|
849
|
+
|
|
850
|
+
def get_buttons(self):
|
|
851
|
+
msg = "<h3>Create a working copy</h3>"
|
|
852
|
+
|
|
853
|
+
if "bg_color" in self._task.name() and "psb" in self._file.name():
|
|
854
|
+
msg += """<h3>
|
|
855
|
+
Remember to change the colour depth to <u>16 bits</u> in Photoshop.
|
|
856
|
+
</h3>
|
|
857
|
+
<h4>
|
|
858
|
+
To convert to 16 Bits/Channel, choose <u>`Image > Mode > 16 Bits/Channel`</u>.
|
|
859
|
+
</h4>"""
|
|
860
|
+
|
|
861
|
+
# Buttons for Use Base File mode
|
|
862
|
+
if self.use_base_file:
|
|
863
|
+
msg += f"<font color=#FFA34D>WARNING: You should start working on this file \
|
|
864
|
+
from the latest version of {self.base_file_name} in {self.from_task} task.</font>"
|
|
865
|
+
self.message.set(msg)
|
|
866
|
+
return ["Create from base file", "Create from scratch", "Cancel"]
|
|
867
|
+
|
|
868
|
+
if self._file.has_working_copy(from_current_user=True):
|
|
869
|
+
msg += "<font color=#FFA34D>WARNING: You already have a working copy to your name. \
|
|
870
|
+
Choosing to create a new one will overwrite your changes.</font>"
|
|
871
|
+
|
|
872
|
+
self.message.set(msg)
|
|
873
|
+
|
|
874
|
+
self.from_revision.revert_to_default()
|
|
875
|
+
|
|
876
|
+
return ["Create", "Create from scratch", "Cancel"]
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
def publish_psd_file(parent):
|
|
880
|
+
if isinstance(parent, TrackedFile) and "psb" in parent.name():
|
|
881
|
+
r = flow.Child(PublishPSDFile).ui(label="Publish")
|
|
882
|
+
r.name = "publish_action"
|
|
883
|
+
r.index = 25
|
|
884
|
+
return r
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
def create_working_copy(parent):
|
|
888
|
+
if isinstance(parent, TrackedFile) and "psb" in parent.name():
|
|
889
|
+
r = flow.Child(CreateWorkingCopy).ui(label="Create working copy")
|
|
890
|
+
r.name = "create_working_copy_action"
|
|
891
|
+
r.index = 25
|
|
892
|
+
return r
|
|
893
|
+
|
|
894
|
+
|
|
691
895
|
def publish_and_export_preview(parent):
|
|
692
896
|
if isinstance(parent, TrackedFile):
|
|
693
897
|
r = flow.Child(PublishandExportPSD)
|
|
@@ -735,5 +939,7 @@ def install_extensions(session):
|
|
|
735
939
|
export_psd_preview,
|
|
736
940
|
upload_preview,
|
|
737
941
|
publish_and_export_preview,
|
|
942
|
+
publish_psd_file,
|
|
943
|
+
create_working_copy,
|
|
738
944
|
]
|
|
739
945
|
}
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-
|
|
11
|
+
"date": "2025-08-19T09:27:05+0000",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.1.
|
|
14
|
+
"full-revisionid": "b1b744a86ee00adf6e955054c0c0088b9bce95a0",
|
|
15
|
+
"version": "1.1.7"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libreflow.extensions.sk.export_psd_layers
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7
|
|
4
4
|
Home-page: https://gitlab.com/lfs.coop/libreflow/libreflow_launcher
|
|
5
5
|
Author: Thomas Thiebaut
|
|
6
6
|
Author-email: autor@les-fees-speciales.coop
|
|
@@ -50,6 +50,17 @@ Types of changes
|
|
|
50
50
|
|
|
51
51
|
## [Unreleased]
|
|
52
52
|
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
* Warning message when publishing regarding resolution and colour depth.
|
|
56
|
+
* Message in the window when creating a new working copy.
|
|
57
|
+
|
|
58
|
+
## [1.1.6] - 2025-08-07
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
* Export resized to psd canvas - makes the action less prone to crash from a lack of RAM
|
|
63
|
+
|
|
53
64
|
## [1.1.5] - 2025-07-03
|
|
54
65
|
|
|
55
66
|
### Fixed
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|