From 8a2a40e6ae7918a491555f2fab2fc5a192320615 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:22:44 +0100 Subject: [PATCH 01/21] moved task short names outside of attribute group --- .../entities/schemas/projects_schema/schema_main.json | 6 ++++++ .../projects_schema/schemas/schema_anatomy_attributes.json | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schema_main.json b/pype/settings/entities/schemas/projects_schema/schema_main.json index 828739e046..81beaa1e39 100644 --- a/pype/settings/entities/schemas/projects_schema/schema_main.json +++ b/pype/settings/entities/schemas/projects_schema/schema_main.json @@ -27,6 +27,12 @@ "type": "schema", "name": "schema_anatomy_attributes" }, + { + "type": "dict-modifiable", + "key": "task_short_names", + "label": "Task short names (by Task type)", + "object_type": "text" + }, { "type": "schema", "name": "schema_anatomy_imageio" diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index 8925233bb8..f06e5d5dac 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -69,12 +69,6 @@ { "blender_2.91": "Blender 2.91" }, { "aftereffects_2021": "After Effects 2021" } ] - }, - { - "type": "dict-modifiable", - "key": "task_short_names", - "label": "Task short names (by Task type)", - "object_type": "text" } ] } From 498cd76888c2dffdf62315d93f20ef5969360fa7 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:23:22 +0100 Subject: [PATCH 02/21] Changed task shor names to Task types with defined possible keys for each task type --- .../schemas/projects_schema/schema_main.json | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schema_main.json b/pype/settings/entities/schemas/projects_schema/schema_main.json index 81beaa1e39..2ac6678d72 100644 --- a/pype/settings/entities/schemas/projects_schema/schema_main.json +++ b/pype/settings/entities/schemas/projects_schema/schema_main.json @@ -29,9 +29,20 @@ }, { "type": "dict-modifiable", - "key": "task_short_names", - "label": "Task short names (by Task type)", - "object_type": "text" + "key": "tasks", + "label": "Task types", + "is_file": true, + "is_group": true, + "object_type": { + "type": "dict", + "children": [ + { + "type": "text", + "key": "short_name", + "label": "Short name" + } + ] + } }, { "type": "schema", From 1f8f0286fa5dbc48652e43393fe75f74085c1585 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:23:35 +0100 Subject: [PATCH 03/21] modified defaults of task types --- .../defaults/project_anatomy/attributes.json | 18 +------- .../defaults/project_anatomy/tasks.json | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 pype/settings/defaults/project_anatomy/tasks.json diff --git a/pype/settings/defaults/project_anatomy/attributes.json b/pype/settings/defaults/project_anatomy/attributes.json index 8f35e41533..fbf0218999 100644 --- a/pype/settings/defaults/project_anatomy/attributes.json +++ b/pype/settings/defaults/project_anatomy/attributes.json @@ -9,21 +9,5 @@ "resolutionWidth": 1920, "resolutionHeight": 1080, "pixelAspect": 1, - "applications": [], - "task_short_names": { - "Generic": "gener", - "Art": "art", - "Modeling": "mdl", - "Texture": "tex", - "Lookdev": "look", - "Rigging": "rig", - "Edit": "edit", - "Layout": "lay", - "Setdress": "dress", - "Animation": "anim", - "FX": "fx", - "Lighting": "lgt", - "Paint": "paint", - "Compositing": "comp" - } + "applications": [] } \ No newline at end of file diff --git a/pype/settings/defaults/project_anatomy/tasks.json b/pype/settings/defaults/project_anatomy/tasks.json new file mode 100644 index 0000000000..74504cc4d7 --- /dev/null +++ b/pype/settings/defaults/project_anatomy/tasks.json @@ -0,0 +1,44 @@ +{ + "Generic": { + "short_name": "gener" + }, + "Art": { + "short_name": "art" + }, + "Modeling": { + "short_name": "mdl" + }, + "Texture": { + "short_name": "tex" + }, + "Lookdev": { + "short_name": "look" + }, + "Rigging": { + "short_name": "rig" + }, + "Edit": { + "short_name": "edit" + }, + "Layout": { + "short_name": "lay" + }, + "Setdress": { + "short_name": "dress" + }, + "Animation": { + "short_name": "anim" + }, + "FX": { + "short_name": "fx" + }, + "Lighting": { + "short_name": "lgt" + }, + "Paint": { + "short_name": "paint" + }, + "Compositing": { + "short_name": "comp" + } +} \ No newline at end of file From c97b6cb39a239edcc2eff995d197806f10a945c9 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 16 Mar 2021 15:32:01 +0100 Subject: [PATCH 04/21] fix python 2 compatibility of setting schemas --- pype/settings/entities/input_entities.py | 5 +++-- pype/settings/entities/item_entities.py | 3 ++- pype/settings/entities/lib.py | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pype/settings/entities/input_entities.py b/pype/settings/entities/input_entities.py index 0eaafb6c25..0c104e3ce7 100644 --- a/pype/settings/entities/input_entities.py +++ b/pype/settings/entities/input_entities.py @@ -4,6 +4,7 @@ from abc import abstractmethod from .base_entity import ItemEntity from .lib import ( NOT_SET, + STRING_TYPE, OverrideState ) from .exceptions import ( @@ -421,7 +422,7 @@ class TextEntity(InputEntity): schema_types = ["text"] def _item_initalization(self): - self.valid_value_types = (str, ) + self.valid_value_types = (STRING_TYPE, ) self.value_on_not_set = "" # GUI attributes @@ -438,7 +439,7 @@ class PathInput(InputEntity): self.valid_value_types = (list, ) self.value_on_not_set = ["", ""] else: - self.valid_value_types = (str, ) + self.valid_value_types = (STRING_TYPE, ) self.value_on_not_set = "" diff --git a/pype/settings/entities/item_entities.py b/pype/settings/entities/item_entities.py index 2f2573721b..11e43e4fa6 100644 --- a/pype/settings/entities/item_entities.py +++ b/pype/settings/entities/item_entities.py @@ -1,5 +1,6 @@ from .lib import ( NOT_SET, + STRING_TYPE, OverrideState ) from .exceptions import ( @@ -56,7 +57,7 @@ class PathEntity(ItemEntity): # Create child object if not self.multiplatform and not self.multipath: - valid_value_types = (str, ) + valid_value_types = (STRING_TYPE, ) item_schema = { "type": "path-input", "key": self.key, diff --git a/pype/settings/entities/lib.py b/pype/settings/entities/lib.py index 1ca3f9efe0..42164fbce9 100644 --- a/pype/settings/entities/lib.py +++ b/pype/settings/entities/lib.py @@ -8,6 +8,10 @@ from .exceptions import ( SchemaDuplicatedEnvGroupKeys ) +try: + STRING_TYPE = basestring +except Exception: + STRING_TYPE = str WRAPPER_TYPES = ["form", "collapsible-wrap"] NOT_SET = type("NOT_SET", (), {"__bool__": lambda obj: False})() @@ -55,7 +59,7 @@ def _fill_schema_template_data( value, template_data, required_keys, missing_keys ) - elif isinstance(template, str): + elif isinstance(template, STRING_TYPE): # TODO find much better way how to handle filling template data for replacement_string in template_key_pattern.findall(template): key = str(replacement_string[1:-1]) From bf313d4d08d519cfd4f332c2cc7ca33ef47a035e Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 16 Mar 2021 15:32:52 +0100 Subject: [PATCH 05/21] system and project schemas have their methods for getting schema data --- pype/settings/entities/lib.py | 10 +++++++++- pype/settings/entities/root_entities.py | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pype/settings/entities/lib.py b/pype/settings/entities/lib.py index 42164fbce9..7eec3225a1 100644 --- a/pype/settings/entities/lib.py +++ b/pype/settings/entities/lib.py @@ -237,7 +237,7 @@ def validate_schema(schema_data): validate_environment_groups_uniquenes(schema_data) -def gui_schema(subfolder, main_schema_name): +def get_gui_schema(subfolder, main_schema_name): dirpath = os.path.join( os.path.dirname(__file__), "schemas", @@ -273,6 +273,14 @@ def gui_schema(subfolder, main_schema_name): return main_schema +def get_studio_settings_schema(): + return get_gui_schema("projects_schema", "schema_main") + + +def get_project_settings_schema(): + return get_gui_schema("projects_schema", "schema_main") + + class OverrideStateItem: """Object used as item for `OverrideState` enum. diff --git a/pype/settings/entities/root_entities.py b/pype/settings/entities/root_entities.py index 88b9da2428..6e804cb286 100644 --- a/pype/settings/entities/root_entities.py +++ b/pype/settings/entities/root_entities.py @@ -10,7 +10,8 @@ from .lib import ( NOT_SET, WRAPPER_TYPES, OverrideState, - gui_schema + get_studio_settings_schema, + get_project_settings_schema ) from pype.settings.constants import ( SYSTEM_SETTINGS_KEY, @@ -450,7 +451,7 @@ class SystemSettings(RootEntity): ): if schema_data is None: # Load system schemas - schema_data = gui_schema("system_schema", "schema_main") + schema_data = get_studio_settings_schema() super(SystemSettings, self).__init__(schema_data, reset) @@ -565,7 +566,7 @@ class ProjectSettings(RootEntity): if schema_data is None: # Load system schemas - schema_data = gui_schema("projects_schema", "schema_main") + schema_data = get_project_settings_schema() super(ProjectSettings, self).__init__(schema_data, reset) From c1852d8a2aeb4f81773849de9d804fa60a595797 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 16 Mar 2021 16:10:23 +0100 Subject: [PATCH 06/21] fix system settings schema usage --- pype/settings/entities/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/settings/entities/lib.py b/pype/settings/entities/lib.py index 7eec3225a1..ed3d7aed84 100644 --- a/pype/settings/entities/lib.py +++ b/pype/settings/entities/lib.py @@ -274,7 +274,7 @@ def get_gui_schema(subfolder, main_schema_name): def get_studio_settings_schema(): - return get_gui_schema("projects_schema", "schema_main") + return get_gui_schema("system_schema", "schema_main") def get_project_settings_schema(): From fa6f5092ddc73032050f5f055100cb5b60b6e3bc Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:43:06 +0100 Subject: [PATCH 07/21] added tools to anatomy attributes --- .../defaults/project_anatomy/attributes.json | 3 ++- .../schemas/schema_anatomy_attributes.json | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pype/settings/defaults/project_anatomy/attributes.json b/pype/settings/defaults/project_anatomy/attributes.json index fbf0218999..cc5516fd1f 100644 --- a/pype/settings/defaults/project_anatomy/attributes.json +++ b/pype/settings/defaults/project_anatomy/attributes.json @@ -9,5 +9,6 @@ "resolutionWidth": 1920, "resolutionHeight": 1080, "pixelAspect": 1, - "applications": [] + "applications": [], + "tools": [] } \ No newline at end of file diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index f06e5d5dac..fbe12daa42 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -69,6 +69,18 @@ { "blender_2.91": "Blender 2.91" }, { "aftereffects_2021": "After Effects 2021" } ] + }, + { + "type": "enum", + "key": "tools", + "label": "Tools", + "multiselection": true, + "enum_items": [ + {"mtoa_3.2": "mtoa_3.2"}, + {"mtoa_3.1": "mtoa_3.1"}, + {"mtoa_3.1.1": "mtoa_3.1.1"}, + {"vray_4300": "vray_4300"} + ] } ] } From 1a5cb96ba3ad43860f67c5ff8ef783b54e2880ef Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:43:18 +0100 Subject: [PATCH 08/21] added are current applications to applications enum --- .../schemas/schema_anatomy_attributes.json | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index fbe12daa42..1f746f7e54 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -62,12 +62,47 @@ "label": "Applications", "multiselection": true, "enum_items": [ - { "maya_2020": "Maya 2020" }, - { "nuke_12.2": "Nuke 12.2" }, - { "hiero_12.2": "Hiero 12.2" }, - { "houdini_18": "Houdini 18" }, - { "blender_2.91": "Blender 2.91" }, - { "aftereffects_2021": "After Effects 2021" } + {"harmony_20": "Harmony 20"}, + {"photoshop_2021": "Photoshop 2021"}, + {"photoshop_2020": "Photoshop 2020"}, + {"unreal_4.24": "Unreal Editor 4.24"}, + {"nuke_11.3": "Nuke 11.3"}, + {"nuke_11.2": "Nuke 11.2"}, + {"fusion_9": "Fusion 9"}, + {"celation_Publish": "CelAction 2D Pulblish"}, + {"nuke_12.0": "Nuke 12.0"}, + {"nuke_12.2": "Nuke 12.2"}, + {"maya_2018": "Maya 2018"}, + {"mayabatch_2018": "MayaBatch 2018"}, + {"mayabatch_2019": "MayaBatch 2019"}, + {"aftereffects_2020": "AfterEffects 2020"}, + {"aftereffects_2021": "AfterEffects 2021"}, + {"blender_2.83": "Blender 2.83"}, + {"tvpaint_Animation 11 (64bits)": "TVPaint 11 (64bits)"}, + {"celation_Local": "CelAction 2D Local"}, + {"tvpaint_Animation 11 (32bits)": "TVPaint 11 (32bits)"}, + {"harmony_17": "Harmony 17"}, + {"resolve_16": "Resolve 16"}, + {"fusion_16": "Fusion 16"}, + {"maya_2019": "Maya 2019"}, + {"djvview_1.1": "DJV View 1.1"}, + {"nukestudio_12.0": "Nuke Studio 12.0"}, + {"nukestudio_12.2": "Nuke Studio 12.2"}, + {"hiero_12.2": "Hiero 12.2"}, + {"hiero_12.0": "Hiero 12.0"}, + {"nukestudio_11.3": "Nuke Studio 11.3"}, + {"nukestudio_11.2": "Nuke Studio 11.2"}, + {"houdini_18": "Houdini 18"}, + {"mayabatch_2020": "MayaBatch 2020"}, + {"hiero_11.2": "Hiero 11.2"}, + {"hiero_11.3": "Hiero 11.3"}, + {"houdini_17": "Houdini 17"}, + {"blender_2.90": "Blender 2.90"}, + {"nukex_12.0": "Nuke X 12.0"}, + {"maya_2020": "Maya 2020"}, + {"nukex_12.2": "Nuke X 12.2"}, + {"nukex_11.2": "Nuke X 11.2"}, + {"nukex_11.3": "Nuke X 11.3"} ] }, { From 721314d744fcf2e50d656721bf21005936bb593b Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 13:51:10 +0100 Subject: [PATCH 09/21] fps and pixel aspect can be decimal --- .../schemas/schema_anatomy_attributes.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index 1f746f7e54..adda6b26f5 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -9,7 +9,9 @@ { "type": "number", "key": "fps", - "label": "Frame Rate" + "label": "Frame Rate", + "decimal": 2, + "minimum": 0 }, { "type": "number", @@ -54,7 +56,9 @@ { "type": "number", "key": "pixelAspect", - "label": "Pixel Aspect Ratio" + "label": "Pixel Aspect Ratio", + "decimal": 2, + "minimum": 0 }, { "type": "enum", From 6859207eb340572ce5df713de668545b33c436c7 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:03:32 +0100 Subject: [PATCH 10/21] Others in anatomy templates is dictionary that can store different template groups --- .../schemas/schema_anatomy_templates.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json index 05718e0bc9..d6187575c0 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json @@ -27,6 +27,9 @@ "key": "frame", "label": "Frame" }, + { + "type": "separator" + }, { "type": "dict", "key": "work", @@ -130,7 +133,11 @@ "type": "dict-modifiable", "key": "other", "label": "Other", - "object_type": "text" + "collapsible_key": true, + "object_type": { + "type": "dict-modifiable", + "object_type": "text" + } } ] } From 997a34800bb21329b512c11c5e975aaac522bc50 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:18:08 +0100 Subject: [PATCH 11/21] changed key `other` to `others` --- pype/settings/defaults/project_anatomy/templates.json | 2 +- .../projects_schema/schemas/schema_anatomy_templates.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pype/settings/defaults/project_anatomy/templates.json b/pype/settings/defaults/project_anatomy/templates.json index 397f7257fd..dcb21d72e1 100644 --- a/pype/settings/defaults/project_anatomy/templates.json +++ b/pype/settings/defaults/project_anatomy/templates.json @@ -25,5 +25,5 @@ "path": "{@folder}/{@file}" }, "delivery": {}, - "other": {} + "others": {} } \ No newline at end of file diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json index d6187575c0..0b5339f9e6 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json @@ -131,8 +131,8 @@ }, { "type": "dict-modifiable", - "key": "other", - "label": "Other", + "key": "others", + "label": "Others", "collapsible_key": true, "object_type": { "type": "dict-modifiable", From e4138b82b7e6684ec722c4766a6643ed21e7e3da Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:18:33 +0100 Subject: [PATCH 12/21] move defaults into special dictionary with key "defaults" --- .../defaults/project_anatomy/templates.json | 10 +++-- .../schemas/schema_anatomy_templates.json | 42 +++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pype/settings/defaults/project_anatomy/templates.json b/pype/settings/defaults/project_anatomy/templates.json index dcb21d72e1..862b732846 100644 --- a/pype/settings/defaults/project_anatomy/templates.json +++ b/pype/settings/defaults/project_anatomy/templates.json @@ -1,8 +1,10 @@ { - "version_padding": 3, - "version": "v{version:0>{@version_padding}}", - "frame_padding": 4, - "frame": "{frame:0>{@frame_padding}}", + "defaults": { + "version_padding": 3, + "version": "v{version:0>{@version_padding}}", + "frame_padding": 4, + "frame": "{frame:0>{@frame_padding}}" + }, "work": { "folder": "{root[work]}/{project[name]}/{hierarchy}/{asset}/work/{task}", "file": "{project[code]}_{asset}_{task}_{@version}<_{comment}>.{ext}", diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json index 0b5339f9e6..46b48036a7 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json @@ -8,24 +8,30 @@ "is_group": true, "children": [ { - "type": "number", - "key": "version_padding", - "label": "Version Padding" - }, - { - "type": "text", - "key": "version", - "label": "Version" - }, - { - "type": "number", - "key": "frame_padding", - "label": "Frame Padding" - }, - { - "type": "text", - "key": "frame", - "label": "Frame" + "type": "dict", + "key": "defaults", + "children": [ + { + "type": "number", + "key": "version_padding", + "label": "Version Padding" + }, + { + "type": "text", + "key": "version", + "label": "Version" + }, + { + "type": "number", + "key": "frame_padding", + "label": "Frame Padding" + }, + { + "type": "text", + "key": "frame", + "label": "Frame" + } + ] }, { "type": "separator" From f3628c13fa075aa8e5ef71a950d6c7f41d1efd34 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:18:51 +0100 Subject: [PATCH 13/21] anatomy can handle "defaults" key --- pype/lib/anatomy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/lib/anatomy.py b/pype/lib/anatomy.py index 67b8c01a56..7062e1abdc 100644 --- a/pype/lib/anatomy.py +++ b/pype/lib/anatomy.py @@ -727,7 +727,7 @@ class Templates: key_2: "value_2" key_4: "value_3/value_2" """ - default_key_values = {} + default_key_values = templates.pop("defaults", {}) for key, value in tuple(templates.items()): if isinstance(value, dict): continue From 6d29a6eda09dbffaf85925321360ff481220cd18 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:20:34 +0100 Subject: [PATCH 14/21] added min and max to frame and version padding --- .../projects_schema/schemas/schema_anatomy_templates.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json index 46b48036a7..8410ec48f4 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_templates.json @@ -14,7 +14,9 @@ { "type": "number", "key": "version_padding", - "label": "Version Padding" + "label": "Version Padding", + "minimum": 1, + "maximum": 10 }, { "type": "text", @@ -24,7 +26,9 @@ { "type": "number", "key": "frame_padding", - "label": "Frame Padding" + "label": "Frame Padding", + "minimum": 1, + "maximum": 10 }, { "type": "text", From 5c1d9655c6e55b49948744da9aa6e348c5c95899 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:23:16 +0100 Subject: [PATCH 15/21] anatomy can handle others templates --- pype/lib/anatomy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pype/lib/anatomy.py b/pype/lib/anatomy.py index 7062e1abdc..4e7643dbbb 100644 --- a/pype/lib/anatomy.py +++ b/pype/lib/anatomy.py @@ -740,6 +740,19 @@ class Templates: key_values.update(sub_value) keys_by_subkey[sub_key] = cls.prepare_inner_keys(key_values) + other_templates = templates.get("others") or {} + for sub_key, sub_value in other_templates.items(): + if sub_key in keys_by_subkey: + log.warning(( + "Key \"{}\" is duplicated in others. Skipping." + ).format(sub_key)) + continue + + key_values = {} + key_values.update(default_key_values) + key_values.update(sub_value) + keys_by_subkey[sub_key] = cls.prepare_inner_keys(key_values) + default_keys_by_subkeys = cls.prepare_inner_keys(default_key_values) for key, value in default_keys_by_subkeys.items(): From 0471fbff60cd6b03a069ac64f237d3dac673ff7e Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 17 Mar 2021 14:26:59 +0100 Subject: [PATCH 16/21] changed tools to list --- .../schemas/schema_anatomy_attributes.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index adda6b26f5..d5d36e79a9 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -110,16 +110,10 @@ ] }, { - "type": "enum", + "type": "list", "key": "tools", "label": "Tools", - "multiselection": true, - "enum_items": [ - {"mtoa_3.2": "mtoa_3.2"}, - {"mtoa_3.1": "mtoa_3.1"}, - {"mtoa_3.1.1": "mtoa_3.1.1"}, - {"vray_4300": "vray_4300"} - ] + "object_type": "text" } ] } From e248c5f585f83a97ccef6fb8c564556faaf91557 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Mar 2021 11:50:52 +0100 Subject: [PATCH 17/21] moved enum entity to specific file --- pype/settings/entities/__init__.py | 8 ++- pype/settings/entities/enum_entity.py | 70 ++++++++++++++++++++++++ pype/settings/entities/input_entities.py | 68 ----------------------- 3 files changed, 76 insertions(+), 70 deletions(-) create mode 100644 pype/settings/entities/enum_entity.py diff --git a/pype/settings/entities/__init__.py b/pype/settings/entities/__init__.py index f67286832c..2c5d22328c 100644 --- a/pype/settings/entities/__init__.py +++ b/pype/settings/entities/__init__.py @@ -90,12 +90,15 @@ from .input_entities import ( NumberEntity, BoolEntity, - EnumEntity, TextEntity, PathInput, RawJsonEntity ) +from .enum_entity import ( + EnumEntity, +) + from .list_entity import ListEntity from .dict_immutable_keys_entity import DictImmutableKeysEntity from .dict_mutable_keys_entity import DictMutableKeysEntity @@ -136,11 +139,12 @@ __all__ = ( "NumberEntity", "BoolEntity", - "EnumEntity", "TextEntity", "PathInput", "RawJsonEntity", + "EnumEntity", + "ListEntity", "DictImmutableKeysEntity", diff --git a/pype/settings/entities/enum_entity.py b/pype/settings/entities/enum_entity.py new file mode 100644 index 0000000000..cb19369de0 --- /dev/null +++ b/pype/settings/entities/enum_entity.py @@ -0,0 +1,70 @@ +from .input_entities import InputEntity +from .lib import NOT_SET + + +class EnumEntity(InputEntity): + schema_types = ["enum"] + + def _item_initalization(self): + self.multiselection = self.schema_data.get("multiselection", False) + self.enum_items = self.schema_data["enum_items"] + if not self.enum_items: + raise ValueError("Attribute `enum_items` is not defined.") + + valid_keys = set() + for item in self.enum_items: + valid_keys.add(tuple(item.keys())[0]) + + self.valid_keys = valid_keys + + if self.multiselection: + self.valid_value_types = (list, ) + self.value_on_not_set = [] + else: + valid_value_types = set() + for key in valid_keys: + if self.value_on_not_set is NOT_SET: + self.value_on_not_set = key + valid_value_types.add(type(key)) + + self.valid_value_types = tuple(valid_value_types) + + # GUI attribute + self.placeholder = self.schema_data.get("placeholder") + + def schema_validations(self): + enum_keys = set() + for item in self.enum_items: + key = tuple(item.keys())[0] + if key in enum_keys: + raise ValueError( + "{}: Key \"{}\" is more than once in enum items.".format( + self.path, key + ) + ) + enum_keys.add(key) + + super(EnumEntity, self).schema_validations() + + def set(self, value): + if self.multiselection: + if not isinstance(value, list): + if isinstance(value, (set, tuple)): + value = list(value) + else: + value = [value] + check_values = value + else: + check_values = [value] + + self._validate_value_type(value) + + for item in check_values: + if item not in self.valid_keys: + raise ValueError( + "Invalid value \"{}\". Expected: {}".format( + item, self.valid_keys + ) + ) + self._current_value = value + self._on_value_change() diff --git a/pype/settings/entities/input_entities.py b/pype/settings/entities/input_entities.py index 0c104e3ce7..c26cb249a6 100644 --- a/pype/settings/entities/input_entities.py +++ b/pype/settings/entities/input_entities.py @@ -350,74 +350,6 @@ class BoolEntity(InputEntity): self.value_on_not_set = True -class EnumEntity(InputEntity): - schema_types = ["enum"] - - def _item_initalization(self): - self.multiselection = self.schema_data.get("multiselection", False) - self.enum_items = self.schema_data["enum_items"] - if not self.enum_items: - raise ValueError("Attribute `enum_items` is not defined.") - - valid_keys = set() - for item in self.enum_items: - valid_keys.add(tuple(item.keys())[0]) - - self.valid_keys = valid_keys - - if self.multiselection: - self.valid_value_types = (list, ) - self.value_on_not_set = [] - else: - valid_value_types = set() - for key in valid_keys: - if self.value_on_not_set is NOT_SET: - self.value_on_not_set = key - valid_value_types.add(type(key)) - - self.valid_value_types = tuple(valid_value_types) - - # GUI attribute - self.placeholder = self.schema_data.get("placeholder") - - def schema_validations(self): - enum_keys = set() - for item in self.enum_items: - key = tuple(item.keys())[0] - if key in enum_keys: - raise ValueError( - "{}: Key \"{}\" is more than once in enum items.".format( - self.path, key - ) - ) - enum_keys.add(key) - - super(EnumEntity, self).schema_validations() - - def set(self, value): - if self.multiselection: - if not isinstance(value, list): - if isinstance(value, (set, tuple)): - value = list(value) - else: - value = [value] - check_values = value - else: - check_values = [value] - - self._validate_value_type(value) - - for item in check_values: - if item not in self.valid_keys: - raise ValueError( - "Invalid value \"{}\". Expected: {}".format( - item, self.valid_keys - ) - ) - self._current_value = value - self._on_value_change() - - class TextEntity(InputEntity): schema_types = ["text"] From 8a8f0b7e8d09682b9726a4c04e889471c46fce49 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Mar 2021 11:52:26 +0100 Subject: [PATCH 18/21] root entities have `get_entity_from_path` but not all are implemented --- pype/settings/entities/base_entity.py | 8 +++++ pype/settings/entities/root_entities.py | 44 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/pype/settings/entities/base_entity.py b/pype/settings/entities/base_entity.py index 9003a66d76..3a4bb23a90 100644 --- a/pype/settings/entities/base_entity.py +++ b/pype/settings/entities/base_entity.py @@ -203,6 +203,11 @@ class BaseItemEntity(BaseEntity): """Return path for a direct child entity.""" pass + @abstractmethod + def get_entity_from_path(self, path): + """Return system settings entity.""" + pass + def schema_validations(self): """Validate schema of entity and it's hierachy. @@ -790,6 +795,9 @@ class ItemEntity(BaseItemEntity): """Reference method for creation of entities defined in RootEntity.""" return self.root_item.create_schema_object(*args, **kwargs) + def get_entity_from_path(self, path): + return self.root_item.get_entity_from_path(path) + @abstractmethod def update_default_value(self, parent_values): """Fill default values on startup or on refresh. diff --git a/pype/settings/entities/root_entities.py b/pype/settings/entities/root_entities.py index 6e804cb286..b4dc667826 100644 --- a/pype/settings/entities/root_entities.py +++ b/pype/settings/entities/root_entities.py @@ -151,6 +151,12 @@ class RootEntity(BaseItemEntity): ).format(self.__class__.__name__)) child_entity.schema_validations() + def get_entity_from_path(self, path): + """Return system settings entity.""" + raise NotImplementedError(( + "Method `get_entity_from_path` not available for \"{}\"" + ).format(self.__class__.__name__)) + def create_schema_object(self, schema_data, *args, **kwargs): """Create entity by entered schema data. @@ -564,6 +570,8 @@ class ProjectSettings(RootEntity): ): self._project_name = project_name + self._system_settings_entity = None + if schema_data is None: # Load system schemas schema_data = get_project_settings_schema() @@ -584,6 +592,40 @@ class ProjectSettings(RootEntity): def project_name(self, project_name): self.change_project(project_name) + @property + def system_settings_entity(self): + output = self._system_settings_entity + if output is None: + output = SystemSettings() + self._system_settings_entity = output + + if self.override_state is OverrideState.DEFAULTS: + if output.override_state is not OverrideState.DEFAULTS: + output.set_defaults_state() + elif self.override_state > OverrideState.DEFAULTS: + if output.override_state <= OverrideState.DEFAULTS: + try: + output.set_studio_state() + except Exception: + output.set_defaults_state() + return output + + def get_entity_from_path(self, path): + path_parts = path.split("/") + first_part = path_parts[0] + # TODO replace with constants + if first_part == "system_settings": + output = self.system_settings_entity + path_parts.pop(0) + else: + output = self + if first_part == "project_settings": + path_parts.pop(0) + + for path_part in path_parts: + output = output[path_part] + return output + def change_project(self, project_name): if project_name == self._project_name: return @@ -648,6 +690,8 @@ class ProjectSettings(RootEntity): if new_state is OverrideState.NOT_DEFINED: new_state = OverrideState.DEFAULTS + self._system_settings_entity = None + self._reset_values() self.set_override_state(new_state) From 0c34efc291c684a33ceeee9d30b115944ece2416 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Mar 2021 11:53:13 +0100 Subject: [PATCH 19/21] implemented apps and tools enums using system settings --- pype/settings/entities/__init__.py | 4 ++ pype/settings/entities/enum_entity.py | 90 +++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/pype/settings/entities/__init__.py b/pype/settings/entities/__init__.py index 2c5d22328c..b48f763c73 100644 --- a/pype/settings/entities/__init__.py +++ b/pype/settings/entities/__init__.py @@ -97,6 +97,8 @@ from .input_entities import ( from .enum_entity import ( EnumEntity, + AppsEnumEntity, + ToolsEnumEntity ) from .list_entity import ListEntity @@ -144,6 +146,8 @@ __all__ = ( "RawJsonEntity", "EnumEntity", + "AppsEnumEntity", + "ToolsEnumEntity", "ListEntity", diff --git a/pype/settings/entities/enum_entity.py b/pype/settings/entities/enum_entity.py index cb19369de0..4d6d268c70 100644 --- a/pype/settings/entities/enum_entity.py +++ b/pype/settings/entities/enum_entity.py @@ -68,3 +68,93 @@ class EnumEntity(InputEntity): ) self._current_value = value self._on_value_change() + + +class AppsEnumEntity(EnumEntity): + schema_types = ["apps-enum"] + + def _item_initalization(self): + self.multiselection = True + self.value_on_not_set = [] + self.enum_items = [] + self.valid_keys = set() + self.valid_value_types = (list, ) + self.placeholder = None + + def _get_enum_values(self): + system_settings_entity = self.get_entity_from_path("system_settings") + + valid_keys = set() + enum_items = [] + for app_group in system_settings_entity["applications"].values(): + enabled_entity = app_group.get("enabled") + if enabled_entity and not enabled_entity.value: + continue + + host_name_entity = app_group.get("host_name") + if not host_name_entity or not host_name_entity.value: + continue + + group_label = app_group["label"].value + + for variant_name, variant_entity in app_group["variants"].items(): + enabled_entity = variant_entity.get("enabled") + if enabled_entity and not enabled_entity.value: + continue + + _group_label = variant_entity["label"].value + if not _group_label: + _group_label = group_label + variant_label = variant_entity["variant_label"].value + + full_label = "{} {}".format(_group_label, variant_label) + enum_items.append({variant_name: full_label}) + valid_keys.add(variant_name) + return enum_items, valid_keys + + def set_override_state(self, *args, **kwargs): + super(AppsEnumEntity, self).set_override_state(*args, **kwargs) + + self.enum_items, self.valid_keys = self._get_enum_values() + new_value = [] + for key in self._current_value: + if key in self.valid_keys: + new_value.append(key) + self._current_value = new_value + + +class ToolsEnumEntity(EnumEntity): + schema_types = ["tools-enum"] + + def _item_initalization(self): + self.multiselection = True + self.value_on_not_set = [] + self.enum_items = [] + self.valid_keys = set() + self.valid_value_types = (list, ) + self.placeholder = None + + def _get_enum_values(self): + system_settings_entity = self.get_entity_from_path("system_settings") + + valid_keys = set() + enum_items = [] + for tool_group in system_settings_entity["tools"].values(): + enabled_entity = tool_group.get("enabled") + if enabled_entity and not enabled_entity.value: + continue + + for variant_name in tool_group["variants"].keys(): + enum_items.append({variant_name: variant_name}) + valid_keys.add(variant_name) + return enum_items, valid_keys + + def set_override_state(self, *args, **kwargs): + super(ToolsEnumEntity, self).set_override_state(*args, **kwargs) + + self.enum_items, self.valid_keys = self._get_enum_values() + new_value = [] + for key in self._current_value: + if key in self.valid_keys: + new_value.append(key) + self._current_value = new_value From 51054b8c97520217b427eb3cd550ef63aa10ba86 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Mar 2021 11:53:32 +0100 Subject: [PATCH 20/21] apps and tools entities are used in schema --- .../schemas/schema_anatomy_attributes.json | 52 ++----------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index d5d36e79a9..76c597e88d 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -61,58 +61,14 @@ "minimum": 0 }, { - "type": "enum", + "type": "apps-enum", "key": "applications", - "label": "Applications", - "multiselection": true, - "enum_items": [ - {"harmony_20": "Harmony 20"}, - {"photoshop_2021": "Photoshop 2021"}, - {"photoshop_2020": "Photoshop 2020"}, - {"unreal_4.24": "Unreal Editor 4.24"}, - {"nuke_11.3": "Nuke 11.3"}, - {"nuke_11.2": "Nuke 11.2"}, - {"fusion_9": "Fusion 9"}, - {"celation_Publish": "CelAction 2D Pulblish"}, - {"nuke_12.0": "Nuke 12.0"}, - {"nuke_12.2": "Nuke 12.2"}, - {"maya_2018": "Maya 2018"}, - {"mayabatch_2018": "MayaBatch 2018"}, - {"mayabatch_2019": "MayaBatch 2019"}, - {"aftereffects_2020": "AfterEffects 2020"}, - {"aftereffects_2021": "AfterEffects 2021"}, - {"blender_2.83": "Blender 2.83"}, - {"tvpaint_Animation 11 (64bits)": "TVPaint 11 (64bits)"}, - {"celation_Local": "CelAction 2D Local"}, - {"tvpaint_Animation 11 (32bits)": "TVPaint 11 (32bits)"}, - {"harmony_17": "Harmony 17"}, - {"resolve_16": "Resolve 16"}, - {"fusion_16": "Fusion 16"}, - {"maya_2019": "Maya 2019"}, - {"djvview_1.1": "DJV View 1.1"}, - {"nukestudio_12.0": "Nuke Studio 12.0"}, - {"nukestudio_12.2": "Nuke Studio 12.2"}, - {"hiero_12.2": "Hiero 12.2"}, - {"hiero_12.0": "Hiero 12.0"}, - {"nukestudio_11.3": "Nuke Studio 11.3"}, - {"nukestudio_11.2": "Nuke Studio 11.2"}, - {"houdini_18": "Houdini 18"}, - {"mayabatch_2020": "MayaBatch 2020"}, - {"hiero_11.2": "Hiero 11.2"}, - {"hiero_11.3": "Hiero 11.3"}, - {"houdini_17": "Houdini 17"}, - {"blender_2.90": "Blender 2.90"}, - {"nukex_12.0": "Nuke X 12.0"}, - {"maya_2020": "Maya 2020"}, - {"nukex_12.2": "Nuke X 12.2"}, - {"nukex_11.2": "Nuke X 11.2"}, - {"nukex_11.3": "Nuke X 11.3"} - ] + "label": "Applications" }, { - "type": "list", + "type": "tools-enum", "key": "tools", - "label": "Tools", + "label": "Tools" "object_type": "text" } ] From 325551be7e79ed742c50c3276beb9420d0e0a5ee Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 18 Mar 2021 11:54:50 +0100 Subject: [PATCH 21/21] removed unused key from tools schema --- .../projects_schema/schemas/schema_anatomy_attributes.json | 1 - 1 file changed, 1 deletion(-) diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json index 76c597e88d..f75319c7e1 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_attributes.json @@ -69,7 +69,6 @@ "type": "tools-enum", "key": "tools", "label": "Tools" - "object_type": "text" } ] }