PDA

View Full Version : problem with attrFieldSliderGrp...


Dryden
11-13-2007, 09:10 AM
Hi all, I'm new in Mel world, so it could be a stupid question, but I can't find a way to fix it.

I make a lil script to change value of scale of an object. Ok that's easy, so i'll try to go deeper.

Now I'm trying to make a general script. 3 Slider to change scale properties of an object, and to use this 3 slider for any object. In few words : 3 sliders who change scale value on 3 axes, but a lil harder who change if I change of selected object. I know how to use ls -sl but I can't find out how to change dynamicly the value of those slider.

Example cause I'm sure I'm not clear :
2 object one sphere one cube. I select cube, so slider value are 0,0,0. Change it with slider to 10,5,1. Ok cube scale change. But now If I select the sphere slider keep the value 10,5,1 and do not load value of sphere 0,0,0. (I can't find to a way to dynamicly change the attr who is link to slider by using scriptJob)

This exemple is about 2object but I can use it for 3, 10 ,100 so I can't use a -visible off....

Any idea to help me ?
(in other word a way to -edit -query dynamicly the value of an attrFieldSliderGrp).

Of course all in Mel not python.

Thanks a lot,
Mathieu 'Dryden' Laussel

ashishdantu
11-13-2007, 10:38 AM
hi dryden,

with attrFieldSliderGrp, i dont think its possible.. because this control needs to be linked to an object.attribute and i dont think this can be edited :( (i tried, crashed my maya !! :scream:)

but try this ??

proc ash()
{
string $s[]=`ls -sl`;
float $val =`floatSliderGrp -q -v sldr`;
scale 1 $val 1 $s[0];
}

string $window = `window -title "Will this work for u ?"`;
columnLayout;
floatSliderGrp -label "Scale Y" -field true
-value 0 -cc "ash()" -dc "ash()" sldr;
showWindow $window;

:rolleyes:

Dryden
11-13-2007, 11:11 AM
Thank's a lot !!!

That's exactly what I'm looking for, exept than if u change of selected object slider do not load selected object value, but as u say, I was thinking since few minutes than it can't be done using only mel.

So thank's a lot.

Moreover I'm looking for 'Skilled' (more than me...so everyone ? :p) Mel Dev to add in msn to help me to find quick help if I'm going another time in DevHell...

So if some of u are interested do not hesitate to add : Dryden_rog@msn.com.
I'm not sure I can ask for that in CGtalk, so if it's not authorized tell me and I edit this post.

Have a nice day & thx again ashishdantu ;)

ashishdantu
11-13-2007, 12:37 PM
hi dryden,


global proc ash()
{
string $s[]=`ls -sl`;
float $val =`floatSliderGrp -q -v sldr`;
scale 1 $val 1 $s[0];
}

global proc updateVal()
{
string $s[]=`ls -sl`;
float $newVal = `getAttr ($s[0]+".scaleY")`;
floatSliderGrp -e -v $newVal sldr;
}

string $window = `window -title "Will this work for u ?"`;
columnLayout;
floatSliderGrp -label "Scale Y" -field true
-value 0 -cc "ash()" -dc "ash()" sldr;
showWindow $window;

scriptJob -p $window -e "SelectionChanged" updateVal;
// this scriptjob shud update your slider on object selection change.

Dryden
11-13-2007, 12:47 PM
Thank's again, work perfectly, I will try to understand how u do now.

Damn I'm so noob, nothing in my code force me to use attrFieldSliderGrp really more clever to use a floatSliderGrp...

CGTalk Moderation
11-13-2007, 12:47 PM
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.