mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'feature/PYPE-11-nuke_workflow_implementing_creat' into feature/PYPE-32-nuke-publish-write-sequence
This commit is contained in:
commit
d4e2d567d1
2 changed files with 77 additions and 10 deletions
|
|
@ -73,14 +73,81 @@ def create_write_node(name, data):
|
||||||
|
|
||||||
log.debug(_data)
|
log.debug(_data)
|
||||||
|
|
||||||
|
_data["frame_range"] = data.get("frame_range", None)
|
||||||
|
|
||||||
instance = avalon.nuke.lib.add_write_node(
|
instance = avalon.nuke.lib.add_write_node(
|
||||||
name,
|
name,
|
||||||
**_data
|
**_data
|
||||||
)
|
)
|
||||||
instance = avalon.nuke.lib.imprint(instance, data["avalon"])
|
instance = avalon.nuke.lib.imprint(instance, data["avalon"])
|
||||||
|
add_rendering_knobs(instance)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
def add_rendering_knobs(node):
|
||||||
|
if "render" not in node.knobs():
|
||||||
|
knob = nuke.Boolean_Knob("render", "Render")
|
||||||
|
knob.setFlag(0x1000)
|
||||||
|
knob.setValue(False)
|
||||||
|
node.addKnob(knob)
|
||||||
|
if "render_farm" not in node.knobs():
|
||||||
|
knob = nuke.Boolean_Knob("render_farm", "Render on Farm")
|
||||||
|
knob.setValue(False)
|
||||||
|
node.addKnob(knob)
|
||||||
|
return node
|
||||||
|
|
||||||
|
|
||||||
|
def update_frame_range(start, end, root=None):
|
||||||
|
"""Set Nuke script start and end frame range
|
||||||
|
|
||||||
|
Args:
|
||||||
|
start (float, int): start frame
|
||||||
|
end (float, int): end frame
|
||||||
|
root (object, Optional): root object from nuke's script
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
knobs = {
|
||||||
|
"first_frame": start,
|
||||||
|
"last_frame": end
|
||||||
|
}
|
||||||
|
|
||||||
|
with avalon.nuke.viewer_update_and_undo_stop():
|
||||||
|
for key, value in knobs.items():
|
||||||
|
if root:
|
||||||
|
root[key].setValue(value)
|
||||||
|
else:
|
||||||
|
nuke.root()[key].setValue(value)
|
||||||
|
|
||||||
|
|
||||||
|
def get_additional_data(container):
|
||||||
|
"""Get Nuke's related data for the container
|
||||||
|
|
||||||
|
Args:
|
||||||
|
container(dict): the container found by the ls() function
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict
|
||||||
|
"""
|
||||||
|
|
||||||
|
node = container["_tool"]
|
||||||
|
tile_color = node['tile_color'].value()
|
||||||
|
if tile_color is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
hex = '%08x' % tile_color
|
||||||
|
rgba = [
|
||||||
|
float(int(hex[0:2], 16)) / 255.0,
|
||||||
|
float(int(hex[2:4], 16)) / 255.0,
|
||||||
|
float(int(hex[4:6], 16)) / 255.0
|
||||||
|
]
|
||||||
|
|
||||||
|
return {"color": QtGui.QColor().fromRgbF(rgba[0], rgba[1], rgba[2])}
|
||||||
|
|
||||||
|
|
||||||
def set_viewers_colorspace(viewer):
|
def set_viewers_colorspace(viewer):
|
||||||
assert isinstance(viewer, dict), log.error(
|
assert isinstance(viewer, dict), log.error(
|
||||||
"set_viewers_colorspace(): argument should be dictionary")
|
"set_viewers_colorspace(): argument should be dictionary")
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,13 @@ class CrateWriteRender(avalon.nuke.Creator):
|
||||||
instance = super(CrateWriteRender, self).process()
|
instance = super(CrateWriteRender, self).process()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
data_templates = {
|
write_data = {
|
||||||
"class": self.families,
|
"class": self.families,
|
||||||
# only one is required
|
|
||||||
"preset": self.family,
|
"preset": self.family,
|
||||||
"avalon": self.data
|
"avalon": self.data
|
||||||
}
|
}
|
||||||
|
|
||||||
create_write_node(self.name, data_templates)
|
create_write_node(self.name, write_data)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -90,14 +89,13 @@ class CrateWritePrerender(avalon.nuke.Creator):
|
||||||
instance = super(CrateWritePrerender, self).process()
|
instance = super(CrateWritePrerender, self).process()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
data_templates = {
|
write_data = {
|
||||||
"class": self.families,
|
"class": self.families,
|
||||||
# only one is required
|
|
||||||
"preset": self.family,
|
"preset": self.family,
|
||||||
"avalon": self.data
|
"avalon": self.data
|
||||||
}
|
}
|
||||||
|
|
||||||
create_write_node(self.name, data_templates)
|
create_write_node(self.name, write_data)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -130,16 +128,18 @@ class CrateWriteStill(avalon.nuke.Creator):
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
|
import nuke
|
||||||
instance = super(CrateWriteStill, self).process()
|
instance = super(CrateWriteStill, self).process()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
data_templates = {
|
write_data = {
|
||||||
"class": self.families,
|
"class": self.families,
|
||||||
# only one is required
|
|
||||||
"preset": self.family,
|
"preset": self.family,
|
||||||
"avalon": self.data
|
"avalon": self.data,
|
||||||
|
"frame_range": [nuke.frame(), nuke.frame()]
|
||||||
}
|
}
|
||||||
|
|
||||||
create_write_node(self.name, data_templates)
|
nuke.createNode("FrameHold", "first_frame {}".format(nuke.frame()))
|
||||||
|
create_write_node(self.name, write_data)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue