AM Tools 1.05 and Unity Maya Extensions!

Although I still need to do a formal write-up for my GDC presentation, I do finally have all of the source code ready to go (or at least I think it’s ready enough), so I wanted to make it available for download now. Here’s a brief summary of changes:

  • All of my Python stuff is officially copyrighted under the MIT License now.
  • Since I know a fair number of people out there rely on decent API examples for learning, I refactored all of my plug-ins to conform to better practice.
  • As part of the plug-in refactoring process, the AM_HipConstraintCmd and AM_ShoulderConstraintCmd plug-ins are now deprecated, and the commands are contained in the same plug-in files as the nodes.
  • Math has been dramatically simplified in both the amHipConstraint node and amShoulderConstraint node. In the case of the latter, the results you get should be identical to before, while the former will yield some minor different results when out of the lateral plane of rotation.
  • All of my comments have been reformatted so that Doxygen can generate more useful information for the online documentation.
  • All tool help menus now link to the online documentation to bypass text formatting issues with maya.cmds GUI in Qt.
  • Added files module with utilities for batch conversion of files to FBX, or for downgrading Maya ASCII files. (Note it is pretty hacky and not tested especially thoroughly, but I included it in case anyone might find it helpful.)
  • Added unity sub-package with utilities for modifying files to work in conjunction with my Unity Maya Extensions.


I have submitted my Unity Maya Extensions package to the Unity Asset Store, so it will hopefully be available soon, but I have also posted all of the code here (under MIT License) for those of you who just can’t wait. I’ve recorded a couple of short demonstration videos to give you an idea of what you can do with it (please check the video descriptions on YouTube for some additional notes). Have fun, and please contact me with any bugs you find!

