# maya-controller-hub
maya控制器库实现
## 目录
- [快速开始](#快速开始)
* [安装](#安装)
* [使用](#使用)
- [版权说明](#版权说明)
## 快速开始
### 安装
注意下方的python是你的Python, 正常情况下可以直接通过python调用, 而Maya的python一般是C:\Program
Files\Autodesk\<Maya版本>\bin\mayapy.exe
```commandline
python -m pip install maya-controller-hub
```
在windows下maya的安装例子
注意:
1. 请将Maya路径替换为自己的。
2. 请使用cmd
```commandline
"C:\Program Files\Autodesk\Maya2018\bin\mayapy.exe" -m pip install maya-controller-hub
```
### 使用
#### 例子
```python
# -*-coding:utf-8 -*-
from __future__ import unicode_literals, print_function, division
import cpmel.cmds as cc
from rig_core.all import *
from controller_hub import ControllerHub
ctx = Ctx()
for i in range(4):
cc.mel.eval('circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.1 -s 8 -ch 0;')
with ControllerHub(ctx, 'your-controller-hub-path') as control_hub:
print('control_hub', control_hub)
control_hub.use_template(
'cp.cube',
[cc.new_object('nurbsCircle1')],
translate=(1, 1, 1),
color='#19448e') # 一个蓝色的正方体控制器
control_hub.use_template(
'cp.octahedron',
[cc.new_object('nurbsCircle2')],
rotate=(45, 45, 45),
color=(0.8, 0.8, 0.8)) # 一个白色的正八面体控制器
control_hub.use_template(
'cp.flower',
[cc.new_object('nurbsCircle3')],
rotate='+y',
color=(0, 0, 0)) # 一个黑色的花形控制器
control_hub.use_template(
'cp.triangle',
[cc.new_object('nurbsCircle4')],
scale=(1.5, 1.5, 1.5),
color=14) # 一个绿色的三角形控制器
```
## 版权说明
该项目签署了Apache-2.0 授权许可,详情请参阅 LICENSE
Raw data
{
"_id": null,
"home_page": null,
"name": "maya-controller-hub",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "cpcgskill <cpcgskill@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/86/ac/d0a1f12d97120f8f67ea0a0a5538fd7bcce8c003a854115bc7145cd987c2/maya_controller_hub-0.1.2.tar.gz",
"platform": null,
"description": "# maya-controller-hub\r\n\r\nmaya\u63a7\u5236\u5668\u5e93\u5b9e\u73b0\r\n\r\n## \u76ee\u5f55\r\n\r\n- [\u5feb\u901f\u5f00\u59cb](#\u5feb\u901f\u5f00\u59cb)\r\n * [\u5b89\u88c5](#\u5b89\u88c5)\r\n * [\u4f7f\u7528](#\u4f7f\u7528)\r\n- [\u7248\u6743\u8bf4\u660e](#\u7248\u6743\u8bf4\u660e)\r\n\r\n## \u5feb\u901f\u5f00\u59cb\r\n\r\n### \u5b89\u88c5\r\n\r\n\u6ce8\u610f\u4e0b\u65b9\u7684python\u662f\u4f60\u7684Python, \u6b63\u5e38\u60c5\u51b5\u4e0b\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7python\u8c03\u7528, \u800cMaya\u7684python\u4e00\u822c\u662fC:\\Program\r\nFiles\\Autodesk\\<Maya\u7248\u672c>\\bin\\mayapy.exe\r\n\r\n```commandline\r\npython -m pip install maya-controller-hub\r\n```\r\n\r\n\u5728windows\u4e0bmaya\u7684\u5b89\u88c5\u4f8b\u5b50\r\n\r\n\u6ce8\u610f:\r\n\r\n1. \u8bf7\u5c06Maya\u8def\u5f84\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u3002\r\n2. \u8bf7\u4f7f\u7528cmd\r\n\r\n```commandline\r\n\"C:\\Program Files\\Autodesk\\Maya2018\\bin\\mayapy.exe\" -m pip install maya-controller-hub\r\n```\r\n\r\n### \u4f7f\u7528\r\n\r\n#### \u4f8b\u5b50\r\n\r\n```python\r\n# -*-coding:utf-8 -*-\r\nfrom __future__ import unicode_literals, print_function, division\r\nimport cpmel.cmds as cc\r\nfrom rig_core.all import *\r\nfrom controller_hub import ControllerHub\r\n\r\nctx = Ctx()\r\nfor i in range(4):\r\n cc.mel.eval('circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.1 -s 8 -ch 0;')\r\n\r\nwith ControllerHub(ctx, 'your-controller-hub-path') as control_hub:\r\n print('control_hub', control_hub)\r\n control_hub.use_template(\r\n 'cp.cube',\r\n [cc.new_object('nurbsCircle1')],\r\n translate=(1, 1, 1),\r\n color='#19448e') # \u4e00\u4e2a\u84dd\u8272\u7684\u6b63\u65b9\u4f53\u63a7\u5236\u5668\r\n control_hub.use_template(\r\n 'cp.octahedron',\r\n [cc.new_object('nurbsCircle2')],\r\n rotate=(45, 45, 45),\r\n color=(0.8, 0.8, 0.8)) # \u4e00\u4e2a\u767d\u8272\u7684\u6b63\u516b\u9762\u4f53\u63a7\u5236\u5668\r\n control_hub.use_template(\r\n 'cp.flower',\r\n [cc.new_object('nurbsCircle3')],\r\n rotate='+y',\r\n color=(0, 0, 0)) # \u4e00\u4e2a\u9ed1\u8272\u7684\u82b1\u5f62\u63a7\u5236\u5668\r\n control_hub.use_template(\r\n 'cp.triangle',\r\n [cc.new_object('nurbsCircle4')],\r\n scale=(1.5, 1.5, 1.5),\r\n color=14) # \u4e00\u4e2a\u7eff\u8272\u7684\u4e09\u89d2\u5f62\u63a7\u5236\u5668\r\n```\r\n\r\n## \u7248\u6743\u8bf4\u660e\r\n\r\n\u8be5\u9879\u76ee\u7b7e\u7f72\u4e86Apache-2.0 \u6388\u6743\u8bb8\u53ef\uff0c\u8be6\u60c5\u8bf7\u53c2\u9605 LICENSE\r\n\r\n",
"bugtrack_url": null,
"license": "Apache Software License (Apache 2.0)",
"summary": "Maya\u63a7\u5236\u5668\u5e93\u5b9e\u73b0",
"version": "0.1.2",
"project_urls": {
"Bug Tracker": "https://github.com/cpcgskill/maya-controller-hub/issues",
"Homepage": "https://github.com/cpcgskill/maya-controller-hub"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "56a50bd6e90c30a794005373145c11c0e0c32a84eb1f08713a0f20b619ed8649",
"md5": "a3bd2ec5b05c76073cda16f7b16e6ba0",
"sha256": "7ec785d22e5222f1d608ffaa749fb92060ff8e31adbe07214be17f61877f0ab5"
},
"downloads": -1,
"filename": "maya_controller_hub-0.1.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3bd2ec5b05c76073cda16f7b16e6ba0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"size": 9746,
"upload_time": "2024-10-07T12:34:55",
"upload_time_iso_8601": "2024-10-07T12:34:55.780946Z",
"url": "https://files.pythonhosted.org/packages/56/a5/0bd6e90c30a794005373145c11c0e0c32a84eb1f08713a0f20b619ed8649/maya_controller_hub-0.1.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "86acd0a1f12d97120f8f67ea0a0a5538fd7bcce8c003a854115bc7145cd987c2",
"md5": "421d376399f4d5294cef3e287e009bd3",
"sha256": "0cdea6971f91b78c3345712126fa8d9a3b0870c4e4168dbe35517c32d2981b13"
},
"downloads": -1,
"filename": "maya_controller_hub-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "421d376399f4d5294cef3e287e009bd3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
"size": 9317,
"upload_time": "2024-10-07T12:34:57",
"upload_time_iso_8601": "2024-10-07T12:34:57.324793Z",
"url": "https://files.pythonhosted.org/packages/86/ac/d0a1f12d97120f8f67ea0a0a5538fd7bcce8c003a854115bc7145cd987c2/maya_controller_hub-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-07 12:34:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cpcgskill",
"github_project": "maya-controller-hub",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "maya-controller-hub"
}