mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge branch 'feature/merge_PR187_toke_nukestudio_improvements' into develop
This commit is contained in:
commit
19ca94fe24
7 changed files with 123 additions and 52 deletions
|
|
@ -384,19 +384,29 @@ def reset_frame_range_handles():
|
|||
log.info("__ handle_start: `{}`".format(handle_start))
|
||||
log.info("__ handle_end: `{}`".format(handle_end))
|
||||
|
||||
edit_in = int(asset["data"]["fstart"]) - handles - handle_start
|
||||
edit_out = int(asset["data"]["fend"]) + handles + handle_end
|
||||
edit_in = int(asset["data"]["fstart"]) - handle_start
|
||||
edit_out = int(asset["data"]["fend"]) + handle_end
|
||||
|
||||
nuke.root()["first_frame"].setValue(edit_in)
|
||||
nuke.root()["last_frame"].setValue(edit_out)
|
||||
|
||||
# setting active viewers
|
||||
nuke.frame(int(asset["data"]["fstart"]))
|
||||
|
||||
vv = nuke.activeViewer().node()
|
||||
vv['frame_range_lock'].setValue(True)
|
||||
vv['frame_range'].setValue('{0}-{1}'.format(
|
||||
|
||||
range = '{0}-{1}'.format(
|
||||
int(asset["data"]["fstart"]),
|
||||
int(asset["data"]["fend"]))
|
||||
)
|
||||
|
||||
vv['frame_range'].setValue(range)
|
||||
vv['frame_range_lock'].setValue(True)
|
||||
|
||||
log.info("_frameRange: {}".format(range))
|
||||
log.info("frameRange: {}".format(vv['frame_range'].value()))
|
||||
|
||||
vv['frame_range'].setValue(range)
|
||||
vv['frame_range_lock'].setValue(True)
|
||||
|
||||
|
||||
def get_avalon_knob_data(node):
|
||||
|
|
@ -416,20 +426,24 @@ def reset_resolution():
|
|||
asset = io.find_one({"name": asset, "type": "asset"})
|
||||
|
||||
try:
|
||||
width = get_hierarchical_attr(asset, 'data.resolution_width', 1920)
|
||||
height = get_hierarchical_attr(asset, 'data.resolution_height', 1080)
|
||||
pixel_aspect = get_hierarchical_attr(asset, 'data.pixel_aspect', 1)
|
||||
bbox = get_hierarchical_attr(asset, 'data.crop', "0.0.1920.1080")
|
||||
width = asset.get('data', {}).get('resolution_width', 1920)
|
||||
height = asset.get('data', {}).get('resolution_height', 1080)
|
||||
pixel_aspect = asset.get('data', {}).get('pixel_aspect', 1)
|
||||
bbox = asset.get('data', {}).get('crop', "0.0.1920.1080")
|
||||
|
||||
try:
|
||||
x, y, r, t = bbox.split(".")
|
||||
except Exception as e:
|
||||
x = 0
|
||||
y = 0
|
||||
r = width
|
||||
t = height
|
||||
log.error("{}: {} \nFormat:Crop need to be set with dots, example: "
|
||||
"0.0.1920.1080, /nSetting to default".format(__name__, e))
|
||||
if bbox not in "0.0.1920.1080":
|
||||
try:
|
||||
x, y, r, t = bbox.split(".")
|
||||
except Exception as e:
|
||||
x = 0
|
||||
y = 0
|
||||
r = width
|
||||
t = height
|
||||
bbox = None
|
||||
log.error("{}: {} \nFormat:Crop need to be set with dots, example: "
|
||||
"0.0.1920.1080, /nSetting to default".format(__name__, e))
|
||||
else:
|
||||
bbox = None
|
||||
|
||||
except KeyError:
|
||||
log.warning(
|
||||
|
|
@ -462,25 +476,31 @@ def reset_resolution():
|
|||
crnt_fmt_kargs = {
|
||||
"width": (check_format.width()),
|
||||
"height": (check_format.height()),
|
||||
"x": int(check_format.x()),
|
||||
"y": int(check_format.y()),
|
||||
"r": int(check_format.r()),
|
||||
"t": int(check_format.t()),
|
||||
"pixel_aspect": float(check_format.pixelAspect())
|
||||
}
|
||||
if bbox:
|
||||
crnt_fmt_kargs.update({
|
||||
"x": int(check_format.x()),
|
||||
"y": int(check_format.y()),
|
||||
"r": int(check_format.r()),
|
||||
"t": int(check_format.t()),
|
||||
})
|
||||
crnt_fmt_str = make_format_string(**crnt_fmt_kargs)
|
||||
log.info("crnt_fmt_str: {}".format(crnt_fmt_str))
|
||||
|
||||
new_fmt_kargs = {
|
||||
"width": int(width),
|
||||
"height": int(height),
|
||||
"x": int(x),
|
||||
"y": int(y),
|
||||
"r": int(r),
|
||||
"t": int(t),
|
||||
"pixel_aspect": float(pixel_aspect),
|
||||
"project_name": format_name
|
||||
}
|
||||
if bbox:
|
||||
new_fmt_kargs.update({
|
||||
"x": int(x),
|
||||
"y": int(y),
|
||||
"r": int(r),
|
||||
"t": int(t),
|
||||
})
|
||||
|
||||
new_fmt_str = make_format_string(**new_fmt_kargs)
|
||||
log.info("new_fmt_str: {}".format(new_fmt_str))
|
||||
|
|
@ -493,16 +513,22 @@ def reset_resolution():
|
|||
|
||||
|
||||
def make_format_string(**args):
|
||||
format_str = (
|
||||
"{width} "
|
||||
"{height} "
|
||||
"{x} "
|
||||
"{y} "
|
||||
"{r} "
|
||||
"{t} "
|
||||
"{pixel_aspect:.2f}".format(**args)
|
||||
)
|
||||
return format_str
|
||||
if args.get("r"):
|
||||
return (
|
||||
"{width} "
|
||||
"{height} "
|
||||
"{x} "
|
||||
"{y} "
|
||||
"{r} "
|
||||
"{t} "
|
||||
"{pixel_aspect:.2f}".format(**args)
|
||||
)
|
||||
else:
|
||||
return (
|
||||
"{width} "
|
||||
"{height} "
|
||||
"{pixel_aspect:.2f}".format(**args)
|
||||
)
|
||||
|
||||
|
||||
def make_format(**args):
|
||||
|
|
|
|||
|
|
@ -190,7 +190,21 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
data=version_data)
|
||||
|
||||
self.log.debug("Creating version ...")
|
||||
version_id = io.insert_one(version).inserted_id
|
||||
existing_version = io.find_one({
|
||||
'type': 'version',
|
||||
'parent': subset["_id"],
|
||||
'name': next_version
|
||||
})
|
||||
if existing_version is None:
|
||||
version_id = io.insert_one(version).inserted_id
|
||||
else:
|
||||
io.update_many({
|
||||
'type': 'version',
|
||||
'parent': subset["_id"],
|
||||
'name': next_version
|
||||
}, {'$set': version}
|
||||
)
|
||||
version_id = existing_version['_id']
|
||||
instance.data['version'] = version['name']
|
||||
|
||||
# Write to disk
|
||||
|
|
@ -261,7 +275,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
src_collection = src_collections[0]
|
||||
# Assert that each member has identical suffix
|
||||
src_head = src_collection.format("{head}")
|
||||
src_tail = ext = src_collection.format("{tail}")
|
||||
src_tail = src_collection.format("{tail}")
|
||||
|
||||
test_dest_files = list()
|
||||
for i in [1, 2]:
|
||||
|
|
@ -284,12 +298,24 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
repre['published_path'] = dst_collection.format()
|
||||
|
||||
index_frame_start = None
|
||||
if repre.get('startFrame'):
|
||||
frame_start_padding = len(str(
|
||||
repre.get('endFrame')))
|
||||
index_frame_start = repre.get('startFrame')
|
||||
|
||||
for i in src_collection.indexes:
|
||||
src_padding = src_collection.format("{padding}") % i
|
||||
src_file_name = "{0}{1}{2}".format(
|
||||
src_head, src_padding, src_tail)
|
||||
|
||||
dst_padding = dst_collection.format("{padding}") % i
|
||||
|
||||
if index_frame_start:
|
||||
dst_padding = "%0{}d".format(
|
||||
frame_start_padding) % index_frame_start
|
||||
index_frame_start += 1
|
||||
|
||||
dst = "{0}{1}{2}".format(dst_head, dst_padding, dst_tail)
|
||||
self.log.debug("destination: `{}`".format(dst))
|
||||
src = os.path.join(stagingdir, src_file_name)
|
||||
|
|
@ -321,7 +347,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
src = os.path.join(stagingdir, fname)
|
||||
anatomy_filled = anatomy.format(template_data)
|
||||
dst = os.path.normpath(
|
||||
anatomy_filled[template_name]["path"])
|
||||
anatomy_filled[template_name]["path"])
|
||||
|
||||
instance.data["transfers"].append([src, dst])
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class CreateWriteRender(avalon.nuke.Creator):
|
|||
family = "{}_write".format(preset)
|
||||
families = preset
|
||||
icon = "sign-out"
|
||||
defaults = ["Main", "Mask"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CreateWriteRender, self).__init__(*args, **kwargs)
|
||||
|
|
@ -72,6 +73,7 @@ class CreateWritePrerender(avalon.nuke.Creator):
|
|||
family = "{}_write".format(preset)
|
||||
families = preset
|
||||
icon = "sign-out"
|
||||
defaults = ["Main", "Mask"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CreateWritePrerender, self).__init__(*args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class CollectClipHandles(api.ContextPlugin):
|
|||
})
|
||||
|
||||
for instance in filtered_instances:
|
||||
if not instance.data.get("main") and not instance.data.get("handleTag"):
|
||||
if not instance.data.get("main") or not instance.data.get("handleTag"):
|
||||
self.log.debug("Synchronize handles on: `{}`".format(
|
||||
instance.data["name"]))
|
||||
name = instance.data["asset"]
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
|||
self.log.debug("__ s_asset_data: {}".format(s_asset_data))
|
||||
name = instance.data["asset"] = s_asset_data["asset"]
|
||||
instance.data["parents"] = s_asset_data["parents"]
|
||||
instance.data["parents"] = s_asset_data["parents"]
|
||||
instance.data["hierarchy"] = s_asset_data["hierarchy"]
|
||||
instance.data["tasks"] = s_asset_data["tasks"]
|
||||
|
||||
|
|
@ -227,17 +226,24 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
|||
|
||||
# get custom attributes of the shot
|
||||
if instance.data.get("main"):
|
||||
start_frame = instance.data.get("frameStart", 0)
|
||||
|
||||
in_info['custom_attributes'] = {
|
||||
'handles': int(instance.data.get('handles')),
|
||||
'handle_start': handle_start,
|
||||
'handle_end': handle_end,
|
||||
'fstart': int(instance.data["startFrame"] - handle_start),
|
||||
'fend': int(instance.data["endFrame"] + handle_end),
|
||||
'fstart': int(instance.data["startFrame"]),
|
||||
'fend': int(instance.data["endFrame"]),
|
||||
'fps': instance.data["fps"],
|
||||
"edit_in": int(instance.data["startFrame"]),
|
||||
"edit_out": int(instance.data["endFrame"])
|
||||
}
|
||||
|
||||
if start_frame is not 0:
|
||||
in_info['custom_attributes'].update({
|
||||
'fstart': start_frame,
|
||||
'fend': start_frame + (
|
||||
instance.data["endFrame"] - instance.data["startFrame"])
|
||||
})
|
||||
# adding SourceResolution if Tag was present
|
||||
s_res = instance.data.get("sourceResolution")
|
||||
if s_res and instance.data.get("main"):
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class CollectPlates(api.InstancePlugin):
|
|||
data[key] = value
|
||||
|
||||
data["family"] = family.lower()
|
||||
data["families"] = ["ftrack"]
|
||||
data["families"] = ["ftrack"] + instance.data["families"][1:]
|
||||
data["source"] = data["sourcePath"]
|
||||
|
||||
subset = ""
|
||||
|
|
@ -73,7 +73,7 @@ class CollectPlates(api.InstancePlugin):
|
|||
timeline_frame_start = timeline_in - handle_start
|
||||
timeline_frame_end = timeline_out + handle_end
|
||||
|
||||
frame_start = 1
|
||||
frame_start = instance.data.get("frameStart", 1)
|
||||
frame_end = frame_start + (data["sourceOut"] - data["sourceIn"])
|
||||
|
||||
data.update(
|
||||
|
|
@ -110,6 +110,9 @@ class CollectPlates(api.InstancePlugin):
|
|||
self.log.debug("Creating instance with name: {}".format(data["name"]))
|
||||
instance.context.create_instance(**data)
|
||||
|
||||
# # remove original instance
|
||||
# instance.context.remove(instance)
|
||||
|
||||
|
||||
class CollectPlatesData(api.InstancePlugin):
|
||||
"""Collect plates"""
|
||||
|
|
@ -186,7 +189,7 @@ class CollectPlatesData(api.InstancePlugin):
|
|||
"handles": handle_start,
|
||||
"handleStart": handle_start,
|
||||
"handleEnd": handle_end,
|
||||
"sourceIn": source_in,
|
||||
"sourceIn": source_in,
|
||||
"sourceOut": source_out,
|
||||
"startFrame": frame_start,
|
||||
"endFrame": frame_end,
|
||||
|
|
@ -217,9 +220,11 @@ class CollectPlatesData(api.InstancePlugin):
|
|||
padding=padding,
|
||||
ext=ext
|
||||
)
|
||||
start_frame = source_first_frame
|
||||
self.log.debug("__ source_in_h: {}".format(source_in_h))
|
||||
self.log.debug("__ source_out_h: {}".format(source_out_h))
|
||||
start_frame = source_first_frame + source_in_h
|
||||
duration = source_out_h - source_in_h
|
||||
end_frame = source_first_frame + duration
|
||||
end_frame = start_frame + duration
|
||||
files = [file % i for i in range(start_frame, (end_frame + 1), 1)]
|
||||
except Exception as e:
|
||||
self.log.debug("Exception in file: {}".format(e))
|
||||
|
|
@ -276,8 +281,8 @@ class CollectPlatesData(api.InstancePlugin):
|
|||
'stagingDir': staging_dir,
|
||||
'name': ext,
|
||||
'ext': ext,
|
||||
'startFrame': start_frame,
|
||||
'endFrame': end_frame,
|
||||
'startFrame': frame_start - handle_start,
|
||||
'endFrame': frame_end + handle_end,
|
||||
}
|
||||
instance.data["representations"].append(plates_representation)
|
||||
|
||||
|
|
|
|||
|
|
@ -87,9 +87,15 @@ class CollectReviews(api.InstancePlugin):
|
|||
|
||||
self.log.debug("Instance review: {}".format(rev_inst.data["name"]))
|
||||
|
||||
# getting file path parameters
|
||||
file_path = rev_inst.data.get("sourcePath")
|
||||
file_dir = os.path.dirname(file_path)
|
||||
file = os.path.basename(file_path)
|
||||
ext = os.path.splitext(file)[-1][1:]
|
||||
|
||||
# adding annotation to lablel
|
||||
instance.data["label"] += " + review (.{})".format(ext)
|
||||
instance.data["families"].append("review")
|
||||
# adding representation for review mov
|
||||
representation = {
|
||||
"files": file,
|
||||
|
|
@ -101,7 +107,7 @@ class CollectReviews(api.InstancePlugin):
|
|||
"preview": True,
|
||||
"thumbnail": False,
|
||||
"name": "preview",
|
||||
"ext": os.path.splitext(file)[-1][1:]
|
||||
"ext": ext
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue