Skip to main content

maya_rig_core

一个好用的绑定核心库

目录

快速开始

安装

注意下方的python是你的Python, 正常情况下可以直接通过python调用, 而Maya的python一般是C:\Program Files\Autodesk<Maya版本>\bin\mayapy.exe

python -m pip install maya-rig-core

在windows下maya的安装例子

注意:

  1. 请将Maya路径替换为自己的。
  2. 请使用cmd
"C:\Program Files\Autodesk\Maya2018\bin\mayapy.exe" -m pip install maya-rig-core

使用

创建控制器与组

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()
con = ctx.controller()
grp = ctx.add_group_to_object(con)

创建名称空间上下文

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()
with ctx.enter_new_name_space(prefix='prefix_'):
    con_list = ctx.controller()
print('在这里你可以查看名称空间上下文结束之后的名称', con_list)

创建生成块上下文

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()
# nodes 就是这个生成块记录的节点, 两个nodes都是.
with ctx.enter_build_block(key=lambda nodes: print('从回调获得 生成块中创建了什么节点 >>  ', nodes)) as nodes:
    con_list = ctx.controller()
print('从变量获得 生成块中创建了什么节点 >>  ', nodes)

使用Tag过滤节点

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()

# 进入一个新的Tag运行时(不进入其实也能跑,但是这里为了演示就进入了)
with ctx.enter_new_tag_rt('test_tag_rt'):
    # 创建有one标签的控制器
    one_con_list = ctx.controller(tags=['one'])
    # 创建有two标签的控制器
    two_con_list = ctx.controller(tags=['two'])

    # 创建过滤器
    f = ctx.filter()
    # 过滤节点
    nodes = f.tag_equal('one')
    print('搜索到的节点', list(nodes))

进入一个新的根对象

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()

root_con = ctx.controller()
root_grp = ctx.add_group_to_object(root_con)

with ctx.enter_new_root_object(root_con):
    child_con = ctx.controller()
    child_grp = ctx.add_group_to_object(child_con)

虚拟骨骼树的使用

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()

# 创建控制器和组
con_list = ctx.controller_list(tags=['test'], count=10)
grp_list = ctx.add_group_to_object_list(con_list, tags=['test'])

# 将控制器添加虚拟骨骼树下面
ctx.root_joint.add_joint_chain_from_object_list(con_list)

# 将虚拟骨骼树转化为实体骨骼
create_real_joints_from_root(ctx.root_joint)

进入一个新的根虚拟关节

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()

root_con = ctx.controller()
root_grp = ctx.add_group_to_object(root_con)

# 进入一个新的根虚拟关节
with ctx.create_child_joint_as_new_root_joint(obj=root_con):
    # 创建控制器和组
    con_list = ctx.controller_list(tags=['test'], count=10)
    grp_list = ctx.add_group_to_object_list(con_list, tags=['test'])

    # 将控制器添加虚拟骨骼树下面
    ctx.root_joint.add_child_from_object_list(con_list)

# 将虚拟骨骼树转化为实体骨骼
create_real_joints_from_root(ctx.root_joint)

节点数据库功能

# -*-coding:utf-8 -*-
from __future__ import print_function, unicode_literals, division
from rig_core.all import *

ctx = Ctx()

con = ctx.controller()
grp = ctx.add_group_to_object(con)
# 进入一个新的节点数据库运行时(不进入其实也能跑,但是这里为了演示就进入了)
with ctx.enter_new_all_node_db_rt('test_attributes_name'):
    # 向控制器储存
    ctx.all_node_db_rt[con, 'test_key'] = 'test_all_db_rt_data'
    # 从控制器读取数据
    print('从控制器读取的数据', ctx.all_node_db_rt[con, 'test_key'])

版权说明

该项目签署了Apache-2.0 授权许可,详情请参阅 LICENSE

Release files for maya-rig-core 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maya-rig-core 0.2.5
File Size Uploaded
maya_rig_core-0.2.5.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maya-rig-core 0.2.5
File Interpreter ABI Platform
maya_rig_core-0.2.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 34.1 kB

Release files / maya_rig_core-0.2.5.tar.gz

Download URL maya_rig_core-0.2.5.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7ab4277532f7680739ac629a86e290104fa10c3664852e6531642560af13abe9
BLAKE2b-256 checksum
How to use checksums
467a4618bbfe84dd20772606e73ecd6ba1abdc488392a0d68d549060c94a7ecb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / maya_rig_core-0.2.5-py2.py3-none-any.whl

Download URL maya_rig_core-0.2.5-py2.py3-none-any.whl
Size 19.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f04a596299a55eee8b34456f1c893357385468ba515cab9d615673904878b1ce
BLAKE2b-256 checksum
How to use checksums
5c1fa7bb4066da76736728474a991460f297f3d9bc53e49f02aeaf9e8618c31f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page