mbControllerLibrary

Author: Morten Bohne

Contact: morten@mortenbohne.dk

http://www.mortenbohne.dk

Description

This tool stores and recreates nurbs curve data in a pickle file to be used as controllers for rigging in Maya

When creating a controller, choose to use drawingoverrides or color(rgbColor=(int, int, int)) to color shapes.

Supports multiple shapes.

Installation

Place scripts in your default-scripts folder directory and execute the following:

import mbControllerLibrary

Example:

mbControllerLibraryUI.saveController()

License

This is free software: you can redistribute it and/or modify it under the terms of the Creative Commons Attribution 4.0 International License, or (at your option) any later version.

To view a copy of this license, visit:

http://creativecommons.org/licenses/by/4.0/

API

mbControllerLibrary.changePaths(pklPath=None, iconPath=None)

Changes the path to pklFile and icon Library and updates the controllerLibrary

Returns:
pklPath, iconPath
mbControllerLibrary.controllerList()

Returns a sorted list of available controllers

Returns:
list
mbControllerLibrary.createController(curve=None, name=None, scale=1.0, rgbColor=None, colorIndex=None)

Creates a nurbs curve from controller library.

Example:

mbControllerLibrary.createController(curve="CTRL", name="MyController")
Kwargs:
curve (str):
Name of the curve in library
name (str):
Name of the newly created object
scale (float):
Size of the new controller
rgbColor (float, float, float):
rgb(0-1, 0-1, 0-1) color of shape

Note

Only works in versions 205ext1 and newer.

colorIndex (int) 0-31:
For versions not supporting rgbColor, colorIndex will be used. Creates drawingOverwrite and sets color to supplied index.
mbControllerLibrary.deleteController(controller)

Removes controller from library.

Args:
controller(str): Name of controller in library to delete.
mbControllerLibrary.saveController(curve=None, name=None, overwrite=False, debug=False, makeScreenGrab=False)

Saves controller to pickle library

Example:

mbControllerLibrary.saveController(name="CTRL")
Kwargs:
curve (PyNode):
Curve to export (shape or transform), if None, use selected
name (str):
Name of curve in library
overwrite (bool):
overwrite existing curve with that name in library
debug (bool):
exports json file at same location as pickle
screenGrab (bool):
creates a screenGrab and saves it as an icon
Returns:
name, pklFile
mbControllerLibrary.screenGrab(name)

Captures 3d viewport as icon image and crops it to 240x240. Saves it as a .jpg in iconsFolderPath.

Note

This calls mbImageConvert through a subprocess. Requires Python and Pillow to be installed.

Args:
name(str): Name of saved icon.
Returns:
icon path