mmSolver.tools.mmshelf#

Create a shelf.

Shelves are created automatically based on the configuration options.

Note

It is possible to create a ‘minimal’ set of shelf buttons, using a Python function so that users and studios may embed mmSolver into already existing shelves.

Tool#

Build the mmSolver Maya shelf.

mmSolver.tools.mmshelf.tool.build_shelf()#

Build the ‘mmSolver’ shelf.

mmSolver.tools.mmshelf.tool.build_minimal_shelf_items(shelf)#

Build a smaller number of shelf items.

This function is designed to be used for integration with an already created shelf-building system. Simply call this function with the parent shelf and the items will be created.

Library#

Supporting functions for building the mmSolver menu.

mmSolver.tools.mmshelf.lib.activate_shelf_tab(shelf_tab_name)#

Set the Maya shelf to the shelf with ‘shelf_tab_name’ as the name.

Parameters:

shelf_tab_name – The shelf name to activate.

Return type:

None

mmSolver.tools.mmshelf.lib.split_key(key)#

Split a key into separate name hierarchy, with a ‘/’ character.

Parameters:

key (str) – Split this string into a list.

Returns:

List of keys.

Return type:

[str, ..]

mmSolver.tools.mmshelf.lib.get_function_definition(key, data_list)#

Look up a function definition in the list of data given.

Parameters:
  • key (str) – String to look up the function definition.

  • data_list ([{..}, ..]) – List of dictionary to look up.

Returns:

Get the value at the key.

Return type:

str or None

mmSolver.tools.mmshelf.lib.compile_function_definition(item, funcs)#

Find and create a function definition.

Parameters:
  • item (str or dict) – Item to compile.

  • funcs (dict) – Function data structures.

Returns:

The function definition data structure.

Return type:

dict or None

mmSolver.tools.mmshelf.lib.lookup_value(data, name, suffix)#

Look up a key on the data, preferring the key ending with suffix rather than name.

Parameters:
  • data ({str: .., ..}) – Search into this data structure for a value.

  • name (str) – Key to look-up.

  • suffix (str) – Test the key and suffix.

Returns:

The found value, or None if nothing was found.

mmSolver.tools.mmshelf.lib.compile_items(items, function_defs)#

Convert a list of items and function definitions in configs, to a list of command items.

Parameters:
  • items ([str, ..]) – The item name paths to look up and create.

  • function_defs ([{str: any}, ..]) – Function definitions, describing how the item will be created and what it will do.

Returns:

Return type:

mmSolver.tools.mmshelf.lib.create_items(items_to_create, main_parent)#

Create shelf items.

Parameters:
  • items_to_create ([{}, ..]) – List of items to be created.

  • main_parent (str) – The parent index name.

Returns:

The created items in a dictionary data structure.

Return type:

{str: {}, ..}

mmSolver.tools.mmshelf.lib.create_item(parents, func_def, is_first_item, is_last_item)#

Create a shelf or menu item with a function definition.

Parameters:
  • parents ([str, ..]) – The list of parent items this item will be created under.

  • func_def ({str: .., ..}) – Function definition.

  • is_first_item (bool) – Will this item be the start of the hierarchy?

  • is_last_item (bool) – Will this item be the end of the hierarchy?

Returns:

List of items created.

Return type:

[{}, ..]

mmSolver.tools.mmshelf.lib.build(shelf, func_config_name, shelf_config_name)#

Build shelf items with configuration file names.

Parameters:
  • shelf (str) – Maya shelf UI path.

  • func_config_name (str) – Function configuration file name.

  • shelf_config_name (str) – Shelf configuration file name.

Returns:

The Maya shelf UI path.

Return type:

str

Constant#

mmSolver shelf constant values.