use of com.talosvfx.talos.editor.notifications.events.AssetFileDroppedEvent in project talos by rockbite.
the class ShaderAddon method projectFileDrop.
@Override
public boolean projectFileDrop(FileHandle handle) {
// a shader project should be loaded, but any other files go straight to modules
IProject currProjectType = TalosMain.Instance().ProjectController().getProject();
if (currProjectType == SHADER_PROJECT) {
AssetFileDroppedEvent event = Notifications.obtainEvent(AssetFileDroppedEvent.class);
event.setFileHandle(handle);
event.setScreenPos(Gdx.input.getX(), Gdx.input.getY());
Notifications.fireEvent(event);
}
return false;
}
use of com.talosvfx.talos.editor.notifications.events.AssetFileDroppedEvent in project talos by rockbite.
the class UIStage method fileDrop.
public void fileDrop(String[] paths, float x, float y) {
// let's see what this can mean by extension
for (String path : paths) {
FileHandle handle = Gdx.files.absolute(path);
if (handle.exists()) {
String extension = handle.extension();
if (extension.equals("tls") && TalosMain.Instance().ProjectController().getProject() != SceneEditorAddon.SE) {
// load project file
TalosMain.Instance().ProjectController().setProject(ProjectController.TLS);
TalosMain.Instance().ProjectController().loadProject(handle);
} else {
// notify talos first
if (TalosMain.Instance().ProjectController().getProject() == ProjectController.TLS) {
AssetFileDroppedEvent event = Notifications.obtainEvent(AssetFileDroppedEvent.class);
event.setFileHandle(handle);
event.setScreenPos(Gdx.input.getX(), Gdx.input.getY());
Notifications.fireEvent(event);
}
// ask addons if they are interested
IAddon addon = TalosMain.Instance().Addons().projectFileDrop(handle);
if (addon != null) {
continue;
}
}
}
}
if (previewWidget.getStage() != null) {
previewWidget.fileDrop(x, y, paths);
}
}
Aggregations