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 scripting > "TextureToGeometry"

0 REPLIES 0
Reply
Message 1 of 1
ymura_riat
81 Views, 0 Replies

MEL scripting > "TextureToGeometry"

Hi !

 

I would like to execute 'TextureToGeometry' using MEL script, but I am having trouble understanding how to specify the options.

In the GUI, I can select the input image by the file browser.

I want to achieve the same thing with MEL script.

 

The desired flow of my actions are as follows:

  1. Read obj files one by one from a folder.
  2. Select '_mt_MeshShape' and execute 'TextureToGeometry'. At this time, specify the .jpg file with the same name as the obj file as an texture image for 'TextureToGeometry' (I'm not sure about this part).
  3. Select the newly generated '_mt_0Mesh' from 'TextureToGeometry' and export it as an fbx file.

Any help will be greatly appreciated.

Thank you so much.

 

Here is my poor MEL script.

------------------------------------------------------------------------------------------

string $folderPath = "C:/Users/Username/Desktop/obj";
string $savePath = "C:/Users/Username/Desktop/fbx";
string $fileList[] = `getFileList -folder $folderPath -filespec "*.obj"`;
 
for ($file in $fileList) {
    
    string $objFile = ($folderPath + "/" + $file);
    file -import -type "OBJ" -ignoreVersion -ra true -mergeNamespacesOnClash false -options "mo=1" $objFile;
    select -r _mt_MeshShape;
    
    string $imgPath = ($folderPath + "/" + basename($file, ".obj") + "_0.jpg");
    textureToGeometry(); 
    
    select -r _mt_0Mesh;
    string $exportPath = ($savePath + "/" + basename($file, ".obj") + ".fbx");
    file -force -options "v=0;" -type "FBX export" -pr -ea ($exportPath);
    
    select -all;
    delete;
}
Tags (1)
Labels (3)
0 REPLIES 0

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

Post to forums