python code in obj's tx

   4048   5   1
User Avatar
Member
326 posts
Joined: May 2007
Offline
this is the code hou.node(“/obj/cam1”).worldTransform().extractTranslates()
when i type it in python shell, it works fine. but i want it apply to a obj's transform,it denied!
this is the error:
Error: Unable to evaluate expression (
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
AttributeError: ‘NoneType’ object has no attribute ‘worldTransform’
(/obj/null1/tx)).
https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
1390 posts
Joined: July 2005
Offline
It definitely works fine here (11.0.595).

cheers,
skk.

ps blindly I didn't notice world transform is what you're after… origin() not ch() could help you also.
User Avatar
Member
1926 posts
Joined: Nov. 2006
Offline
The code works fine for me and there's no reason why it should be failing assuming your path to the node is correct. The error is a result of it not being able to find your specific node so double check your spelling I suppose. If that doesn't work maybe post a hip file.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
326 posts
Joined: May 2007
Offline
i tried h11.0.504 and h11.0.581,neither works!!

Attachments:
python_error.hip (51.7 KB)

https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
1926 posts
Joined: Nov. 2006
Offline
You need to start the node paths with a forward slash “/”.
hou.node('/obj/sphere_object1').worldTransform().extractTranslates()
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
326 posts
Joined: May 2007
Offline
thank you very much!!
https://vimeo.com/user3971456/videos [vimeo.com]
  • Quick Links