# Mel Script Directory Dialog

This topic is 3794 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've been able to pop up a directory dialog using Mel Script (using fileBrowserDialog with -m to specify directories only), but cannot figure out how to add the "New Folder" button. Does anyone know how to do enable this? Or is there another command I should be using? Thanks!

##### Share on other sites
interesting. Never moticed that myself. Anyhow, the source code for the basic fileBrowser (defines the lower level fileBrowser command) can be found in maya/scripts/others/fileBrowser.mel. Uhm, the best solution i can suggest is to modify that to add a new folder button i guess. The only problem i can see is that you may not be able to access the selected item in the tree view (since i'm assuming it's imported from C++ since mel doesn't have a tree view). However if you can find a way to get that, then you *should* be laughing.... (maybe).

##### Share on other sites
p.s. in answer to this question:

MItMeshPolygon has the following 2 methods:

MStatus numTriangles(int &count) const;MStatus getTriangle(int localTriIndex,MPointArray& points,MIntArray& vertexList, MSpace::Space space) const;

the returned vertexList array contains the vertex indices for the n'th triangle in this face. There will be a bit of hacking involved, but you can basically figure out how to re-map your normal & uv indices to the new triangle indices.

There is another dirtier way of doing it (the first method is better!). You can basically just call triangulate on all meshes in the scene. i.e.

MDgModifier mod;mod.commandToExecute("select -r ls -type mesh; polyTriangulate -ch 1;"); mod.doIt();// export mesh data// restore to previous state... mod.undoIt();

The problem with that is that Maya can mess around with the vertex normals, where as extracting Maya's triangulation data from the MItMeshPolygon will preserve the original normals. (i.e. create a basic poly cube, put into shaded mode, then triangulate. You'll notice the normals are now wrong).

##### Share on other sites
Thanks robthebloke. Briefly, I have a plugin that interfaces with a mel script. the mel script is for user input only. The plugin does all the heavy lifting. Here's what I tried for the file browser dialog and it worked: My mel script makes a call back in to my plugin which puts up the dialog the way I want. In my case, the mel script also needs to display the directory that was chosen in a text field, so my plugin has to hand the the chosen directory name back to the script. This turned out to be a pain because I found that when passing a string to a script (via a command with an argument), it fails if the string contains anything but alphanumerics. So a directory name with "\", "\\", etc just fails. I ended up writing the directory name to a file in the temp directory and passing it that way. It's convoluted, but it works.

For the triangulation, I've used the GetTriangle method and did the hacking for UV's, etc., and also handled the negative scale winding issue.

BTW, I've read through many of your tutorials and they've been very useful to me.

--iterator

• 33
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631352
• Total Posts
2999487
×