-
-
Save Meatplowz/376d7483d557c47f2ef8bdf3023fdf16 to your computer and use it in GitHub Desktop.
// Randall Hess [email protected] | |
// Instructions: Copy this file over your local maya version to override the default behavior | |
// Maya 2022 and Higher | |
// 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\performFileDropAction.mel | |
global proc int | |
performFileDropAction (string $theFile) | |
{ | |
string $msg = "Would you like to Import, Open or Reference the file?"; | |
string $import = "Import"; | |
string $open = "Open"; | |
string $reference = "Reference"; | |
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 $gOperationMode; | |
string $save_gOperationMode = $gOperationMode; | |
$gOperationMode = "Open"; | |
int $result = performFileAction ($theFile, 1, ""); | |
$gOperationMode = $save_gOperationMode; | |
return ($result); | |
} | |
else if ($response == $import) | |
{ | |
file -import -namespace (basenameEx($theFile)) $theFile ; | |
return(1); | |
} | |
else if ($response == $reference) | |
{ | |
file -reference -namespace (basenameEx($theFile)) $theFile ; | |
return(1); | |
} | |
} |
Oh, It works fine. Thanks so much.
Hi there, Love your script. I just got this problem. Whenever I have a scene open that has already been saved, and I drag a file in there. It will save my current open scene over the dragged in file. Making the dragged in file into the other file
Hi ! It works well for me for few files and the option " Import / Open / Reference / " stop as it should and always reference the file I drop in whatever the option I took ..., But it was nice when it worked. ;)
do yuou think it's possible to make a newer update to this mel so that the drag and drop will make Maya pops a window to let us choose the behaviour such as open or import or reference, etc
USE AT YOUR OWN RISK! However, let me know if there are any issues so that I can correct them.
do yuou think it's possible to make a newer update to this mel so that the drag and drop will make Maya pops a window to let us choose the behaviour such as open or import or reference, etc
Good morning Randall, been a long time! I forked, and made a small change to this that worked in my local Maya 2023. not sure how to do Maya version branching inside of MEL, so I could retain the old gv_operationMode variable. I just changed it in the fork.
https://gist.github.com/Nat3Turner/b5029d9649b742f3cd34a24e5f94abf3
Updated to reflect the latest Maya versions for now. Thanks Nate!
USE AT YOUR OWN RISK!
However, let me know if there are any issues so that I can correct them.