Home Coding, Scripting, Shaders

textFieldButtonGrp Maya #mel #button

polycounter lvl 5
Offline / Send Message
Pinned
jayantbhatt007 polycounter lvl 5

Hi, How can I use that browse button or assign command to the button, when I click on it, It should set the path? Any Idea

string $window = `window`;
columnLayout;
textFieldButtonGrp -label "path" -buttonLabel "Browse";
showWindow $window;

Replies

  • Tekoppar
    Options
    Offline / Send Message
    Tekoppar polycounter lvl 10
    Sorry if I misunderstand you, but I'm assuming you want it so you get a dialog window to browse for a path? If so you should use https://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Commands/show.html?fileDialog2.html&cat=System
  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
    Just messing around with the dialog it seems like not working.

    fileDialog2 -fileFilter "Maya ASCII (*.ma);)" -cap "Browse" -optionsUICreate "MyCustomOptionsUISetup";

    global proc MyCustomOptionsUISetup(string $parent)
    {
    setParent $parent;
    $parent = `scrollLayout -childResizable true`;

    // generate some UI which will show up in the options tab of the Maya file dialog
    columnLayout -adj true;
    iconTextRadioCollection itRadCollection;
    iconTextRadioButton -st "iconAndTextVertical" -i1 "sphere.png" -l "sphere" SphereIconButton;
    iconTextRadioButton -st "iconAndTextVertical" -i1 "cone.png" -l "cone" ConeIconButton;
    iconTextRadioButton -st "iconAndTextVertical" -i1 "cube.png" -l "cube" -select CubeIconButton;
    }
  • Tekoppar
    Options
    Offline / Send Message
    Tekoppar polycounter lvl 10
    Your filefilter is:
    Maya ASCII (*.ma);)
    When it should be, loose the extra )
    Maya ASCII (*.ma);
    Working example code:
    // a function to be called when the button gets clicked.<br>	proc func() {<br>		string $basicFilter = "Maya ASCII (*.ma);; Jpeg (*.jpeg *jpg);";<br>        string $result[] = `fileDialog2 -fileFilter $basicFilter -fileMode 2 -dialogStyle 1`;<br>        for ( $i = 0; $i < size($result); ++$i) {<br>            print($result[$i]);<br>        }<br>	}<br><br>	// create a window<br>	window;<br><br>		// define the layout of controls added <br>		// to the window.<br>		columnLayout;<br><br>			// create a button<br>			button -label "click me" -command "func";<br><br>	// show the window we last created<br>	showWindow;

  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
    Tekoppar said:
    Your filefilter is:
    Maya ASCII (*.ma);)
    When it should be, loose the extra )
    Maya ASCII (*.ma);
    Working example code:
    // a function to be called when the button gets clicked.<br>	proc func() {<br>		string $basicFilter = "Maya ASCII (*.ma);; Jpeg (*.jpeg *jpg);";<br>        string $result[] = `fileDialog2 -fileFilter $basicFilter -fileMode 2 -dialogStyle 1`;<br>        for ( $i = 0; $i < size($result); ++$i) {<br>            print($result[$i]);<br>        }<br>	}<br><br>	// create a window<br>	window;<br><br>		// define the layout of controls added <br>		// to the window.<br>		columnLayout;<br><br>			// create a button<br>			button -label "click me" -command "func";<br><br>	// show the window we last created<br>	showWindow;

    Hi thank you so much for your response I figured it out and another person helped me with that But still one small error is there it seems hard for me. Any Idea?

    ERROR     ( // Error: line 12: Flags must come before objects: -ed )

    { string $sn = `file -q -sn`;
    string $cfp = `dirname( $sn )`;

    if (`window -exists ScreenCapture`) //closes window if already open
    deleteUI ScreenCapture;

    window -title "ScreenCapture" ScreenCapture; //creates window

    rowColumnLayout -numberOfColumns 4 -columnAttach 1 "left" 0
    -columnWidth 1 40 -columnWidth 50 500;
    text -label "Path";
    textFieldButtonGrp -buttonLabel "Browse" -tx $cfp -bc rsFileDialog rsTxtFld -ed true filepath;
    button -w 60 -h 28 -label "Capture" -command "Capture";






    // show the window we last created
    showWindow;
    }

    proc rsFileDialog()

    {
    string $rsPath[] = `fileDialog2 -ds 1 -fm 3`;
    textFieldButtonGrp -e -tx $rsPath[0] rsTxtFld ;
    }


    global proc Capture()
    {

    string $path = `textField -q -tx filepath`;
    string $k = ($path + "/snapshot");
    string $ff = ".png";

    string $node[] = `ls -sl`;
    {

    setAttr "defaultRenderGlobals.imageFormat" 8;
    playblast -st 1 -et 1 -v 0 -fmt "image" -qlt 100 -p 100 -w 2000 -h 2000 -f $k;
    }

    clear $node;
    }
Sign In or Register to comment.