ChatGPT + Maya

Dec. 18, 2022

Recently, I have been playing around with chatGPT, ( a text based artificial intelligence (( AI is too fancy - I call him Bob, the botman from botland. )), Mostly asking it silly question like how are babies made.

But recently, i have been using it more, on a professional level. Kinda.

Usually i am fairly efficient at googling solutions to any kind of complex problem that im dealing with, this usually means i break down the problem into a smaller problem, and research how to solve that smaller problem by diving down into many rabbit holes and documentations - before i can finally solve the bigger original problem i had, But here comes chatGPT!

A useful tool that i now find myself occasionally utilizing when google has failed me, or has taken me too long to get to the answers i seek, chatGPT has allowed me to directly ask questions, and be able to re-ask the same question, but from maybe a different perspective - like explain it to me like i am a 5 year old vibes, So its faster for me to solve the problem and understand how the solution works.

This has, in a subtle way, sped up my learning ability, and ability to build tools and systems that are outside of my knowledge domain. chatGPT is not perfect, but it can definitely point you in a new direction to help you solve a problem that you are having.

Anyway, this post is more about the code that Bob the botman, can output, If you talk to Bob, in a logical way and ask him nicely, he can write you some python, or any language code snippets, this is great for people that want a small script to run in Maya for example. And you might maybe sort-of kinda potentially possibly and most probably need to fix the code that Bob gave you,👀 so, it is not perfect and you will most likely still need a TD to help you write tools. YAY.

But i recently was curious as to how i could implement chatGPT into Maya, as a simple tool, That directly executes the code given by chatGPT, and that is exactly what i did,

Here is a simple tool that i built:

The user inputs simple instructions, written in a logical way, that data gets sent to the chatGPT API and returns chatGPTs response in code that my Maya tool immediatly executes, To make this work i have the phrase: "write Maya python code with no instructions that: " , This phrase gets added to the users instruction before the API call, this basically asks chatGPT to only return python code with no explaination and instructions, which allows my tool to execute the code immediatly.

Which in a hacky way, results in a Maya tool that has "AI" ... , but anyway, the Bob in Maya works great for simple automation tasks (If you communicate in a logical way.) and will fail for more complex tasks, like asking it to build a UI, Bob usually gets the arguments in the functions wrong, but this will probably improve over time.

For now here is a simple Maya tool that i had a lot of fun building, you are welcome to copy the code into your Maya script and play around with it.

Source code here:

To test out and play with it:

And then you are ready to PLAY!


Return to blog