ECToo / pymel

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

Locators in PyMEL 1.0.1 don't have xForm methods #178

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the problem.
Locators don't seem to have the methods they should (setTranslation, 
setParent, etc)

What Version of Maya are you using?
2009x64

On what operating system? (be as specific as possible and include service
packs, 64bit vs 32bit, etc)
Windows 7 64bit

What Version of PyMEL are you using?
1.0.1

What is the expected output? What do you see instead?
I expect to be able to call xForm methods on locators.  Here's the error:

# Warning: 'parent' command only operates on transform nodes. To parent 
shapes, use the -s/shape flag. # 
# Warning: 'parent' command only operates on transform nodes. To parent 
shapes, use the -s/shape flag. # 
# Error: nt.Locator(u'myChar_r_armDistStartA_loc') has no attribute or 
method named 'setTranslation'
# Traceback (most recent call last):
#   File "<maya console>", line 25, in <module>
#   File "C:\Users\John\Documents\python\pymel-
1.0.1\pymel\core\nodetypes.py", line 1732, in __getattr__
#     return super(GeometryShape,self).__getattr__(attr)
#   File "C:\Users\John\Documents\python\pymel-
1.0.1\pymel\core\nodetypes.py", line 301, in __getattr__
#     raise AttributeError,"%r has no attribute or method named '%s'" % 
(self, attr)
# AttributeError: nt.Locator(u'myChar_r_armDistStartA_loc') has no 
attribute or method named 'setTranslation' # 

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.
See attached...it should reproduce the error in a new scene file

Does maya.cmds exhibit the same problem?
N/A

Please provide any additional information below.

Original issue reported on code.google.com by jspatr...@gmail.com on 9 Apr 2010 at 5:11

Attachments:

GoogleCodeExporter commented 9 years ago
i believe your problem is that you're calling getTranslation on the locator 
shape, not the transform:

x = spaceLocator()
x
# Result: nt.Transform(u'locator2') # 
x.getTranslation()
# Result: dt.Vector([0.0, 0.0, 0.0]) # 
s = x.getShape()
s
# Result: nt.Locator(u'locatorShape2') # 
s.getTranslation()
# Error: nt.Locator(u'locatorShape2') has no attribute or method named 
'getTranslation'
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
#   File 
"/Users/chad/Documents/dev/luma/python/thirdParty/pymel/pymel/core/nodetypes.py"
, line 1732, in 
__getattr__
#     return super(GeometryShape,self).__getattr__(attr)
#   File 
"/Users/chad/Documents/dev/luma/python/thirdParty/pymel/pymel/core/nodetypes.py"
, line 301, in 
__getattr__
#     raise AttributeError,"%r has no attribute or method named '%s'" % (self, 
attr)
# AttributeError: nt.Locator(u'locatorShape2') has no attribute or method named 
'getTranslation' # 

Original comment by chad...@gmail.com on 10 Apr 2010 at 11:21

GoogleCodeExporter commented 9 years ago
You're right...however, the node that the .listConnections() method returns has
changed, at least in this example.

I just extracted pymel 1.0.0rc2 and 1.0.1 right next to each other, and changed 
my
maya.env between the two.  When using 1.0.0rc2, when I print type(loc1) I get
nt.Transform.  When I do the same with 1.0.1, I get nt.Locator. Makes sense why 
I was
getting the error, I'm just not sure if it was intentional that the type of node
returned has changed.

Original comment by jspatr...@gmail.com on 11 Apr 2010 at 2:12

GoogleCodeExporter commented 9 years ago
ah, i know what the problem is now.  listConnections was returning transforms 
of shapes even when the actual 
connection went to the shape. this was fixed in pymel, but it's such a 
fundamental change that maybe we ought 
to make a new flag for the command to enable this behavior.  i'll talk it over 
with the other developers.

Original comment by chad...@gmail.com on 11 Apr 2010 at 2:25

GoogleCodeExporter commented 9 years ago
Sorry, my description was really misleading (err....inaccurate).  That makes 
sense that 
the return value is to the actual object that it's connected to:  since I take 
it 
that's a permanent change,  I'll update my scripts to work with it.  Thanks!

Original comment by jspatr...@gmail.com on 11 Apr 2010 at 3:20

GoogleCodeExporter commented 9 years ago
hang on. it might not be the best decision on our part.  i'm still looking into 
it.

Original comment by chad...@gmail.com on 11 Apr 2010 at 4:01

GoogleCodeExporter commented 9 years ago
we rolled this change back. 1.0.2 will be out soon along with a few other 
updates.

Original comment by chad...@gmail.com on 12 Apr 2010 at 7:11