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

Maya Internal Procedures Broken..

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
max.kogan
496 Views, 3 Replies

Maya Internal Procedures Broken..

Hey guys,

 

I hope someone could help me out on this one as it's a really bizarre behavior on Maya's side.

Basically I have this simple batch file that has this inside it:


@Anonymous/R "C:\Users\Mark\Downloads\TestMaFiles" %%I in (*.ma) do maya -batch -file %%I -command "evalDeferred (\"soften_save;\")"

 

And this script inside the scripts folder named soften_save.mel:


global proc soften_save()
{
print("hey");
select -r mouth;
UnlockNormals;
PolygonSoftenEdge;
SaveScene;
}

When Maya is launched manually the scripts works great. But when run from the command line it doesnt

seem to know where to find it's own internal methods?! So I am getting these errors:
Error: Line 1: Cannot find procedure "SoftPolyEdgeElements".

Error: Line 1: Cannot find procedure "fileCmdCallback".

 

The print command shows up.

 

Any help on shedding light on what I might be missing would be awesome and much appreciated!

P.S -  I tried clearing my prefs to no avail. Using Maya 2020.

 

Tags (1)
Labels (1)
  • MEL
3 REPLIES 3
Message 2 of 4
max.kogan
in reply to: max.kogan

Oddly enough when I try this built-in Maya command it does work from the batch file:
ArchiveScene;

😕

Message 3 of 4
e_honda
in reply to: max.kogan

Hi,

 

As you wrote in your post, the problem is that those two procedures -SoftPolyEdgeElements and fileCmdCallback- are not defined.

So, why they are not defined and how you could know that?

 

The first step is: check what exactly you are trying to call.

running this MEL code, you'll get what SaveScene is.

whatIs SaveScene;
// Result: Run Time Command // 

https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/Commands/whatIs.html

The result is: Run Time Command. Well... it does not seems to help so much.

But you can call another piece of code that will show you what this run time command is.

runTimeCommand -query -command SaveScene;
// Result: fileCmdCallback; FileMenu_SaveItem; fileCmdRestoreCallback; //

https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/Commands/runTimeCommand.html

And now, we know what the run time command is. It is a command that executes three other procedures.

fileCmdCallback, FileMenu_SaveItem and fileCmdRestoreCallback.

And if you remember your error, it says:

Error: Line 1: Cannot find procedure "fileCmdCallback". 

So, naturally, you should think: "I must know what fileCmdCallback is". 

 

The steps are similar. Before aniything, call whatIs.

whatIs fileCmdCallback;
// Result: Mel procedure found in: C:/Program Files/Autodesk/Maya2020/scripts/startup/initAfter.mel // 

And now, you see that fileCmdCallback is a procedure defined in some MEL file.

You can check in that path and see yourself how things are written.

If you open the file, in the very beginning of it, you'll see its definition, which says:

// Description:
// This script is called after file open/new on startup to make
// sure that the UI construction went okay, and if not to clean up.

I'll not dive deep to explain every detail, but you can see that this MEL is trying to create/check UI.

So, this code is for an "normal manually launched Maya with UI" and should not work with a batch instance.

You should use file command, instead of the SaveScene command.

 

The same happens in the PolygonSoftenEdge command.

If you check the files and all the procedures inside, you'll see that it also requires an UI.

You should opt for using something like PolySoftEdge command instead.

 

Hope it helps

Message 4 of 4
max.kogan
in reply to: e_honda

@e_honda- Thanks a lot for putting in the time, this is much appreciated and definitely helps clear everything up!

Keep up the great work!

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

Post to forums  

Autodesk Design & Make Report