Skip to content

Instantly share code, notes, and snippets.

@Nat3Turner
Forked from Meatplowz/performFileDropAction.mel
Last active June 28, 2023 14:18
Show Gist options
  • Select an option

  • Save Nat3Turner/b5029d9649b742f3cd34a24e5f94abf3 to your computer and use it in GitHub Desktop.

Select an option

Save Nat3Turner/b5029d9649b742f3cd34a24e5f94abf3 to your computer and use it in GitHub Desktop.

Revisions

  1. Nat3Turner revised this gist Jun 27, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -20,11 +20,11 @@ performFileDropAction (string $theFile)
    }
    else if ($response == $open)
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    global string $gOperationMode;
    string $save_gOperationMode = $gOperationMode;
    $gOperationMode = "Open";
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    $gOperationMode = $save_gOperationMode;
    return ($result);
    }
    else if ($response == $import)
  2. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 2 additions and 30 deletions.
    32 changes: 2 additions & 30 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -1,37 +1,9 @@
    // Copyright (C) 1997-2014 Autodesk, Inc., and/or its licensors.
    // All rights reserved.
    //
    // The coded instructions, statements, computer programs, and/or related
    // material (collectively the "Data") in these files contain unpublished
    // information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
    // which is protected by U.S. and Canadian federal copyright law and by
    // international treaties.
    //
    // The Data is provided for use exclusively by You. You have the right to use,
    // modify, and incorporate this Data into other products for purposes authorized
    // by the Autodesk software license agreement, without fee.
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
    // DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
    // INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
    // MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE
    // OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
    // LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
    // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
    // LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.

    //
    //
    // Creation Date: June 25, 2012
    //
    // Description:
    // performFileDropAction, helper function to import dropped files
    //
    //
    // Randall Hess randall.hess@gmail.com
    // Instructions: Copy this file over your local maya version to override the default behavior
    // Additional: You can also build and load this as a module and not overwrite the local maya file.

    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others
    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others\performFileDropAction.mel


    global proc int
    performFileDropAction (string $theFile)
  3. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -52,8 +52,8 @@ performFileDropAction (string $theFile)
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    else if ($response == $import)
    {
  4. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 5 additions and 15 deletions.
    20 changes: 5 additions & 15 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -36,9 +36,7 @@
    global proc int
    performFileDropAction (string $theFile)
    {
    string $msg = "Would you like to Import, Open or Reference the file?";
    string $save_msg = "Would you like to Save your current File?";
    string $save = "Save"
    string $msg = "Would you like to Import, Open or Reference the file?";
    string $import = "Import";
    string $open = "Open";
    string $reference = "Reference";
    @@ -53,21 +51,13 @@ performFileDropAction (string $theFile)
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = catch(performFileAction ($theFile, 1, ""));
    if ($result == 0)
    {
    file -force -open $theFile;
    return (1);
    }
    else
    {
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    else if ($response == $import)
    {
    file -import -mergeNamespacesOnClash false -namespace (basenameEx($theFile)) $theFile ;
    file -import -namespace (basenameEx($theFile)) $theFile ;
    return(1);
    }
    else if ($response == $reference)
  5. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 16 additions and 2 deletions.
    18 changes: 16 additions & 2 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,8 @@ global proc int
    performFileDropAction (string $theFile)
    {
    string $msg = "Would you like to Import, Open or Reference the file?";
    string $save_msg = "Would you like to Save your current File?";
    string $save = "Save"
    string $import = "Import";
    string $open = "Open";
    string $reference = "Reference";
    @@ -48,8 +50,20 @@ performFileDropAction (string $theFile)
    }
    else if ($response == $open)
    {
    file -force -open $theFile;
    return (1);
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = catch(performFileAction ($theFile, 1, ""));
    if ($result == 0)
    {
    file -force -open $theFile;
    return (1);
    }
    else
    {
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    }
    else if ($response == $import)
    {
  6. @Meatplowz Meatplowz revised this gist Aug 20, 2018. No changes.
  7. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,7 @@ performFileDropAction (string $theFile)
    }
    else if ($response == $open)
    {
    catch(file -force -open $theFile);
    file -force -open $theFile;
    return (1);
    }
    else if ($response == $import)
  8. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 3 additions and 10 deletions.
    13 changes: 3 additions & 10 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -47,16 +47,9 @@ performFileDropAction (string $theFile)
    return(1);
    }
    else if ($response == $open)
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = catch(performFileAction ($theFile, 1, ""));
    $gv_operationMode = $save_gv_operationMode;
    if $result == 0:
    file -force -open $theFile;
    return (1);
    return ($result);
    {
    catch(file -force -open $theFile);
    return (1);
    }
    else if ($response == $import)
    {
  9. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,8 @@
    //
    // Randall Hess randall.hess@gmail.com
    // Instructions: Copy this file over your local maya version to override the default behavior
    // Additional: You can also build and load this as a module and not overwrite the local maya file.

    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others

    global proc int
  10. @Meatplowz Meatplowz revised this gist Aug 20, 2018. 1 changed file with 10 additions and 3 deletions.
    13 changes: 10 additions & 3 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -45,9 +45,16 @@ performFileDropAction (string $theFile)
    return(1);
    }
    else if ($response == $open)
    {
    file -open $theFile;
    return (1);
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = catch(performFileAction ($theFile, 1, ""));
    $gv_operationMode = $save_gv_operationMode;
    if $result == 0:
    file -force -open $theFile;
    return (1);
    return ($result);
    }
    else if ($response == $import)
    {
  11. @Meatplowz Meatplowz revised this gist Aug 19, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,8 @@ performFileDropAction (string $theFile)
    }
    else if ($response == $import)
    {
    return( performFileImportAction( $theFile ) );
    file -import -mergeNamespacesOnClash false -namespace (basenameEx($theFile)) $theFile ;
    return(1);
    }
    else if ($response == $reference)
    {
  12. @Meatplowz Meatplowz revised this gist Aug 19, 2018. 1 changed file with 3 additions and 7 deletions.
    10 changes: 3 additions & 7 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -38,20 +38,16 @@ performFileDropAction (string $theFile)
    string $import = "Import";
    string $open = "Open";
    string $reference = "Reference";
    string $cancel = (uiRes("m_containerTemplateBrowser.kConfirmCancel"));
    string $cancel = "Cancel";
    string $response = `confirmDialog -message $msg -button $import -button $open -button $reference -button $cancel -defaultButton $cancel`;
    if ($response == $cancel)
    {
    return(1);
    }
    else if ($response == $open)
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    file -open $theFile;
    return (1);
    }
    else if ($response == $import)
    {
  13. @Meatplowz Meatplowz revised this gist Aug 19, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ performFileDropAction (string $theFile)
    }
    else if ($response == $reference)
    {
    file -reference $theFile;
    file -reference -namespace (basenameEx($theFile)) $theFile ;
    return(1);
    }

  14. @Meatplowz Meatplowz revised this gist Aug 16, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ performFileDropAction (string $theFile)
    return(1);
    }
    else if ($response == $open)
    {
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
  15. @Meatplowz Meatplowz revised this gist Aug 16, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,7 @@ performFileDropAction (string $theFile)
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    }
    else if ($response == $import)
    {
    return( performFileImportAction( $theFile ) );
  16. @Meatplowz Meatplowz revised this gist Aug 16, 2018. 1 changed file with 12 additions and 6 deletions.
    18 changes: 12 additions & 6 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -26,19 +26,20 @@
    // Description:
    // performFileDropAction, helper function to import dropped files
    //

    // Randall Hess randall.hess@gmail.com
    // Instructions: Copy this file over your local maya version to override the default behavior
    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others
    //
    // Randall Hess randall.hess@gmail.com
    // Instructions: Copy this file over your local maya version to override the default behavior
    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others

    global proc int
    performFileDropAction (string $theFile)
    {
    string $msg = "Would you like to Import or Open the file?";
    string $msg = "Would you like to Import, Open or Reference the file?";
    string $import = "Import";
    string $open = "Open";
    string $reference = "Reference";
    string $cancel = (uiRes("m_containerTemplateBrowser.kConfirmCancel"));
    string $response = `confirmDialog -message $msg -button $import -button $open -button $cancel -defaultButton $cancel`;
    string $response = `confirmDialog -message $msg -button $import -button $open -button $reference -button $cancel -defaultButton $cancel`;
    if ($response == $cancel)
    {
    return(1);
    @@ -56,5 +57,10 @@ performFileDropAction (string $theFile)
    {
    return( performFileImportAction( $theFile ) );
    }
    else if ($response == $reference)
    {
    file -reference $theFile;
    return(1);
    }

    }
  17. @Meatplowz Meatplowz revised this gist Aug 16, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@
    global proc int
    performFileDropAction (string $theFile)
    {
    string $msg = "Would you like to Open or Import the file?";
    string $msg = "Would you like to Import or Open the file?";
    string $import = "Import";
    string $open = "Open";
    string $cancel = (uiRes("m_containerTemplateBrowser.kConfirmCancel"));
  18. @Meatplowz Meatplowz created this gist Aug 16, 2018.
    60 changes: 60 additions & 0 deletions performFileDropAction.mel
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    // Copyright (C) 1997-2014 Autodesk, Inc., and/or its licensors.
    // All rights reserved.
    //
    // The coded instructions, statements, computer programs, and/or related
    // material (collectively the "Data") in these files contain unpublished
    // information proprietary to Autodesk, Inc. ("Autodesk") and/or its licensors,
    // which is protected by U.S. and Canadian federal copyright law and by
    // international treaties.
    //
    // The Data is provided for use exclusively by You. You have the right to use,
    // modify, and incorporate this Data into other products for purposes authorized
    // by the Autodesk software license agreement, without fee.
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. AUTODESK
    // DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES
    // INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF NON-INFRINGEMENT,
    // MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE
    // OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS
    // LICENSORS BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL,
    // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS
    // LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.

    //
    //
    // Creation Date: June 25, 2012
    //
    // Description:
    // performFileDropAction, helper function to import dropped files
    //

    // Randall Hess randall.hess@gmail.com
    // Instructions: Copy this file over your local maya version to override the default behavior
    // Location: C:\Program Files\Autodesk\MayaXX\scripts\others

    global proc int
    performFileDropAction (string $theFile)
    {
    string $msg = "Would you like to Open or Import the file?";
    string $import = "Import";
    string $open = "Open";
    string $cancel = (uiRes("m_containerTemplateBrowser.kConfirmCancel"));
    string $response = `confirmDialog -message $msg -button $import -button $open -button $cancel -defaultButton $cancel`;
    if ($response == $cancel)
    {
    return(1);
    }
    else if ($response == $open)
    {
    global string $gv_operationMode;
    string $save_gv_operationMode = $gv_operationMode;
    $gv_operationMode = "Open";
    int $result = performFileAction ($theFile, 1, "");
    $gv_operationMode = $save_gv_operationMode;
    return ($result);
    }
    else if ($response == $import)
    {
    return( performFileImportAction( $theFile ) );
    }

    }