Blender Implements the ability to drag files onto the interface and have an operator called when the file is dropped on the interface. Depending on what is under the cursor one of these operators will be called:
The code for the available dropboxes can be found here:
source/blender/editors/space_view3d/space_view3d.c – view_3d_dropboxes(void) : void
Allow a python operator to define the functionality that is called when a file is dragged onto the interface. This exposes very intuitive functionality that can be used by Blender Add-on Developers. An example of this functionality can be found in the Fluid Designer project. In order to achieve this functionality in Fluid Designer we just forced a python operator to be called using this code:
PointerRNA ptr; WM_operator_properties_create(&ptr, "VIEW3D_OT_drag_and_drop"); RNA_string_set(&ptr, "filepath", ima->name); WM_operator_name_call(C, "VIEW3D_OT_drag_and_drop", WM_OP_INVOKE_REGION_WIN, &ptr); WM_operator_properties_free(&ptr);
How would the user know if two add-ons are subscribed to the drag and drop operator?
Is there a better way for an operator to subscribe to a drag and drop event? Maybe using the ‘bl_options’ property of an operator.