Import External File - MEL?

Import External File - MEL?

jayantbhatt07
Advocate Advocate
2,683 Views
4 Replies
Message 1 of 5

Import External File - MEL?

jayantbhatt07
Advocate
Advocate

Hi guys I'm working on a script where I wanna import external file into my existing scene but as you can see in the screenshot my path is fine for me but if I upload this script on highend, user has to change the location which I don't want. I have seen script where people are using some other commands to import the file But I couldn't figured it out. LIKE THIS (

global proc string[] Character_scale () {

string $X = (`internalVar -userScriptDir`) + "scripts/3D_Ghost_Script/Files/UE4_Man_Scale.ma";


}    DON'T KNOW WHAT HE DID?

 

 

Any Help???

 

dsa.PNG

0 Likes
Accepted solutions (1)
2,684 Views
4 Replies
Replies (4)
Message 2 of 5

rajasekaransurjen
Collaborator
Collaborator
Accepted solution

Hi,

The following is the Default script folder path for Windows 

<user’s directory>/My Documents/Maya/<version>/scripts

We can query it with `internalVar -userScriptDir` command.

in my system the above code returns

 

internalVar -userScriptDir;
// Result: C:/Users/USER/Documents/maya/2019/scripts/ // 

in your system it will be 

internalVar -userScriptDir;
// Result: C:/Users/Jatant Bhatt/Documents/maya/2019/scripts/ // 

As per your screen shot.

 

So you can paste the "3D_Ghost_Script" in the above path.

 

global proc string[] Character_scale () 
{
string $X = (`internalVar -userScriptDir`) + "3D_Ghost_Script/Files/UE4_Man_Scale.ma";
} 
// In this above code the `internalVar -userScriptDir` will return C:/Users/Jatant Bhatt/Documents/maya/2019/scripts/
// You string concatenate the result with ""3D_Ghost_Script/Files/UE4_Man_Scale.ma"
// Now the string $X will have the complete file path.
// That is "C:/Users/Jatant Bhatt/Documents/maya/2019/scripts/3D_Ghost_Script/Files/UE4_Man_Scale.ma"
// So now you can use the $X to import the file UE4_Man_Scale.ma.

Please refer

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Maya-Env...

 

https://download.autodesk.com/us/maya/2009help/Commands/internalVar.html

 

 

0 Likes
Message 3 of 5

jayantbhatt07
Advocate
Advocate

Procedure is missing a return statement. I'm getting this error.

0 Likes
Message 4 of 5

jayantbhatt07
Advocate
Advocate

global proc string[] UE4_Man_Scale()
{
string $file_Path = (`internalVar -userScriptDir`) + "3D_Ghost_Script/UE4_Man_Scale.ma";
file -import $file_Path;
}

0 Likes
Message 5 of 5

jayantbhatt07
Advocate
Advocate

global proc UE4_Man_Scale()

{
string $file_Path = (`internalVar -userScriptDir`) + "3D_Ghost_Script/k.png";
file -import $file_Path;
}

0 Likes