Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.cpp
void AttachmentsWindow::dropEvent(QDropEvent* event)
    {
        // check if we dropped any files to the application
        const QMimeData* mimeData = event->mimeData();
        if (mimeData->hasUrls())
        {
            // read out the dropped file names
            const QList<QUrl> urls = mimeData->urls();

            // clear the drop filenames
            m_dropFileNames.clear();
            m_dropFileNames.reserve(urls.count());

            // get the number of urls and iterate over them
            AZStd::string filename;
            AZStd::string extension;
            const int numUrls = urls.count();
            for (int i = 0; i < numUrls; ++i)
            {
                // get the complete file name and extract the extension
                filename = urls[i].toLocalFile().toUtf8().data();
                AzFramework::StringFunc::Path::GetExtension(filename.c_str(), extension, false /* include dot */);

                if (extension == "actor")
                {
                    m_dropFileNames.push_back(filename);
                }
            }

            // get the number of dropped sound files
            if (m_dropFileNames.empty())
            {
                MCore::LogWarning("Drag and drop failed. No valid actor file dropped.");
            }
            else
            {
                // create the import context menu
                QMenu menu(this);

                QAction* attachmentAction   = menu.addAction("Open Regular Attachment");
                QAction* deformableAction   = menu.addAction("Open Skin Attachment");
                menu.addSeparator();
                /*QAction* cancelAction     =*/menu.addAction("Cancel");

                connect(attachmentAction, &QAction::triggered, this, &AttachmentsWindow::OnDroppedAttachmentsActors);
                connect(deformableAction, &QAction::triggered, this, &AttachmentsWindow::OnDroppedDeformableActors);

                // show the menu at the given position
                menu.exec(mapToGlobal(event->pos()));
            }
        }

        event->acceptProposedAction();
    }
// when dropping stuff in our window
when dropping stuff in our window
when dropping stuff in our window
void AttachmentsWindow::dropEvent(QDropEvent* event)
    {
        const QMimeData* mimeData = event->mimeData();
        if (mimeData->hasUrls())
        {
            const QList<QUrl> urls = mimeData->urls();
            m_dropFileNames.clear();
            m_dropFileNames.reserve(urls.count());
            AZStd::string filename;
            AZStd::string extension;
            const int numUrls = urls.count();
            for (int i = 0; i < numUrls; ++i)
            {
                filename = urls[i].toLocalFile().toUtf8().data();
                AzFramework::StringFunc::Path::GetExtension(filename.c_str(), extension, false );
                if (extension == "actor")
                {
                    m_dropFileNames.push_back(filename);
                }
            }
            if (m_dropFileNames.empty())
            {
                MCore::LogWarning("Drag and drop failed. No valid actor file dropped.");
            }
            else
            {
                QMenu menu(this);
                QAction* attachmentAction   = menu.addAction("Open Regular Attachment");
                QAction* deformableAction   = menu.addAction("Open Skin Attachment");
                menu.addSeparator();
                menu.addAction("Cancel");
                connect(attachmentAction, &QAction::triggered, this, &AttachmentsWindow::OnDroppedAttachmentsActors);
                connect(deformableAction, &QAction::triggered, this, &AttachmentsWindow::OnDroppedDeformableActors);
                menu.exec(mapToGlobal(event->pos()));
            }
        }
        event->acceptProposedAction();
    }
void AttachmentsWindow :: dropEvent ( QDropEvent * event ) { const QMimeData * mimeData = event -> mimeData ( ) ; if ( mimeData -> hasUrls ( ) ) { const QList < QUrl > urls = mimeData -> urls ( ) ; m_dropFileNames . clear ( ) ; m_dropFileNames . reserve ( urls . count ( ) ) ; AZStd :: string filename ; AZStd :: string extension ; const int numUrls = urls . count ( ) ; for ( int i = 0 ; i < numUrls ; ++ i ) { filename = urls [ i ] . toLocalFile ( ) . toUtf8 ( ) . data ( ) ; AzFramework :: StringFunc :: Path :: GetExtension ( filename . c_str ( ) , extension , false ) ; if ( extension == " " ) { m_dropFileNames . push_back ( filename ) ; } } if ( m_dropFileNames . empty ( ) ) { MCore :: LogWarning ( " " ) ; } else { QMenu menu ( this ) ; QAction * attachmentAction = menu . addAction ( " " ) ; QAction * deformableAction = menu . addAction ( " " ) ; menu . addSeparator ( ) ; menu . addAction ( " " ) ; connect ( attachmentAction , & QAction :: triggered , this , & AttachmentsWindow :: OnDroppedAttachmentsActors ) ; connect ( deformableAction , & QAction :: triggered , this , & AttachmentsWindow :: OnDroppedDeformableActors ) ; menu . exec ( mapToGlobal ( event -> pos ( ) ) ) ; } } event -> acceptProposedAction ( ) ; }
when dropping stuff in our window
when dropping stuff in our window
// check if we dropped any files to the application // read out the dropped file names // clear the drop filenames // get the number of urls and iterate over them // get the complete file name and extract the extension /* include dot */ // get the number of dropped sound files // create the import context menu /*QAction* cancelAction     =*/ // show the menu at the given position