Skip to content

Instantly share code, notes, and snippets.

@redglasses67
Last active December 25, 2019 04:40
Show Gist options
  • Select an option

  • Save redglasses67/488ffc3f60a165fc3bb24279fa15197f to your computer and use it in GitHub Desktop.

Select an option

Save redglasses67/488ffc3f60a165fc3bb24279fa15197f to your computer and use it in GitHub Desktop.
トランスフォームとメッシュを取得する
import maya.api.OpenMaya as om2
selList = om2.MGlobal.getActiveSelectionList()
mDagPath = selList.getDagPath(0)
if mDagPath.hasFn(om2.MFn.kMesh):
transform = om2.MFnTransform(mDagPath)
print("transform = %s" %transform.fullPathName())
mesh = om2.MFnMesh(mDagPath)
mesh2 = mDagPath.extendToShape() # こんな方法もあります
print("mesh = %s ( mesh2 = %s )" %(mesh.fullPathName(), mesh2.fullPathName()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment