mmSolver.tools.solver#
Solver tool to solve Maya attributes using 2D to 3D re-projection error.
Tool#
Maya Callbacks#
Set up callbacks for Maya events.
- class mmSolver.tools.solver.maya_callbacks.CallbackManager#
Stores Callback information used inside the Solver tool.
The Callback Manager maintains the state of callback registration data structure, but does not perform any operations such as adding or removing Maya callbacks.
Note
The relative order of Callback Ids is not guaranteed!
- get_all_ids()#
- add_node_ids(callback_type, node_uuid, callback_ids)#
- get_types()#
- get_type_nodes(callback_type)#
- get_type_node_ids(callback_type, node_uuid)#
- remove_type_node_ids(callback_type, node_uuid)#
- type_has_node(callback_type, node_uuid)#
- mmSolver.tools.solver.maya_callbacks.remove_callbacks(callback_ids)#
Remove Maya Callbacks for ‘New scene’
- Parameters:
callback_ids (list of maya.OpenMaya.MCallbackId) – List of callback ids to be removed.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.add_callbacks_new_scene(obj_UI)#
Create callback to be run just before a new Maya scene is created.
- Parameters:
obj_UI (mmSolver.tools.solver.ui.solver_window.SolverWindow) – The Solver Window that should be closed when a new scene is created.
- Returns:
Maya callback ids.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_attribute(node_uuid, node_path)#
Add all callbacks for a node from a ‘Attribute’ class.
Many callbacks are created for the node given.
- Parameters:
node_uuid (str) – An ‘unchanging’ unique id for a node, we can refer back to the node without holding a reference to a smart pointer.
node_path (str) – The full node path for the node.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_collection(node_uuid, node_path)#
Add all callbacks for a node from a ‘Collection’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_marker(node_uuid, node_path)#
Add all callbacks for a node from a ‘Marker’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_line(node_uuid, node_path)#
Add all callbacks for a node from a ‘Line’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_marker_group(node_uuid, node_path)#
Add all callbacks for a node from a ‘MarkerGroup’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_bundle(node_uuid, node_path)#
Add all callbacks for a node from a ‘Bundle’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_callbacks_to_camera(node_uuid, node_path)#
Add all callbacks for a node from a ‘Camera’ class.
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.add_selection_changed_callback(obj_UI)#
Add a selection event callback to Maya.
Note we can get all Event Message and Condition names:
>>> import maya.OpenMaya as OpenMaya >>> array = [] >>> OpenMaya.MEventMessage.getEventNames(array) >>> for x in sorted(array): print(x) >>> OpenMaya.MConditionMessage.getConditionNames(array) >>> for x in sorted(array): print(x) >>>
- Parameters:
obj_UI (SolverWindow) – Expected to be an instance of the Solver UI window class (Qt).
- Returns:
List of callback ids created.
- Return type:
list of maya.OpenMaya.MCallbackId
- mmSolver.tools.solver.maya_callbacks.attribute_changed_func(callback_msg, plugA, plugB, clientData)#
Callback triggered when an event happens to an attribute on a node.
One callback handles many attributes and event types for one node. The callback is linked to the node, not the attribute.
- Parameters:
callback_msg (OpenMaya.MNodeMessage.AttributeMessage) – The type of callback message.
plugA (OpenMaya.MPlug) – First plug related to callback.
plugB (OpenMaya.MPlug) – Second plug related to callback, may not be used if not relevant to callback type.
clientData (str) – node_uuid given to the function.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.attribute_connection_changed_func(callback_msg, plugA, plugB, clientData)#
Callback triggered when an event happens to an attribute on a node.
One callback handles many attributes and event types for one node. The callback is linked to the node, not the attribute.
- Parameters:
callback_msg (OpenMaya.MNodeMessage.AttributeMessage) – The type of callback message.
plugA (OpenMaya.MPlug) – First plug related to callback.
plugB (OpenMaya.MPlug) – Second plug related to callback, may not be used if not relevant to callback type.
clientData (str) – node_uuid given to the function.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.node_name_changed_func(node, prevName, clientData)#
Callback triggered after a node is renamed.
- Parameters:
node (OpenMaya.MObject) – The node that has been renamed.
prevName (str) – The name of the node before the change happened.
clientData (str) – node_uuid given to the function.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.node_deleted_func(clientData)#
Callback triggered after a node is deleted.
- Parameters:
clientData (str) – node_uuid given to the function.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.membership_change_func(node_obj, clientData)#
- mmSolver.tools.solver.maya_callbacks.new_scene_func(clientData)#
Create a callback called just before a new scene file is created or before a new file is loaded. The UI must be closed. All data structures stored must be removed.
- Parameters:
clientData (SolverWindow) – The Qt window object class.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.maya_callbacks.selection_changed_func(clientData)#
The Maya selection has changed, we must synchronize the Maya selection with the Solver UI.
- Parameters:
clientData (SolverWindow) – The Qt window object class.
- Returns:
Nothing.
- Return type:
None
Library#
Attribute#
Collection#
Collection and solving functions.
- mmSolver.tools.solver.lib.collection.get_collections()#
Get all Collection objects defined in the scene.
- Returns:
A list of Collection objects.
- Return type:
[Collection, ..]
- mmSolver.tools.solver.lib.collection.create_collection(name=None)#
Create a new Collection in the scene.
- Parameters:
name (str or None) – The node name for the created collection.
- Returns:
A new Collection object.
- Return type:
- mmSolver.tools.solver.lib.collection.rename_collection(col, new_name)#
Rename a Collection node name.
Note: The Collection object stores a pointer to the underlying node. We can change the name without affecting the Collection object..
- Parameters:
col (Collection) – Collection object to rename.
new_name (str) – The new name to rename the Collection to.
- mmSolver.tools.solver.lib.collection.delete_collection(col)#
Delete a Collection object (and underlying Maya node).
- Parameters:
col (Collection) – The Collection object to delete.
- mmSolver.tools.solver.lib.collection.select_collection(col)#
Select the collection node, not the members of the collection node.
- Parameters:
col (Collection) – The Collection object to select.
- mmSolver.tools.solver.lib.collection.get_previous_collection_and_index(cols, current_col)#
Get the previous collection to the current collection, in list of collections.
- Parameters:
cols ([Collection, ..]) – List of collections.
current_col (Collection) – The current collection.
- Returns:
Collection and index in ‘cols’ of the previous collection.
- Return type:
Collection, int
- mmSolver.tools.solver.lib.collection.get_previous_collection(cols, current_col)#
Get the previous collection to the current collection, in list of collections.
- Parameters:
cols ([Collection, ..]) – List of collections.
current_col (Collection) – The current collection.
- Returns:
The previous Collection in cols relative to current_col.
- Return type:
- mmSolver.tools.solver.lib.collection.log_solve_results(log, solres_list, timestamp=None, total_time=None, status_fn=None)#
Displays / saves the Solve Results.
- Parameters:
log (logger) – Logging object to log with.
solres_list (list of SolveResult) – List of Solve Results to log.
timestamp (None or float) – The current time; as a UNIX Epoch floating point number (as returned by ‘time.time()’).
total_time (None or float) – The duration of the solve to log, in seconds.
status_fn (callable function or None) – Function to set the status text.
- Returns:
Nothing.
- Return type:
None
- mmSolver.tools.solver.lib.collection.compile_collection(col, prog_fn=None)#
Compiles, checks and validates the collection, ready for a solve.
- Parameters:
col (Collection) – Collection to execute.
prog_fn (None or function) – Progress function that is called each time progress is made. The function should take a single ‘int’ argument, and the integer is expected to be a percentage value, between 0 and 100.
- mmSolver.tools.solver.lib.collection.gather_execute_options()#
Query the current Solver UI ExecuteOptions state that is saved in the scene.
- Returns:
The ExecuteOptions ready to be passed to an execution function.
- Return type:
- mmSolver.tools.solver.lib.collection.execute_collection(col, options=None, log_level=None, prog_fn=None, status_fn=None, info_fn=None)#
Execute the entire collection; Solvers, Markers, Bundles, etc.
- Parameters:
col (Collection) – Collection to execute.
options (mmSolver.api.ExecuteOptions) – Solver execution options.
log_level (None or str) – Logging level to print out.
prog_fn (None or function) – A function called with an ‘int’ argument, to display progress information to the user. The integer is expected to be between 0 and 100 (and is read as a percentage).
status_fn (None or function) – A function called with an ‘str’ argument, to display status information to the user.
info_fn (None or function) – A function called with an ‘str’ argument, to display solver information to the user.
- mmSolver.tools.solver.lib.collection.query_solver_info_text(col)#
Get a string of text, telling the user of the current solve inputs/outputs.
- Parameters:
col (Collection) – The collection to compile and query.
- Returns:
Text, ready for a QLabel.setText().
- Returns:
str
- mmSolver.tools.solver.lib.collection.run_solve_ui(col, options, log_level, window)#
Run the active “solve” (UI state information), and update the UI.
This is a UI focused function. Calling this function with the ‘window’ argument set will update the UI and show progress to the user. If the UI window is not given, the solve still runs, but does not update the UI.
- Parameters:
col (Collection) – The active collection to solve.
options (mmSolver.api.ExecuteOptions) – Options for the solver options.
log_level (str) – How much information should we print out; ‘error’, ‘warning’, ‘info’, ‘verbose’ or ‘debug’.
window (SolverWindow or None) – The SolverWindow object for the UI.
Collection State#
Querying and setting of state information on Collection nodes.
- mmSolver.tools.solver.lib.collectionstate.ensure_attr_exists(node, attr_name, attr_type=None, default_value=None)#
Ensure an attribute exists on the given node, or we create it.
- mmSolver.tools.solver.lib.collectionstate.get_value_from_node(node, attr_name, attr_type=None, default_value=None)#
Get a value from a node.
Note
First create the attribute if it does not exist.
- mmSolver.tools.solver.lib.collectionstate.set_value_on_node(node, attr_name, value, attr_type=None, default_value=None)#
Set a value on a node.
Note
First create the attribute if it does not exist.
- mmSolver.tools.solver.lib.collectionstate.get_value_structure_from_node(node, attr_name, attr_type=None, default_value=None)#
Get a value from a node.
Note
First create the attribute if it does not exist.
- mmSolver.tools.solver.lib.collectionstate.set_value_structure_on_node(node, attr_name, value, attr_type=None, default_value=None)#
Set a value on a node.
Note
First create the attribute if it does not exist.
- mmSolver.tools.solver.lib.collectionstate.get_attribute_toggle_animated_from_collection(col)#
Get the value of ‘Attributes Toggle Animated’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_attribute_toggle_animated_on_collection(col, value)#
Set the value of ‘Attributes Toggle Animated’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_attribute_toggle_static_from_collection(col)#
Get the value of ‘Attributes Toggle Static’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_attribute_toggle_static_on_collection(col, value)#
Set the value of ‘Attributes Toggle Static’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_attribute_toggle_locked_from_collection(col)#
Get the value of ‘Attributes Toggle Locked’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_attribute_toggle_locked_on_collection(col, value)#
Set the value of ‘Attributes Toggle Locked’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_object_toggle_camera_from_collection(col)#
Get the value of ‘Objects Toggle Camera’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_object_toggle_camera_on_collection(col, value)#
Set the value of ‘Objects Toggle Camera’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_object_toggle_marker_from_collection(col)#
Get the value of ‘Objects Toggle Marker’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_object_toggle_marker_on_collection(col, value)#
Set the value of ‘Objects Toggle Marker’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_object_toggle_bundle_from_collection(col)#
Get the value of ‘Objects Toggle Bundle’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
True or False.
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_object_toggle_bundle_on_collection(col, value)#
Set the value of ‘Objects Toggle Bundle’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_object_toggle_line_from_collection(col)#
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_object_toggle_line_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_tab_from_collection(col)#
Get the value of solver ‘tab’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
The tab name.
- Return type:
str
- mmSolver.tools.solver.lib.collectionstate.set_solver_tab_on_collection(col, value)#
Set the value of solver ‘tab’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (str) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_range_type_from_collection(col)#
Get the value of solver ‘Range Type’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
An integer value in const.RANGE_TYPE_VALUE_LIST.
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_range_type_on_collection(col, value)#
Set the value of solver ‘Range Type’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (int) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_frames_from_collection(col)#
Get the value of solver ‘Frames’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
The string representation of the frames.
- Return type:
str
- mmSolver.tools.solver.lib.collectionstate.set_solver_frames_on_collection(col, value)#
Set the value of solver ‘Frames’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (str) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_increment_by_frame_from_collection(col)#
Get the value of solver ‘Increment By Frame’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
The frame number value.
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_increment_by_frame_on_collection(col, value)#
Set the value of solver ‘Increment By Frame’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (int) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_user_frames_from_collection(col)#
Get the value of solver ‘User Frames’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
The string representation of the frames.
- Return type:
str
- mmSolver.tools.solver.lib.collectionstate.set_solver_user_frames_on_collection(col, value)#
Set the value of solver ‘User Frames’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (str) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_use_per_marker_frames_from_collection(col)#
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_use_per_marker_frames_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_per_marker_frames_from_collection(col)#
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_per_marker_frames_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_use_span_frames_from_collection(col)#
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_use_span_frames_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_span_frames_from_collection(col)#
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_span_frames_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_root_frames_from_collection(col)#
Get the value of solver ‘Root Frames’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
The string representation of the frames.
- Return type:
str
- mmSolver.tools.solver.lib.collectionstate.set_solver_root_frames_on_collection(col, value)#
Set the value of solver ‘Root Frames’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (str) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_only_root_frames_from_collection(col)#
Get the value of solver ‘Only Root Frames’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
A boolean, do we solve only root frames, or not?
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_only_root_frames_on_collection(col, value)#
Set the value of solver ‘Only Root Frames’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_global_solve_from_collection(col)#
Get the value of solver ‘Global Solve’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
A boolean, do we solve all frames and attributes together, or not?
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_global_solve_on_collection(col, value)#
Set the value of solver ‘Global Solve’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_eval_complex_graphs_from_collection(col)#
Get the value of solver ‘Evaluate Complex Node Graphs’, from a Collection.
- Parameters:
col (Collection) – The Collection to query.
- Returns:
A boolean, should the solver try extra hard to evaluate complex node graphs?
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_eval_complex_graphs_on_collection(col, value)#
Set the value of solver ‘Evaluate Complex Node Graphs’ on a Collection.
- Parameters:
col (Collection) – The Collection to change.
value (bool) – Value to set to.
- mmSolver.tools.solver.lib.collectionstate.get_solver_scene_graph_mode_from_collection(col)#
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_scene_graph_mode_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_origin_frame_from_collection(col)#
- Return type:
int
- mmSolver.tools.solver.lib.collectionstate.set_solver_origin_frame_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_scene_scale_from_collection(col)#
- Return type:
float
- mmSolver.tools.solver.lib.collectionstate.set_solver_scene_scale_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_solve_focal_length_from_collection(col)#
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_solve_focal_length_on_collection(col, value)#
- mmSolver.tools.solver.lib.collectionstate.get_solver_solve_lens_distortion_from_collection(col)#
- Return type:
bool
- mmSolver.tools.solver.lib.collectionstate.set_solver_solve_lens_distortion_on_collection(col, value)#
Marker#
Marker functions.
- mmSolver.tools.solver.lib.marker.add_markers_to_collection(mkr_list, col)#
- mmSolver.tools.solver.lib.marker.remove_markers_from_collection(mkr_list, col)#
- mmSolver.tools.solver.lib.marker.get_markers_from_collection(col)#
- mmSolver.tools.solver.lib.marker.add_callbacks_to_markers(mkr_list, callback_manager)#
- mmSolver.tools.solver.lib.marker.remove_callbacks_from_markers(mkr_list, callback_manager)#
Maya Utilities#
General Maya utility functions
- mmSolver.tools.solver.lib.maya_utils.ensure_plugin_loaded()#
Loads all plug-ins required for Solver tool.
- Raises:
mmapi.SolverNotAvailable
- mmSolver.tools.solver.lib.maya_utils.get_scene_selection()#
Get the currently selected nodes.
Intended for selection store/restore.
- Returns:
List of full path node names.
- Return type:
list of str
- mmSolver.tools.solver.lib.maya_utils.set_scene_selection(nodes)#
The Maya scene selection is replaced with nodes.
- Parameters:
nodes (list of str) – Nodes to set as selected.
- Returns:
Nothing.
- mmSolver.tools.solver.lib.maya_utils.add_scene_selection(nodes)#
The Maya scene selection is appended with nodes.
- Parameters:
nodes (list of str) – Nodes to set as selected.
- Returns:
Nothing.
- mmSolver.tools.solver.lib.maya_utils.remove_scene_selection(nodes)#
The Maya scene selection is removed with nodes.
- Parameters:
nodes (list of str) – Nodes to set as selected.
- Returns:
Nothing.
- mmSolver.tools.solver.lib.maya_utils.get_node_names_from_uuids(uuids)#
Get the full DAG path for the given UUIDs.
- Parameters:
uuids (list of str) – The UUIDs of Maya nodes.
- Returns:
List of full path node names.
- Return type:
list of str or empty list
- mmSolver.tools.solver.lib.maya_utils.get_current_frame()#
Get the current Maya frame number.
- Returns:
Frame number
- Return type:
int
- mmSolver.tools.solver.lib.maya_utils.set_current_frame(value, update=None)#
Get the current Maya frame number.
- Returns:
Frame number
- Return type:
int
- mmSolver.tools.solver.lib.maya_utils.prompt_for_new_node_name(title, message, text)#
Ask the user for a new node name.
- Parameters:
title (str) – Dialog box window title.
message (str) – Read-only text to show the user, for making a decision.
text (str) – The initial text to prompt the user as a starting point.
- Returns:
New node name, or None if user cancelled.
- Return type:
str or None
- mmSolver.tools.solver.lib.maya_utils.get_markers_from_selection()#
Given a selection of nodes, find the associated markers.
- Returns:
list of Marker objects.
- Return type:
[Marker, ..]
- mmSolver.tools.solver.lib.maya_utils.get_lines_from_selection()#
Given a selection of nodes, find the associated markers.
- Returns:
list of Marker objects.
- Return type:
[Marker, ..]
- mmSolver.tools.solver.lib.maya_utils.get_selected_maya_attributes()#
Get the currently selected attributes from the Channel Box.
This function uses Maya ChannelBox logic to get the objects, which is based on the selection, but may be doing more complex logic.
- Returns:
List of Attribute objects for all nodes in the Channel Box.
- Return type:
list of Attribute
Scene Data#
Solver tool scene data manipulation.
- mmSolver.tools.solver.lib.scene_data.get_scene_data(name)#
- mmSolver.tools.solver.lib.scene_data.set_scene_data(name, value)#
Solver#
Manipulate solvers.
- mmSolver.tools.solver.lib.solver.create_solver()#
- mmSolver.tools.solver.lib.solver.get_solvers_from_collection(col)#
- mmSolver.tools.solver.lib.solver.add_solver_to_collection(sol, col)#
- mmSolver.tools.solver.lib.solver.remove_solver_from_collection(sol, col)#
Solver Step#
State#
Query and set Maya scene state.
All data is stored in the Maya scene and is dependent on the Maya scene.
- mmSolver.tools.solver.lib.state.get_active_collection()#
Get the active collection object in the current scene file.
- Returns:
The active Collection object, or None if no Collection is active.
- Return type:
Collection or None
- mmSolver.tools.solver.lib.state.set_active_collection(col)#
Set the Maya scene’s active collection.
There may only be 1 active collection, or no active collection in a Maya scene.
- Parameters:
col (Collection or None) – The Collection to make active, or None to set no active collection.
- Return type:
None
- mmSolver.tools.solver.lib.state.get_state_bool(name, default_value)#
Get State boolean from the scene settings.
- Parameters:
name (str) – Name of the state boolean variable.
default_value (bool) – Fallback value, if ‘name’ cannot be found.
- Returns:
The queried value, or ‘default_value’.
- Return type:
bool
- mmSolver.tools.solver.lib.state.set_state_bool(name, value)#
Get a boolean stored in the scene settings.
- Parameters:
name (str) – Name of the state boolean variable.
value (bool) – Value to set.
- mmSolver.tools.solver.lib.state.get_state_str(name, default_value)#
Get State string from the scene settings.
- Parameters:
name (str) – Name of the state string variable.
default_value (str) – Fallback value, if ‘name’ cannot be found.
- Returns:
The queried value, or ‘default_value’.
- Return type:
str
- mmSolver.tools.solver.lib.state.set_state_str(name, value)#
Get a string stored in the scene settings.
- Parameters:
name (str) – Name of the state string variable.
value (str) – Value to set.
- mmSolver.tools.solver.lib.state.get_pre_solve_force_eval_state()#
- mmSolver.tools.solver.lib.state.set_pre_solve_force_eval_state(value)#
- mmSolver.tools.solver.lib.state.get_refresh_viewport_state()#
- mmSolver.tools.solver.lib.state.set_refresh_viewport_state(value)#
- mmSolver.tools.solver.lib.state.get_force_dg_update_state()#
- mmSolver.tools.solver.lib.state.set_force_dg_update_state(value)#
- mmSolver.tools.solver.lib.state.get_isolate_object_while_solving_state()#
- mmSolver.tools.solver.lib.state.set_isolate_object_while_solving_state(value)#
- mmSolver.tools.solver.lib.state.get_display_image_plane_while_solving_state()#
- mmSolver.tools.solver.lib.state.set_display_image_plane_while_solving_state(value)#
- mmSolver.tools.solver.lib.state.get_display_meshes_while_solving_state()#
- mmSolver.tools.solver.lib.state.set_display_meshes_while_solving_state(value)#
- mmSolver.tools.solver.lib.state.get_display_object_frame_deviation_state()#
- mmSolver.tools.solver.lib.state.set_display_object_frame_deviation_state(value)#
- mmSolver.tools.solver.lib.state.get_display_object_average_deviation_state()#
- mmSolver.tools.solver.lib.state.set_display_object_average_deviation_state(value)#
- mmSolver.tools.solver.lib.state.get_display_object_maximum_deviation_state()#
- mmSolver.tools.solver.lib.state.set_display_object_maximum_deviation_state(value)#
- mmSolver.tools.solver.lib.state.get_display_object_weight_state()#
- mmSolver.tools.solver.lib.state.set_display_object_weight_state(value)#
- mmSolver.tools.solver.lib.state.get_display_attribute_state_state()#
- mmSolver.tools.solver.lib.state.set_display_attribute_state_state(value)#
- mmSolver.tools.solver.lib.state.get_display_attribute_min_max_state()#
- mmSolver.tools.solver.lib.state.set_display_attribute_min_max_state(value)#
- mmSolver.tools.solver.lib.state.get_display_attribute_stiffness_state()#
- mmSolver.tools.solver.lib.state.set_display_attribute_stiffness_state(value)#
- mmSolver.tools.solver.lib.state.get_display_attribute_smoothness_state()#
- mmSolver.tools.solver.lib.state.set_display_attribute_smoothness_state(value)#
- mmSolver.tools.solver.lib.state.get_log_level()#
- mmSolver.tools.solver.lib.state.set_log_level(value)#
- mmSolver.tools.solver.lib.state.get_solver_is_running_state()#
- mmSolver.tools.solver.lib.state.set_solver_is_running_state(value)#
- mmSolver.tools.solver.lib.state.get_solver_user_interrupt_state()#
- mmSolver.tools.solver.lib.state.set_solver_user_interrupt_state(value)#
UI Query#
Query the Qt UI in some way.
- mmSolver.tools.solver.lib.uiquery.get_ui_node_from_index(idx, filter_model)#
- mmSolver.tools.solver.lib.uiquery.get_selected_ui_nodes(tree_view, filter_model)#
- mmSolver.tools.solver.lib.uiquery.get_selected_ui_table_row(tree_view, model, filter_model)#
- mmSolver.tools.solver.lib.uiquery.convert_ui_nodes_to_nodes(ui_nodes, key)#
Get the list of data from the UI objects.
- Parameters:
ui_nodes ([PlugNode, ..] or [ObjectNode, ..]) – Nodes from the UI classes. ui_nodes is expected to be a list of classes derived from
mmSolver.tools.solver.ui.attr_nodes.PlugNode
ormmSolver.tools.solver.ui.object_nodes.ObjectNode
.key (str) – Key to look up on the node, to get the data.
- Returns:
List of the data contents in the UI nodes given.
- Return type:
[object, ..]
User Interface#
Solver Window#
Solver Layout#
UI Widgets#
Attribute Widget#
Collection Widget#
Frame Range Widget#
Node Browser Widget#
Object Widget#
Root Frame Widget#
Solver Widget#
Solver Basic Widget#
Solver Standard Widget#
Solver Legacy Widget#
Solver State Widget#
UI Node Abstractions#
Attribute Nodes#
Attribute nodes for the mmSolver Window UI.
- class mmSolver.tools.solver.ui.attr_nodes.PlugNode(name, parent=None, data=None, icon=None, enabled=True, editable=False, selectable=True, checkable=False, neverHasChildren=False)#
- uuid()#
- status()#
- state()#
- minMaxValue()#
- stiffnessValue()#
- smoothnessValue()#
- class mmSolver.tools.solver.ui.attr_nodes.AttrNode(name, data=None, parent=None)#
- status()#
- state()#
- minMaxValue()#
- stiffnessValue()#
- smoothnessValue()#
- mayaNodeName()#
- mayaAttrName()#
- mayaPlug()#
Object Nodes#
Object nodes for the mmSolver Window UI.
- class mmSolver.tools.solver.ui.object_nodes.ObjectNode(name, parent=None, data=None, icon=None, enabled=True, editable=False, selectable=True, checkable=False, neverHasChildren=False)#
- objectColor()#
- uuid()#
- weight()#
- deviation()#
- avgDeviation()#
- maxDeviation()#
- class mmSolver.tools.solver.ui.object_nodes.MarkerNode(name, data=None, parent=None)#
- status()#
- objectColor()#
- weight()#
Get the current weight value of the marker.
- avgDeviation()#
Get the current deviation value of the marker.
- deviation()#
Get the current deviation value of the marker.
- maxDeviation()#
Get the current deviation value of the marker.
- class mmSolver.tools.solver.ui.object_nodes.CameraNode(name, data=None, parent=None)#
- objectColor()#
- weight()#
- deviation()#
Get the current deviation of the for the camera.
- avgDeviation()#
Get the average deviation value of the camera.
- maxDeviation()#
Get the average deviation value of the camera.
- class mmSolver.tools.solver.ui.object_nodes.BundleNode(name, data=None, parent=None)#
- objectColor()#
- weight()#
- deviation()#
- avgDeviation()#
- maxDeviation()#
Solver Nodes#
Convert to UI#
Convert mmSolver API objects into UI objects that can be used in Qt models.
- mmSolver.tools.solver.ui.convert_to_ui.solverObjectsToUINodes(mkr_list, line_list, show_cam, show_mkr, show_bnd, show_line)#
Convert a list of markers and lines into a hierarchy to show the user.
- Parameters:
mkr_list ([Marker, ..]) – List of Marker objects to convert into UI nodes.
line_list ([Line, ..]) – List of Marker objects to convert into UI nodes.
show_cam (bool) – Should we show cameras?
show_mkr (bool) – Should we show markers?
show_bnd (bool) – Should we show bundles?
show_line (bool) – Should we show lines?
- Returns:
A root node for a tree of UI ObjectNode objects.
- Return type:
- mmSolver.tools.solver.ui.convert_to_ui.attributesToUINodes(col, attr_list, show_anm, show_stc, show_lck)#
Convert a list of mmSolver API Attributes into classes to be used in the Solver UI.
- Parameters:
col – The Collection the Attributes belong to.
col – Collection
attr_list ([Attribute, ..]) – List of Attributes to convert.
show_anm (bool) – Should the animated attributes be visible?
show_stc (bool) – Should the static attributes be visible?
show_lck (bool) – Should the locked attributes be visible?
- Returns:
A hierarchy of UI nodes to be viewed in a ‘tree view’.
- Return type:
Constant#
Holds all constant data needed for the solver tool and UI.