Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

TVPaint extractor enhancement #1084

Merged
merged 39 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1e5d2fd
removed modifiable save modes from extractor
iLLiCiTiT Mar 3, 2021
0ab6609
imlpemented method for copying same temp image files
iLLiCiTiT Mar 3, 2021
8654bca
implemented method that will fill frames by pre behavior of a layer
iLLiCiTiT Mar 3, 2021
8a53aa4
implemented method that will fill frames by post behavior of a layer
iLLiCiTiT Mar 3, 2021
0ecdfb6
implemented logic of layers compositing using Pillow
iLLiCiTiT Mar 3, 2021
9d62464
frame start/end are defined by mark in/out of published clip
iLLiCiTiT Mar 3, 2021
e4fc43a
collect both layer's position and all layer ids
iLLiCiTiT Mar 3, 2021
1bf02c5
skip savemode filling
iLLiCiTiT Mar 3, 2021
e1d9613
removed previous logic of rendering
iLLiCiTiT Mar 3, 2021
4ca8b47
collect behavior of layer ids to process
iLLiCiTiT Mar 3, 2021
7b1e4fe
implemented method that will render and fill all frames of given layer
iLLiCiTiT Mar 3, 2021
6eeeb72
layers are rendered one by one and stored by their position (order)
iLLiCiTiT Mar 3, 2021
a2e2d1f
rendered frames are composite to final output
iLLiCiTiT Mar 3, 2021
5779158
added cleanup method that will remove temp image files of individial …
iLLiCiTiT Mar 3, 2021
7973229
pass different arguments and expect different output of render method
iLLiCiTiT Mar 3, 2021
2600883
keep frame start/end as they are
iLLiCiTiT Mar 3, 2021
018512b
added some extra logs
iLLiCiTiT Mar 3, 2021
9baf9aa
fixed case when all layers miss image for frame
iLLiCiTiT Mar 3, 2021
a710d12
moved composite_images to pype's tvpaint.lib
iLLiCiTiT Mar 3, 2021
01458f6
using multiprocessing to speed up compositing part
iLLiCiTiT Mar 3, 2021
b6fd172
simplified extractor with tv_savesequence command
iLLiCiTiT Mar 3, 2021
9c28c48
removed unused lib
iLLiCiTiT Mar 3, 2021
9e6b8b0
fixed hound
iLLiCiTiT Mar 3, 2021
f1058f9
fix variable names
iLLiCiTiT Mar 3, 2021
7e76320
fix frame range of pass output
iLLiCiTiT Mar 4, 2021
573011a
renamed extract sequence to extract review sequence
iLLiCiTiT Mar 4, 2021
901287a
moved back tvpaint's lib for compositing
iLLiCiTiT Mar 4, 2021
ddd23d1
implemented extract review that can render layer by layer with alpha
iLLiCiTiT Mar 4, 2021
7452ac7
modified extract sequence to skip compositing is rendering only one l…
iLLiCiTiT Mar 4, 2021
4ea35c2
removed thumbnail filename variable
iLLiCiTiT Mar 4, 2021
da12476
merged extractors to one extractor
iLLiCiTiT Mar 4, 2021
e6e4954
extract sequence use key word arguments in filename template
iLLiCiTiT Mar 4, 2021
a34c14f
handle "none" behavior
iLLiCiTiT Mar 4, 2021
9dc1e38
add files to `layer_files_by_frame` on creation
iLLiCiTiT Mar 4, 2021
b5aa524
added some debug loggins messages
iLLiCiTiT Mar 4, 2021
e79c8c6
review instance stores copy of layers data
iLLiCiTiT Mar 4, 2021
3360f99
added validation of layers visibility
iLLiCiTiT Mar 4, 2021
3fc3355
modified to match pype 3 structure
iLLiCiTiT Mar 4, 2021
673b558
extraction is a little bit faster
iLLiCiTiT Mar 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pype/hosts/tvpaint/api/lib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from PIL import Image


def composite_images(input_image_paths, output_filepath):
"""Composite images in order from passed list.

Raises:
ValueError: When entered list is empty.
"""
if not input_image_paths:
raise ValueError("Nothing to composite.")

img_obj = None
for image_filepath in input_image_paths:
_img_obj = Image.open(image_filepath)
if img_obj is None:
img_obj = _img_obj
else:
img_obj.alpha_composite(_img_obj)
img_obj.save(output_filepath)
16 changes: 6 additions & 10 deletions pype/hosts/tvpaint/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def process(self, context):
instance_data["subset"] = new_subset_name

instance = context.create_instance(**instance_data)
instance.data["layers"] = context.data["layersData"]

instance.data["layers"] = copy.deepcopy(
context.data["layersData"]
)
# Add ftrack family
instance.data["families"].append("ftrack")

Expand All @@ -70,15 +73,8 @@ def process(self, context):
if instance is None:
continue

frame_start = context.data["frameStart"]
frame_end = frame_start
for layer in instance.data["layers"]:
_frame_end = layer["frame_end"]
if _frame_end > frame_end:
frame_end = _frame_end

instance.data["frameStart"] = frame_start
instance.data["frameEnd"] = frame_end
instance.data["frameStart"] = context.data["frameStart"]
instance.data["frameEnd"] = context.data["frameEnd"]

self.log.debug("Created instance: {}\n{}".format(
instance, json.dumps(instance.data, indent=4)
Expand Down
32 changes: 22 additions & 10 deletions pype/hosts/tvpaint/plugins/publish/collect_workfile_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,33 +113,45 @@ def process(self, context):
self.log.info("Collecting scene data from workfile")
workfile_info_parts = lib.execute_george("tv_projectinfo").split(" ")

frame_start = int(workfile_info_parts.pop(-1))
# Project frame start - not used
workfile_info_parts.pop(-1)
field_order = workfile_info_parts.pop(-1)
frame_rate = float(workfile_info_parts.pop(-1))
pixel_apsect = float(workfile_info_parts.pop(-1))
height = int(workfile_info_parts.pop(-1))
width = int(workfile_info_parts.pop(-1))
workfile_path = " ".join(workfile_info_parts).replace("\"", "")

# TODO This is not porper way of getting last frame
# - but don't know better
last_frame = frame_start
for layer in layers_data:
frame_end = layer["frame_end"]
if frame_end > last_frame:
last_frame = frame_end

frame_start, frame_end = self.collect_clip_frames()
scene_data = {
"currentFile": workfile_path,
"sceneWidth": width,
"sceneHeight": height,
"pixelAspect": pixel_apsect,
"frameStart": frame_start,
"frameEnd": last_frame,
"frameEnd": frame_end,
"fps": frame_rate,
"fieldOrder": field_order
}
self.log.debug(
"Scene data: {}".format(json.dumps(scene_data, indent=4))
)
context.data.update(scene_data)

def collect_clip_frames(self):
clip_info_str = lib.execute_george("tv_clipinfo")
self.log.debug("Clip info: {}".format(clip_info_str))
clip_info_items = clip_info_str.split(" ")
# Color index - not used
clip_info_items.pop(-1)
clip_info_items.pop(-1)

mark_out = int(clip_info_items.pop(-1))
frame_end = mark_out + 1
clip_info_items.pop(-1)

mark_in = int(clip_info_items.pop(-1))
frame_start = mark_in + 1
clip_info_items.pop(-1)

return frame_start, frame_end
Loading