def add_callbacks_to_camera(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'Marker' class. """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) # Node Name Change clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNameChangedCallback( node_mobj, node_name_changed_func, clientData, ) callback_ids.append(callback_id) # Node Has Been Deleted clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNodeDestroyedCallback( node_mobj, node_deleted_func, clientData, ) callback_ids.append(callback_id) return callback_ids
def add_callbacks_to_bundle(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'Bundle' class. """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) # Attribute Changed (if a marker/bundle relationship is changed.) clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addAttributeChangedCallback( node_mobj, attribute_connection_changed_func, clientData, ) callback_ids.append(callback_id) # Node Name Change clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNameChangedCallback( node_mobj, node_name_changed_func, clientData, ) callback_ids.append(callback_id) # Node Has Been Deleted clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNodeDestroyedCallback( node_mobj, node_deleted_func, clientData, ) callback_ids.append(callback_id) return callback_ids
def add_callbacks_attribute(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'Attribute' class. Many callbacks are created for the node given. :param node_uuid: An 'unchanging' unique id for a node, we can refer back to the node without holding a reference to a smart pointer. :type node_uuid: str :param node_path: The full node path for the node. :type node_path: str :param update_func: The function pointer to be called each time the a change is made. :type update_func: Function :return: List of callback ids created. :rtype: list of maya.OpenMaya.MCallbackId """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) # Attribute Changed clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addAttributeChangedCallback( node_mobj, attribute_changed_func, clientData, ) callback_ids.append(callback_id) # Node Name Change clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNameChangedCallback( node_mobj, node_name_changed_func, clientData, ) callback_ids.append(callback_id) # Node Has Been Deleted clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNodeDestroyedCallback( node_mobj, node_deleted_func, clientData, ) callback_ids.append(callback_id) return callback_ids
def add_callbacks_to_collection(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'Collection' class. """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) clientData = (node_uuid, update_func) callback_id = OpenMaya.MObjectSetMessage.addSetMembersModifiedCallback( node_mobj, membership_change_func, clientData, ) callback_ids.append(callback_id) return callback_ids
def add_callbacks_to_marker_group(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'MarkerGroup' class. """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) # Node Has Been Deleted # TODO: This callback does not seem to be doing anything. clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNodeDestroyedCallback( node_mobj, node_deleted_func, clientData, ) callback_ids.append(callback_id) return callback_ids
def add_callbacks_to_marker(node_uuid, node_path, update_func): """ Add all callbacks for a node from a 'Marker' class. .. todo:: - Add callback when parenting changes (marker may not live under camera anymore), specific to marker objects. """ callback_ids = [] node_mobj = mmapi.get_as_object(node_path) # Attribute Changed (if a marker/bundle relationship is changed.) clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addAttributeChangedCallback( node_mobj, attribute_connection_changed_func, clientData, ) callback_ids.append(callback_id) # Node Name Change clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNameChangedCallback( node_mobj, node_name_changed_func, clientData, ) callback_ids.append(callback_id) # Node Has Been Deleted # TODO: This callback does not seem to be doing anything. clientData = (node_uuid, update_func) callback_id = OpenMaya.MNodeMessage.addNodeDestroyedCallback( node_mobj, node_deleted_func, clientData, ) callback_ids.append(callback_id) return callback_ids