diff --git a/openpype/hosts/maya/plugins/publish/validate_loaded_plugin.py b/openpype/hosts/maya/plugins/publish/validate_loaded_plugin.py index 01705e8b13..444aeb24c1 100644 --- a/openpype/hosts/maya/plugins/publish/validate_loaded_plugin.py +++ b/openpype/hosts/maya/plugins/publish/validate_loaded_plugin.py @@ -1,6 +1,7 @@ import pyblish.api import maya.cmds as cmds import openpype.api +import os class ValidateLoadedPlugin(pyblish.api.ContextPlugin): @@ -15,9 +16,16 @@ class ValidateLoadedPlugin(pyblish.api.ContextPlugin): def get_invalid(cls, context): invalid = [] + loaded_plugin = cmds.pluginInfo(query=True, listPlugins=True) + # get variable from OpenPype settings + whitelist_native_plugins = cls.whitelist_native_plugins + authorized_plugins = cls.authorized_plugins or [] - for plugin in context.data.get("loadedPlugins"): - if plugin not in cls.authorized_plugins: + for plugin in loaded_plugin: + if not whitelist_native_plugins and os.getenv('MAYA_LOCATION') \ + in cmds.pluginInfo(plugin, query=True, path=True): + continue + if plugin not in authorized_plugins: invalid.append(plugin) return invalid @@ -35,4 +43,5 @@ class ValidateLoadedPlugin(pyblish.api.ContextPlugin): """Unload forbidden plugins""" for plugin in cls.get_invalid(context): + cmds.pluginInfo(plugin, edit=True, autoload=False) cmds.unloadPlugin(plugin, force=True) diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index b19d544fed..56496e05d0 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -171,52 +171,8 @@ }, "ValidateLoadedPlugin": { "enabled": false, - "authorized_plugins": [ - "stereoCamera", - "svgFileTranslator", - "invertShape", - "mayaHIK", - "GamePipeline", - "curveWarp", - "tiffFloatReader", - "MASH", - "poseInterpolator", - "ATFPlugin", - "hairPhysicalShader", - "cacheEvaluator", - "ikSpringSolver", - "ik2Bsolver", - "xgenToolkit", - "AbcExport", - "retargeterNodes", - "gameFbxExporter", - "VectorRender", - "OpenEXRLoader", - "lookdevKit", - "Unfold3D", - "Type", - "mayaCharacterization", - "meshReorder", - "modelingToolkit", - "MayaMuscle", - "rotateHelper", - "dx11Shader", - "matrixNodes", - "AbcImport", - "autoLoader", - "deformerEvaluator", - "sceneAssembly", - "gpuCache", - "OneClick", - "shaderFXPlugin", - "objExport", - "renderSetup", - "GPUBuiltInDeformer", - "ArubaTessellator", - "quatNodes", - "fbxmaya", - "Turtle" - ] + "whitelist_native_plugins": false, + "authorized_plugins": [] }, "ValidateRenderSettings": { "arnold_render_attributes": [], diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json index e2df6654f2..8379f04556 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json @@ -94,6 +94,11 @@ "key": "enabled", "label": "Enabled" }, + { + "type": "boolean", + "key": "whitelist_native_plugins", + "label": "Whitelist Maya Native Plugins" + }, { "type": "list", "key": "authorized_plugins",