ChatGPT - Maya naming checker v001


Thu Dec 08 2022 17:46:03 GMT+0000 (UTC)

Saved by @HiveHD #python

import maya.cmds as cmds
import re

# List all meshes in the scene
meshes ="mesh")

# Define the naming convention regex pattern
# Use capture groups and wildcard patterns to match the material name and mesh name
# Append "Shape" to the end of the regex pattern to only match mesh objects with "Shape" in their name
naming_convention = "(.+)_(.+)_####_GEOShape"

# Check if the "NamingConventionFail" selection set already exists
if cmds.objExists("NamingConventionFail"):
    # Delete the "NamingConventionFail" selection set

# Create the "NamingConventionFail" selection set

# Loop through the meshes
for mesh in meshes:
    # Use to check if the mesh name matches the naming convention
    match =, mesh)
    if not match:
        # Add the mesh to the "NamingConventionFail" selection set
        cmds.sets(mesh, add="NamingConventionFail")

# Get the list of meshes in the "NamingConventionFail" selection set
mesh_list = cmds.sets("NamingConventionFail", query=True)

# Create a GUI window
window = cmds.window(title="Naming Convention Check")

# Create a column layout in the GUI window
layout = cmds.columnLayout()

# Create a label that displays the text "List of meshes that don't follow the correct naming convention"
cmds.text(label="List of meshes that don't follow the correct naming convention")

# Create a text scroll list in the column layout

# Show the GUI window