From 73400612435880f731230a18afa603b0ad05df3b Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 30 Dec 2021 17:31:07 +0100 Subject: [PATCH] Fix repair taking very long time for many heavy meshes (optimization) --- .../hosts/maya/plugins/publish/validate_shape_zero.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_shape_zero.py b/openpype/hosts/maya/plugins/publish/validate_shape_zero.py index acc42f073a..bb601b8f50 100644 --- a/openpype/hosts/maya/plugins/publish/validate_shape_zero.py +++ b/openpype/hosts/maya/plugins/publish/validate_shape_zero.py @@ -3,6 +3,7 @@ from maya import cmds import pyblish.api import openpype.api import openpype.hosts.maya.api.action +from openpype.hosts.maya.api import lib from avalon.maya import maintained_selection @@ -53,8 +54,13 @@ class ValidateShapeZero(pyblish.api.Validator): return with maintained_selection(): - for shape in invalid_shapes: - cmds.polyCollapseTweaks(shape) + with lib.tool("selectSuperContext"): + for shape in invalid_shapes: + cmds.polyCollapseTweaks(shape) + # cmds.polyCollapseTweaks keeps selecting the geometry + # after each command. When running on many meshes + # after one another this tends to get really heavy + cmds.select(clear=True) def process(self, instance): """Process all the nodes in the instance "objectSet"""