ECToo / pymel

Automatically exported from code.google.com/p/pymel
0 stars 0 forks source link

PyMel list-like objects should be indexable with int-like objects #264

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
> Describe the problem.
For example, Mesh.vtx cannot be indexed correctly with numpy.int64.

> What Version of Maya are you using?
Maya 2011 SP1 64bit

> On what operating system? (be as specific as possible and include service
> packs, 64bit vs 32bit, etc)
Mac OS X Lion/Snow Leopard, Windows 7 64bit

> What Version of PyMEL are you using?
1.0.0

> What is the expected output? What do you see instead?

It is counter-intuitive that int-like objects cannot be used as indices. It 
should work without casting to Python built-in int.

> If possible, provide a few lines of code to reproduce the problem. It helps
> us if your code will reproduce the problem from a new scene.

import sys
sys.path.append('/path/to/numpy')
import pymel.core as pm
import numpy as np
vtx_id = np.arange(10)  # create arbitrary list of numpy.int64
mesh = pm.polySphere()[0]
mesh.vtx[vtx_id[5]]  # this refers to wrong vertex
# Result: MeshVertex(u'pSphereShape1.vtx[0]') # 
mesh.vtx[int(vtx_id[5])]  # this works
# Result: MeshVertex(u'pSphereShape1.vtx[5]') # 

> Does maya.cmds exhibit the same problem?
Never tried.

> Please provide any additional information below.

Original issue reported on code.google.com by dukec...@gmail.com on 25 Oct 2011 at 5:33