Merge pull request #762 from pypeclub/feature/modifiable_dict_with_labels

Settings modifiable dictionary with top labels
This commit is contained in:
Milan Kolar 2020-12-01 18:06:54 +01:00 committed by GitHub
commit 9aa413c434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 740 additions and 380 deletions

View file

@ -1,122 +1,129 @@
{
"hiero": {
"workfile": {
"ocioConfigName": "nuke-default",
"ocioconfigpath": {
"windows": [],
"darwin": [],
"linux": []
},
"workingSpace": "linear",
"sixteenBitLut": "sRGB",
"eightBitLut": "sRGB",
"floatLut": "linear",
"logLut": "Cineon",
"viewerLut": "sRGB",
"thumbnailLut": "sRGB"
},
"regexInputs": {
"inputs": [{
"regex": "[^-a-zA-Z0-9](plateRef).*(?=mp4)",
"colorspace": "sRGB"
}]
}
},
"nuke": {
"workfile": {
"colorManagement": "Nuke",
"OCIO_config": "nuke-default",
"customOCIOConfigPath": {
"windows": [],
"darwin": [],
"linux": []
},
"workingSpaceLUT": "linear",
"monitorLut": "sRGB",
"int8Lut": "sRGB",
"int16Lut": "sRGB",
"logLut": "Cineon",
"floatLut": "linear"
},
"nodes": {
"requiredNodes": [{
"plugins": [
"CreateWriteRender"
],
"nukeNodeClass": "Write",
"knobs": [{
"name": "file_type",
"value": "exr"
"hiero": {
"workfile": {
"ocioConfigName": "nuke-default",
"ocioconfigpath": {
"windows": [],
"darwin": [],
"linux": []
},
{
"name": "datatype",
"value": "16 bit half"
},
{
"name": "compression",
"value": "Zip (1 scanline)"
},
{
"name": "autocrop",
"value": "True"
},
{
"name": "tile_color",
"value": "0xff0000ff"
},
{
"name": "channels",
"value": "rgb"
},
{
"name": "colorspace",
"value": "linear"
}
]
"workingSpace": "linear",
"sixteenBitLut": "sRGB",
"eightBitLut": "sRGB",
"floatLut": "linear",
"logLut": "Cineon",
"viewerLut": "sRGB",
"thumbnailLut": "sRGB"
},
{
"plugins": [
"CreateWritePrerender"
],
"nukeNodeClass": "Write",
"knobs": [{
"name": "file_type",
"value": "exr"
},
{
"name": "datatype",
"value": "16 bit half"
},
{
"name": "compression",
"value": "Zip (1 scanline)"
},
{
"name": "autocrop",
"value": "False"
},
{
"name": "tile_color",
"value": "0xff0000ff"
},
{
"name": "channels",
"value": "rgb"
},
{
"name": "colorspace",
"value": "linear"
}
]
"regexInputs": {
"inputs": [
{
"regex": "[^-a-zA-Z0-9](plateRef).*(?=mp4)",
"colorspace": "sRGB"
}
]
}
],
"customNodes": []
},
"regexInputs": {
"inputs": [{
"regex": "[^-a-zA-Z0-9]beauty[^-a-zA-Z0-9]",
"colorspace": "linear"
}]
"nuke": {
"workfile": {
"colorManagement": "Nuke",
"OCIO_config": "nuke-default",
"customOCIOConfigPath": {
"windows": [],
"darwin": [],
"linux": []
},
"workingSpaceLUT": "linear",
"monitorLut": "sRGB",
"int8Lut": "sRGB",
"int16Lut": "sRGB",
"logLut": "Cineon",
"floatLut": "linear"
},
"nodes": {
"requiredNodes": [
{
"plugins": [
"CreateWriteRender"
],
"nukeNodeClass": "Write",
"knobs": [
{
"name": "file_type",
"value": "exr"
},
{
"name": "datatype",
"value": "16 bit half"
},
{
"name": "compression",
"value": "Zip (1 scanline)"
},
{
"name": "autocrop",
"value": "True"
},
{
"name": "tile_color",
"value": "0xff0000ff"
},
{
"name": "channels",
"value": "rgb"
},
{
"name": "colorspace",
"value": "linear"
}
]
},
{
"plugins": [
"CreateWritePrerender"
],
"nukeNodeClass": "Write",
"knobs": [
{
"name": "file_type",
"value": "exr"
},
{
"name": "datatype",
"value": "16 bit half"
},
{
"name": "compression",
"value": "Zip (1 scanline)"
},
{
"name": "autocrop",
"value": "False"
},
{
"name": "tile_color",
"value": "0xff0000ff"
},
{
"name": "channels",
"value": "rgb"
},
{
"name": "colorspace",
"value": "linear"
}
]
}
],
"customNodes": []
},
"regexInputs": {
"inputs": [
{
"regex": "[^-a-zA-Z0-9]beauty[^-a-zA-Z0-9]",
"colorspace": "linear"
}
]
}
}
}
}
}

View file

@ -10,6 +10,18 @@
}
},
"create": {
"__dynamic_keys_labels__": {
"create_workfile": "Workfile",
"create_model": "Model",
"create_rig": "Rig",
"create_pointcache": "Pointcache",
"create_plate": "Plate",
"create_camera": "Camera",
"create_editorial": "Editorial",
"create_image": "Image",
"create_matchmove": "matchmove",
"": ""
},
"create_workfile": {
"name": "workfile",
"label": "Workfile",
@ -21,7 +33,7 @@
"help": "Working scene backup"
},
"create_model": {
"name": "mode",
"name": "model",
"label": "Model",
"family": "model",
"icon": "cube",

View file

@ -9,6 +9,8 @@ log = logging.getLogger(__name__)
M_OVERRIDEN_KEY = "__overriden_keys__"
# Metadata key for storing information about environments
M_ENVIRONMENT_KEY = "__environment_keys__"
# Metadata key for storing dynamic created labels
M_DYNAMIC_KEY_LABEL = "__dynamic_keys_labels__"
# NOTE key popping not implemented yet
M_POP_KEY = "__pop_key__"

View file

@ -45,6 +45,7 @@
"collapsable": true,
"key": "create",
"label": "Creator plugins",
"collapsable_key": true,
"is_file": true,
"object_type":
{

View file

@ -97,6 +97,11 @@ QPushButton[btn-type="tool-item"]:hover {
background-color: transparent;
}
QPushButton[btn-type="tool-item-icon"] {
border: 0px solid #bfccd6;
background-color: transparent;
}
QPushButton[btn-type="expand-toggle"] {
background: #1d272f;
}

View file

@ -38,7 +38,7 @@ class AnatomyWidget(QtWidgets.QWidget, SettingObject):
}
def __init__(
self, input_data, parent, as_widget=False, label_widget=None
self, schema_data, parent, as_widget=False
):
if as_widget:
raise TypeError(
@ -47,11 +47,12 @@ class AnatomyWidget(QtWidgets.QWidget, SettingObject):
super(AnatomyWidget, self).__init__(parent)
self.setObjectName("AnatomyWidget")
self.initial_attributes(input_data, parent, as_widget)
self.initial_attributes(schema_data, parent, as_widget)
self.key = input_data["key"]
self.key = schema_data["key"]
children_data = input_data["children"]
def create_ui(self, label_widget=None):
children_data = self.schema_data["children"]
roots_input_data = {}
templates_input_data = {}
imageio_input_data = {}
@ -66,6 +67,7 @@ class AnatomyWidget(QtWidgets.QWidget, SettingObject):
self.root_widget = RootsWidget(roots_input_data, self)
self.templates_widget = TemplatesWidget(templates_input_data, self)
self.imageio_widget = DictWidget(imageio_input_data, self)
self.imageio_widget.create_ui()
self.setAttribute(QtCore.Qt.WA_StyledBackground)
@ -298,6 +300,7 @@ class RootsWidget(QtWidgets.QWidget, SettingObject):
path_widget_data, self,
as_widget=True, parent_widget=content_widget
)
singleroot_widget.create_ui()
multiroot_data = {
"key": self.key,
"expandable": False,
@ -310,6 +313,7 @@ class RootsWidget(QtWidgets.QWidget, SettingObject):
multiroot_data, self,
as_widget=True, parent_widget=content_widget
)
multiroot_widget.create_ui()
content_layout = QtWidgets.QVBoxLayout(content_widget)
content_layout.setContentsMargins(0, 0, 0, 0)
@ -667,10 +671,9 @@ class TemplatesWidget(QtWidgets.QWidget, SettingObject):
}
self.body_widget = body_widget
self.label_widget = body_widget.label_widget
self.value_input = RawJsonWidget(
template_input_data, self,
label_widget=self.label_widget
)
self.value_input = RawJsonWidget(template_input_data, self)
self.value_input.create_ui(label_widget=self.label_widget)
content_layout.addWidget(self.value_input)
layout = QtWidgets.QVBoxLayout(self)

View file

@ -239,14 +239,6 @@ class SystemWidget(QtWidgets.QWidget):
if not self.items_are_valid():
return
output = {}
for item in self.input_fields:
output.update(item.config_value())
for key in reversed(self.keys):
_output = {key: output}
output = _output
all_values = {}
for item in self.input_fields:
all_values.update(item.config_value())
@ -313,6 +305,7 @@ class SystemWidget(QtWidgets.QWidget):
item_type = child_configuration["type"]
klass = lib.TypeToKlass.types.get(item_type)
item = klass(child_configuration, self)
item.create_ui()
self.input_fields.append(item)
self.content_layout.addWidget(item, 0)
@ -579,6 +572,7 @@ class ProjectWidget(QtWidgets.QWidget):
item_type = child_configuration["type"]
klass = lib.TypeToKlass.types.get(item_type)
item = klass(child_configuration, self)
item.create_ui()
self.input_fields.append(item)
self.content_layout.addWidget(item, 0)
@ -624,6 +618,8 @@ class ProjectWidget(QtWidgets.QWidget):
for item in self.input_fields:
all_values.update(item.config_value())
all_values = lib.convert_gui_data_with_metadata(all_values)
for key in reversed(self.keys):
_all_values = {key: all_values}
all_values = _all_values

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,11 @@ import os
import re
import json
import copy
from pype.settings.lib import M_OVERRIDEN_KEY, M_ENVIRONMENT_KEY
from pype.settings.lib import (
M_OVERRIDEN_KEY,
M_ENVIRONMENT_KEY,
M_DYNAMIC_KEY_LABEL
)
from queue import Queue
@ -35,6 +39,8 @@ def convert_gui_data_with_metadata(data, ignored_keys=None):
if key == "environments":
output[M_ENVIRONMENT_KEY] = value
elif key == "dynamic_key_label":
output[M_DYNAMIC_KEY_LABEL] = value
else:
raise KeyError("Unknown metadata key \"{}\"".format(key))
@ -51,6 +57,11 @@ def convert_data_to_gui_data(data, first=True):
if M_ENVIRONMENT_KEY in data:
data.pop(M_ENVIRONMENT_KEY)
if M_DYNAMIC_KEY_LABEL in data:
if METADATA_KEY not in data:
data[METADATA_KEY] = {}
data[METADATA_KEY]["dynamic_key_label"] = data.pop(M_DYNAMIC_KEY_LABEL)
for key, value in data.items():
output[key] = convert_data_to_gui_data(value, False)

View file

@ -1,4 +1,23 @@
from Qt import QtWidgets, QtCore, QtGui
from avalon.vendor import qtawesome
class IconButton(QtWidgets.QPushButton):
def __init__(self, icon_name, color, hover_color, *args, **kwargs):
super(IconButton, self).__init__(*args, **kwargs)
self.icon = qtawesome.icon(icon_name, color=color)
self.hover_icon = qtawesome.icon(icon_name, color=hover_color)
self.setIcon(self.icon)
def enterEvent(self, event):
self.setIcon(self.hover_icon)
super(IconButton, self).enterEvent(event)
def leaveEvent(self, event):
self.setIcon(self.icon)
super(IconButton, self).leaveEvent(event)
class NumberSpinBox(QtWidgets.QDoubleSpinBox):
@ -108,11 +127,11 @@ class ExpandingWidget(QtWidgets.QWidget):
label_widget.setObjectName("DictLabel")
before_label_widget = QtWidgets.QWidget(side_line_widget)
before_label_layout = QtWidgets.QVBoxLayout(before_label_widget)
before_label_layout = QtWidgets.QHBoxLayout(before_label_widget)
before_label_layout.setContentsMargins(0, 0, 0, 0)
after_label_widget = QtWidgets.QWidget(side_line_widget)
after_label_layout = QtWidgets.QVBoxLayout(after_label_widget)
after_label_layout = QtWidgets.QHBoxLayout(after_label_widget)
after_label_layout.setContentsMargins(0, 0, 0, 0)
spacer_widget = QtWidgets.QWidget(side_line_widget)
@ -158,6 +177,12 @@ class ExpandingWidget(QtWidgets.QWidget):
self.content_widget.setVisible(not hide_content)
self.parent().updateGeometry()
def show_toolbox(self):
self.toolbox_hidden = False
self.toggle_content(self.button_toggle.isChecked())
self.parent().updateGeometry()
def set_content_widget(self, content_widget):
content_widget.setVisible(False)
self.main_layout.addWidget(content_widget)