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: 

Import character as refrence

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
jayantbhatt07
555 Views, 6 Replies

Import character as refrence

Hi guys this is my command to import the charater but I want this character as a reference rather than import. Any idea?

Refrence cmd -

  1. file -reference "C:/mystuff/wilma.mb";
 
 
 
global proc UE4_Man_Scale()
 
{
string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
file -import $file_Path;
}
6 REPLIES 6
Message 2 of 7

Hi,

Try this...

global proc UE4_Man_Scale()
{
    string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
    file -r -type "mayaAscii"  -ignoreVersion $file_Path;
}
Message 3 of 7

Yes this working thank you so much. I have one doubt I assigned this procedure to the button (as a command) but  when I click on the ( button1 ) it is refrencing that character. Is that possible when I again hit that button it should remove the refrenced character using any alternate key (like holding alt + Button1) or (ctrl + button1).

 

To remove the refrence - - -  The command is ( -removeReference(-rr) )

 

SEE THE COMMAND _ _ _ _

 

{
// create a window
window;
// define the layout of controls added
// to the window.
columnLayout;
// create a couple of buttons
button -label "button1" -c "UE4_Man_Scale()";

// show the window we last created
showWindow;;
}

 

// It will import your character as a refrence

UE4_Man_Scale();

global proc UE4_Man_Scale()
{
string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
file -r -type "mayaAscii" -ignoreVersion $file_Path;
}

Message 4 of 7

Hi,

Try this....

global proc UE4_Man_Scale()
 
{
    string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
    string $rsRefQry[] = `file -q -r`;
    string $rsRefFile[];
    int $rsCont;
    for($i=0;$i<size($rsRefQry);$i++)
    {
        $rsRefFile[$i] = `referenceQuery -f -shn $rsRefQry[$i]`;
    }
    for($j=0;$j<size($rsRefQry);$j++)
    {
        if($rsRefFile[$j]=="Unreal_Character_Scale.ma")
        {
            $rsCont += 1;
        }
    }
    if($rsCont==0)
    {
        file -r -type "mayaAscii"  -ignoreVersion $file_Path;
    }
    else
    {
        file -rr $file_Path;
    }
}
Message 5 of 7
Message 6 of 7

And on more thing If I press any button in the keyboard and left mouse button it is removing the reference which I don't want. ex ( F + LMB ) removing the reference. 

Message 7 of 7

Finally Figured it out thank you so much man here is the final command

 

// final

 

 

{
// create a window
window -title "Nut" -menuBar true -w 220 -h 200 "";
// define the layout of controls added
// to the window.
columnLayout;
// create a collapsible frame layout
frameLayout -collapsable true -label "Nuts";

// add the other controls
flowLayout -columnSpacing 1 -w 220 -h 30;

// create six symbol buttons with related mel command

symbolButton -image "commandButton.png" -command "Character()";

setParent ..;
// show the window we last created
showWindow;
}

 

 

global proc Character()
{
string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
int $mods = `getModifiers`;
print ("Modifiers are:");

int $getModifierPressed = `getModifiers`;
if ( $getModifierPressed == 0)
{
string $file_Path = (`internalVar -userPrefDir`) + "icons/3D_Ghost_Script/Unreal_Character_Scale.ma";
file -r -type "mayaAscii" -ignoreVersion $file_Path;
}

//If I PRESSED SHIFT IT WILL IMPORT CHARACTER

if (($mods / 1) % 2)

{
file -rr $file_Path;
}

//If I PRESSED CTRL IT WILL IMPORT CHARACTER


if (($mods / 4) % 2)

{
file -ir $file_Path;

}


}

 

 

// if you want to use alt then here is the command I'm writing this so it would  be benefit for other users

 

if (($mods / 😎 % 2) print (" Alt");

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report