trigger.library.connection ========================== .. py:module:: trigger.library.connection .. autoapi-nested-parse:: connections / constrains / attachments / procedural movements Attributes ---------- .. autoapisummary:: trigger.library.connection.LOG Functions --------- .. autoapisummary:: trigger.library.connection.average_constraint trigger.library.connection.connect_mirror trigger.library.connection.connections trigger.library.connection.create_follicle trigger.library.connection.get_closest_uv trigger.library.connection.get_uv_at_point trigger.library.connection.get_vertex_uv trigger.library.connection.matrixConstraint trigger.library.connection.matrix_constrain_localised trigger.library.connection.matrix_switch trigger.library.connection.pin_to_surface trigger.library.connection.replace_connections trigger.library.connection.uv_pin Module Contents --------------- .. py:function:: average_constraint(target_mesh, vertex_list, source_object=None, offset_parent=False, force_follicle=False) Create a average weighted constraint between defined vertices. Works version 2020+ ATTENTION: Follicles won't follow face normals if the normals are locked Args: target_mesh (str): Mesh object which holds the defined vertices vertex_list (List): List of Integer vertex IDs source_object (str): If not defined a locator will be created instead offset_parent (bool): If True, the matrix output will be connected to offset parent matrix of the source object, leaving the transform values available force_follicle (bool): If True, follicles will be used instead of pin constraints. Returns:(String) source object. It will be the created locator if none provided .. py:function:: connect_mirror(node1, node2, mirror_axis='X') Make a mirrored connection between node1 and node2 along the mirrorAxis. Args: node1: Driver Node node2: Driven Node mirror_axis: Mirror axis for the driven node. Returns: None .. py:function:: connections(node, exclude_nodes=None, exclude_types=None, return_mode='all') Return the connections for the given node as a dictionary result_dict = { "incoming": [ { "plug_out": "someNode.outputX", "plug_in": "node.inputX" } ] "outgoing": [ { "plug_out": "node.outputX", "plug_in": "someOtherNode.inputZ } ] } Args: node (str): Node to get connections exclude_nodes (List): nodes in this list will be excluded exclude_types (List): nodes types in this list will be excluded return_mode (str): modifies return value: "all" : returns a dictionary with incoming and outgoing keys "incoming": returns a list of dictionaries for incoming connections "outgoing": returns a list of dictionaries for outgoing connections defaults to "all" Returns: (Dictionary) or (List) .. py:function:: create_follicle(name, surface, uv) .. py:function:: get_closest_uv(source_node, dest_node) Return the UV coordinates of dest_node closest to the source_node. Args: source_node (str): source node to collect position dest_node (str): destination node which will collect the uv coordinates from Returns: tuple: (float, float) The U and V values. .. py:function:: get_uv_at_point(position, dest_node) Get a tuple of u, v values for a point on a given mesh. Args: position (vector3): The world space position to get the uvs of. dest_node (str): The mesh with uvs. Returns: tuple: (float, float) The U and V values. .. py:function:: get_vertex_uv(mesh, vertex_id) .. py:function:: matrixConstraint(drivers, driven, maintainOffset=True, prefix='', skipRotate=None, skipTranslate=None, skipScale=None, source_parent_cutoff=None, **short_arguments) Create a Matrix Constraint. Args: drivers (List) or (str): Parent Node(s) driven (str): Child Node maintainOffset (bool): Maintain offset. If True, the existing distance between nodes will be preserved prefix (str): Prefix for the nodes names which will be created skipRotate (str or list): Skip Rotations. Listed rotation values will be skipped. "xyz" or ["x", "y", "z"] skipTranslate (str or list): Skip Translation. Listed translation values will be skipped. "xyz" or ["x", "y", "z"] skipScale (str or list): Skip Scale. Listed scale values will be skipped. "xyz" or ["x", "y", "z"] source_parent_cutoff (None or str): The transformation matrices above this node won't affect to the child. Returns: (Tuple) mult_matrix, decompose_matrix, wtAddMatrix .. py:function:: matrix_constrain_localised(inherit, no_inherit, destination, target_attrs='', force=True) .. py:function:: matrix_switch(parent_a, parent_b, child, control_attribute, position=True, rotation=True, scale=False, source_parent_cutoff=None) Create a matrix blended switch between two locations. Args: parent_a (str): first parent node parent_b (str): second parent node child (str): child to be constrained control_attribute (str): switch control attribute. e.g. masterCont.switch. If missing, will created position (bool): If True, makes the positional switch. Defaults True rotation (bool): If True, makes the rotational switch. Defaults True scale (bool): If True, makes the scale switch. Default False source_parent_cutoff (str): Any transforms on this node and above won't affect the constraint Returns: (str) name of the blend node .. py:function:: pin_to_surface(node, surface, sr='', st='', ss='xyz') .. py:function:: replace_connections(source_node, target_node, exclude_nodes=None, exclude_types=None, incoming=True, outgoing=True) .. py:function:: uv_pin(mesh_transform, coordinates) .. py:data:: LOG