Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Add support to Editor Drag&Drop #268

Merged
merged 11 commits into from
Dec 1, 2021
Merged

Conversation

zhuxingwei
Copy link
Contributor

@zhuxingwei zhuxingwei commented Nov 26, 2021

This PR aims to add Drag&Drop support for UIWigetsEditorWindow, which enables features like:
(1) user can drag a Unity GameObject into a UIWigetsEditorWindow and drop it inside this window;
(2) user can drag any file from the OS (e.g., FileOpenDialog or Finder (on Mac)) into a UIWigetsEditorWindow and drop it inside this window;

This PR also modifies UIWidgets libraries.

How to Use:
(1) You need to use UIWidgetsEditorBinding to create the App in the main method of your UIWidgetsEditorPanel like:

protected override void main()
{
      editor_ui_.runEditorApp(new YourApp());
}

(2) The functionality is wrapped inside a widget: UnityObjectDetector, in which there are four callbacks that can be triggered when:
(A) dragging UnityObject or file to enter the widget; (B) dragging UnityObject or file to exit the widget; (C) dragging UnityObject or file and release it inside the widget; (D) dragging UnityObject or file and moving inside the widget

How to Test:
You can find a test sample in the Editor main menu under UIWidgets/EditorSample/UnityObjectDragging

@guanghuispark
Copy link
Contributor

Now that we have made this change, do we need to update the dll file?

@zhuxingwei
Copy link
Contributor Author

Now that we have made this change, do we need to update the dll file?

yes we do. I have updated the Mac library (Debug version) so that you can test the functionality on your Mac. I will update other libraries once this PR is approved

@zhuxingwei zhuxingwei changed the title [WIP] Add support to Editor Drag&Drop Add support to Editor Drag&Drop Dec 1, 2021
@zhuxingwei
Copy link
Contributor Author

Now that we have made this change, do we need to update the dll file?

yes we do. I have updated the Mac library (Debug version) so that you can test the functionality on your Mac. I will update other libraries once this PR is approved

all libraries are updated and tested

@zhuxingwei zhuxingwei merged commit e3b5991 into master Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants