mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Optimize validation speed for dense polymeshes (especially those that have locked normal)
This commit is contained in:
parent
b2d6011d21
commit
1d94607037
1 changed files with 11 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from maya import cmds
|
||||
import maya.api.OpenMaya as om2
|
||||
|
||||
import pyblish.api
|
||||
import openpype.api
|
||||
|
|
@ -25,10 +26,16 @@ class ValidateMeshNormalsUnlocked(pyblish.api.Validator):
|
|||
|
||||
@staticmethod
|
||||
def has_locked_normals(mesh):
|
||||
"""Return whether a mesh node has locked normals"""
|
||||
return any(cmds.polyNormalPerVertex("{}.vtxFace[*][*]".format(mesh),
|
||||
query=True,
|
||||
freezeNormal=True))
|
||||
"""Return whether mesh has at least one locked normal"""
|
||||
|
||||
sel = om2.MGlobal.getSelectionListByName(mesh)
|
||||
node = sel.getDependNode(0)
|
||||
fn_mesh = om2.MFnMesh(node)
|
||||
_, normal_ids = fn_mesh.getNormalIds()
|
||||
for normal_id in normal_ids:
|
||||
if fn_mesh.isNormalLocked(normal_id):
|
||||
return True
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue