Search in sources :

Example 1 with AssetFileDroppedEvent

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;
}
Also used : AssetFileDroppedEvent(com.talosvfx.talos.editor.notifications.events.AssetFileDroppedEvent) IProject(com.talosvfx.talos.editor.project.IProject)

Example 2 with AssetFileDroppedEvent

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

Aggregations

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