diff --git a/openpype/lib/applications.py b/openpype/lib/applications.py index 3302a88f97..a6c110aa87 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 ) @@ -165,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)) @@ -265,22 +278,31 @@ 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: - # TODO This should be replaced with `full_name` in future 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: + 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: @@ -336,16 +358,24 @@ 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"] 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 @@ -372,8 +402,10 @@ 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.variant_label = label + self.label = " ".join((group.label, label)) self.group = group self._environment = environment self.full_name = "/".join((group.name, name)) 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 diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index 42e742d07c..8034bc6368 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" @@ -84,86 +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": { - "enabled": true, - "variant_label": "2020", - "executables": { - "windows": [ - "C:\\Program Files\\Autodesk\\Maya2020\\bin\\mayabatch.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": { - "MAYA_VERSION": "2020" - } - }, - "2019": { - "enabled": true, - "variant_label": "2019", - "executables": { - "windows": [ - "C:\\Program Files\\Autodesk\\Maya2019\\bin\\mayabatch.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": { - "MAYA_VERSION": "2019" - } - }, - "2018": { - "enabled": true, - "variant_label": "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", @@ -182,8 +96,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -201,8 +113,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -220,8 +130,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -239,8 +147,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -254,6 +160,11 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3" } } }, @@ -275,8 +186,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -300,8 +209,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -325,8 +232,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -350,8 +255,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -371,6 +274,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -392,8 +301,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -417,8 +324,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -442,8 +347,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -467,8 +370,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [], "darwin": [], @@ -486,6 +387,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -507,8 +414,6 @@ }, "variants": { "12-2": { - "enabled": true, - "variant_label": "12.2", "executables": { "windows": [ "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" @@ -532,8 +437,6 @@ "environment": {} }, "12-0": { - "enabled": true, - "variant_label": "12.0", "executables": { "windows": [ "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" @@ -557,8 +460,6 @@ "environment": {} }, "11-3": { - "enabled": true, - "variant_label": "11.3", "executables": { "windows": [ "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" @@ -582,8 +483,6 @@ "environment": {} }, "11-2": { - "enabled": true, - "variant_label": "11.2", "executables": { "windows": [ "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" @@ -603,6 +502,12 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "12-2": "12.2", + "12-0": "12.0", + "11-3": "11.3", + "11-2": "11.2" } } }, @@ -752,8 +657,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 +672,6 @@ "environment": {} }, "18": { - "enabled": true, - "variant_label": "18", "executables": { "windows": [], "darwin": [], @@ -784,8 +685,6 @@ "environment": {} }, "17": { - "enabled": true, - "variant_label": "17", "executables": { "windows": [], "darwin": [], @@ -797,6 +696,11 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "18-5": "18.5", + "18": "18", + "17": "17" } } }, @@ -815,8 +719,6 @@ }, "variants": { "2-83": { - "enabled": true, - "variant_label": "2.83", "executables": { "windows": [ "C:\\Program Files\\Blender Foundation\\Blender 2.83\\blender.exe" @@ -838,8 +740,6 @@ "environment": {} }, "2-90": { - "enabled": true, - "variant_label": "2.90", "executables": { "windows": [ "C:\\Program Files\\Blender Foundation\\Blender 2.90\\blender.exe" @@ -859,6 +759,10 @@ ] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "2-83": "2.83", + "2-90": "2.90" } } }, @@ -916,8 +820,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 +835,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 +848,10 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "animation_11-64bits": "11 (64bits)", + "animation_11-32bits": "11 (32bits)" } } }, @@ -1085,8 +989,6 @@ }, "variants": { "4-24": { - "enabled": true, - "variant_label": "4.24", "executables": { "windows": [], "darwin": [], @@ -1106,8 +1008,6 @@ "environment": {}, "variants": { "python_3-7": { - "enabled": true, - "variant_label": "3.7", "executables": { "windows": [], "darwin": [], @@ -1121,8 +1021,6 @@ "environment": {} }, "python_2-7": { - "enabled": true, - "variant_label": "2.7", "executables": { "windows": [], "darwin": [], @@ -1136,8 +1034,6 @@ "environment": {} }, "terminal": { - "enabled": true, - "variant_label": "", "executables": { "windows": [], "darwin": [], @@ -1149,6 +1045,10 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "python_3-7": "Python 3.7", + "python_2-7": "Python 2.7" } } }, @@ -1160,8 +1060,6 @@ "environment": {}, "variants": { "1-1": { - "enabled": true, - "variant_label": "1.1", "executables": { "windows": [], "darwin": [], @@ -1173,6 +1071,9 @@ "linux": [] }, "environment": {} + }, + "__dynamic_keys_labels__": { + "1-1": "1.1" } } } 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 = ( 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: 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" + } + ] + } } ] } 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 deleted file mode 100644 index bdeca9089c..0000000000 --- a/openpype/settings/entities/schemas/system_schema/host_settings/schema_mayabatch.json +++ /dev/null @@ -1,47 +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", - "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" - } - ] - } - ] - } - ] -} 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_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/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" + } + ] + } } ] } 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..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 @@ -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": "schema_template", + "name": "template_host_variant_items" } ] } 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" + } +] 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" + } + ] + } } ] } 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", 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() 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 diff --git a/openpype/tools/settings/settings/widgets/dict_mutable_widget.py b/openpype/tools/settings/settings/widgets/dict_mutable_widget.py index 30e12aa5ac..9bea89c0d6 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"