Implements Drag&Drop only for File Import Selection Window
This implements the most simple drag&drop. The only benefit is that the user does not need to navigate in the file selection window, but can drag a file from the native file browser and drop it into the file selection window.
The Import Operator has already been selected by the user.
The user still can modify the import options before the file is imported to Blender
It is not a true drag&drop into canvas as proposed in the task.
But maybe its a begin
I am unsure if this is correct, because the operator already opened the file selection window, so calling it again may be is not the proper way? But i do not know for sure.
Its not certain that filepath is even available. There are directory only file selectors (File -> External Files -> Find Missing) for example.
This should instead check for directory and filepath properties, and set them if they're available.
Just access sfile->op->ot
Please keep style consistent.
I have 2 issues still:
- file_ops.c:1299 I tried to just return OPERATOR_FINISHED here. But then the dropped filepath is not shown in the file import window. So i do not know how to avoid calling the operator here.
- When i drop a file into the file import window when the Collada Importer is open, then the dropped file is directly imported into the scene. Is this because the Collada importer does not have its own invoke function? What should i do best to avoid the collada importer's direct import of a dropped file? I did not do anything here for now because this may become obsolete after my first issue is solved.
Think this is how (I think) it should work...
- Drop path onto file selector.
- access sfile->op, filepath / directory
- Set the property in place, rather than invoking again... This is important, since you may have changes a bunch of options already.
As an extra it could also select the path in the file browser (select multiple paths for dropping multiple files...) but this can be done after.
Found 2 odd things...
- Dropping a file into the browser doesn't refresh the file browser.
- Dropping a directory acts as if its a file (directory name shows up in the filename field).
Also calling this FILE_OT_import_activate is quite odd, since this doesnt import anything. Maybe best call it FILE_OT_filepath_drop ?
- Merge branch 'master' into arcpatch-D1322
- adjusted operator name to something more understandable
- adjusted an API change in the file selector calling function
This is work in progress still. The automatic screen update after drop does not work at the moment, this needs more checking.
I am happy with this version. However there is one pitfall still:
Assume the user has enabled a file extension filter.
Now the user drops a file to the file browser with a different file extension.
The File browser switches to the new directory as intended.
The file is displayed in the filename field as expected
But the file is not visible in the file browser (because the extension filter hides it)
This might be confusing.
imho there are 3 solutions:
1.) Disable filter when filter is enabled but file with different extension is dropped
2.) Reject file when filter is enabled and file with wrong extension is dropped
3.) do nothing, just keep this as a "feature not a bug"