maya.core.plug

Plug module for Maya core functionalities.

Classes

Plug

Represents an attribute plug on a Maya node.

Module Contents

class Plug(node, attr: str)

Represents an attribute plug on a Maya node.

connect(other: Plug, force: bool = True) None

Connect this plug to another plug.

Args:

other (Plug): The plug to connect to. force (bool): Whether to force the connection, breaking existing

connections if necessary.

create(**kwargs)

Add a new attribute to the node.

Args:

**kwargs: Additional keyword arguments to pass to cmds.addAttr.

delete()

Delete an attribute from the node.

disconnect(other=None)

Disconnect this plug from another plug, or from its source if no plug is given.

Args:
other (Plug, optional): The plug to disconnect from. If None,

disconnects from the source connection.

exists()

Check if the attribute exists.

Returns:

bool: True if the attribute exists on the node, False otherwise.

get(**kwargs)

Get the value of the attribute.

Args:

**kwargs: Additional keyword arguments to pass to cmds.getAttr.

get_input(plug=False)

List incoming connections to this plug.

Returns:
list of Plug: A list of Plug instances representing the incoming

connections.

list_inputs(plugs=False)

List incoming connections to this plug.

Returns:
list of Plug: A list of Plug instances representing the incoming

connections.

list_outputs(plugs=False)

List outgoing connections from this plug.

Returns:
list of Plug: A list of Plug instances representing the outgoing

connections.

lock()

Lock the attribute.

rename(new_attr_name)

Rename the attribute.

Args:

new_attr_name (str): The new name for the attribute.

set(value, **kwargs)

Set the value of the attribute.

Args:
value: The value to set. Can be a single value or a list/tuple for

multi-value attributes.

**kwargs: Additional keyword arguments to pass to cmds.setAttr.

unlock()

Unlock the attribute.

property attr

The attribute name.

Returns:

str: The name of the attribute.

property children

If the plug is a compound attribute, return its child plugs.

Returns:

list: List of child Plug instances, or empty list if not compound.

property keyable: bool

Check if the attribute is keyable.

Returns:

bool: True if keyable, False otherwise.

property locked: bool

Check if the attribute is locked.

Returns:

bool: True if locked, False otherwise.

property mplug

The MPlug representation of this attribute.

Returns:

OpenMaya.MPlug: The Maya API plug object.

Raises:

RuntimeError: If the attribute cannot be found or is invalid.

property node

The node this plug belongs to.

Returns:

Node: The node wrapper owning this attribute.

property path

The full attribute path (node.attribute).

Returns:

str: The full path to this attribute.

property type

The attribute type as a string.

Returns:

str: The API type string of the attribute.

property value

Get the value of the attribute.

Returns:

The current value of the attribute.

property visible: bool

Check if the attribute is visible in the channelbox.

An attribute is visible if it’s either keyable or shown in the channel box.

Returns:

bool: True if visible, False otherwise.