Skip to content

Python API

Opening the window from your own code, and the environment variables that make picker paths portable across a studio.

Opening the picker

import Am_picker

Am_picker.load()                  # Anim mode
Am_picker.load(edit=True)         # Edit mode
Am_picker.load(dockable=True)     # Maya dockable workspace control

load() returns the main window instance.

Argument Default What it does
edit False True opens in Edit mode, False in Anim mode
dockable False Use Maya's dockable workspace control instead of a free-floating window

Each call gives you a fresh window rather than re-showing the previous one.

dockable=True is not finished

The dockable path exists but is deliberately not offered anywhere in the tool's own UI. Treat it as unsupported; use the default window.

Version

import Am_picker

Am_picker.__version__     # '1.0.0-beta.1'
Am_picker.DISPLAY_NAME    # 'Am_Picker' — the user-facing name

Making your own shelf button

If you installed with the drag-and-drop installer you already have one. To build your own — a studio shelf, a marking menu, a custom launcher — the command is:

import Am_picker
Am_picker.load()

If you installed into the AM_Tools module, the installer also writes a small entry-point module you can call instead. It gives you the same menu the shelf button raises:

import AM_Tools.am_picker as am_picker

am_picker.menu()        # the Anim / Edit pop-up menu at the cursor
am_picker.open_anim()   # straight to Anim mode
am_picker.open_edit()   # straight to Edit mode

open_anim() and open_edit() report a missing installation clearly rather than raising a bare ImportError, which makes them the better choice for a shelf button somebody else will use.

Adding your own tool to the same menu system

AM_Tools keeps a small registry so several tools can share one shelf menu:

import AM_Tools

AM_Tools.register(
    "my_tool.main",              # unique id, "<tool>.<action>"
    "My Tool",                   # menu label
    my_module.launch,            # zero-argument callable
    icon=AM_Tools.icon_path("my_tool.png"),
    tooltip="What this does.",
    tool="my_tool",
)

AM_Tools.popup(AM_Tools.entries(tool="my_tool"), title="My Tool")
Function Does
register(key, label, callback, icon, tooltip, tool) Add an entry, replacing any with the same key and keeping its place
unregister(key) Remove one
entries(tool=None) The registered entries, optionally filtered to one tool
build_menu(items, title) Build the styled QMenu without showing it
popup(items, title, pos) Show it at the cursor
module_root() The AM_Tools install root
icon_path(name) Absolute path of an icon in <root>/icons, or ""

Environment variables

AM_PICKER_PATH

A root folder for picker files. Paths under it are stored in the picker as a [AM_PICKER_PATH] token rather than an absolute path:

[AM_PICKER_PATH]/characters/kamal.ampkr

Set the variable per machine or per project and the same picker resolves correctly on every workstation — the classic case being artists whose projects are mounted at different drive letters.

import os
os.environ["AM_PICKER_PATH"] = "//studio/projects/showA/pickers"

Set it before Maya loads — in userSetup.py, or in your pipeline's launcher — so it is present when a scene opens a picker.

ANIM_PICKER_PATH

The legacy variable name, still recognised so older setups keep working. Files carrying [ANIM_PICKER_PATH] tokens are rewritten to [AM_PICKER_PATH] when they are loaded and saved. Use the new name for anything new.

Where settings are stored

Preferences live in Maya's own optionVars, prefixed AP_am_picker_. That means they follow the user's Maya preferences rather than the install, and survive reinstalling the tool.

They are not part of a picker file — a picker carries no preferences, so opening somebody else's picker never changes your setup.

Reloading during development

Am_picker.reload_package reloads the package in a live Maya session, so you can iterate on your own additions without restarting Maya:

import Am_picker.reload_package as rp
rp.reload_am_picker_package()

It restores the mode you were in and cleans up the docked channel box and tab switchers on the way through. Close anything you care about first — this is a development convenience, not a supported user-facing feature.