Hello, animator here. I really can't figure out this problem for several 
weeks so hopefully someone can help me. 

I am trying to get a worldMatrix of a controller at different frames 
WITHOUT moving in the timeline. I am using getAttr() with the time argument 
but it gives me wrong result on some specific controllers. I am not good 
enough in rigging to understand what is so specific about these controllers.

Here is my code where I compare the matrices translations of a single 
selection, obtained by different method. xform(ws = True) that gives me 
always the correct result. And Funny enough, getAttr() without the time 
argument give me the correct result as well. Why on earth just adding the 
time argument make the result all wrong? 

import maya.cmds as mc
import random

#Get selection
ctrl = mc.ls(sl=True)[0]

#Get a random frame 
frameNr = random.randint(1,100)
#Set the current time to test xform 
mc.currentTime(frameNr)

print ('Frame: %s'%mc.currentTime(q=True))

#Get the matrix with getAttr with the Time argument - bad result
getAttr_matrix_time = mc.getAttr('%s.worldMatrix[0]'%ctrl, time = frameNr)
print 
(getAttr_matrix_time[12],getAttr_matrix_time[13],getAttr_matrix_time[14], ' 
-> getAttr(time) ')

#Get the matrix with getAttr without the time argument - good result 
getAttr_matrix = mc.getAttr('%s.worldMatrix[0]'%ctrl)
print (getAttr_matrix[12],getAttr_matrix[13],getAttr_matrix[14], ' -> 
getAttr() ')

#Get the matrix with xform - good result 
xform_mat = mc.xform(ctrl , matrix = True, q = True, ws = True)
print (xform_mat[12],xform_mat[13],xform_mat[14], ' -> xform() ')


My bug comes on this rig free rig for example: 
https://agora.community/content/bulbasaur
On the controller "C_big_vine_mid_ctrl". 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/cac2b045-6968-46fa-8fed-c34fd65980a3n%40googlegroups.com.

Reply via email to