Highlight Collection when object is selected

Nonono, don’t do that :slight_smile: It’s not allowed to post screen caps from other softwares on devtalk.

Some copyright thing - https://devtalk.blender.org/t/copyright-guidelines-for-devtalk/17331.

There are a million things which have been solved elegantly and efficiently elsehwere, and it would be best to just show examples. I’m no lawyer though so I guess it’s best to play it safe.

Best thing we can do is talk about it and emphasize it’s importance. Child highlighting in collapsed hierarchies is used in every other software out there and it’s extremely off-putting to newcomers that finding objects in complicated scenes is a tedium.

1 Like

:astonished:
Ok I remove this link ASAP.
Thanks
sorry

It’s a recent rule, a lot of people aren’t aware.

Also, I think for ideas like these rightclickselect is the encouraged platform. Not sure which one is getting more developer attention.

For things like the outliner I think it’s about getting the general consent as far as UI changes go. It was planned to look at this for GSOC last year but I think there was an agreement that there are too many highlight types.

It’s kind of like leaving off the left indicator of a car cause we have too many lights already. :slight_smile:

1 Like

No copyright

4 Likes

I think where this might have gotten messy is selected vs active object highlighting, as well as object data selection in the outliner.

For example:

  • if you have a linked material on several objects in several collections, would selecting the material highlight the collection and if so, which one?
  • how would we distinguish between the current parent highlighting for object data and the new collection highlighting?
  • how can we distinguish between selected and active in the same context?
  • what about collapsed object hierarchies or rigs? Would it highlight the parent or just the collection?

I mockup would help, but I’m also not sure what happens under the hood when something is selected.

Anyway, before putting too much energy into this I’d ask @natecraddock if it’s worth pursuing this at all or if the decision is pretty much set in stone for now?

Hi, @dan2, I don’t know if I understand all you considerations because I’m a new Blender user and my english is ok for a Brazillian.

Comparing with C4D again (sorry).
" if you have a linked material on several objects in several collections, would selecting the material highlight the collection and if so, which one?"
C4D Show a list of objects that using da same texture in texture manager and is possible 2x click in this list and highlight this object.

“how would we distinguish between the current parent highlighting for object data and the new collection highlighting?”
I think this problem is solved with Intensity of color(Orange I used) and Bold

“how can we distinguish between selected and active in the same context?”
Sorry I did not understand your point

“what about collapsed object hierarchies or rigs? Would it highlight the parent or just the collection?”
Probably both with de same idea color and Bold

My point is…
if you have a big scene with a car, lots of parts in different collections organized.
All collections are close
you make a selection in viewport > (wheels front)
has no indication which collection is. the result is mess
I don’t know if my object is in correct Collection.

@natecraddock What do you think about it?

Regards Fernando.

Blender has a concept of selected objects and active objects, which are different things. You can have objects selected with none of them being active, or multiple selected with 1 being the active one.

selection

It’s the same concept as first/last selected in Maya, Blender is just actively visualizing it which is nice.

On the other hand, it creates the need for yet another type of highlight so it’s clear that the highlighted parent or collection is not selected, it’s just containing an object which is.

I’d personally use the text highlighting for indicating the active state, and the dimmed row highlight could be reserved for the parent highlight.

1 Like

I have similar discussion here (and I recommend to use one thread to post about Outliner)

1 Like

How about change highlight color in different Outliners.
Outliner01 Orange
Outliner02 Green

1 Like

That would always be theme dependent. As long as it’s customizable I don’t mind at all. Anything is better than no highlight at all.

Alternatively I’d be fine with just highlighting the collection icon or the data icon thingie of the parent mesh, as long as that highlight color is exposed in the theme settings.

But to be honest I’m not sure what could be done to move this forward. There were a lot of suggestions already and there has clearly been a discussion where decisions were made. Sadly I’m not very hopeful that user feedback would move this particular issue forward (even if priorities would allow for it).

1 Like

And how about we are make this option. Is it possible?
How do I customize Blender Ui? Is it possible programming this highlight?

1 Like

Not sure about you but I’m good for basic Python, not much else in terms of programming.

If you look at Nathan’s commits you can get a sense of the logic for the outliner as well as look at examples.

If it was possible to do it as an addon I’m sure people would have done it, so I’m guessing it’d be working on the source code. Then it’s the journey of trying to get it into the master or using it as a branch, having to commit to maintain the whole thing…

If I was to dip my toes into this I would just modify that little highlighty square thing first, to be more prominent, maybe expose the color into the theme settings.

selectionHL

The way I see it the full row highlighting thing would not be super hard to code for someone who knows what they’re doing, but getting it through and approved would be a different story for sure.

Hi @dan2 I thinking in the same way like you.
Create an addon using the same highlight in your Screenshot.
Maybe in freetime, who knows.
Cross fingers.
Regards Fernando.

1 Like

Hi.
This issue was solved in Collection Manager.
Now it is possible to detect if collection is selectable, contain selection or is selected completely, and select the whole collection as well.

image

1 Like

Hi, sorry for delay.
How do I enable this option?
Best, Fernando.

If selection ability is not presented, probably it is too early and it will be available in further versions.

The only thing for me, it’s Switch Active Collection with hotkey.
I made this little addon for one person who asked for this feature.

Switch_Active_Collection_0_1_0.py
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

