maya-attribs


Namemaya-attribs JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python library for creating Maya Attributes
upload_time2024-12-22 18:03:46
maintainerNone
docs_urlNone
authorThibaud Gambier
requires_python>=3.7
licenseMIT License Copyright (c) 2024 Thibaud Gambier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords maya openmaya
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # attribs

An experimental Python library for creating Maya Attributes.

## Installation

Install attribs with pip:

```bash
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`.

```python
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.

```python
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.

```python
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)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "maya-attribs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "maya, openmaya",
    "author": "Thibaud Gambier",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/db/ff/d3a814ff9f36bbbfffa94e92954bc4dedb4c4eecc542d00098fdbc328188/maya_attribs-0.1.0.tar.gz",
    "platform": null,
    "description": "# attribs\n\nAn experimental Python library for creating Maya Attributes.\n\n## Installation\n\nInstall attribs with pip:\n\n```bash\npip install maya-attribs\n```\n\n## Quickstart\n\nUse `attribs.add_attribute` to create an new attributes\non an `OpenMaya.MFnDependencyNode`.\nThis function also returns the newly created `OpenMaya.MPlug`.\n\n```python\nfrom maya import cmds\nfrom maya.api import OpenMaya\nimport attribs\n\ndef create_node(node_type: str) -> OpenMaya.MObject:\n    name = cmds.createNode(node_type)\n    return OpenMaya.MSelectionList().add(name).getDependNode(0)\n\nnode = OpenMaya.MFnDependencyNode(create_node(\"transform\"))\nmodifier = OpenMaya.MDGModifier()\n\nattribute = attribs.Bool(\"foo\", default=False)\n\nplug = attribs.add_attribute(node, attribute, modifier=modifier)\n```\n\nSet attribute flags either as keyword argument or later as properties.\n\n```python\nfrom maya import cmds\nfrom maya.api import OpenMaya\nimport attribs\n\ndef create_node(node_type: str) -> OpenMaya.MObject:\n    name = cmds.createNode(node_type)\n    return OpenMaya.MSelectionList().add(name).getDependNode(0)\n\nnode = OpenMaya.MFnDependencyNode(create_node(\"transform\"))\nmodifier = OpenMaya.MDGModifier()\n\nattribute = attribs.Double3(\n    \"MyDouble\", \n    default=(1.0, 2.0, 3.0), \n    channel_box=True,\n)\nattribute.keyable = True\n\nplug = attribs.add_attribute(node, attribute, modifier=modifier)\n```\n\nCompounds are also supported.\n\n```python\nfrom maya import cmds\nfrom maya.api import OpenMaya\nimport attribs\n\ndef create_node(node_type: str) -> OpenMaya.MObject:\n    name = cmds.createNode(node_type)\n    return OpenMaya.MSelectionList().add(name).getDependNode(0)\n\nnode = OpenMaya.MFnDependencyNode(create_node(\"transform\"))\nmodifier = OpenMaya.MDGModifier()\n\nattribute = attribs.Compound(\"foo\")\nattribute.append(attribs.Bool(\"bar\"))\nattribute.append(attribs.String(\"baz\"))\n\nplug = attribs.add_attribute(node, attribute, modifier=modifier)\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Thibaud Gambier  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Python library for creating Maya Attributes",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "maya",
        " openmaya"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d8268a695cf84e94a9de94eb76ca0542e8d9798d3479b756b0903386894ed45",
                "md5": "395c15d9788f02190c830838749365dd",
                "sha256": "7a8539f5a8f45847c74a1c12378f5c592f2723e35dab680aabcef55cb88f406b"
            },
            "downloads": -1,
            "filename": "maya_attribs-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "395c15d9788f02190c830838749365dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11192,
            "upload_time": "2024-12-22T18:03:43",
            "upload_time_iso_8601": "2024-12-22T18:03:43.748232Z",
            "url": "https://files.pythonhosted.org/packages/8d/82/68a695cf84e94a9de94eb76ca0542e8d9798d3479b756b0903386894ed45/maya_attribs-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dbffd3a814ff9f36bbbfffa94e92954bc4dedb4c4eecc542d00098fdbc328188",
                "md5": "22daa32effa5ca43f2abe41b8fde2289",
                "sha256": "6dbddcb291ac0b0c8d3683ef29506843475b9b410428aded42a2b0b651a18e5c"
            },
            "downloads": -1,
            "filename": "maya_attribs-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "22daa32effa5ca43f2abe41b8fde2289",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16570,
            "upload_time": "2024-12-22T18:03:46",
            "upload_time_iso_8601": "2024-12-22T18:03:46.593607Z",
            "url": "https://files.pythonhosted.org/packages/db/ff/d3a814ff9f36bbbfffa94e92954bc4dedb4c4eecc542d00098fdbc328188/maya_attribs-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-22 18:03:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "maya-attribs"
}
        
Elapsed time: 0.36787s