July Tool: Control Library

Rigging tool this month! This is a way to build and keep track of a control curve library. Simply create a nurbsCurve (or open that file you use to save all your control curves), select a curve and export it. An icon gets rendered and the curve is cleanly written out to your library, so you never have to go searching through your old rigs or or re-create it for the 5th time.

controlLibrary

Thanks again to all my Patrons for making this possible, and enjoy!

Download below (Please note you’ll need the latest ml_utilities update, and this also requires the ml_parentShape script in order to work.)

ControlLibrary
ControlLibrary
ml_controlLibrary.py
Version: 3
11.7 KiB
393 Downloads
Details
Share Button
This entry was posted in Crowdfunding, Rigging, Tools. Bookmark the permalink.

15 Responses to July Tool: Control Library

  1. Ru says:

    Hi Morgan, just tried installing and running this tool but get this error:

    # Error: line 1: TypeError: file line 1: controlFilePath() takes exactly 1 argument (0 given) #

    any suggestions? (sorry, always seems to be me!)
    Ive got ml_utilities version 20 in my scripts folder

    cheers again

  2. Ru says:

    Actually quite a few ml tools now seem broken so not sure if it was changing the ml_utilities file but I now get, for example on opening graph editor mask tool :

    import ml_graphEditorMask;ml_graphEditorMask.ui()
    # Error: AttributeError: file C:/Users/ru/Documents/maya/scripts\ml_graphEditorMask.py line 83: ‘NoneType’ object has no attribute ‘buttonWithPopup’ #

  3. I think you’re just always the first one to test it out. This is probably what I get for doing my testing at midnight.

  4. Alright, ml_utilities 21 should fix the error with other tools.

  5. When building rigs with many (many) controllers, I found that importing a .ma file for each control would take up a rather large amount of time of the building process while polluting the log output. I understand that your script does it a bit differently but it still seems to access the disk each time that a curve is needed, which might not be optimal performance-wise. If you fancy, maybe you could try saving all the curves in a single .json file, with only the data required to build the curves through the `OpenMaya.MFnNurbsCurve::create` method. A .json file makes it convenient because you can load the data by directly using an `import` statement at the beginning of your Python script and that data will be cached in memory for the rest of the session in a Python dictionary (or whatever the .json structure is). As a bonus, the export function might become more straightforward (process-wise) by not requiring to export then parse a temporary .ma file. That being said I didn’t try this approach myself but I bet it could be orders of magnitude faster. Or not! 🙂

  6. Ru says:

    Thanks Morgan, that update to ml_utilities certainly fixed the error with the other tools.
    Still getting an error when trying to run the control library though:

    # Error: TypeError: file line 2: controlFilePath() takes exactly 1 argument (0 given) #

    cheers

  7. Hey Ru, sorry for the late reply, not sure offhand what’s causing that one, just want to check you have ml_parentShape in your script directory as well? Can you show me the command you’re using to run the tool?

  8. Correction to my previous comment: I somehow was convinced that we could use an `import` statement to load a .json file in Python but it looks like I was wrong. It needs to be done through the`json.load` function.

  9. Hey chris thanks for the comments. I figured as long as a single control is a file on disk there would be some sort of overhead, but these should be pretty light since they just amount to running a short mel script. Now that you mention it though, the code for each control could be encapsulated in a global proc, and that way the file would only be sourced the first time it is run, and subsequent calls would be faster…

    To be honest I wasn’t thinking too much about speed though, I do use similar code during puppet builds but it’s not nearly the slowest part 🙂

  10. You’re right, there’s definitely no need to waste time on optimizations if there’s no speed issues in the first place. I was just saying this as a possible idea to try out in case the need should arise one day (or if you’d fancy because it could be fun to implement!).

    Keep up the good work!

    PS: maybe I noticed a speed issue only because I tend to generate rigs with hundreds of controllers to spam the animators? 😛

  11. Ru says:

    Hi Morgan,

    yeah the command I’m using is (in the python tab):

    import ml_controlLibrary
    ml_controlLibrary.controlFilePath()

    Not sure if setting the repository path myself would help – sorry I’m useless with scripting !

    cheers

  12. Ah dang it, sorry, my dumb auto header generation…. The correct command is:

    import ml_controlLibrary
    ml_controlLibrary.ui()

    I’ll fix that documentation, but the above command should work.

  13. Ru says:

    Thanks Morgan that works now.

    However I’m getting an error when creating the icon I think.. A stroke gets built and is left in the scene and this error is thrown up:

    # Error: TypeError: file C:\Program Files\Autodesk\Maya2016\bin\python27.zip\ntpath.py line 96: object of type ‘NoneType’ has no len() #

    Nothing is in the import tab but if I close and reopen I get the control curves but without any icon? (just has maya default icnons).

    This isnt urgent for you but looks like another nice tool so would be cool to get working 🙂

    Cheers Morgan

  14. Ru says:

    Just an update fyi that I found some .PNG files have been written to my project folder\images\tmp folder,

    If i move them to the \Documents\maya\scripts\ml_controlCurveRepository folder then the icons appear on a re-load of the script.

    Any new curves exported are still throwing out the error as before and sending the .PNGs to the tmp folder.

    Dont know if that helps!
    Cheers

  15. Alright, so it’s failing to copy the files. I’ll follow up with you later today on email and send you a debug script to try to get some more info. Thanks for the reports!

Leave a Reply

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