Expanding Tik Manager with AI: Converting a Validation Plugin from Maya to Blender

Introduction

One of the core strengths of Tik Manager is its ability to integrate with multiple DCCs, making it a versatile tool for VFX and game production pipelines. Expanding its functionality across different software can be time-consuming, but with AI-powered assistance, tasks like converting scripts can be done efficiently.

In this post, I’ll demonstrate how I used ChatGPT to convert a Maya validation plugin to work in Blender, showcasing how easily Tik Manager can be extended.

The Challenge: Converting a Maya Validation Plugin

I had an existing validation plugin for Tik Manager that checks for ngons in Maya. It worked by iterating over all meshes in the scene and selecting any that contained faces with more than four sides. This plugin is placed in tik_manager4/dcc/maya/validate/ngons.py, where it gets automatically collected by the system.

Here’s the original Maya plugin:


"""Ensure meshes do not contain ngons"""

from maya import cmds
from tik_manager4.dcc.validate_core import ValidateCore
from tik_manager4.dcc.maya import utils

class Ngons(ValidateCore):
"""Example validation for Maya"""

nice_name = "Ngons"

def __init__(self):
super(Ngons, self).__init__()
self.autofixable = False
self.ignorable = True
self.selectable = True

self.bad_meshes = []

def collect(self):
"""Collect all meshes in the scene."""
self.collection = cmds.ls(type="mesh")

def validate(self):
"""Identify ngons in the scene."""
self.bad_meshes = []
self.collect()
for mesh in self.collection:
ngon_count = self.get_ngon_count(mesh)
if ngon_count:
self.bad_meshes.append(mesh)
if self.bad_meshes:
self.failed(msg="Ngons found in the following meshes: {}".format(self.bad_meshes))
else:
self.passed()

def select(self):
"""Select the bad meshes with ngons."""
cmds.select(self.bad_meshes)

@utils.keepselection
def get_ngon_count(self, mesh):
"""Checks the mesh for ngons and returns the count of ngons. Returns None if 0"""
cmds.select(mesh)
cmds.selectType(smp=0, sme=1, smf=0, smu=0, pv=0, pe=1, pf=0, puv=0)
cmds.polySelectConstraint(mode=3, type=0x0008, size=3)
cmds.polySelectConstraint(disable=True)
return cmds.polyEvaluate(mesh, faceComponent=True)

Converting the Plugin to Blender with ChatGPT

Instead of manually rewriting everything, I asked ChatGPT to convert this plugin to work with Blender’s bpy module. Within seconds, it provided a clean, structured version that integrates seamlessly with Tik Manager’s validation system.

Here’s the converted Blender plugin:


"""Ensure meshes do not contain ngons"""

import bpy
from tik_manager4.dcc.validate_core import ValidateCore

class Ngons(ValidateCore):
"""Example validation for Blender"""

nice_name = "Ngons"

def __init__(self):
super(Ngons, self).__init__()
self.autofixable = False
self.ignorable = True
self.selectable = True
self.bad_meshes = []

def collect(self):
"""Collect all mesh objects in the scene."""
self.collection = [obj for obj in bpy.context.scene.objects if obj.type == 'MESH']

def validate(self):
"""Identify ngons in the scene."""
self.bad_meshes = []
self.collect()
for mesh in self.collection:
ngon_count = self.get_ngon_count(mesh)
if ngon_count:
self.bad_meshes.append(mesh.name)
if self.bad_meshes:
self.failed(msg="Ngons found in the following meshes: {}".format(self.bad_meshes))
else:
self.passed()

def select(self):
"""Select the bad meshes with ngons."""
bpy.ops.object.select_all(action='DESELECT')
for mesh_name in self.bad_meshes:
obj = bpy.data.objects.get(mesh_name)
if obj:
obj.select_set(True)

def get_ngon_count(self, obj):
"""Check the mesh for ngons and return the count. Returns 0 if none found."""
if obj.type != 'MESH':
return 0

mesh = obj.data
return sum(1 for poly in mesh.polygons if len(poly.vertices) > 4)

The only thing left for me to do is to save this into a ngons.py file under the tik_manager4/dcc/blender/validate/ folder. And that’s it…

The Result

With this AI-powered approach, I converted the plugin in minutes instead of hours, ensuring Tik Manager now supports ngon validation in both Maya and Blender. This is a game-changer for developers looking to expand their tools across different platforms with minimal effort.

Conclusion

AI tools like ChatGPT are revolutionizing the way we approach pipeline development. By leveraging these capabilities, developers can automate tedious tasks, expand their tools, and focus on creative problem-solving.

If you’re a Tik Manager user and want to extend it for other DCCs, AI can help you speed up the process. Give it a try, and let me know your thoughts!

Related Posts

Welcome to Tik Manager – Let’s Build Better Pipelines Together!

  Hey there! If you’re reading this, you’re probably curious about Tik Manager...

Leave a Comment

Your email address will not be published. Required fields are marked *

Add Comment *

Name *

Email *

Website

Social Share Buttons and Icons powered by Ultimatelysocial