Collections.hide_viewport needs Visibility user interface #100786

Open
opened 2022-09-03 01:54:33 +02:00 by Kevin C. Burke · 11 comments
Contributor

System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94

Blender Version
Broken: version: 3.4.0 Alpha, branch: Timeline-Changes (modified), commit date: 2022-08-05 08:51, hash: 009e1324c9

Short description of error
Collection.hide_viewport disables a Collection without a Visibility user interface: an inconsistency with Objects.

Exact steps for others to reproduce the error
Objects whose visibility have been disabled by Python can be re-enabled from the Visibility panel:

cube = bpy.data.objects.get("Cube")
cube.hide_viewport = True

image.png

Collections do not:

import bpy
coll = bpy.data.collections.get("Collection")
coll.hide_viewport = True

image.png

In order to re-enable a collection disabled using hide_viewport, the user must context-click the Collection > Visibility > Enable in Viewports which is very confusing and inconsistent with Objects.

**System Information** Operating system: Windows-10-10.0.22000-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.94 **Blender Version** Broken: version: 3.4.0 Alpha, branch: Timeline-Changes (modified), commit date: 2022-08-05 08:51, hash: `009e1324c9` **Short description of error** [Collection.hide_viewport ](https://docs.blender.org/api/current/bpy.types.Collection.html#bpy.types.Collection.hide_viewport) disables a Collection without a Visibility user interface: an inconsistency with Objects. **Exact steps for others to reproduce the error** Objects whose visibility have been disabled by Python can be re-enabled from the Visibility panel: ``` cube = bpy.data.objects.get("Cube") cube.hide_viewport = True ``` ![image.png](https://archive.blender.org/developer/F13453453/image.png) Collections do not: ``` import bpy coll = bpy.data.collections.get("Collection") coll.hide_viewport = True ``` ![image.png](https://archive.blender.org/developer/F13453459/image.png) In order to re-enable a collection disabled using `hide_viewport`, the user must context-click the Collection > Visibility > Enable in Viewports which is very confusing and inconsistent with Objects.
Author
Contributor

Added subscriber: @KevinCBurke

Added subscriber: @KevinCBurke
Author
Contributor
No description provided.
Member
No description provided.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Pratik Borhade self-assigned this 2022-09-03 06:39:07 +02:00
Member

Following change would add a option in interface. But clicking on the options clears the selection flag for the collection. Not sure how to avoid this. Will look into it.

index 95debb259b0..08858e6caf5 100644
    - a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -43,6 +43,7 @@ class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel):
   col = layout.column(align=True)
   col.prop(collection, "hide_select", text="Selectable", toggle=False, invert_checkbox=True)
   col.prop(collection, "hide_render", toggle=False)
+        col.prop(collection, "hide_viewport", toggle=False)

   col = layout.column(align=True)
   col.prop(vlc, "holdout", toggle=False)```
Following change would add a option in interface. But clicking on the options clears the selection flag for the collection. Not sure how to avoid this. Will look into it. ```diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index 95debb259b0..08858e6caf5 100644 - a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -43,6 +43,7 @@ class COLLECTION_PT_collection_flags(CollectionButtonsPanel, Panel): ``` col = layout.column(align=True) col.prop(collection, "hide_select", text="Selectable", toggle=False, invert_checkbox=True) col.prop(collection, "hide_render", toggle=False) ``` + col.prop(collection, "hide_viewport", toggle=False) ``` col = layout.column(align=True) col.prop(vlc, "holdout", toggle=False)```
Author
Contributor
Perhaps this? https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_outliner/outliner_draw.cc$933
Member

No, that didn't fix the issue

No, that didn't fix the issue
Member

I think I found the cause.
In layer.c file, if collection is hidden or disabled, we set it's parent collection as "active collection"

LayerCollection *active = view_layer->active_collection;
if (active && layer_collection_hidden(view_layer, active)) {
BKE_layer_collection_activate_parent(view_layer, active);
}```

I don't understand the purpose to set it's parent collection as active. 
- - -
I'm seeing more inconsistency here:
- Suppose Col2 is parent of Col1. Select Col1 and set it as Hidden . Now collection properties tab will display Col2 as active but in outliner Col1 appears as active/selected
- Say "scene collection" is parent of Col1. Select and hide col1. Now "scene collection" will be our active collection. For them we don't display "Collection properties tab". see: `buttons_context_path_collection`. So we'll have col1 as active/selected in outliner but there won't be Collection properties tab
I think I found the cause. In `layer.c` file, if collection is hidden or disabled, we set it's parent collection as "active collection" ``` /* Always set a valid active collection. */ ``` LayerCollection *active = view_layer->active_collection; if (active && layer_collection_hidden(view_layer, active)) { BKE_layer_collection_activate_parent(view_layer, active); }``` ``` I don't understand the purpose to set it's parent collection as active. - - - I'm seeing more inconsistency here: - Suppose Col2 is parent of Col1. Select Col1 and set it as Hidden . Now collection properties tab will display Col2 as active but in outliner Col1 appears as active/selected - Say "scene collection" is parent of Col1. Select and hide col1. Now "scene collection" will be our active collection. For them we don't display "Collection properties tab". see: `buttons_context_path_collection`. So we'll have col1 as active/selected in outliner but there won't be Collection properties tab

Added subscriber: @1D_Inc

Added subscriber: @1D_Inc

The point of any active element is being user-defined, if active element is changed not by user, it is equal to "losing active element".

The point of any active element is being user-defined, if active element is changed not by user, it is equal to "losing active element".
Pratik Borhade removed their assignment 2022-12-31 05:14:52 +01:00
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:21:46 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#100786
No description provided.