Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dynamic attributeの値をチェックする。主にSOuPやMash使ってる時用かも。
# とりあえず大急ぎで書いてる
# あれこれ書き方忘れてたので参考ページもメモ
# https://area.autodesk.jp/column/tutorial/maya_atoz/attribute_plug/
# http://ianwaters.co.uk/wp/mash/accessing-mash-point-data-with-the-maya-api/
from maya import OpenMaya
import pymel.core as pm
def mdg_from_name(name):
if not pm.objExists(name):
raise pm.MayaNodeError, name
slist = OpenMaya.MSelectionList()
slist.add(name)
dg = OpenMaya.MObject()
slist.getDependNode(0, dg)
return dg
# main
inst = mdg_from_name('instancer2')
instFn = OpenMaya.MFnDependencyNode(inst)
ip_plug = instFn.findPlug('inputPoints')
handle_data = ip_plug.asMDataHandle().data()
points_data = OpenMaya.MFnArrayAttrsData(handle_data)
#print(points_data.list())
indexs = points_data.getIntData('objectIndex')[:]
#print(len(indexs))
print(indexs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.