API Documentation

Setting Up For Development

Make sure to grab the requirements.txt file before trying to build the docs

pip -r docs/requirements.txt

There are some modules used by Pickrunner that are not mentioned in the requirements.txt file. Namely shiboken, pymel, and maya.cmds. All of these are provided by Maya so we just ignore them for building documentation.

Building The Documentation

Here are the steps to rebuild this documentation:

  1. Make sure that the scripts folder is visible in the PYTHONPATH.
  2. Run make html while cd’ed into the docs folder, or make.bat if you’re on Windows
  3. Alternatively, run sphinx-build -b html docs/source docs/build
  4. If new Python modules are added, make sure to rebuild their pages, using docs/regenerate.sh or docs/regenerate.bat if you’re on Windows.

Python Documentation

Most (all?) of the documentation is just for the Pickrunner GUI so mileage will vary. The main class of-interest are pickrunner.gui.BehaviorControl. For an example of how it’s implemented, check out pickrunner.mayarunner.MayaBehaviorControl.

pickrunner.gui module

The Pickrunner base interface.

This module contains an abstract controller that is used to implement different DCC environments, such as Maya, and a GUI that the controller can be used for.

class pickrunner.gui.BehaviorControl[source]

Bases: object

An abstract controller that must be implemented in subclasses.

This controller is used to interface with Pickrunner.

classmethod assign(from_object, direction, to_object, settings=None)[source]

Set an object to be remapped to another object, given some direction.

Parameters:
  • from_object – The object that will have the direction and to_object stored onto.
  • direction – Some unique key to store onto from_object. This direction should always point towards to_object. (How direction points to to_object is up to the developer to implement).
  • to_object – The object to remap to when direction and from_object are given to BehaviorControl.do_motion().
classmethod do_motion(direction, obj)[source]

Move the object to a given direction.

How exactly it should “move” must be implemented in subclasses. For example, in Maya, this method will select a node that is associated with the given node-direction pair.

Parameters:
  • direction – The direction to move to.
  • obj – The object to move from.
static get_object_name(obj)[source]

str: Find the unique-name of the given object.

static get_selection()[source]

list: The selected objects in the Maya scene.

classmethod get_settings(obj)[source]

dict: Any information stored in the given object that can be used.

pickrunner.mayarunner module

A Maya implementation for Pickrunner.

The user, usually an animator or rigger, can use this GUI to assign object-to-object relationships. Once those relationships are defined, they can use the arrow-keys on their keyboard to move between those objects.

Functionally, this is exactly the same as Maya’s built-in pickWalk command. The difference here however is that pickWalk is notoriously useless because it relies on Maya’s DAG hierarchy, which doesn’t always make navigation easy.

Pickrunner doesn’t care about hierarchy. It can even be used for DG nodes. Take that, pickWalk!

class pickrunner.mayarunner.MayaBehaviorControl[source]

Bases: pickrunner.gui.BehaviorControl

A controller that implements Maya-specific functions to Pickrunner.

classmethod assign(from_object, direction, to_object, settings=None)[source]

Set an object to be remapped to another object, given some direction.

Once an object is remapped to another object, we can use that to move Maya’s selection around whenever the user asks to.

Parameters:
  • from_object – The object that will have the direction and to_object stored onto.
  • direction – Some unique key to store onto from_object. This direction should always point towards to_object. (How direction points to to_object is up to the developer to implement).
  • to_object – The object to remap to when direction and from_object are given to BehaviorControl.do_motion().
classmethod do_motion(direction, obj)[source]

Change selection to an associated node of obj, given some direction.

Parameters:
  • direction (str) – The direction to move to.
  • obj (<pm.general.PyNode>) – The object to get the associated object from.
static get_object_name(obj)[source]

str: Find the unique-name of the given object.

static get_selection()[source]

list[<pm.general.PyNode>]: The selected objects in the Maya scene.

classmethod get_settings(node)[source]

dict[str]: Get the settings for the given node, if any.

reserved_attribute_name = '__mayarunner_info'
pickrunner.mayarunner.do_pickrun_motion(direction)[source]

Try to pickrun in a given direction. Otherwise, pickWalk.

Parameters:direction (str) – The direction to walk. Options are: (“up”, “down”, “left”, “right”).
pickrunner.mayarunner.get_uuid(node)[source]

str: Get the UUID of the given node, if the node exists.

pickrunner.mui module

Maya-UI functions.

pickrunner.mui.delete_ui_if_exists(*uis)[source]

Delete UIs using a function wrapper to delete Maya UIs, if they exist.

Parameters:*uis (list[str]) – The UI names to delete.
Returns:The wrapped function.
Return type:callable
pickrunner.mui.delete_ui_if_exists_qt(uis)[source]

Delete UIs using a function wrapper to delete Maya UIs, if they exist.

Parameters:*uis (list[str]) – The UI names to delete.
Returns:The wrapped function.
Return type:callable
pickrunner.mui.get_main_menu_bar()[source]

<QtWidgets.QMenuBar> or NoneType: The top bar.

pickrunner.mui.get_main_shelf_name()[source]

Get Maya’s main shelf widget.

This is just a convenience method for querying $gShelfTopLevel.

Example

>>> pm.shelfLayout('some_shelf', parent=get_main_shelf_name()).
Returns:The name/path to the main Maya shelf.
Return type:str
pickrunner.mui.get_main_window()[source]

<QtWidgets.QWidget> or NoneType: Cast Maya’s window to widget.

pickrunner.visibility_widget module

A set of small widgets that are meant to show/hide themselves.

Module contents