editor icon indicating copy to clipboard operation
editor copied to clipboard

Make it easier to select entity parents from the viewport

Open yaustar opened this issue 3 years ago • 13 comments

It's not an uncommon pattern where the selectable mesh in the viewport is the child of an entity that holds the logic or is considered the root of an 'object'.

A good example is template instances where users tend to want to move the template root around the scene rather than the child mesh(es).

Currently it's a tedious task to select the mesh in the 3D view, move to the hierarchy view to find the parent entity to select and move and then back to 3D view. Especially if selection is lost.

This is going to be more of an issue as we enable Import Hierarchy by default as all models will be templates.

PlayCanvas Editor Plus 'solved' this by adding an 'UP' button to select the parent:

https://user-images.githubusercontent.com/16639049/132704256-233b874b-9c72-4c9b-9d46-f53dc9906e40.mp4

Other suggestions have been:

  • If it's part of a template, select the root of template instead
  • Having a right click context menu of some sort that lists all the parents
  • Being able to group an entity child chain (that can be temp broken by double clicking)
  • Shortcut keys to move up the hierarchy
  • Double click on a mesh to select it's parent (and that can be continued ad infinite to walk up the parents)

yaustar avatar Sep 09 '21 14:09 yaustar

  • Having a right click context menu of some sort that lists all the parents

This is a good method, that I've seen in similar context in other places.

Anything that will fiddle with common selection, might appear as magical and not intended by user, so will frustrate.

Explicit system with making selection group - is a way, but should be easy to toggle on/off.

Maksims avatar Sep 09 '21 14:09 Maksims

I remember we had this discussion in some other thread.. or probably I'm remembering wrong. Anyhow, I would add here that one of the options would be to allow to "lock" selection. Similar to how you have layers in Photoshop, where you control which one you select/modify when clicking the viewport by locking a layer or control. Perhaps an entity could have a selection lock - then you can't select it or any of its children via viewport.

LeXXik avatar Sep 09 '21 17:09 LeXXik

I've been told that Unity have something like this: https://docs.unity3d.com/ScriptReference/SelectionBaseAttribute.html

It looks like a 'hack' as it's an attribute that needs to be added to a script but maybe we can add something like this to the Entity inspector and highlight it in an obvious way in the hierarchy viewer?

yaustar avatar Sep 13 '21 08:09 yaustar

There's a classic, 'group' and 'ungroup' that Google presentations/draw and other programs do that could work well as it's familiar feature?

yaustar avatar Jul 25 '22 11:07 yaustar

In the meantime, I've made my own editor tools for this 😬 https://github.com/yaustar/yaustar.github.io/tree/master/playcanvas-editor-api-tools#hierarchy-menu

yaustar avatar Jul 25 '22 11:07 yaustar

Had a conversation with a client and after some thought, as a default it would seem to be okay to select the template root of the mesh that is picked by default and requiring a double click to actual select the entity that the mesh belongs to.

This could even be an Editor setting to have this behaviour?

@jiajasper What do you think about this?

yaustar avatar Aug 16 '22 10:08 yaustar

I think this is definitely a desired UX! so all good on my end! @yaustar

jiajasper avatar Aug 16 '22 13:08 jiajasper

Could it be possible to add a boolean "primary" checkbox for entities, or to select the nearest template in the hierarchy instead of always selecting the last child? It's quite frustrating and annoying to click intending to move one entity and then realize the wrong one was selected.

ScriptArtist avatar Apr 09 '24 15:04 ScriptArtist

Yeah, I've been thinking about adding this to my own Editor Plugin toolset somehow 🤔 I have the following currently

yaustar avatar Apr 10 '24 09:04 yaustar

Some potential UX I would suggest for this task: have a keyboard button that would select a parent from a current selection. It would it will only take in account first selected entity (to avoid multi-selection complexity). So you would be able to select anything, not break current behavior and have flexibility to select up.

Maksims avatar Apr 10 '24 10:04 Maksims

One of the issues for me in the current flow is that I just don't notice that I am moving a child, instead of a parent. I am carefully positioning a few entities to the correct places, only to find out that I was moving children, instead of their parents, and have to redo the positioning again. I don't know, if it is possible, but perhaps some visual cue would help to recognize that I am working with a child. Like some breakcrumbs over the selected item or something.

LeXXik avatar Apr 10 '24 10:04 LeXXik

One of the issues for me in the current flow is that I just don't notice that I am moving a child, instead of a parent. I am carefully positioning a few entities to the correct places, only to find out that I was moving children, instead of their parents, and have to redo the positioning again. I don't know, if it is possible, but perhaps some visual cue would help to recognize that I am working with a child. Like some breakcrumbs over the selected item or something.

When you select an entity via viewport, it is highlighted and focused in the hierarchy tree view, so you straight away see your hierarchy you are familiar with, and if there would be a single button to select a parent, you could press it.

Currently P - is not used, it would be simple.

Here is a small script you can implement via extensions, or paste it in Editor console to test:

window.addEventListener('keydown', (evt) => {
    if (evt.keyCode === 80 && editor.selection?.item?.parent) {
        editor.selection.set([ editor.selection.item.parent ]);
    }
})

Of course it is naive implementation, e.g. we would need to check if any input is focused to ignore that hotkey.

Maksims avatar Apr 10 '24 13:04 Maksims

I agree with LeXXik, it is not always obvious what you selected because you will select it, see the move gizmos and start moving it as the viewport is what I'm focusing on, not the hierarchy tree panel

That said, I'm not sure what the 'best' solution here is but the way that Unity allows you to define what should be selected if a child of it is selected seems to be more controllable/configurable to me (but still feels hacky)

yaustar avatar Apr 11 '24 12:04 yaustar