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.
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 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?
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.
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.