how to add a button to set vector direction

   2128   5   0
User Avatar
Member
41 posts
Joined: July 2014
Offline
Hello

I would like to add a button to knife tool which would set the direction to a specified vector let's say 1,0,0
Is there any way to do it?


Not being good at this I just tried to add “set dirx=1” as a callback script to set at least one component of this vector but with no succes
User Avatar
Member
538 posts
Joined: Dec. 2006
Offline
Set sctipt type to ‘Python’ and set callback:
kwargs['node'].parmTuple('dir').set((1.0, 0.0, 0.0))
https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Staff
3456 posts
Joined: July 2005
Offline
to the far right of the Callback Script is an icon -> “H”
this means the script needs to be written in valid HScript
you can click the “H” and you'll get a dropdown where you can select python instead - then write the script in python

here is a simple Hscript you can use for +x:

opparm . dist ( 1, 0, 0 )

to see the help for opparm in Hscript you can open a Textport and type : help opparm
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
41 posts
Joined: July 2014
Offline
Vux
Thank you! Exactly what I was hoping for. Works perfectly.

arctor
Thank you, also tried this solution but the problem was once I pressed the button it somehow broke the connection to the handle.
User Avatar
Staff
3456 posts
Joined: July 2005
Offline
I just typed it from memory
for some reason the hscript is setting keys on x and y…
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
41 posts
Joined: July 2014
Offline
arctor
Should I report a bug?
  • Quick Links