Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mel Import Command Documentation?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1045 Views, 2 Replies

Mel Import Command Documentation?

Hi Guys,

i would like to open the import window with mel.

So far so good. It works with just "Import;"

Now i would like to open that window with a specific folder and a selected File Filter.

But there is no documentation. The Import Command is not documentated, but it exists.

Anyone knows?

 

Cheers

Sebastian

Tags (3)
2 REPLIES 2
Message 2 of 3
clemensF4NFT
in reply to: Anonymous

Sebastian,

Import is a runtime command as you can see by typing

whatIs Import;

It executes the projectViewer command as you can find out by typing

runTimeCommand -q -command Import;

You can look into the projectViewer script that resides here:

whatIs projectViewer;

The Import portion of this script can be configured only by setting the defaultFileImportType option variable
and by setting the working directory.
But the projectViewer script configures the fileDialog2 itself.
So the most flexible approach is to configure fileDialog2, too, like projectViewer does but with your own values.
After calling the dialog you have to run the same lines of code like in projectViewer.mel.
In the end your custom import script might look like this:

preCheckColorManagement();
string $myImportFolder = "/my/predefined/import/folder";
string $file[] = `fileDialog2 -returnFilter 1 -caption "Import" -fileMode 1 -okCaption "Import"
 -optionsUICreate "fileOperationsOptionsUISetup Import"
 -optionsUIInit "fileOperationsOptionsUIInitValues Import"
 -selectionChanged "fileOperationsSelectionChangedCallback Import"
 -optionsUICommit2 "fileOperationsOptionsUICallback Import"
 -fileTypeChanged "setCurrentFileTypeOption Import"
 -fileFilter "Maya Scenes (*.ma *.mb)"
 -selectFileFilter "Maya Scenes"
 -startingDirectory $myImportFolder
 -optionsUICancel "fileOptionsCancel"`;
int $len = size($file);
if( $len > 0 && $file[0] != "" )
{
    string $path = fromNativePath($file[0]);
    string $type = filterDescriptionToFileType($file[$len-1]);
    eval ("performFileAction \"" + $path + "\" Import \"" + $type + "\"");
}
checkForUnknownNodes();
checkColorManagementMissingColorSpaces();

All best wishes

Clemens

Message 3 of 3
Anonymous
in reply to: clemensF4NFT

Meanwhile i have made another solution with filedialog2 and file -import.

Meanwhile i know what runtime commands are and that is much more complex than just doing some mel commands.

I will try your solution and thanks for the detailed explanation.

 

cheers

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report