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

TVPaint extractor enhancement #1080

Merged
merged 40 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9271101
removed modifiable save modes from extractor
iLLiCiTiT Mar 3, 2021
f85edd3
imlpemented method for copying same temp image files
iLLiCiTiT Mar 3, 2021
bed900f
implemented method that will fill frames by pre behavior of a layer
iLLiCiTiT Mar 3, 2021
72a6e1d
implemented method that will fill frames by post behavior of a layer
iLLiCiTiT Mar 3, 2021
5ece25b
implemented logic of layers compositing using Pillow
iLLiCiTiT Mar 3, 2021
796e722
frame start/end are defined by mark in/out of published clip
iLLiCiTiT Mar 3, 2021
9b78deb
collect both layer's position and all layer ids
iLLiCiTiT Mar 3, 2021
df1435e
skip savemode filling
iLLiCiTiT Mar 3, 2021
cf6d649
removed previous logic of rendering
iLLiCiTiT Mar 3, 2021
cc9369e
collect behavior of layer ids to process
iLLiCiTiT Mar 3, 2021
838ebbe
implemented method that will render and fill all frames of given layer
iLLiCiTiT Mar 3, 2021
df4e281
layers are rendered one by one and stored by their position (order)
iLLiCiTiT Mar 3, 2021
d14e584
rendered frames are composite to final output
iLLiCiTiT Mar 3, 2021
d8033fc
added cleanup method that will remove temp image files of individial …
iLLiCiTiT Mar 3, 2021
f57ecfa
pass different arguments and expect different output of render method
iLLiCiTiT Mar 3, 2021
b8c57e0
keep frame start/end as they are
iLLiCiTiT Mar 3, 2021
c452dc9
added some extra logs
iLLiCiTiT Mar 3, 2021
043a9d9
fixed case when all layers miss image for frame
iLLiCiTiT Mar 3, 2021
84f3801
moved composite_images to pype's tvpaint.lib
iLLiCiTiT Mar 3, 2021
3193ade
using multiprocessing to speed up compositing part
iLLiCiTiT Mar 3, 2021
554e0f5
simplified extractor with tv_savesequence command
iLLiCiTiT Mar 3, 2021
bda4296
removed unused lib
iLLiCiTiT Mar 3, 2021
d6a9341
fixed hound
iLLiCiTiT Mar 3, 2021
df5916e
fix variable names
iLLiCiTiT Mar 3, 2021
e3b686e
fix frame range of pass output
iLLiCiTiT Mar 4, 2021
86ccfb6
renamed extract sequence to extract review sequence
iLLiCiTiT Mar 4, 2021
7cb7a5b
moved back tvpaint's lib for compositing
iLLiCiTiT Mar 4, 2021
253fba6
implemented extract review that can render layer by layer with alpha
iLLiCiTiT Mar 4, 2021
285d91d
modified extract sequence to skip compositing is rendering only one l…
iLLiCiTiT Mar 4, 2021
8714245
removed thumbnail filename variable
iLLiCiTiT Mar 4, 2021
8004d3c
merged extractors to one extractor
iLLiCiTiT Mar 4, 2021
445b6b5
extract sequence use key word arguments in filename template
iLLiCiTiT Mar 4, 2021
aae0522
handle "none" behavior
iLLiCiTiT Mar 4, 2021
7c696a0
add files to `layer_files_by_frame` on creation
iLLiCiTiT Mar 4, 2021
075080b
added some debug loggins messages
iLLiCiTiT Mar 4, 2021
97446f6
review instance stores copy of layers data
iLLiCiTiT Mar 4, 2021
d69f700
added validation of layers visibility
iLLiCiTiT Mar 4, 2021
b1cda0b
do not skip not visible layers for render layer
iLLiCiTiT Mar 4, 2021
d7992f1
turn of publishing based on visibility of layers
iLLiCiTiT Mar 4, 2021
50a59f2
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/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)
22 changes: 13 additions & 9 deletions pype/plugins/tvpaint/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,16 @@ def process(self, context):
if instance is None:
continue

frame_start = context.data["frameStart"]
frame_end = frame_start
any_visible = False
for layer in instance.data["layers"]:
_frame_end = layer["frame_end"]
if _frame_end > frame_end:
frame_end = _frame_end
if layer["visible"]:
any_visible = True
break

instance.data["publish"] = any_visible

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 Expand Up @@ -107,7 +111,7 @@ def create_render_layer_instance(self, context, instance_data):
group_id = instance_data["group_id"]
group_layers = []
for layer in layers_data:
if layer["group_id"] == group_id and layer["visible"]:
if layer["group_id"] == group_id:
group_layers.append(layer)

if not group_layers:
Expand Down
32 changes: 22 additions & 10 deletions pype/plugins/tvpaint/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