Merge pull request #3567 from pypeclub/feature/validation_exceptions_nuke

This commit is contained in:
Jakub Ježek 2022-08-25 12:24:45 +02:00 committed by GitHub
commit 6c1f83dffe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 648 additions and 328 deletions

View file

@ -26,8 +26,8 @@ from .lib import (
maintained_selection,
reset_selection,
get_view_process_node,
duplicate_node
duplicate_node,
convert_knob_value_to_correct_type
)
from .utils import (
@ -59,6 +59,7 @@ __all__ = (
"reset_selection",
"get_view_process_node",
"duplicate_node",
"convert_knob_value_to_correct_type",
"colorspace_exists_on_node",
"get_colorspace_list"

View file

@ -1593,28 +1593,35 @@ def set_node_knobs_from_settings(node, knob_settings, **kwargs):
if not knob_value:
continue
# first convert string types to string
# just to ditch unicode
if isinstance(knob_value, six.text_type):
knob_value = str(knob_value)
# set correctly knob types
if knob_type == "bool":
knob_value = bool(knob_value)
elif knob_type == "decimal_number":
knob_value = float(knob_value)
elif knob_type == "number":
knob_value = int(knob_value)
elif knob_type == "text":
knob_value = knob_value
elif knob_type == "color_gui":
knob_value = color_gui_to_int(knob_value)
elif knob_type in ["2d_vector", "3d_vector", "color"]:
knob_value = [float(v) for v in knob_value]
knob_value = convert_knob_value_to_correct_type(
knob_type, knob_value)
node[knob_name].setValue(knob_value)
def convert_knob_value_to_correct_type(knob_type, knob_value):
# first convert string types to string
# just to ditch unicode
if isinstance(knob_value, six.text_type):
knob_value = str(knob_value)
# set correctly knob types
if knob_type == "bool":
knob_value = bool(knob_value)
elif knob_type == "decimal_number":
knob_value = float(knob_value)
elif knob_type == "number":
knob_value = int(knob_value)
elif knob_type == "text":
knob_value = knob_value
elif knob_type == "color_gui":
knob_value = color_gui_to_int(knob_value)
elif knob_type in ["2d_vector", "3d_vector", "color"]:
knob_value = [float(v) for v in knob_value]
return knob_value
def color_gui_to_int(color_gui):
hex_value = (
"0x{0:0>2x}{1:0>2x}{2:0>2x}{3:0>2x}").format(*color_gui)
@ -2227,10 +2234,9 @@ def get_write_node_template_attr(node):
subset=avalon_knob_data["subset"]
)
# collecting correct data
correct_data = OrderedDict({
"file": get_render_path(node)
})
correct_data = OrderedDict()
# adding imageio knob presets
for k, v in nuke_imageio_writes.items():