import bpy
bl_info = {
    "name": "Switch Active Collection",
    "location": "3D View / Outliner, (Hotkey Y)",
    "version": (0, 1, 0),
    "blender": (2, 90, 0),
    "description": "Switching active Collection to the active Object selected",
    "author": "APEC",
    "category": "Object",
}

#Recursivly transverse layer_collection for a particular name
def recurLayerCollection(layerColl, collName):
    found = None
    if (layerColl.name == collName):
        return layerColl
    for layer in layerColl.children:
        found = recurLayerCollection(layer, collName)
        if found:
            return found

class OUTLINER_OT_switch_collection(bpy.types.Operator):
    bl_idname = "outliner.switch_collection"
    bl_label = "Switch Collection"
    bl_options = {'REGISTER', 'UNDO'}

    @classmethod
    def poll(self, context):
        ar = context.screen.areas
        __class__.area = next(
            (a for a in ar if a.type == 'OUTLINER'), None)
        return __class__.area

    def execute(self, context):
        obj = bpy.context.object
        ucol = obj.users_collection

        #Switching active Collection to active Object selected
        for i in ucol:
            layer_collection = bpy.context.view_layer.layer_collection
            layerColl = recurLayerCollection(layer_collection, i.name)
            bpy.context.view_layer.active_layer_collection = layerColl
        return {'FINISHED'}


addon_keymaps = []


def register():
    bpy.utils.register_class(OUTLINER_OT_switch_collection)
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon.keymaps
    km = kc.get("Object Mode")
    if not km:
        km = kc.new("Object Mode")
    kmi = km.keymap_items.new("outliner.switch_collection", "Y", "PRESS")
    addon_keymaps.append((km, kmi))

    km = kc.get("Outliner")
    if not km:
        km = kc.new("Outliner", space_type="OUTLINER")
    kmi = km.keymap_items.new("outliner.switch_collection", "Y", "PRESS")
    addon_keymaps.append((km, kmi))


def unregister():
    bpy.utils.unregister_class(OUTLINER_OT_switch_collection)

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

it assigned for “Y” key, you can change it for any.

And yes, it need to every time hit it to make active collection. The active collection depend of active object selected. If you select multiple objects it make active only one collection which active object is highlighted.

Added:
Or this variant with icon in outliner header

Switch_Active_Collection_0_1_0.py
# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

import bpy
bl_info = {
    "name": "Switch Active Collection",
    "location": "3D View / Outliner, (Hotkey Y)",
    "version": (0, 1, 0),
    "blender": (2, 90, 0),
    "description": "Switching active Collection to the active Object selected",
    "author": "APEC",
    "category": "Object",
}

#Recursivly transverse layer_collection for a particular name
def recurLayerCollection(layerColl, collName):
    found = None
    if (layerColl.name == collName):
        return layerColl
    for layer in layerColl.children:
        found = recurLayerCollection(layer, collName)
        if found:
            return found

class OUTLINER_OT_switch_collection(bpy.types.Operator):
    """Switch Active Collection"""
    bl_idname = "outliner.switch_collection"
    bl_label = ""
    #bl_options = {'REGISTER', 'UNDO'}

    @classmethod
    def poll(self, context):
        ar = context.screen.areas
        __class__.area = next(
            (a for a in ar if a.type == 'OUTLINER'), None)
        return __class__.area

    def execute(self, context):
        obj = bpy.context.object
        ucol = obj.users_collection

        #Switching active Collection to active Object selected
        for i in ucol:
            layer_collection = bpy.context.view_layer.layer_collection
            layerColl = recurLayerCollection(layer_collection, i.name)
            bpy.context.view_layer.active_layer_collection = layerColl
        return {'FINISHED'}

def draw_sync_collection(self, context):
    self.layout.operator("outliner.switch_collection", icon="FILE_TICK")

addon_keymaps = []


def register():
    bpy.types.OUTLINER_HT_header.append(draw_sync_collection)
    
    bpy.utils.register_class(OUTLINER_OT_switch_collection)
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon.keymaps
    km = kc.get("Object Mode")
    if not km:
        km = kc.new("Object Mode")
    kmi = km.keymap_items.new("outliner.switch_collection", "Y", "PRESS")
    addon_keymaps.append((km, kmi))

    km = kc.get("Outliner")
    if not km:
        km = kc.new("Outliner", space_type="OUTLINER")
    kmi = km.keymap_items.new("outliner.switch_collection", "Y", "PRESS")
    addon_keymaps.append((km, kmi))


def unregister():
    bpy.types.OUTLINER_HT_header.remove(draw_sync_collection)
    
    bpy.utils.unregister_class(OUTLINER_OT_switch_collection)

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

SAC_0.1.0
icon can be changed to any you want here
self.layout.operator("outliner.switch_collection", icon="FILE_TICK")

3 Likes

There is also ability to set active collection in Collection Manager with buttons with collection icon.

1 Like

You can also download fresh CM version from there as a regular zip addon

1 Like

There is a new RCS propsal regarding child highlighting - https://blender.community/c/rightclickselect/qQXy/#

Maybe this time we have a bit more luck, perhaps due to the current UI overhaul work. Exposing it in the theme settings could be a compromise.

Not being able to clearly see selected objects in the outliner if inside a collapsed hierarchy is something that would need to be resolved sooner than later.