From 95a3f2f5a263f1965a56ab5acd1f25738e44934e Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 14:10:44 +0200 Subject: [PATCH 01/19] defined template for application variant --- .../template_host_variant_items.json | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant_items.json diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant_items.json b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant_items.json new file mode 100644 index 0000000000..bba4634c46 --- /dev/null +++ b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant_items.json @@ -0,0 +1,43 @@ +[ + { + "type": "path", + "key": "executables", + "label": "Executables", + "multiplatform": true, + "multipath": true + }, + { + "type":"separator" + }, + { + "type": "dict", + "key": "arguments", + "label": "Arguments", + "use_label_wrap": false, + "children": [ + { + "key": "windows", + "label": "Windows", + "type": "list", + "object_type": "text" + }, + { + "key": "darwin", + "label": "MacOS", + "type": "list", + "object_type": "text" + }, + { + "key": "linux", + "label": "Linux", + "type": "list", + "object_type": "text" + } + ] + }, + { + "key": "environment", + "label": "Environment", + "type": "raw-json" + } +] From 3ac2a0c7c72644d8a61c1b69dd7712e1b2fc5be6 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 14:11:45 +0200 Subject: [PATCH 02/19] modified template_host_variant to use template_host_variant_items --- .../host_settings/template_host_variant.json | 43 ++----------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json index 63d3d9413d..82da407942 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json @@ -15,48 +15,11 @@ "type": "text", "key": "variant_label", "label": "Variant label", - "placeholder": "Only \"Label\" is used if not filled." + "placeholder": "< {app_variant} >" }, { - "type": "path", - "key": "executables", - "label": "Executables", - "multiplatform": true, - "multipath": true - }, - { - "type":"separator" - }, - { - "type": "dict", - "key": "arguments", - "label": "Arguments", - "use_label_wrap": false, - "children": [ - { - "key": "windows", - "label": "Windows", - "type": "list", - "object_type": "text" - }, - { - "key": "darwin", - "label": "MacOS", - "type": "list", - "object_type": "text" - }, - { - "key": "linux", - "label": "Linux", - "type": "list", - "object_type": "text" - } - ] - }, - { - "key": "environment", - "label": "Environment", - "type": "raw-json" + "type": "template", + "name": "template_host_variant_items" } ] } From 03bd7bff9b6b1aaf39b8a1a6d59092680520125a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 14:35:38 +0200 Subject: [PATCH 03/19] fix invalid key style in mutable dict --- .../tools/settings/settings/widgets/dict_mutable_widget.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openpype/tools/settings/settings/widgets/dict_mutable_widget.py b/openpype/tools/settings/settings/widgets/dict_mutable_widget.py index 3b5f15f519..f849a9a2a9 100644 --- a/openpype/tools/settings/settings/widgets/dict_mutable_widget.py +++ b/openpype/tools/settings/settings/widgets/dict_mutable_widget.py @@ -103,7 +103,10 @@ class ModifiableDictEmptyItem(QtWidgets.QWidget): self.key_is_valid = KEY_REGEX.match(key) self.is_duplicated = self.entity_widget.is_key_duplicated(key) key_input_state = "" - if self.is_duplicated or not self.key_is_valid: + # Collapsible key and empty key are not invalid + if self.collapsible_key and self.key_input.text() == "": + pass + elif self.is_duplicated or not self.key_is_valid: key_input_state = "invalid" elif key != "": key_input_state = "modified" From 32c7382b764919ef6fd48c4eef74e0b591b1777d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 14:52:49 +0200 Subject: [PATCH 04/19] allow to have not set label on modifiable dict with enabled collapsible_key --- openpype/settings/entities/dict_mutable_keys_entity.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpype/settings/entities/dict_mutable_keys_entity.py b/openpype/settings/entities/dict_mutable_keys_entity.py index cbc80b6409..7ba44ed0df 100644 --- a/openpype/settings/entities/dict_mutable_keys_entity.py +++ b/openpype/settings/entities/dict_mutable_keys_entity.py @@ -226,7 +226,16 @@ class DictMutableKeysEntity(EndpointEntity): self.is_group = True def schema_validations(self): + # Allow to have not set label if keys are collapsible + # - this it to bypass label validation + used_temp_label = False + if self.is_group and not self.label and self.collapsible_key: + used_temp_label = True + self.label = "LABEL" + super(DictMutableKeysEntity, self).schema_validations() + if used_temp_label: + self.label = None if not self.schema_data.get("object_type"): reason = ( From 9f528e68b2e34562b4113b42c2a0395e9a5eea60 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 14:55:14 +0200 Subject: [PATCH 05/19] fix template type --- .../system_schema/host_settings/template_host_variant.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json index 82da407942..33cde3d216 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json @@ -18,7 +18,7 @@ "placeholder": "< {app_variant} >" }, { - "type": "template", + "type": "schema_template", "name": "template_host_variant_items" } ] From d7840ce760e1a2386359463e18041c42997fe693 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 15:02:47 +0200 Subject: [PATCH 06/19] added dynamic variants for blender --- .../host_settings/schema_blender.json | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_blender.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_blender.json index 98d0f99843..e6e7381e9f 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_blender.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_blender.json @@ -20,24 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant_label": "2.83", - "app_variant": "2-83" - }, - { - "app_variant_label": "2.90", - "app_variant": "2-90" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } From 1f62875f9d610e86a7ff8097133c91e59f16a598 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 15:03:18 +0200 Subject: [PATCH 07/19] added dynamic variants for other applications that may benefit from it --- .../host_settings/schema_djv.json | 24 ++++++----- .../host_settings/schema_houdini.json | 36 +++++++---------- .../host_settings/schema_maya.json | 36 +++++++---------- .../host_settings/schema_mayabatch.json | 36 +++++++---------- .../host_settings/schema_tvpaint.json | 32 +++++++-------- .../host_settings/template_nuke.json | 40 +++++++------------ 6 files changed, 89 insertions(+), 115 deletions(-) diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_djv.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_djv.json index 9698266bca..a95cedf7c3 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_djv.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_djv.json @@ -20,18 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": { - "app_variant_label": "1.1", - "app_variant": "1-1" + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" } - } - ] + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_houdini.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_houdini.json index a6d2103dbe..22a5b2e737 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_houdini.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_houdini.json @@ -20,28 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant_label": "18.5", - "app_variant": "18-5" - }, - { - "app_variant_label": "18", - "app_variant": "18" - }, - { - "app_variant_label": "17", - "app_variant": "17" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_maya.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_maya.json index 007ebb4d62..7c33671fa7 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_maya.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_maya.json @@ -20,28 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant_label": "2020", - "app_variant": "2020" - }, - { - "app_variant_label": "2019", - "app_variant": "2019" - }, - { - "app_variant_label": "2018", - "app_variant": "2018" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json index bdeca9089c..93e3adbd8e 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json @@ -20,28 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant_label": "2020", - "app_variant": "2020" - }, - { - "app_variant_label": "2019", - "app_variant": "2019" - }, - { - "app_variant_label": "2018", - "app_variant": "2018" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_tvpaint.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_tvpaint.json index 8f8c2c5ac5..eac09be113 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_tvpaint.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_tvpaint.json @@ -20,24 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant_label": "Animation 11 (64bits)", - "app_variant": "animation_11-64bits" - }, - { - "app_variant_label": "Animation 11 (32bits)", - "app_variant": "animation_11-32bits" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/template_nuke.json b/openpype/settings/entities/schemas/system_schema/host_settings/template_nuke.json index 737a695e1b..3f25c7d72f 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/template_nuke.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/template_nuke.json @@ -21,32 +21,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant": "12-2", - "app_variant_label": "12.2" - }, - { - "app_variant": "12-0", - "app_variant_label": "12.0" - }, - { - "app_variant": "11-3", - "app_variant_label": "11.3" - }, - { - "app_variant": "11-2", - "app_variant_label": "11.2" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } From 1b7e7054191232701d929dc4af6b3a402bb7d6b4 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 15:39:21 +0200 Subject: [PATCH 08/19] fix apps enum to have correct labels --- openpype/settings/entities/enum_entity.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/openpype/settings/entities/enum_entity.py b/openpype/settings/entities/enum_entity.py index 919fd3178e..693305cb1e 100644 --- a/openpype/settings/entities/enum_entity.py +++ b/openpype/settings/entities/enum_entity.py @@ -128,13 +128,21 @@ class AppsEnumEntity(BaseEnumEntity): continue group_label = app_group["label"].value - - for variant_name, variant_entity in app_group["variants"].items(): + variants_entity = app_group["variants"] + for variant_name, variant_entity in variants_entity.items(): enabled_entity = variant_entity.get("enabled") if enabled_entity and not enabled_entity.value: continue - variant_label = variant_entity["variant_label"].value + variant_label = None + if "variant_label" in variant_entity: + variant_label = variant_entity["variant_label"].value + elif hasattr(variants_entity, "get_key_label"): + variant_label = variants_entity.get_key_label(variant_name) + + if not variant_label: + variant_label = variant_name + if group_label: full_label = "{} {}".format(group_label, variant_label) else: From f5830d9b1544d7c333b017f7190e442a5225f26f Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:26:04 +0200 Subject: [PATCH 09/19] it is possible to retrieve settings with metadata and with or without local settings --- openpype/settings/lib.py | 74 +++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/openpype/settings/lib.py b/openpype/settings/lib.py index 60a51c01a0..895fc1e133 100644 --- a/openpype/settings/lib.py +++ b/openpype/settings/lib.py @@ -645,13 +645,22 @@ def apply_local_settings_on_project_settings( sync_server_config["remote_site"] = remote_site -def get_system_settings(clear_metadata=True): +def get_system_settings(clear_metadata=True, exclude_locals=None): """System settings with applied studio overrides.""" default_values = get_default_settings()[SYSTEM_SETTINGS_KEY] studio_values = get_studio_system_settings_overrides() result = apply_overrides(default_values, studio_values) + + # Clear overrides metadata from settings if clear_metadata: clear_metadata_from_settings(result) + + # Apply local settings + # Default behavior is based on `clear_metadata` value + if exclude_locals is None: + exclude_locals = not clear_metadata + + if not exclude_locals: # TODO local settings may be required to apply for environments local_settings = get_local_settings() apply_local_settings_on_system_settings(result, local_settings) @@ -659,40 +668,52 @@ def get_system_settings(clear_metadata=True): return result -def get_default_project_settings(clear_metadata=True, exclude_locals=False): +def get_default_project_settings(clear_metadata=True, exclude_locals=None): """Project settings with applied studio's default project overrides.""" default_values = get_default_settings()[PROJECT_SETTINGS_KEY] studio_values = get_studio_project_settings_overrides() result = apply_overrides(default_values, studio_values) + # Clear overrides metadata from settings if clear_metadata: clear_metadata_from_settings(result) - if not exclude_locals: - local_settings = get_local_settings() - apply_local_settings_on_project_settings( - result, local_settings, None - ) + + # Apply local settings + if exclude_locals is None: + exclude_locals = not clear_metadata + + if not exclude_locals: + local_settings = get_local_settings() + apply_local_settings_on_project_settings( + result, local_settings, None + ) return result -def get_default_anatomy_settings(clear_metadata=True, exclude_locals=False): +def get_default_anatomy_settings(clear_metadata=True, exclude_locals=None): """Project anatomy data with applied studio's default project overrides.""" default_values = get_default_settings()[PROJECT_ANATOMY_KEY] studio_values = get_studio_project_anatomy_overrides() - # TODO uncomment and remove hotfix result when overrides of anatomy - # are stored correctly. result = apply_overrides(default_values, studio_values) + # Clear overrides metadata from settings if clear_metadata: clear_metadata_from_settings(result) - if not exclude_locals: - local_settings = get_local_settings() - apply_local_settings_on_anatomy_settings( - result, local_settings, None - ) + + # Apply local settings + if exclude_locals is None: + exclude_locals = not clear_metadata + + if not exclude_locals: + local_settings = get_local_settings() + apply_local_settings_on_anatomy_settings( + result, local_settings, None + ) return result -def get_anatomy_settings(project_name, site_name=None, exclude_locals=False): +def get_anatomy_settings( + project_name, site_name=None, clear_metadata=True, exclude_locals=None +): """Project anatomy data with applied studio and project overrides.""" if not project_name: raise ValueError( @@ -709,7 +730,13 @@ def get_anatomy_settings(project_name, site_name=None, exclude_locals=False): for key, value in project_overrides.items(): result[key] = value - clear_metadata_from_settings(result) + # Clear overrides metadata from settings + if clear_metadata: + clear_metadata_from_settings(result) + + # Apply local settings + if exclude_locals is None: + exclude_locals = not clear_metadata if not exclude_locals: local_settings = get_local_settings() @@ -719,7 +746,9 @@ def get_anatomy_settings(project_name, site_name=None, exclude_locals=False): return result -def get_project_settings(project_name, exclude_locals=False): +def get_project_settings( + project_name, clear_metadata=True, exclude_locals=None +): """Project settings with applied studio and project overrides.""" if not project_name: raise ValueError( @@ -733,7 +762,14 @@ def get_project_settings(project_name, exclude_locals=False): ) result = apply_overrides(studio_overrides, project_overrides) - clear_metadata_from_settings(result) + + # Clear overrides metadata from settings + if clear_metadata: + clear_metadata_from_settings(result) + + # Apply local settings + if exclude_locals is None: + exclude_locals = not clear_metadata if not exclude_locals: local_settings = get_local_settings() From 8ba5fd54dbeba18b1b127226f51631016ddf9d84 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:26:36 +0200 Subject: [PATCH 10/19] saved defaults of applications --- .../system_settings/applications.json | 99 ++++++++----------- 1 file changed, 39 insertions(+), 60 deletions(-) diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index 42e742d07c..38320b8981 100644 --- a/openpype/settings/defaults/system_settings/applications.json +++ b/openpype/settings/defaults/system_settings/applications.json @@ -20,8 +20,6 @@ }, "variants": { "2020": { - "enabled": true, - "variant_label": "2020", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2020\\bin\\maya.exe" @@ -41,8 +39,6 @@ } }, "2019": { - "enabled": true, - "variant_label": "2019", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2019\\bin\\maya.exe" @@ -62,8 +58,6 @@ } }, "2018": { - "enabled": true, - "variant_label": "2018", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2018\\bin\\maya.exe" @@ -106,8 +100,6 @@ }, "variants": { "2020": { - "enabled": true, - "variant_label": "2020", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2020\\bin\\mayabatch.exe" @@ -125,8 +117,6 @@ } }, "2019": { - "enabled": true, - "variant_label": "2019", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2019\\bin\\mayabatch.exe" @@ -144,8 +134,6 @@ } }, "2018": { - "enabled": true, - "variant_label": "2018", "executables": { "windows": [ "C:\\Program Files\\Autodesk\\Maya2018\\bin\\mayabatch.exe" @@ -182,8 +170,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -201,8 +187,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -220,8 +204,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -239,8 +221,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -254,6 +234,11 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3" } } }, @@ -275,8 +260,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -300,8 +283,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -325,8 +306,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -350,8 +329,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -371,6 +348,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -392,8 +375,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -417,8 +398,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -442,8 +421,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -467,8 +444,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [], "darwin": [], @@ -486,6 +461,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -507,8 +488,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -532,8 +511,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -557,8 +534,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -582,8 +557,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -603,6 +576,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -752,8 +731,6 @@ }, "variants": { "18-5": { - "enabled": true, - "variant_label": "18.5", "executables": { "windows": [ "C:\\Program Files\\Side Effects Software\\Houdini 18.5.499\\bin\\houdini.exe" @@ -769,8 +746,6 @@ "environment": {} }, "18": { - "enabled": true, - "variant_label": "18", "executables": { "windows": [], "darwin": [], @@ -784,8 +759,6 @@ "environment": {} }, "17": { - "enabled": true, - "variant_label": "17", "executables": { "windows": [], "darwin": [], @@ -797,6 +770,11 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "18-5": "18.5", + "18": "18", + "17": "17" } } }, @@ -815,8 +793,6 @@ }, "variants": { "2-83": { - "enabled": true, - "variant_label": "2.83", "executables": { "windows": [ "C:\\Program Files\\Blender Foundation\\Blender 2.83\\blender.exe" @@ -838,8 +814,6 @@ "environment": {} }, "2-90": { - "enabled": true, - "variant_label": "2.90", "executables": { "windows": [ "C:\\Program Files\\Blender Foundation\\Blender 2.90\\blender.exe" @@ -859,6 +833,10 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "2-83": "2.83", + "2-90": "2.90" } } }, @@ -916,8 +894,6 @@ }, "variants": { "animation_11-64bits": { - "enabled": true, - "variant_label": "11 (64bits)", "executables": { "windows": [ "C:\\Program Files\\TVPaint Developpement\\TVPaint Animation 11 (64bits)\\TVPaint Animation 11 (64bits).exe" @@ -933,8 +909,6 @@ "environment": {} }, "animation_11-32bits": { - "enabled": true, - "variant_label": "11 (32bits)", "executables": { "windows": [ "C:\\Program Files (x86)\\TVPaint Developpement\\TVPaint Animation 11 (32bits)\\TVPaint Animation 11 (32bits).exe" @@ -948,6 +922,10 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "animation_11-64bits": "11 (64bits)", + "animation_11-32bits": "11 (32bits)" } } }, @@ -1160,8 +1138,6 @@ "environment": {}, "variants": { "1-1": { - "enabled": true, - "variant_label": "1.1", "executables": { "windows": [], "darwin": [], @@ -1173,6 +1149,9 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "1-1": "1.1" } } } From db4836e66217cdee37247857ac3657f703f54c3f Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:36:39 +0200 Subject: [PATCH 11/19] fill variant label with label from metadata --- openpype/lib/applications.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index 3302a88f97..a3c5b00a0b 100644 --- a/openpype/lib/applications.py +++ b/openpype/lib/applications.py @@ -17,6 +17,10 @@ from openpype.settings import ( get_project_settings, get_environments ) +from openpype.settings.constants import ( + METADATA_KEYS, + M_DYNAMIC_KEY_LABEL +) from . import ( PypeLogger, Anatomy @@ -123,7 +127,16 @@ class ApplicationGroup: self.host_name = host_name variants = data.get("variants") or {} + key_label_mapping = variants.pop(M_DYNAMIC_KEY_LABEL, {}) for variant_name, variant_data in variants.items(): + if variant_name in METADATA_KEYS: + continue + + if "variant_label" not in variant_data: + variant_label = key_label_mapping.get(variant_name) + if variant_label: + variant_data["variant_label"] = variant_label + variants[variant_name] = Application( variant_name, variant_data, self ) @@ -265,10 +278,15 @@ class ApplicationManager: self.tool_groups.clear() self.tools.clear() - settings = get_system_settings() + settings = get_system_settings( + clear_metadata=False, exclude_locals=False + ) app_defs = settings["applications"] for group_name, variant_defs in app_defs.items(): + if group_name in METADATA_KEYS: + continue + group = ApplicationGroup(group_name, variant_defs, self) self.app_groups[group_name] = group for app in group: @@ -277,7 +295,7 @@ class ApplicationManager: tools_definitions = settings["tools"]["tool_groups"] for tool_group_name, tool_group_data in tools_definitions.items(): - if not tool_group_name: + if not tool_group_name or tool_group_name in METADATA_KEYS: continue group = EnvironmentToolGroup( tool_group_name, tool_group_data, self From 633f99f13ea85bdf666e99726add89a25b600b3a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:37:00 +0200 Subject: [PATCH 12/19] count with metadata keys in tools too and add variant label too --- openpype/lib/applications.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index a3c5b00a0b..d48a8ea619 100644 --- a/openpype/lib/applications.py +++ b/openpype/lib/applications.py @@ -361,9 +361,16 @@ class EnvironmentToolGroup: self._environment = data["environment"] variants = data.get("variants") or {} + label_by_key = variants.pop(M_DYNAMIC_KEY_LABEL, {}) variants_by_name = {} for variant_name, variant_env in variants.items(): - tool = EnvironmentTool(variant_name, variant_env, self) + if variant_name in METADATA_KEYS: + continue + + variant_label = label_by_key.get(variant_name) or variant_name + tool = EnvironmentTool( + variant_name, variant_label, variant_env, self + ) variants_by_name[variant_name] = tool self.variants = variants_by_name @@ -390,8 +397,9 @@ class EnvironmentTool: group (str): Name of group which wraps tool. """ - def __init__(self, name, environment, group): + def __init__(self, name, label, environment, group): self.name = name + self.label = label self.group = group self._environment = environment self.full_name = "/".join((group.name, name)) From b86c56015a3e6def5fcadebba9301ee30f327f91 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:37:10 +0200 Subject: [PATCH 13/19] removed TODO which is already done --- openpype/lib/applications.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index d48a8ea619..660f7598e2 100644 --- a/openpype/lib/applications.py +++ b/openpype/lib/applications.py @@ -290,7 +290,6 @@ class ApplicationManager: group = ApplicationGroup(group_name, variant_defs, self) self.app_groups[group_name] = group for app in group: - # TODO This should be replaced with `full_name` in future self.applications[app.full_name] = app tools_definitions = settings["tools"]["tool_groups"] From 3c4f48e3ab0ad83157b189aa9c176dac75991512 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:49:38 +0200 Subject: [PATCH 14/19] fix applications in local settings --- .../settings/local_settings/apps_widget.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/openpype/tools/settings/local_settings/apps_widget.py b/openpype/tools/settings/local_settings/apps_widget.py index bc27a3c1c4..2e12c010d1 100644 --- a/openpype/tools/settings/local_settings/apps_widget.py +++ b/openpype/tools/settings/local_settings/apps_widget.py @@ -10,12 +10,20 @@ from .constants import CHILD_OFFSET class AppVariantWidget(QtWidgets.QWidget): exec_placeholder = "< Specific path for this machine >" - def __init__(self, group_label, variant_entity, parent): + def __init__(self, group_label, variant_name, variant_entity, parent): super(AppVariantWidget, self).__init__(parent) self.executable_input_widget = None + variant_label = variant_entity.label + if variant_label is None: + parent_entity = variant_entity.parent + if hasattr(parent_entity, "get_key_label"): + variant_label = parent_entity.get_key_label(variant_name) - label = " ".join([group_label, variant_entity.label]) + if not variant_label: + variant_label = variant_name + + label = " ".join([group_label, variant_label]) expading_widget = ExpandingWidget(label, self) content_widget = QtWidgets.QWidget(expading_widget) @@ -102,7 +110,7 @@ class AppGroupWidget(QtWidgets.QWidget): valid_variants = {} for key, entity in group_entity["variants"].items(): - if entity["enabled"].value: + if "enabled" not in entity or entity["enabled"].value: valid_variants[key] = entity group_label = group_entity.label @@ -114,7 +122,7 @@ class AppGroupWidget(QtWidgets.QWidget): widgets_by_variant_name = {} for variant_name, variant_entity in valid_variants.items(): variant_widget = AppVariantWidget( - group_label, variant_entity, content_widget + group_label, variant_name, variant_entity, content_widget ) widgets_by_variant_name[variant_name] = variant_widget content_layout.addWidget(variant_widget) @@ -173,7 +181,10 @@ class LocalApplicationsWidgets(QtWidgets.QWidget): # Check if has enabled any variant enabled_variant = False for variant_entity in entity["variants"].values(): - if variant_entity["enabled"].value: + if ( + "enabled" not in variant_entity + or variant_entity["enabled"].value + ): enabled_variant = True break From e59e959a95050abf9bbbcfcfc5e8889778a3c792 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 16:51:05 +0200 Subject: [PATCH 15/19] fix enabled attribute in Application class --- openpype/lib/applications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index 660f7598e2..dd6d0b93f4 100644 --- a/openpype/lib/applications.py +++ b/openpype/lib/applications.py @@ -178,7 +178,7 @@ class Application: enabled = False if group.enabled: enabled = data.get("enabled", True) - self.enabled = enabled + self.enabled = enabled self.label = data.get("variant_label") or name self.full_name = "/".join((group.name, name)) From da32cbe8b0376d186f6fc817c9d2685521e05d06 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 17:17:04 +0200 Subject: [PATCH 16/19] fix tool labels --- openpype/lib/applications.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index dd6d0b93f4..a6c110aa87 100644 --- a/openpype/lib/applications.py +++ b/openpype/lib/applications.py @@ -293,11 +293,16 @@ class ApplicationManager: self.applications[app.full_name] = app tools_definitions = settings["tools"]["tool_groups"] + tool_label_mapping = tools_definitions.pop(M_DYNAMIC_KEY_LABEL, {}) for tool_group_name, tool_group_data in tools_definitions.items(): if not tool_group_name or tool_group_name in METADATA_KEYS: continue + + tool_group_label = ( + tool_label_mapping.get(tool_group_name) or tool_group_name + ) group = EnvironmentToolGroup( - tool_group_name, tool_group_data, self + tool_group_name, tool_group_label, tool_group_data, self ) self.tool_groups[tool_group_name] = group for tool in group: @@ -353,8 +358,9 @@ class EnvironmentToolGroup: manager (ApplicationManager): Manager that creates the group. """ - def __init__(self, name, data, manager): + def __init__(self, name, label, data, manager): self.name = name + self.label = label self._data = data self.manager = manager self._environment = data["environment"] @@ -398,7 +404,8 @@ class EnvironmentTool: def __init__(self, name, label, environment, group): self.name = name - self.label = label + self.variant_label = label + self.label = " ".join((group.label, label)) self.group = group self._environment = environment self.full_name = "/".join((group.name, name)) From 19a9a54754e12aa3ce37fa0d73aee691b6db39ab Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 7 Apr 2021 17:17:19 +0200 Subject: [PATCH 17/19] ftrack custom attributes have right tool label --- .../ftrack/event_handlers_user/action_create_cust_attrs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/modules/ftrack/event_handlers_user/action_create_cust_attrs.py b/openpype/modules/ftrack/event_handlers_user/action_create_cust_attrs.py index 0ebd221e9f..63025d35b3 100644 --- a/openpype/modules/ftrack/event_handlers_user/action_create_cust_attrs.py +++ b/openpype/modules/ftrack/event_handlers_user/action_create_cust_attrs.py @@ -400,9 +400,9 @@ class CustomAttributes(BaseAction): def tools_attribute(self, event): tools_data = [] - for tool_name in self.app_manager.tools.keys(): + for tool_name, tool in self.app_manager.tools.items(): tools_data.append({ - tool_name: tool_name + tool_name: tool.label }) # Make sure there is at least one item From 0d71f7c216e2336967408c932c9b6e17a8791cfb Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Thu, 8 Apr 2021 09:50:20 +0200 Subject: [PATCH 18/19] remove mayabatch from applications --- .../host_settings/schema_mayabatch.json | 41 ------------------- .../system_schema/schema_applications.json | 4 -- 2 files changed, 45 deletions(-) delete mode 100644 openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json deleted file mode 100644 index 93e3adbd8e..0000000000 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "type": "dict", - "key": "mayabatch", - "label": "Autodesk Maya Batch", - "collapsible": true, - "checkbox_key": "enabled", - "children": [ - { - "type": "boolean", - "key": "enabled", - "label": "Enabled" - }, - { - "type": "schema_template", - "name": "template_host_unchangables" - }, - { - "key": "environment", - "label": "Environment", - "type": "raw-json" - }, - { - "type": "dict-modifiable", - "key": "variants", - "collapsible_key": true, - "dynamic_label": false, - "use_label_wrap": false, - "object_type": { - "type": "dict", - "collapsible": true, - "checkbox_key": "enabled", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant_items" - } - ] - } - } - ] -} diff --git a/openpype/settings/entities/schemas/system_schema/schema_applications.json b/openpype/settings/entities/schemas/system_schema/schema_applications.json index 61d47df8b6..efdd021ede 100644 --- a/openpype/settings/entities/schemas/system_schema/schema_applications.json +++ b/openpype/settings/entities/schemas/system_schema/schema_applications.json @@ -9,10 +9,6 @@ "type": "schema", "name": "schema_maya" }, - { - "type": "schema", - "name": "schema_mayabatch" - }, { "type": "schema_template", "name": "template_nuke", From 42fd33ef819981d831bda430ae1175539341593e Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Thu, 8 Apr 2021 09:53:16 +0200 Subject: [PATCH 19/19] add unreal and terminal to modifiable applications --- .../system_settings/applications.json | 86 +------------------ .../host_settings/schema_shell.json | 36 ++++---- .../host_settings/schema_unreal.json | 28 +++--- 3 files changed, 34 insertions(+), 116 deletions(-) diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index 38320b8981..8034bc6368 100644 --- a/openpype/settings/defaults/system_settings/applications.json +++ b/openpype/settings/defaults/system_settings/applications.json @@ -78,80 +78,6 @@ } } }, - "mayabatch": { - "enabled": true, - "label": "MayaBatch", - "icon": "{}/app_icons/maya.png", - "host_name": "maya", - "environment": { - "PYTHONPATH": [ - "{OPENPYPE_ROOT}/avalon-core/setup/maya", - "{OPENPYPE_ROOT}/maya-look-assigner", - "{PYTHON_ENV}/python2/Lib/site-packages", - "{PYTHONPATH}" - ], - "MAYA_DISABLE_CLIC_IPM": "Yes", - "MAYA_DISABLE_CIP": "Yes", - "MAYA_DISABLE_CER": "Yes", - "PYMEL_SKIP_MEL_INIT": "Yes", - "LC_ALL": "C", - "OPENPYPE_LOG_NO_COLORS": "Yes", - "MAYA_TEST": "{MAYA_VERSION}" - }, - "variants": { - "2020": { - "executables": { - "windows": [ - "C:\\Program Files\\Autodesk\\Maya2020\\bin\\mayabatch.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": { - "MAYA_VERSION": "2020" - } - }, - "2019": { - "executables": { - "windows": [ - "C:\\Program Files\\Autodesk\\Maya2019\\bin\\mayabatch.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": { - "MAYA_VERSION": "2019" - } - }, - "2018": { - "executables": { - "windows": [ - "C:\\Program Files\\Autodesk\\Maya2018\\bin\\mayabatch.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": { - "MAYA_VERSION": "2018" - } - } - } - }, "nuke": { "enabled": true, "label": "Nuke", @@ -1063,8 +989,6 @@ }, "variants": { "4-24": { - "enabled": true, - "variant_label": "4.24", "executables": { "windows": [], "darwin": [], @@ -1084,8 +1008,6 @@ "environment": {}, "variants": { "python_3-7": { - "enabled": true, - "variant_label": "3.7", "executables": { "windows": [], "darwin": [], @@ -1099,8 +1021,6 @@ "environment": {} }, "python_2-7": { - "enabled": true, - "variant_label": "2.7", "executables": { "windows": [], "darwin": [], @@ -1114,8 +1034,6 @@ "environment": {} }, "terminal": { - "enabled": true, - "variant_label": "", "executables": { "windows": [], "darwin": [], @@ -1127,6 +1045,10 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "python_3-7": "Python 3.7", + "python_2-7": "Python 2.7" } } }, diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_shell.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_shell.json index 1e356154fd..e344f98594 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_shell.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_shell.json @@ -16,28 +16,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant": "python_3-7", - "app_variant_label": "Python 3.7" - }, - { - "app_variant": "python_2-7", - "app_variant_label": "Python 2.7" - }, - { - "app_variant": "terminal", - "app_variant_label": "Terminal" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] } diff --git a/openpype/settings/entities/schemas/system_schema/host_settings/schema_unreal.json b/openpype/settings/entities/schemas/system_schema/host_settings/schema_unreal.json index 3cf3005e70..c5096197d6 100644 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_unreal.json +++ b/openpype/settings/entities/schemas/system_schema/host_settings/schema_unreal.json @@ -20,20 +20,22 @@ "type": "raw-json" }, { - "type": "dict", + "type": "dict-modifiable", "key": "variants", - "children": [ - { - "type": "schema_template", - "name": "template_host_variant", - "template_data": [ - { - "app_variant": "4-24", - "app_variant_label": "4.24" - } - ] - } - ] + "collapsible_key": true, + "dynamic_label": false, + "use_label_wrap": false, + "object_type": { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "schema_template", + "name": "template_host_variant_items" + } + ] + } } ] }