Ctrl-G to Send Selection to New Collection

Edit: For now, better off using M in the 3d view for more options that don’t remove the objects from previous collections. Still works for now for collecting the selected objects in Outliner to a new group versus hitting the New Collection button and having to drag them into it.

I read a post of RCS that got my interest, and then realized the expected behavior doesn’t really do anything with Ctrl-G so I set up a simple legacy addon for a fix.

If anyone wants to make it work better, have at.
artistCDMJ/Selection2Collection: Hack to make it possible to use Ctrl-G to set the current selection to a new Collection (github.com)

3 Likes

Hi Craig. Thank you for creating this add-on.

I hope you don’t mind if I share the link of the Right-Click-Select suggestion: https://blender.community/c/rightclickselect/zBoq/?sorting=hot

Do you think it’s possible to implement in your add-on the following behavior? (selection of objects in the Outliner then a click on the “New collection icon” to create a new collection but with previously selected objects moving to that new collection):

I suppose I can try to add the operator to the existing UI with a poll like if len of selection is greater than 1, do this.

I’ll look at it, won’t hurt to try.

1 Like

I think that this should be the default behaviour for the COLLECTION_OT_create operator…

If you want I could try to make a PR with those changes…

I also thought in adding an option keep the links to their current collections, but don’t know if it’s really needed.

Edit, looking at the source code… got a new question… Should we remove the objects from every other collection? (as in, not allow two collections to share the same object?)

Where is the difference between this and pressing M key?
Can’t you just remap the shortcut and save preferences instead of registering one more add-on?

2 Likes

Totally forgotten we had that shortcut!

1 Like

I think it should be optional but I need to figure out how they already did that and emulate that.

At my level of coding experience, this is more of a proof of concept to see if I can do it at all without changing source code or preexisting scripts.

edit: I see where I have missed the mark - there are multiple ways to do this and M is the easiest to use and has more options, while Ctrl-G looks to be leftover from the Group operator and doesn’t do anything on its own anymore except here where I mapped it to a new operator to redundantly do the same thing that M offers.

The other request I got this morning looks like something I should look into to make happen with the button in the outliner.

        if display_mode == 'VIEW_LAYER':
            layout.operator("outliner.collection_new", text="", icon='COLLECTION_NEW').nested = True

I think that an opportunity for an improvement could be here with some logic, but I do think that the idea of completely removing them from previous collections should be optional.

Thanks all of you for responding, at least I know that it is something necessary even if I went aobut the wrong approach to solving it.

1 Like

See this change here - I have to do some work to get set up with a fork of blender to be able to do a PR to the source, but this is a temporary home for this change. I added the 'object.move_to_collection onto the same button if objects are selected, and of no selection it uses the ‘outliner.collection_new’ as before.

Selection2Collection/space_outliner.py at main · artistCDMJ/Selection2Collection (github.com)

I did a PR after jumping through some stuff to see what I needed. I hope it gets approved eventually.

2 Likes

Thank you so much @CDMJ for fixing this “UX annoyance”.

Here is a sneak peek of what this change does (for those who haven’t tested this new space_outliner.py file from CDMJ’s PR):

blender_V0Pe0ZX8Vw

And if no object is selected, the New Collection icon behaves like it does currently:
blender_Lp1bMMipi4

1 Like