This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6137 from tokejepsen/enhancement/OP-7592_expose_w…
…rite_knobs Nuke: Expose write knobs - OP-7592
- Loading branch information
Showing
10 changed files
with
146 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
openpype/hosts/nuke/plugins/publish/validate_exposed_knobs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import pyblish.api | ||
|
||
from openpype.pipeline.publish import get_errored_instances_from_context | ||
from openpype.hosts.nuke.api.lib import link_knobs | ||
from openpype.pipeline.publish import ( | ||
OptionalPyblishPluginMixin, | ||
PublishValidationError | ||
) | ||
|
||
|
||
class RepairExposedKnobs(pyblish.api.Action): | ||
label = "Repair" | ||
on = "failed" | ||
icon = "wrench" | ||
|
||
def process(self, context, plugin): | ||
instances = get_errored_instances_from_context(context) | ||
|
||
for instance in instances: | ||
child_nodes = ( | ||
instance.data.get("transientData", {}).get("childNodes") | ||
or instance | ||
) | ||
|
||
write_group_node = instance.data["transientData"]["node"] | ||
# get write node from inside of group | ||
write_node = None | ||
for x in child_nodes: | ||
if x.Class() == "Write": | ||
write_node = x | ||
|
||
plugin_name = plugin.families_mapping[instance.data["family"]] | ||
nuke_settings = instance.context.data["project_settings"]["nuke"] | ||
create_settings = nuke_settings["create"][plugin_name] | ||
exposed_knobs = create_settings["exposed_knobs"] | ||
link_knobs(exposed_knobs, write_node, write_group_node) | ||
|
||
|
||
class ValidateExposedKnobs( | ||
OptionalPyblishPluginMixin, | ||
pyblish.api.InstancePlugin | ||
): | ||
""" Validate write node exposed knobs. | ||
Compare exposed linked knobs to settings. | ||
""" | ||
|
||
order = pyblish.api.ValidatorOrder | ||
optional = True | ||
families = ["render", "prerender", "image"] | ||
label = "Validate Exposed Knobs" | ||
actions = [RepairExposedKnobs] | ||
hosts = ["nuke"] | ||
families_mapping = { | ||
"render": "CreateWriteRender", | ||
"prerender": "CreateWritePrerender", | ||
"image": "CreateWriteImage" | ||
} | ||
|
||
def process(self, instance): | ||
if not self.is_active(instance.data): | ||
return | ||
|
||
plugin = self.families_mapping[instance.data["family"]] | ||
group_node = instance.data["transientData"]["node"] | ||
nuke_settings = instance.context.data["project_settings"]["nuke"] | ||
create_settings = nuke_settings["create"][plugin] | ||
exposed_knobs = create_settings["exposed_knobs"] | ||
unexposed_knobs = [] | ||
for knob in exposed_knobs: | ||
if knob not in group_node.knobs(): | ||
unexposed_knobs.append(knob) | ||
|
||
if unexposed_knobs: | ||
raise PublishValidationError( | ||
"Missing exposed knobs: {}".format(unexposed_knobs) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.1.8" | ||
__version__ = "0.1.9" |