27 thoughts on “AM Tools 1.05 and Unity Maya Extensions!”

  1. Does this allow us to use blend shapes for animations in our game vs baked out animations? We have a nice facial rig and would prefer blend shapes given they have more flexibility than baked data.

  2. Hi Jason! Not sure exactly what you mean by “vs baked out animations.” Basically my scripts allow you to automatically import blend shape data. Right now, to animate them in Unity, you either have to a) create the animation curves for the blend shape weight values in Unity using the Animation Editor, or b) using my system, create transforms in your Maya scene that drive the blend shape weights using expressions and animate them as normal. I’m currently working on a solution to automate the exporting of animation curves on blend shape nodes from Maya directly into Unity.

  3. The targets aren’t available in the animation editor in Unity? Am I missing something?

  4. Unfortunately, no, you’re not. The problem is that (as far as I know), you cannot get an animation path to a property that is in an array or in a serializable class. Right now, the easiest workarounds are a) write expressions in Maya that adjust weights for blendshapes based on a transform’s position (e.g. a locator) and let my importer automatically convert that to C# or b) write a new MonoBehaviour script that just has float fields (e.g. BlendshapeAnimator.mouthOpenWeight) and you’ll have to set keys on it, and just map its values to weights on the BlendShape component in its Update loop. Another option, if you’re feeling adventurous, is to change my code so that a BlendShape.Target is a MonoBehaviour and you just add a separate component for each one, linking them all up to the BlendShape component’s target array. I plan to implement a solution for automatically getting animation data out of Maya, but it will be a couple months before I have time for it.

  5. okay, thanks… i’ll take the maya expressions route.

    thanks for this, by the way… until maya natively supports blend shapes, this is the best options we have.

  6. where is exactly that piece to paste into .mel file stored? failed to find it in online documentation =(

  7. oh, thank you. I was looking at the wrong place (amTools instead of amTools.unity) ^^’

  8. I have amTools working in Maya, but still not getting the blendshapes through to Unity when I export either as .mb or .fbx

    It says that the requirements are Unity Pro with importBlendShapes.cs? if so where can I find it and all it’s dependencies? Or do I not have my geeks on at all? 🙂

  9. Hi Adam,

    I just tried your maya extension tools and they are awesome for sure, especially the blendshape tool. However, I have a question about one thing (probably because I am not a programmer). By watching your tutorial, I can play the weight value of the blendshape targets in the inspector, but it would be really convenient if we can keyframe the weight value in the animation panel. Do you have any suggestions how to approach this issue?

  10. Hi Adam,
    thanks a lot for this great stuff. I’m playing with it in Unity and it’s pretty nice. I only have a question ’cause I can’t find any documentation about it: how to control the weigth of a blendshape with a slider as in your chatacter customization video? I didn’t find the way to acces it with something like “blendShape.targets.NameOfBlendshape.weight” being blendShape my var to acces your script. Thanks in advance and again, great work!

  11. Hi there! The BlendShape component builds a HashTable when the game starts, so you can access individual targets by index or by name. For example, assuming “fat” is index 1, you can do either:

    BlendShape b = GetComponent();
    b.targets[1].weight = 0.5f;
    b[“fat”].weight = 0.5f;

  12. Hi Adam, I’m trying to use your scripts to create blendshapes with rigged meshes, but as soon as a skinned model is used, random vertecies on the mesh “explode,” and an animated weighted mesh has a whole bunch of other issues. Does the scripts not support skinned meshes, or is there some sort of deformation order issue I’m causing? I go through all of the steps in your videos and it works perfectly fine with an unskinned mesh, but once I try incorporating a rig (and using your fantastic constraint tools) I fail.

  13. Hi Adam,
    I hust heard about this extension and immediatly tried to get it but alas Unity 3.5 cannot read it/import the package. Any suggestions?

    Regards

  14. Hi,

    Can you confirm that you are using Unity Pro? If so, can you tell me more specifically what the problem is you are experiencing?

  15. Error while importing package: Couldn’t create asset Assets/Maya Extensions/ Documentation
    Failed to create asset directory at Assets/Maya Extensions/ Documentation

    can’t downlaod from Asset Store

  16. Hi there,

    Unity 3.5 no longer allows leading spaces in folder names (at least on Windows). I had hoped to have a fix out before release, but it has been delayed until probably after GDC. If you download with 3.4, you can rename the folders as needed.

  17. Hello. I want to use blendshape in unity.So,download this tool. But,I can’t this tool Even I operated as a video…
    amTools is available. But, Even I override mel command,I can see Blendshape(script) on Inspector.
    Why?
    Is there a relationship other scripts?
    For example, Where do I put some C#script?

  18. Hi Adam
    Great product (AM Tools) and the article on post proc rigging is wonderful.

    I want to drive my blendshapes with uSequencer. I can access the blend script but not the weight
    property.
    Any ideas ??
    GGB

  19. Hi Gary. I’m not familiar with uSequencer, but my guess is that it relies on Unity’s animation system. If that’s the case, then the problem is the same as attempting to create an animation clip any other way: you cannot access properties in an array by name for an animation. It’s something I have a fix for for version 2.0, but unfortunately an update has been quite delayed, since this is a free product (it has received virtually no donations, so is very low priority).

    In the meantime, you should try creating an expression in your source file to drive the blend shape weights with locators, and then importing this source model with its rig using my Export Rigs functionality to bring the expression across to C#. I would guess you could then animate these locators in Unity via uSequencer and it should work.

  20. Hello,

    So I am working on a project in Unity for my job and I imported the maya extensions into my project and now on all the models that I import after the fact start moving away from the camera forever when i add weight to my animation layers.

    Thank you for your time,

    Zach

  21. hi,
    i am facing some prob related to importing blendshape in unity.it would be great if you help to sort it out.
    In my computer amTool is working fine in maya but when i open the file in unity after checking the blendshapeexport option i dont get any blendshape (script) in inspector though i have added the custom editor script in my project folder.two of the mesh seamless and index map is shown in the unity outliner but
    no script is attached ..please let me know if i am skiiping some step..

  22. Hello,

    So here is my problem: I have three characters all with blend shapes. All of these characters were bought by my employer and then I cleaned them up/ adjusted them, rigged them with AdvancedSkeleton, and made blend shapes for them in Autodesk Maya 2011. Using AM Tools I prepped them for export to Unity, which happens without a hitch. Once I bring them into Unity and adjust the import settings and put them in the scene. I push the play button and for one, just one of them, the head appears at the feet of it’s body when I zoom in with the camera it turns invisible (if it’s selected you can still see the polygons highlighted). This does not happen for the other two and I’ve followed exactly the same process for all three characters.

    P.S. when I uncheck the blendshapes script this does not happen, so that is where the problem is apparently located, but still, the above problem only occurs for the one character.

Leave a Reply

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