Skip to main content

一个好用的绑定核心库

Project description

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

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_rig_core-0.2.4.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

maya_rig_core-0.2.4-py2.py3-none-any.whl (19.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file maya_rig_core-0.2.4.tar.gz.

File metadata

  • Download URL: maya_rig_core-0.2.4.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7

File hashes

Hashes for maya_rig_core-0.2.4.tar.gz
Algorithm Hash digest
SHA256 514f6e61e1dfda8f60df45118221910061a174fb7f75a88398d3a9a1e158b5b9
MD5 ee86a6b1be9685839ccd28f5286d5ac1
BLAKE2b-256 fc858cce72e588239584708053e31ca2aac9d360b0d7820314b0e938fd8a85dc

See more details on using hashes here.

File details

Details for the file maya_rig_core-0.2.4-py2.py3-none-any.whl.

File metadata

  • Download URL: maya_rig_core-0.2.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7

File hashes

Hashes for maya_rig_core-0.2.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4e8a193d361de9f83cb406e7a8ac2d78e5660b186026e6d6f94e94538cf7b028
MD5 cde8fa3fb1f4de518fffb67e45c0c783
BLAKE2b-256 bc6efab29e8c9121c365d2b1e45f48f975a51f649f99ec3957886cc1e9e68da7

See more details on using hashes here.

Supported by

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