-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57fd286
commit ba828ee
Showing
5 changed files
with
46 additions
and
38 deletions.
There are no files selected for viewing
11 changes: 2 additions & 9 deletions
11
src/OpenSimCreator/UI/MeshImporter/MeshImporterSharedState.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
#include "MeshImporterSharedState.h" | ||
|
||
#include <oscar/Platform/Event.h> | ||
#include <SDL_events.h> | ||
|
||
bool osc::mi::MeshImporterSharedState::onEvent(const Event& ev) | ||
{ | ||
const SDL_Event& e = ev; | ||
|
||
// if the user drags + drops a file into the window, assume it's a meshfile | ||
// and start loading it | ||
if (e.type == SDL_DROPFILE && e.drop.file != nullptr) | ||
{ | ||
m_DroppedFiles.emplace_back(e.drop.file); | ||
if (const auto* dropfile = dynamic_cast<const DropFileEvent*>(&ev)) { | ||
m_DroppedFiles.emplace_back(dropfile->path()); | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
#include "Event.h" | ||
|
||
#include <oscar/Utils/Assertions.h> | ||
|
||
#include <SDL_events.h> | ||
|
||
#include <memory> | ||
|
||
using namespace osc; | ||
|
||
osc::DropFileEvent::DropFileEvent(const SDL_Event& e) : | ||
Event{e}, | ||
path_{e.drop.file} | ||
{} | ||
|
||
std::unique_ptr<Event> osc::parse_into_event(const SDL_Event& e) | ||
{ | ||
return std::make_unique<RawEvent>(e); | ||
} | ||
if (e.type == SDL_DROPFILE and e.drop.file) { | ||
return std::make_unique<DropFileEvent>(e); | ||
} | ||
else { | ||
return std::make_unique<RawEvent>(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters