Help with MEL (noobhere)

Help with MEL (noobhere)

gabbriel.buenaventura
Observer Observer
558 Views
1 Reply
Message 1 of 2

Help with MEL (noobhere)

gabbriel.buenaventura
Observer
Observer

Hi! I'm basically new to MEL scripting. I'm trying to figure out how to connect the intslidergrp to my variables as an adjuster. No idea what I'm doing or what I've done wrong, the lecturer just told us to make an UI script and now I'm here. Any help would really be appreciated! Here's my script. 

 

global proc cubeconeUI ()
{window;
columnLayout;

intSliderGrp $count -label "Slide Me" -int field true;-fieldMinValue -50 -fieldMaxValue 50 -minValue -10 -maxValue 10 -value 0;
intSliderGrp $distance -label "Limits" -int field true -fieldMinValue -50 -fieldMaxValue 50 -minValue -10 -maxValue 10 -value 0;
button -label "Create" -c ("cubecone") -w 70;
showWindow;
}
proc cubecone (int $count,int $distance)
{
string $groupList[0];
for ($i = 0; $i < $count; $i++)
{
string $cube[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
xform -t 0 1.047089 0 -s 1.80978 1.80978 1.80978 $cube[0];
string $cone[] = `polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
move -r 0 3.129135 0 $cone[0] ;
select -r $cube[0] $cone[0];
string $groupName = `group`;
xform -t 0 ($distance*$i) 0 -ro 0 (30*$i) 0;;

}
}

0 Likes
559 Views
1 Reply
Reply (1)
Message 2 of 2

jmreinhart
Advisor
Advisor
global proc cubeconeUI ()
{
    //create the window
    window;
    //create the layout
    columnLayout;
    //create the slider and store the name of the slider
    $count_slider = `intSliderGrp -label "Slide Me" -field true -fieldMinValue -50 -fieldMaxValue 50 -minValue -10 -maxValue 10 -value 0`;
    $distance_slider = `intSliderGrp -label "Limits" -field true -fieldMinValue -50 -fieldMaxValue 50 -minValue -10 -maxValue 10 -value 0`;
    //create the button
    //the command for th button will query the values from the sliders and call the cubeCone function
    button -label "Create" -c ("cubecone(`intSliderGrp -q - v \"" + $count_slider + "\"`,`intSliderGrp -q - v \"" + $distance_slider + "\"`);") -w 70;
    showWindow;
}

proc cubecone (int $count,int $distance)
{
    string $groupList[0];
    for ($i = 0; $i < $count; $i++)
    {
        string $cube[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
        xform -t 0 1.047089 0 -s 1.80978 1.80978 1.80978 $cube[0];
        string $cone[] = `polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
        move -r 0 3.129135 0 $cone[0] ;
        select -r $cube[0] $cone[0];
        string $groupName = `group`;
        xform -t 0 ($distance*$i) 0 -ro 0 (30*$i) 0;;
    }
}

cubeconeUI()
0 Likes