global string $unityMenuName = "UnityFbxForMaya";
global string $unityMenuDivider = "UnityFbxForMayaDivider";
global string $unityMenuLabel = "Unity";
global string $unityMenuInsertAfter = "exportActiveFileOptions";

global string $unityImportIconPath = "import.png";
global string $unityExportIconPath = "export.png";
global string $unityIconPath = "unity.png";

global string $unityFamilyLabel = "The UnityFbxForMaya () plugin allows you to reliably exchange and review your work between Maya and Unity.";
global string $unityImportLabel = "Import an FBX file from a Unity project and auto-configure for exporting";
global string $unityExportModelLabel = "Export Model to Unity";
global string $unityExportAnimLabel = "Export Animation to Unity";
global string $unityExportModelAnimLabel = "Export Model and Animation to Unity in a single file";
global string $unityCreateExportSetLabel = "Setup an export set containing the current selection for simple one click export";

global string $unityCommandsFile = "unityCommands.mel";
global string $unityImportMenuName = "Import";
global string $unityExportModelMenuName = "Export Model Only";
global string $unityExportAnimMenuName = "Export Animation Only";
global string $unityExportModelAnimMenuName = "Export";
global string $unityCreateExportSetMenuName = "Create Export Set";

global string $unityImportCommand = "unityImport";
global string $unityExportModelCommand = "unityExportModel";
global string $unityExportAnimCommand = "unityExportAnim";
global string $unityExportModelAnimCommand = "unityExportModelAnim";
global string $unityCreateExportSetCommand = "unityCreateExportSet";

global proc string unityWhatsNewVersion(){
    return `about -q -version`;

}

global proc unitySetupUI(){
    global string $unityCommandsFile;
    $isHeadless = `optionVar -q "UnityFbxForMaya_Headless"`;
    if($isHeadless){
        // headless install, don't add UI
        return;
    }    
    
    eval ("source " + $unityCommandsFile);
    loadUnityDependencies();

    evalDeferred -lowestPriority "unityInstallUI";
}

global proc unityInstallUI(){
    global string $unityMenuName;
    global string $unityMenuDivider;
    global string $unityMenuLabel;
    global string $unityMenuInsertAfter;

    global string $unityImportIconPath;
    global string $unityExportIconPath;
    global string $unityIconPath;

    global string $unityPluginVersion;
    global string $unityFamilyLabel;
    global string $unityImportLabel;
    global string $unityExportModelLabel;
    global string $unityExportAnimLabel;
    global string $unityExportModelAnimLabel;
    global string $unityCreateExportSetLabel;
    global string $unityCommandsFile;
    global string $unityImportMenuName;
    global string $unityExportModelMenuName;
    global string $unityExportAnimMenuName;
    global string $unityExportModelAnimMenuName;
    global string $unityCreateExportSetMenuName;
    global string $unityImportCommand;
    global string $unityExportModelCommand;
    global string $unityExportAnimCommand;
    global string $unityExportModelAnimCommand;
    global string $unityCreateExportSetCommand;
    
    global string $gMainFileMenu;
    
    buildFileMenu;
    $parentMenu = $gMainFileMenu;
    $pluginVersion = unityWhatsNewVersion();
    eval ("source " + $unityCommandsFile);
    menuItem -parent $parentMenu -insertAfter $unityMenuInsertAfter -divider true -longDivider false -version $pluginVersion $unityMenuDivider;
    menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
    menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;

    menuItem -parent $unityMenuName -label $unityExportModelAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelAnimLabel -command $unityExportModelAnimCommand;
    menuItem -parent $unityMenuName -label $unityExportModelMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelLabel -command $unityExportModelCommand;
    menuItem -parent $unityMenuName -label $unityExportAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportAnimLabel -command $unityExportAnimCommand;
    
    menuItem -parent $unityMenuName -label $unityCreateExportSetMenuName -version $pluginVersion -annotation $unityCreateExportSetLabel -command $unityCreateExportSetCommand;
    
    unityRemoveNativeMenuOnLoad(); 

}
