Search in sources :

Example 1 with IAddon

use of com.talosvfx.talos.editor.addons.IAddon 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);
    }
}
Also used : IAddon(com.talosvfx.talos.editor.addons.IAddon) FileHandle(com.badlogic.gdx.files.FileHandle) AssetFileDroppedEvent(com.talosvfx.talos.editor.notifications.events.AssetFileDroppedEvent)

Aggregations

FileHandle (com.badlogic.gdx.files.FileHandle)1 IAddon (com.talosvfx.talos.editor.addons.IAddon)1 AssetFileDroppedEvent (com.talosvfx.talos.editor.notifications.events.AssetFileDroppedEvent)1