← All ideas
  • Published 22 Feb 2022

List Selected function.

Maya has a basic utility function ( 'ls -sl' = List Selected ) for returning a list of what is currently selected. It is mode-less and context-less and the list is there for the script-writer to then manipulate, investigate, and generally use for further functions.

Blender feels more than a bit incomplete without a basic utility function of this nature.

[edit:] I have been exploring the Scripting for Artists videos created by dr. Sybren A. Stüvel . One of the most powerful suggestions (and I am surprised this is not sitting at the top of the scripting documentation), is to enable Python Tool Tips in the Blender preferences.

This literally allows me to poke everything and to see the resulting Python command associated. This covers much of the functionality desired in using ls -ls in conjunction with the Maya MEL/Python docs, but has the added benefit of keeping everything at one level of interaction.

71.4%

Development Status: Open

Upvote 5 Downvote 2
AmbientSpace
22 Feb 2022

6 Comments

testure

Blender can have multiple scenes, of which there can be multiple view layers- all having their own selection states. Without context, what would your expected result be, out of curiosity? What happens when a user is in one view layer, selects a vertex, then switches to another and selects something different. When you 'query selected' without any context you would get both results, which will almost certainly contradict one another.

1
AmbientSpace Author

As a utility function I would expect a list of all selected items/components to be returned as a result. This is commonly used by developers in Maya to identify what object and components are selected in a handy list for further use in scripting.

I would expect contextless results to indicate the layer, object/material/vertex/port/anything in a tidy list.

If the result appears to be contradictory, then that's my problem to sort out as part of my development process. I have been spoiled rotten by Maya offering this as a standard utility function and I don't know how to proceed without it.

I want to poke things and have an easy way to know what I've just clicked on so I can use it in my scripting development process.

Lauloque

Then add flags to specify how deep to go with the query.

1
campbell

Could you write a proof of concept API call that works how you expect? Without this it's difficult to know what your asking for exactly.

campbell

Would this only work for objects? Or other kinds of selections too?

Blender relies on context quite a lot - so to request contextless selection access - doesn't fit with the way Blender works. See longer reply here: devtalk.blender.org/t/17817/43

FreeMind

Can already be done in the outliner.