AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 288 forks source link

Introduce a Way to search for a Component before adding it to a GameObject. #637

Closed ChristianGreiner closed 6 years ago

ChristianGreiner commented 6 years ago

At the moment is quite annoying when you want to add a new component via the context menu, especially when you have a "big project structure"...

Here is an example: image

So it would be nice if you could search for a specific component instead of clicking through the context menu. Here is an example: image by Unity

We could reuse this dialog by @BobGneu for this propose. image

So what do you say?

ilexp commented 6 years ago

Looks like an overdue usability improvement 👍 Let's say we go with the pop-up dialog variant, how would you trigger the dialog?

I think the dialog itself will need a small upgrade to allow searching for component types, rather than components, but shouldn't be too big of a stretch.

ChristianGreiner commented 6 years ago

One way to trigger the dialog could be a button on the right hand side (red button)?

image

mfep commented 6 years ago

Just a little addition: I'd be happy to see that in the Add new GameObject context menu as well

ilexp commented 6 years ago

One way to trigger the dialog could be a button on the right hand side (red button)?

Sounds good. We could extend this even further:

Three ways to reach the new dialog should be good enough and fit most situations. We won't need all of them, would be fine to have just one initially, but could add the other two later. Easiest / fastest one implementation wise might be the Scene View menu item, though not the one with the highest usability.

As a side note for the implementation, all three will need to account for multi-selection of objects.

JordanMunroe commented 6 years ago

Would it not be better to add components to the Project View under a read-only folder similar to the Default one? It would all be neatly organized by namespace and the filter functionality is already there. Then you could drag a component onto the inspector or an object in the scene view to add it to the selected object.

ilexp commented 6 years ago

Would it not be better to add components to the Project View under a read-only folder similar to the Default one?

Hmm, wouldn't agree in that regard.

In a way, you have a point - there's already dragdrop from the Project View to Scene and Camera view to create things, so why not just add a folder for component types? However, the Project View currently deals with Resources only, and there is a clarity in that distinction that I think is worth keeping.

deanljohnson commented 6 years ago

Is anyone actually working on this? If not I'll start looking into it.

ilexp commented 6 years ago

@deanljohnson Nope, this is currently up for grabs. I'll assign you 👍

deanljohnson commented 6 years ago

You can see the branch I am working on here.

I've implemented both styles of buttons within the GameObject editing panel: image

I haven't figured out yet how to remove the "Actions" header on the bottom button but I'll keep looking into that.

I've implemented this by adding a new option to ObjectRefSelectionDialog which causes the dialog to select types rather than instances. This is a bit counter to the naming of the dialog, but it was so easy to hijack the dialog for this I went with that. Should we rename ObjectRefSelectionDialog if this implementation sticks?

ToDo

ilexp commented 6 years ago

I've implemented both styles of buttons within the GameObject editing panel:

Awesome 🙂

I haven't figured out yet how to remove the "Actions" header on the bottom button but I'll keep looking into that.

Check out the Hints property of PropertyEditor, it has a way of telling its parent editor whether it wants to be displayed with a name, or use the full space for content. Not 100% sure if that's it already, but could be.

I've implemented this by adding a new option to ObjectRefSelectionDialog which causes the dialog to select types rather than instances.

Nice work 👍 For the gray-ish part, can we rename the Path column to Origin or something similar, so it works for both resource paths and full type names? Also, check out the GetTypeCSCodeName extension method, it will give you a string representation that matches what you'd write in C#, and without the assembly name and version.

Should we rename ObjectRefSelectionDialog if this implementation sticks?

Sounds good, do it. It's a nice general-purpose use case, actually, and the dialog provides common functionality such as filtering and convenient keyboard input. Could be just "that dialog" to select a thing from a list of things.

ilexp commented 6 years ago

Done by @deanljohnson and merged back to master. Release will follow soon. Closing this.

ilexp commented 6 years ago

Release in progress. Should be out there in about 15 minutes.