mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
nuke plugins update
This commit is contained in:
parent
70f42d4db7
commit
bc44306eeb
4 changed files with 51 additions and 66 deletions
|
|
@ -22,79 +22,42 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
for node in nuke.allNodes():
|
||||
if node.Class() != "Write":
|
||||
continue
|
||||
if node["disable"].value():
|
||||
continue
|
||||
|
||||
# Determine defined file type
|
||||
ext = node["file_type"].value()
|
||||
|
||||
# Determine output type
|
||||
output_type = "img"
|
||||
if node["file_type"].value() == "mov":
|
||||
if ext == "mov":
|
||||
output_type = "mov"
|
||||
|
||||
# Create instance
|
||||
instance = pyblish.api.Instance(node.name())
|
||||
instance.add(node)
|
||||
instance.data["label"] = node.name()
|
||||
|
||||
instance.data["publish"] = False
|
||||
|
||||
# Get frame range
|
||||
start_frame = int(nuke.root()["first_frame"].getValue())
|
||||
end_frame = int(nuke.root()["last_frame"].getValue())
|
||||
|
||||
if node["use_limit"].getValue():
|
||||
start_frame = int(node["first"].getValue())
|
||||
end_frame = int(node["last"].getValue())
|
||||
|
||||
self.log.info("writeNode collected: {}".format(node.name()))
|
||||
|
||||
# Add collection
|
||||
collection = None
|
||||
path = nuke.filename(node)
|
||||
path += " [{0}-{1}]".format(start_frame, end_frame)
|
||||
collection = clique.parse(path)
|
||||
|
||||
instance.data.update({
|
||||
"asset": os.environ["AVALON_ASSET"], # todo: not a constant
|
||||
"subset": subset,
|
||||
"path": nuke.filename(node),
|
||||
"outputDir": os.path.dirname(nuke.filename(node)),
|
||||
"ext": output_type, # todo: should be redundant
|
||||
"label": node.name(),
|
||||
"family": "write",
|
||||
"publish": False,
|
||||
"collection": collection,
|
||||
"start_frame": start_frame,
|
||||
"end_frame": end_frame
|
||||
})
|
||||
subset = node.name()
|
||||
# Include start and end render frame in label
|
||||
label = "{subset} ({start}-{end})".format(subset=subset,
|
||||
start=int(start_frame),
|
||||
end=int(end_frame))
|
||||
|
||||
instances.append(instance)
|
||||
# Create instance
|
||||
instance = context.create_instance(subset)
|
||||
instance.add(node)
|
||||
|
||||
context.data["write_instances"] = instances
|
||||
|
||||
context.data["instances"] = (
|
||||
context.data.get("instances", []) + instances)
|
||||
|
||||
|
||||
class CollectNukeWritesProcess(pyblish.api.ContextPlugin):
|
||||
"""Collect all local processing write instances."""
|
||||
|
||||
order = CollectNukeWrites.order + 0.01
|
||||
label = "Writes Local"
|
||||
hosts = ["nuke"]
|
||||
|
||||
# targets = ["process.local"]
|
||||
|
||||
def process(self, context):
|
||||
|
||||
for item in context.data["write_instances"]:
|
||||
instance = context.create_instance(item.data["name"])
|
||||
for key, value in item.data.iteritems():
|
||||
instance.data[key] = value
|
||||
|
||||
instance.data["label"] += " - render - local"
|
||||
instance.data["families"] = ["render", "local"]
|
||||
|
||||
for node in item:
|
||||
instance.add(node)
|
||||
|
||||
# Adding/Checking publish attribute
|
||||
# Adding/Checking publish and render target attribute
|
||||
if "render_local" not in node.knobs():
|
||||
knob = nuke.Boolean_Knob("render_local", "Local rendering")
|
||||
knob.setValue(False)
|
||||
|
|
@ -105,24 +68,45 @@ class CollectNukeWritesProcess(pyblish.api.ContextPlugin):
|
|||
# Compare against selection
|
||||
selection = instance.context.data.get("selection", [])
|
||||
if selection:
|
||||
if list(set(instance) & set(selection)):
|
||||
if list(set(instance) and set(selection)):
|
||||
value = True
|
||||
else:
|
||||
value = False
|
||||
|
||||
instance.data["publish"] = value
|
||||
|
||||
def instanceToggled(instance, value):
|
||||
instance[0]["render_local"].setValue(value)
|
||||
|
||||
instance.data["instanceToggled"] = instanceToggled
|
||||
instance.data.update({
|
||||
"instanceToggled": instanceToggled,
|
||||
"asset": os.environ["AVALON_ASSET"], # todo: not a constant
|
||||
"path": nuke.filename(node),
|
||||
"subset": subset,
|
||||
"outputDir": os.path.dirname(nuke.filename(node)),
|
||||
"ext": ext, # todo: should be redundant
|
||||
"label": label,
|
||||
"families": ["render"],
|
||||
"family": "write",
|
||||
"publish": value,
|
||||
"collection": collection,
|
||||
"start_frame": start_frame,
|
||||
"end_frame": end_frame,
|
||||
"output_type": output_type
|
||||
})
|
||||
instances.append(instance)
|
||||
|
||||
self.log.info("writeNode collected: {}".format(subset))
|
||||
|
||||
context.data["write_instances"] = instances
|
||||
|
||||
context.data["instances"] = (
|
||||
context.data.get("instances", []) + instances)
|
||||
|
||||
|
||||
class CollectNukeWritesPublish(pyblish.api.ContextPlugin):
|
||||
"""Collect all write instances for publishing."""
|
||||
|
||||
order = CollectNukeWrites.order + 0.01
|
||||
label = "Writes"
|
||||
label = "Writes Publish"
|
||||
hosts = ["nuke", "nukeassist"]
|
||||
|
||||
# targets = ["default"]
|
||||
|
|
@ -153,7 +137,7 @@ class CollectNukeWritesPublish(pyblish.api.ContextPlugin):
|
|||
# print key, value
|
||||
instance.data[key] = value
|
||||
|
||||
instance.data["families"] = ["output"]
|
||||
instance.data["families"] = ["publish"]
|
||||
instance.data["label"] += (
|
||||
" - " + os.path.basename(instance.data["collection"].format()))
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class CollectNukeRenderMode(pyblish.api.InstancePlugin):
|
|||
"""Collect current comp's render Mode
|
||||
|
||||
Options:
|
||||
renderlocal
|
||||
local
|
||||
deadline
|
||||
|
||||
Note that this value is set for each comp separately. When you save the
|
||||
|
|
@ -24,7 +24,7 @@ class CollectNukeRenderMode(pyblish.api.InstancePlugin):
|
|||
order = pyblish.api.CollectorOrder + 0.4
|
||||
label = "Collect Render Mode"
|
||||
hosts = ["nuke"]
|
||||
families = ["write"]
|
||||
families = ["write", "render"]
|
||||
|
||||
def process(self, instance):
|
||||
"""Collect all image sequence tools"""
|
||||
|
|
@ -39,8 +39,9 @@ class CollectNukeRenderMode(pyblish.api.InstancePlugin):
|
|||
|
||||
assert rendermode in options, "Must be supported render mode"
|
||||
|
||||
self.log.info("Render mode: {0}".format(rendermode))
|
||||
|
||||
# Append family
|
||||
family = "write.{0}".format(rendermode)
|
||||
instance.data["families"].remove("render")
|
||||
family = "render.{0}".format(rendermode)
|
||||
instance.data["families"].append(family)
|
||||
|
||||
self.log.info("Render mode: {0}".format(rendermode))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
order = pyblish.api.ExtractorOrder
|
||||
label = "Render Local"
|
||||
hosts = ["nuke"]
|
||||
families = ["write.local"]
|
||||
families = ["write", "render.local"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
label = "Submit to Deadline"
|
||||
order = pyblish.api.IntegratorOrder
|
||||
hosts = ["nuke"]
|
||||
families = ["write.deadline"]
|
||||
families = ["write", "render.deadline"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue