You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using setAttr on a floatArray data type attribute, the attribute data gets "corrupted". See example bellow: A 3 element floatArray created and initialized through maya.cmds, returns only one element (the first) after updated through PyMel. Resetting the attribute through maya.cmds.setAttr "un-corrupts" the attribute data again, but this is not shown in the example to keep it brief.
Seems to be a rarely used corner case, as setAttr on doubleArray data type works just fine.
Maya version 20180400, PyMel version 1.0.10.
import maya.cmds as mc
import pymel.core as pm
mc.createNode( 'locator', n='node' )
mc.addAttr(ln='dArray', sn='da', dt='doubleArray')
mc.addAttr(ln='fArray', sn='fa', dt='floatArray')
print 'mc.setAttr type doubleArray'
mc.setAttr("node.dArray", (2, 3.14159, 2.782), type="doubleArray")
print 'mc.getAttr : {0}'.format(mc.getAttr("node.dArray"))
print 'pm.getAttr : {0}'.format(pm.getAttr("node.dArray"))
print
print 'mc.setAttr type floatArray'
mc.setAttr("node.fArray", (2, 3.14159, 2.782), type="floatArray")
print 'mc.getAttr : {0}'.format(mc.getAttr("node.fArray"))
print 'pm.getAttr : {0}'.format(pm.getAttr("node.fArray"))
print
print 'pm.setAttr type doubleArray'
pm.setAttr("node.dArray", (1.0, 2.0, 3.0), type="doubleArray")
print 'mc.getAttr : {0}'.format(mc.getAttr("node.dArray"))
print 'pm.getAttr : {0}'.format(pm.getAttr("node.dArray"))
print
print 'pm.setAttr type floatArray'
pm.setAttr("node.fArray", (1.0, 2.0, 3.0), type="floatArray")
print 'mc.getAttr : {0}'.format(mc.getAttr("node.fArray")) # Returns a list with one element
print 'pm.getAttr : {0}'.format(pm.getAttr("node.fArray")) # Returns a list with one element
print
The text was updated successfully, but these errors were encountered:
ParticlePeter
changed the title
setAttr on floatArray data type
setAttr on floatArray data type does not work as expected
Mar 28, 2019
When using
setAttr
on afloatArray
data type attribute, the attribute data gets "corrupted". See example bellow: A 3 elementfloatArray
created and initialized throughmaya.cmds
, returns only one element (the first) after updated through PyMel. Resetting the attribute throughmaya.cmds.setAttr
"un-corrupts" the attribute data again, but this is not shown in the example to keep it brief.Seems to be a rarely used corner case, as
setAttr
ondoubleArray
data type works just fine.Maya version 20180400, PyMel version 1.0.10.
The text was updated successfully, but these errors were encountered: