pymxs wiring params - connect and disconnect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is what i've managed to piece together:
from pymxs import runtime as rt
XslC = rt.getCurrentSelection()[0]
XslP = rt.getCurrentSelection()[1]
rt.paramWire.connect(self.XslC['transform']['position'], self.XslP['transform']['position']['X_Position'], "-Position.x")
rt.paramWire.connect(self.XslC['transform']['position'], self.XslP['transform']['position']['Y_Position'], "Position.y")
rt.paramWire.connect(self.XslC['transform']['position'], self.XslP['transform']['position']['Z_Position'], "Position.z")
rt.paramWire.connect(self.XslC['transform']['rotation'], self.XslP['transform']['rotation']['X_Rotation'], "-degtorad (quatToEuler Rotation).x")
rt.paramWire.connect(self.XslC['transform']['rotation'], self.XslP['transform']['rotation']['Y_Rotation'], "degtorad (quatToEuler Rotation).y")
rt.paramWire.connect(self.XslC['transform']['rotation'], self.XslP['transform']['rotation']['Z_Rotation'], "degtorad (quatToEuler Rotation).z")
and for the disconnect:
rt.paramWire.disconnect(Xsl['transform']['position']['X_Position'].controller)
rt.paramWire.disconnect(Xsl['transform']['position']['Y_Position'].controller)
rt.paramWire.disconnect(Xsl['transform']['position']['Z_Position'].controller)
rt.paramWire.disconnect(Xsl['transform']['rotation']['X_Rotation'].controller)
rt.paramWire.disconnect(Xsl['transform']['rotation']['Y_Rotation'].controller)
rt.paramWire.disconnect(Xsl['transform']['rotation']['Z_Rotation'].controller)
Initially, I thought the disconnect wasn't working, although i've found some issues with the connect, where I can run it successfully on objects 1 and 2, but when i run it on objects 3 and 4, object 1 automatically wires itself to object 4, as well as object 3 wiring itself to object 4, so something deeper is going on here.
Additionally, I'm having problems assigning controllers to sub positions and rotations:
Xsl1 = rt.getCurrentSelection()[0] # get selection
posCtrl = rt.bezier_float() # establish a controller
print Xsl1['transform']['position']['Y_position'].controller # print current controller
Xsl1['transform']['position'].setmxsprop('Y_Position.controller', posCtrl) # assign new controller
print Xsl1['transform']['position']['Y_position'].controller # print current controller
It seems like this should work, but it doesn't.
I'm thinking that i'm grabbing these controllers and attributes incorrectly, so if anyone has any insight into this it would be greatly appreciated.