Spaces

Space Switching Constraint Setup
  • Store offsets from each space node in new attrs on the follower

    (follower.wm * space.wm.inverse)

  • Connect all offset matrices to ‘offsetChoice’ (choice) node

  • Connect all space node world matrices to ‘spaceChoice’ (choice) node

  • Connect ‘space’ attribute (enum) to selector of both choice nodes

  • Connect output of choices to calc new follower world matrix (multMatrix)

    (offsetChoice.output * spaceChoice.output)

  • Connect output matrix to offsetParentMatrix of follower

Space Switching Constraint Setup (2019 and older)
  • Store offsets from each space node in new attrs on the follower

    (follower.wm * space.wm.inverse)

  • Connect all offset matrices to ‘offsetChoice’ (choice) node

  • Connect all space node world matrices to ‘spaceChoice’ (choice) node

  • Connect ‘space’ attribute (enum) to selector of both choice nodes

  • Connect output of choices to calc new follower world matrix (multMatrix)

    (offsetChoice.output * spaceChoice.output * follower.pim)

  • Decompose and connect to follower trs (will occupy transform attributes, so this

    requires the use of an offset transform for anim controls)

(see space switching solution by Jarred Love)

add_dynamic_space(node, space)

Add a space dynamically to a space constraint. This is intended for use during animation, and is not used to set up the native spaces of the constraint.

connect_space_constraint(node)

Create the actual constraints for each defined space in a space constraint node.

Parameters:

node (PyNode) – The space constraint node

connect_space_constraints(nodes)

Create the actual constraints for a list of prepared space constraints. This is more efficient than calling connect_space_constraint for each node since all spaces are gathered only once.

create_space(node: pymel.core.PyNode | str, name: str)

Create a new space

Parameters:
  • node – A PyNode or string node name.

  • name – A string name of the space to create

get_all_space_constraints()

Return a list of all space constrained nodes

get_all_spaces()

Return a list of all space nodes

get_all_spaces_indexed_by_name()

Return all space nodes in a dict indexed by their space name

is_space(node)

Return True if the node is a space

Parameters:

node – A PyNode or string node name

is_space_constraint(node)

Return True if the node is space constrained

Parameters:

node – A PyNode or string node name

setup_space_constraint(node, space_names, follower=None, use_offset_matrix=True)

Set up a node to be constrained for a space switch, but do not actually connect it to the desired spaces until connect_space_constraint is called. This is necessary because the transforms that represent each space may not have been defined yet, but the desire to constrain to them by space name can be expressed ahead of time.

Parameters:
  • node (PyNode) – The node that will contain space switching attrs

  • space_names (str list) – The names of all spaces to be applied

  • follower (PyNode) – If given, the node that will be constrained, otherwise node will be used. Useful when wanting to create the space constrain attributes on an animation control, but connect the actual constraint to a parent transform

  • use_offset_matrix (bool) – When true, will connect to the offsetParentMatrix of the follower node, instead of directly into the translate, rotate, and scale. This also eliminates the necessity for a decompose matrix node.