Home Coding, Scripting, Shaders

Button work - MEL

polycounter lvl 5
Offline / Send Message
Pinned
jayantbhatt007 polycounter lvl 5
 Hi guys I'm working on a free script where it contains a lot of nut bolts but I'm having a problem while assigning the command to the button.  Actually when I click on this button it should create that nut bolt (as you can see in the screen shot) right now it's not doing anything. Check the command also.


  {
// create a window
window -title "jay" -menuBar true -w 220 -h 200 "jay";
// define the layout of controls added 
// to the window.
columnLayout;
// create a collapsible frame layout
    frameLayout -collapsable true -label "Nuts";
   
    // add the other controls
    flowLayout -columnSpacing 1 -w 220 -h 30;
   
        // create six symbol buttons with related mel command
   
    symbolButton -image "Nut.png" -command "donothing";
   
   
   
    setParent ..;
// show the window we last created
showWindow;;
  }



Replies

  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    Probably because it's literally set to "donothing" ?

    Try do -command "print 0"

    See if that does something. If it does then you probably just need to pass in a string that drives it all.

    It's been a long time since I touched mel so I can't help much more I'm afraid. But what you'd probably have to do, is register your commands to create your objects, IIRC you can just do this by putting the Mel script in the correct folder, so that when you type "nut1" into the console, it would run the script called "nut1.mel" in that directory. Then you can just pass "nut1" as your -command args.

    Unless this is what you're already doing, but honestly we'd need to see more of that in order to work out what's going on!
  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
      {
    // create a window
    window -title "jay" -menuBar true -w 220 -h 200 "";
    // define the layout of controls added 
    // to the window.
    columnLayout;
    // create a collapsible frame layout
        frameLayout -collapsable true -label "Nuts";
       
        // add the other controls
        flowLayout -columnSpacing 1 -w 220 -h 30;
       
            // create six symbol buttons with related mel command
       
        symbolButton -image "AS5.png" -command "sample_Proc";
       
       
       
        setParent ..;
    // show the window we last created
    showWindow;;
      }
      

    proc sample_Proc()
    {
        file -import "D:/test/dlt.ma";
    }


  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    think you need the brackets -command "sample_Proc()"
  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
      {
    // create a window
    window -title "jay" -menuBar true -w 220 -h 200 "";
    // define the layout of controls added 
    // to the window.
    columnLayout;
    // create a collapsible frame layout
        frameLayout -collapsable true -label "Nuts";
       
        // add the other controls
        flowLayout -columnSpacing 1 -w 220 -h 30;
       
            // create six symbol buttons with related mel command
       
        symbolButton -image "AS5.png" -command "sample_Proc";
        symbolButton -image "AS5.png" -command "btn_02";
       
       
       
        setParent ..;
    // show the window we last created
    showWindow;;
      }
      

    proc sample_Proc()
    {
        file -import "D:/Nut.ma";
    }


    proc btn_02()
    {
        file -import "D:/Nut.ma";
    }

  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
     {
    // create a window
    window -title "jay" -menuBar true -w 220 -h 200 "";
    // define the layout of controls added 
    // to the window.
    columnLayout;
    // create a collapsible frame layout
        frameLayout -collapsable true -label "Nuts";
       
        // add the other controls
        flowLayout -columnSpacing 1 -w 220 -h 30;
            symbolButton -image "AS5.png" -command "sample_Proc";
            symbolButton -image "AS5.png" -command "btn_02";
       setParent ..;
       button -l "Place" -c "place_OBJ()";
       
       setParent ..;
    // show the window we last created
    showWindow;;
    }

    proc place_OBJ()
    {
        select -tgl "nut_01";
        doCreatePointOnPolyConstraintArgList 2 {   "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
        select "nut_01_pointOnPolyConstraint1";
        delete;
        rename "nut_01" "nutPlaced_01";
    }  

    proc sample_Proc()
    {
        string $sel_faces[] = `ls -sl`;
        file -import "F:/Nut.ma";
        rename "Nut" "nut_01";
        
        select $sel_faces[0];
        select -tgl "nut_01";
        doCreatePointOnPolyConstraintArgList 2 {   "0" ,"0" ,"0" ,"1" ,"" ,"1" ,"0" ,"0" ,"0" ,"0" };
        select "nut_01_pointOnPolyConstraint1";
        delete;
        rename "nut_01" "nutPlaced_01";
    }


    proc btn_02()
    {
        file -import "F:/Nut.ma";
    }
Sign In or Register to comment.