Skip to main content

A Python library for creating Maya Attributes

Project description

attribs

An experimental Python library for creating Maya Attributes.

Installation

Install attribs with pip:

pip install maya-attribs

Quickstart

Use attribs.add_attribute to create an new attributes on an OpenMaya.MFnDependencyNode. This function also returns the newly created OpenMaya.MPlug.

from maya import cmds
from maya.api import OpenMaya
import attribs

def create_node(node_type: str) -> OpenMaya.MObject:
    name = cmds.createNode(node_type)
    return OpenMaya.MSelectionList().add(name).getDependNode(0)

node = OpenMaya.MFnDependencyNode(create_node("transform"))
modifier = OpenMaya.MDGModifier()

attribute = attribs.Bool("foo", default=False)

plug = attribs.add_attribute(node, attribute, modifier=modifier)

Set attribute flags either as keyword argument or later as properties.

from maya import cmds
from maya.api import OpenMaya
import attribs

def create_node(node_type: str) -> OpenMaya.MObject:
    name = cmds.createNode(node_type)
    return OpenMaya.MSelectionList().add(name).getDependNode(0)

node = OpenMaya.MFnDependencyNode(create_node("transform"))
modifier = OpenMaya.MDGModifier()

attribute = attribs.Double3(
    "MyDouble", 
    default=(1.0, 2.0, 3.0), 
    channel_box=True,
)
attribute.keyable = True

plug = attribs.add_attribute(node, attribute, modifier=modifier)

Compounds are also supported.

from maya import cmds
from maya.api import OpenMaya
import attribs

def create_node(node_type: str) -> OpenMaya.MObject:
    name = cmds.createNode(node_type)
    return OpenMaya.MSelectionList().add(name).getDependNode(0)

node = OpenMaya.MFnDependencyNode(create_node("transform"))
modifier = OpenMaya.MDGModifier()

attribute = attribs.Compound("foo")
attribute.append(attribs.Bool("bar"))
attribute.append(attribs.String("baz"))

plug = attribs.add_attribute(node, attribute, modifier=modifier)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maya_attribs-0.1.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maya_attribs-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file maya_attribs-0.1.0.tar.gz.

File metadata

  • Download URL: maya_attribs-0.1.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for maya_attribs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6dbddcb291ac0b0c8d3683ef29506843475b9b410428aded42a2b0b651a18e5c
MD5 22daa32effa5ca43f2abe41b8fde2289
BLAKE2b-256 dbffd3a814ff9f36bbbfffa94e92954bc4dedb4c4eecc542d00098fdbc328188

See more details on using hashes here.

Provenance

The following attestation bundles were made for maya_attribs-0.1.0.tar.gz:

Publisher: release.yml on tahv/attribs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file maya_attribs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: maya_attribs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for maya_attribs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a8539f5a8f45847c74a1c12378f5c592f2723e35dab680aabcef55cb88f406b
MD5 395c15d9788f02190c830838749365dd
BLAKE2b-256 8d8268a695cf84e94a9de94eb76ca0542e8d9798d3479b756b0903386894ed45

See more details on using hashes here.

Provenance

The following attestation bundles were made for maya_attribs-0.1.0-py3-none-any.whl:

Publisher: release.yml on tahv/attribs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page