externalDropCallback/externalDropCallback.cpp
#include <maya/MIOStream.h>
#include <maya/MExternalDropCallback.h>
#include <maya/MExternalDropData.h>
#include <maya/MFnPlugin.h>
#include <maya/MGlobal.h>
#include <maya/MStringArray.h>
{
public:
{
std::cout << "externalDropCallback: " << doDrop << ", \"" << controlName << "\"" << std::endl;
std::cout <<
" hasText(): " << data.
hasText() <<
", \"" << data.
text() <<
"\"" << std::endl;
std::cout <<
" hasUrls(): " << data.
hasUrls();
for (
unsigned int i=0; i<urls.
length(); ++i )
std::cout << ", \"" << urls[i] << "\"";
std::cout << std::endl;
std::cout << " formats(): ";
for (
unsigned int i=0; i<formats.
length(); ++i )
std::cout << ", \"" << formats[i] << "\"";
std::cout << std::endl;
{
int result;
cmd = "shelfLayout -exists \"" + controlName + "\"";
if ( result )
{
{
if ( doDrop )
{
cmd = "scriptToShelf( \"" + name + "\", ";
cmd += "\"file -open \\\"" + url + "\\\"\"";
cmd += ", true )";
}
}
}
}
}
};
static ExampleExternalDropCallback* theCallback = NULL;
{
MFnPlugin plugin(obj, PLUGIN_COMPANY,
"1.0",
"Any");
theCallback = new ExampleExternalDropCallback;
return status;
}
{
delete theCallback;
theCallback = NULL;
return status;
}