Hello everyone. I am trying to create a synoptic button that when pressed once,
will enable the current weight influence of a constraint to 1 and when I press it again
it will roll it back to zero.
I checked the toggle value command on the script editor, but I think I´m not approaching
the problem and the syntax correctly (im using VB):
ToggleValue ("Rig.Ctrl2_Hand_LFT_IK1.kine.posecns.blendweight, 1");
Could anyone please help me to code that button, please?
Thanks.
David.
Toggle value between 0 and 1 to blend constraint´s weight
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Toggle value between 0 and 1 to blend constraint´s weight
Im switching to JS now, I got this:
if ("Rig.Ctrl2_IK1.kine.posecns.blendweight = 0") then
SetValue ("Rig.Ctrl2_IK1.kine.posecns.blendweight", 1);
But I get an error on the first line.
Any ideas?
if ("Rig.Ctrl2_IK1.kine.posecns.blendweight = 0") then
SetValue ("Rig.Ctrl2_IK1.kine.posecns.blendweight", 1);
But I get an error on the first line.
Any ideas?
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
xsisupport
- Posts: 713
- Joined: 09 Jun 2009, 09:02
- Location: Montreal Canada
Re: Toggle value between 0 and 1 to blend constraint´s weight
In your IF statement, all you have is a string.
You need something like this (in Jscript)
You need something like this (in Jscript)
Code: Select all
if ( GetValue("Rig.Ctrl2_IK1.kine.posecns.blendweight") = 0 )
SetValue ("Rig.Ctrl2_IK1.kine.posecns.blendweight", 1);-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Toggle value between 0 and 1 to blend constraint´s weight
Thank you my coded now it´s working after adding the second =
Great! now I´ll go experiment with the boolean value.
Great! now I´ll go experiment with the boolean value.
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
agedito
- Posts: 6
- Joined: 16 Mar 2010, 07:28
Re: Toggle value between 0 and 1 to blend constraint´s weight
A classic mathematic trick:
1 - 0 = 1
1 - 1 = 0
1 - 0 = 1
1 - 1 = 0
Code: Select all
oldValue = GetValue("Rig.Ctrl2_IK1.kine.posecns.blendweight")
SetValue ("Rig.Ctrl2_IK1.kine.posecns.blendweight", 1 - oldValue );