diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index 0fd4f9e18a..19d8667002 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -869,7 +869,6 @@ "dynamics": false, "fluids": false, "follicles": false, - "gpuCacheDisplayFilter": false, "greasePencils": false, "grid": false, "hairSystems": true, @@ -896,7 +895,10 @@ "polymeshes": true, "strokes": false, "subdivSurfaces": false, - "textures": false + "textures": false, + "pluginObjects": { + "gpuCacheDisplayFilter": false + } }, "Camera Options": { "displayGateMask": false, diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_capture.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_capture.json index a4a986bad8..1d78f5a03f 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_capture.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_capture.json @@ -426,11 +426,6 @@ "key": "follicles", "label": "Follicles" }, - { - "type": "boolean", - "key": "gpuCacheDisplayFilter", - "label": "GPU Cache" - }, { "type": "boolean", "key": "greasePencils", @@ -565,6 +560,12 @@ "type": "boolean", "key": "textures", "label": "Texture Placements" + }, + { + "type": "dict-modifiable", + "key": "pluginObjects", + "label": "Plugin Objects", + "object_type": "boolean" } ] }, diff --git a/openpype/vendor/python/common/capture.py b/openpype/vendor/python/common/capture.py index 09a42d84d1..224699f916 100644 --- a/openpype/vendor/python/common/capture.py +++ b/openpype/vendor/python/common/capture.py @@ -732,11 +732,23 @@ def _applied_viewport_options(options, panel): """Context manager for applying `options` to `panel`""" options = dict(ViewportOptions, **(options or {})) + plugin_options = options.pop("pluginObjects", {}) + # BUGFIX Maya 2020 some keys in viewport options dict may not be unicode + # This is a local OpenPype edit to capture.py for issue #4730 + # TODO: Remove when dropping Maya 2020 compatibility + if int(cmds.about(version=True)) <= 2020: + options = { + str(key): value for key, value in options.items() + } + plugin_options = { + str(key): value for key, value in plugin_options.items() + } + + # Backwards compatibility for `pluginObjects` flattened into `options` # separate the plugin display filter options since they need to # be set differently (see #55) - plugins = cmds.pluginDisplayFilter(query=True, listFilters=True) - plugin_options = dict() + plugins = set(cmds.pluginDisplayFilter(query=True, listFilters=True)) for plugin in plugins: if plugin in options: plugin_options[plugin] = options.pop(plugin) @@ -745,7 +757,14 @@ def _applied_viewport_options(options, panel): try: cmds.modelEditor(panel, edit=True, **options) except TypeError as e: - logger.error("Cannot apply options {}".format(e)) + # Try to set as much as possible of the state by setting them one by + # one. This way we can also report the failing key values explicitly. + for key, value in options.items(): + try: + cmds.modelEditor(panel, edit=True, **{key: value}) + except TypeError: + logger.error("Failing to apply option '{}': {}".format(key, + value)) # plugin display filter options for plugin, state in plugin_options.items():