depsgraph.object_instances does not respect collection visibility #74368

Open
opened 2020-03-02 14:23:10 +01:00 by Mikhail Rachinskiy · 16 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 860M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.48

Blender Version
Broken: version: 2.83 (sub 5), branch: master, commit date: 2020-02-26 22:33, hash: 1a1f2912e6
Worked: 2.80 release

Short description of error
Collection visibility (Hide in Viewport) does not affect object appearance in depsgraph.object_instances.
While hiding objects individually or excluding collection from view layer or Disable in Viewports does hide them from depsgraph.object_instances.

In 2.80 release collection visibility did affect depsgraph.object_instances.

Exact steps for others to reproduce the error

  • Open attached blend file: dep_visibility.blend
  • Run the script > console output lists all three objects.
  • Use collection Hide in Viewport visibility options and run script > console output has the same objects regardless of collection visibility state.
  • Use Hide in Viewport on an individual object > console output remose this individual object
**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 860M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.48 **Blender Version** Broken: version: 2.83 (sub 5), branch: master, commit date: 2020-02-26 22:33, hash: `1a1f2912e6` Worked: 2.80 release **Short description of error** Collection visibility (Hide in Viewport) does not affect object appearance in `depsgraph.object_instances`. While hiding objects individually or excluding collection from view layer or Disable in Viewports does hide them from `depsgraph.object_instances`. In 2.80 release collection visibility did affect `depsgraph.object_instances`. **Exact steps for others to reproduce the error** - Open attached blend file: [dep_visibility.blend](https://archive.blender.org/developer/F8383469/dep_visibility.blend) - Run the script > console output lists all three objects. - Use collection `Hide in Viewport` visibility options and run script > console output has the same objects regardless of collection visibility state. - Use `Hide in Viewport` on an individual object > console output remose this individual object
Author
Member

Added subscriber: @MikhailRachinskiy

Added subscriber: @MikhailRachinskiy

Added subscriber: @brecht

Added subscriber: @brecht

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
  • Hide in Viewport is not intended to remove it from this list, the object is hidden for display but still part of dependency graph evaluation, like modifiers or collision
  • Disable in Viewport works for me, it doesn't print any objects here.
* Hide in Viewport is not intended to remove it from this list, the object is hidden for display but still part of dependency graph evaluation, like modifiers or collision * Disable in Viewport works for me, it doesn't print any objects here.
Author
Member

But then why individually hidden objects are missing from depsgraph? Shouldn't there be a universally expected behaviour?

Currently behaviour is confusing: objects hidden individually are out of depsgraph, objects hidden by collection are appearing in depsgraph.

But then why individually hidden objects are missing from depsgraph? Shouldn't there be a universally expected behaviour? Currently behaviour is confusing: objects hidden individually are out of depsgraph, objects hidden by collection are appearing in depsgraph.

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Author
Member

Sorry I must have confused something while testing the issue, Collection Disable in Viewport option is in fact hides objects from depsgraph. The issue is only with Hide in Viewport option.
I edited task description to reflect this.

Sorry I must have confused something while testing the issue, Collection Disable in Viewport option is in fact hides objects from depsgraph. The issue is only with Hide in Viewport option. I edited task description to reflect this.
Member

Added subscribers: @dfelinto, @lichtwerk

Added subscribers: @dfelinto, @lichtwerk
Member

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

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

In #74368#883580, @brecht wrote:

  • Hide in Viewport is not intended to remove it from this list, the object is hidden for display but still part of dependency graph evaluation, like modifiers or collision

I would also argue that Hide in Viewport should not remove the object from the depsgraph.object_instances list.
The bug here seems to be the fact that if you hide an object individually [not the collection], the object gets indeed removed from the list (which is wrong I think)

CC @dfelinto

> In #74368#883580, @brecht wrote: > * Hide in Viewport is not intended to remove it from this list, the object is hidden for display but still part of dependency graph evaluation, like modifiers or collision I would also argue that `Hide in Viewport` should not remove the object from the `depsgraph.object_instances` list. The bug here seems to be the fact that if you hide an object **individually** [not the collection], the object gets indeed removed from the list (which is wrong I think) CC @dfelinto
Author
Member

I would argue that hidden objects should not be present in depsgraph.object_instances.

API documentation for depsgraph.object_instances says the following:

All object instances to display or render

Hidden objects (with Hide in Viewport) are not displayed, therefore they should not be in the list.
Just how it was in 2.80.

I would argue that hidden objects should not be present in `depsgraph.object_instances`. API documentation for [depsgraph.object_instances ](https://docs.blender.org/api/blender2.8/bpy.types.Depsgraph.html#bpy.types.Depsgraph.object_instances) says the following: > All object instances to display or render Hidden objects (with Hide in Viewport) are not displayed, therefore they should not be in the list. Just how it was in 2.80.

Changed status from 'Confirmed' to: 'Needs User Info'

Changed status from 'Confirmed' to: 'Needs User Info'

The difference between collections and objects is that you can view a collection that is disabled for viewports in a viewport, when using "Local Collections" option. The same is not true for objects.

@MikhailRachinskiy what are you trying to do exactly with the Python API?

The difference between collections and objects is that you can view a collection that is disabled for viewports in a viewport, when using "Local Collections" option. The same is not true for objects. @MikhailRachinskiy what are you trying to do exactly with the Python API?
Author
Member

I am trying to get a list of all visible objects and their instances.

I can use ob.visible_get() to know if object is visible to the user, but instances do not have this method, I cannot check their visibility.
With current system instances that are hidden to the user would still appear in this list.

I am trying to get a list of all visible objects and their instances. I can use `ob.visible_get()` to know if object is visible to the user, but instances do not have this method, I cannot check their visibility. With current system instances that are hidden to the user would still appear in this list.

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

I agree it would be better if the collections and objects behaved consistent here, also just to make it easier to write add-ons.

I wouldn't consider it a bug, but a known issue that would be good to address.

I agree it would be better if the collections and objects behaved consistent here, also just to make it easier to write add-ons. I wouldn't consider it a bug, but a known issue that would be good to address.
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:47:05 +01:00
Philipp Oeser added the
Interest
Core
label 2023-02-10 11:09:53 +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
4 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#74368
No description provided.