View Full Version : Connect translation with percent or skinpercent value of component editor
11-25-2012, 03:46 PM
I just wanted to know if there is any possibility to connect an object's translation (i.e. '.ty')
with a percent value in the weighted deformer tab or skinpercent value in the smoothskinning tab of the component editor.
And this all should be achieved by scripting in python (or mel), without expressions.
So whenever I move the object in .ty the percent value should dynamically increase or decrease, till it reaches 0 or 1.
How is this possible?
PS: I'm using Maya 2013. Thx guys
You dont need python or mel because you can simply use the connection editor to do this.
Create a setRange node and set the oldMin and oldMax to the ty values that correspond to the 0 and 1 weight. Set min and max to 0 and 1 (I think this is default). Now connect ty to the setRange.valueY and connect the setRange.outValueY to the deformer weight.
Set it up manually first then have a look at the connections and you can write a python script to hook it up for you next time.
11-25-2012, 09:51 PM
first thank you for your help. I did as you said and it worked. I just want to be sure that I've got it right. After I did the connections with the ty and the setRange.valueY I connected the outValueY to the deformer weight. The deformer weight... is this the envelope in this case?
Well that works fine. I change the .ty of the control in the specific given range and the envelope changes. But my intention is to change each cv's weight of a curve for example. The curve has got 2 cluster defomer, one on the left, one on the right, so when I change the .ty the left or the right cluster gets more weight.
....Maybe I couldn't find the right connection and what you've written is exactly that what I want finally, but if it's the case it would be cool if you could let me know exactly which connection I have to build then :D
Either way thanks for support David.
There is always more than one way to do something. You might want to read about how the "set driven key" method works in maya. Using driven keys you could control many clusters envelope values using a single ty channel. You can set keys so that when you change ty from 0 to 10 for example, then one cluster envelope will go from 0 to 1, and the other will do the opposite, 1 to 0. (These are just suggestions, since you may want your ty to go from -10 to 10 and some other relationship with the clusters).
You can use setRange to do the same thing. In my first post I suggested to connect ty to valueY, but there is nothing stopping you also connecting to valueX and using the outValueX to control the envelope on the 2nd cluster. Just set the oldMin and oldMax to determin how the ty will affect each one.
The driven key method will give you more control and you will also have a visual representation of the mapping between the ty and the envelope values (in the graph editor). Both approaches can be scripted, but as I said before, do it manually until you know what you need, then script it.
11-25-2012, 11:25 PM
thx for the quick response. Well yeah set driven keyframes or alternatively using remapValue is a good solution. Didn't thought about it... :D. Either way I can blend the weights of each cluster from one to the other...this will solve the problem, thanks man.
Nonetheless it's interesting to know how to connect directly to the cvs weight values when you use just one cluster.(Since the component editor just changes the values by typing in or using the slider, too)
When each cv(for example we have a straight ep-curve with 10 cvs) has a linear offset between 1 and 0 (like a gradient), weighted to one cluster and one control just manipulates how the cvs are weighted to the cluster, I think that could be really cool. :D
But you're right, there are many ways to do that. I should use the simple way...haha
Thanks David and Cheerio
Controlling the weights at the component level is more difficult, but certainly possible. You can paint weights and you can set values from a script, but neither lend themselves to animating. I guess it depends on what you are trying to achieve. For a smallish number of CVs I'd probably just make a cluster for each cv and do it that way.
For something more complex I would recommend the SOuP plugin. The key word in that sentence, after SOuP of course, is "complex", but once you figure it out a world of possibility opens.
11-26-2012, 03:53 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.