Tag: Python

QtQuick/QML in Maya

Apr 23, 2020 Maya Python PySide QML QtQuick Qt

In this post, I will discuss how to use QtQuick/QML for tools inside of Maya and whether it should be used in production. Spoiler alert: it shouldn’t. QtQuick is the module of Qt used to write QML applications. Using the QtQuick module allows designers and developers to create modern, fluid, and animated user interfaces such as this: or this useful example: or something more professional and useful such as Telegram. ...

Read more →

Quaternion Rotation Output from RBF Solvers

In my previous post, I described how driving an RBF solver with quaternion values for rotational inputs is more reliable than driving with euler inputs. In this post, I will describe a method to output rotational values from an RBF solver. As described in my last post, euler rotations suffer from gimbal lock and multiple solutions to the same rotation. If we were to solve directly to these euler angles, we would see a lot of undesirable flipping depending on the sample inputs. ...

Read more →

Quaternion Rotation Input to RBF Solvers

In my previous post, I described how to create an RBF solver using regularized linear regression. While the solver works well for most independent input values, it does not work so well if we want to drive it with euler rotations. Euler rotations are susceptible to gimbal lock and can have multiple solutions for the same rotation. These two joints look like they have the same rotation. But looking at their animation curves tells a different story: ...

Read more →

Regularized Linear Regression with Radial Basis Functions

RBF solvers are systems used to interpolate from values in one space to another set of values in another space. Basically a set driven key with arbitrary inputs and arbitrary outputs. This has many applications such as driving corrective shapes, retargeting meshes, or training systems in machine learning to predict values based on a set of known samples. There are several demo implementations and explanations of RBF solvers scattered around the internet: ...

Read more →

Swing Twist Decomposition to Offset Parent Matrix

Decomposing a rotation into separate swing and twist components has many useful applications. Maya’s pose interpolator toolset allows shapes to be driven with isolated twist and/or swing components of rotations. This allows a corrective shape in the pectorals driven by the raising of the arm to be independent from the twist motion of the arm. Also, the twist component can be used to drive twist joints more reliably than the euler twist axis by itself, as demonstrated in the video below. ...

Read more →

Trig Functions in Maya without Third-Party Plug-ins

Jan 7, 2020 Maya Rigging Python

By default Maya does not ship with any nodes to calculate trig functions. If you want to use a plug-in, you can use the great plug-in Maya Math Nodes written by Serguei Kalentchouk. If you want or have to use default Maya, there is still hope. I recently added trig function support to dge, my library that converts string math equations to Maya node networks. Using math and trig knowledge, we can recreate these functions with the nodes that come with Maya. ...

Read more →

Python Scripting for Maya Artists 2.0

Feb 28, 2016 Maya python

I’ve updated my semi-popular pages on Python Scripting for Maya Artists. The material was originally written in 2009 and the pdf has been downloaded over 18,000 time so it was all due for an update. Updates include: Various cleanup on examples and explanations. New material on string formatting. New material on directory traversal. New material on docstring formats. New section on code conventions and PEP8. New section on writing clean code. PDF has been cleaned up and reformatted. ...

Read more →

Unit Testing in Maya (Part 2)

Feb 20, 2016 cmt Maya python unit testing

Edited: 6/18/2016: Updated RollbackImporter to support relative imports and “from package import module” syntax. In my last post, I went over writing scripts that can be used to write unit tests for Maya tools and then run those tests from the commandline outside of Maya. In this post, I’ll go over running those tests interactively in Maya. Being able to run tests interactively in Maya will greatly speed up debug times when tracking down issues because you’ll be able to see what is going on in your tests. To make the process more user-friendly, I’ll also add a UI to help execute the tests. Again, all of this code is available on my Github. ...

Read more →

Unit Testing in Maya

Feb 15, 2016 cmt Maya python unit testing

Unit testing is a valuable tool that a lot of studios fail to implement. Unit testing can save a great amount of time and energy (and therefore money) by allowing developers, tool writers, and even content creators to catch broken deliverables before passing them downstream in the pipeline. The lack of unit testing with TD’s is most likely due to one of the following: The person doesn’t know what unit testing is. The person has heard of unit testing but has no idea how to implement it. The person is in production and believes there is no time for creating unit tests. The person knows what unit tests are and just doesn’t want to do them. In this post, I am going to describe unit testing as it relates to assets and Python tools created for Maya. For those that don’t know, unit testing is pretty much a bunch of Python functions that you write that verify your tool is doing what it is supposed to be doing. For example, if you write an ik/fk switch tool, one unit test could be to load a rig, pose the arm in ik, switch to fk, and then check to see if the arm is in the same place. Another example is if you write a blendShape exporter, you can write tests to make sure the shapes are properly recreated when you import them into a new scene. Unit testing gives developers the confidence to update their code and assets with the certainty that their updates are not breaking any existing functionality. ...

Read more →