USD Export Crash When Parent is disabled for rendering. #85729

Closed
opened 2021-02-17 09:43:49 +01:00 by Jeroen Bakker · 11 comments
Member

System Information
Operating system: Linux-5.4.0-65-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: AMD Radeon RX 5700 (NAVI10, DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0) X.Org 4.6 (Core Profile) Mesa 20.2.6

Blender Version
Broken:

  • version: 2.93.0 Alpha, branch: master, commit date: 2021-02-17 06:07, hash: 17dddc9417
  • 2.83.12

Worked: (newest version of Blender that worked as expected)

Short description of error
When exporting render and an object parent is disabled for rendering there it crashes during USD export.
usdtest.blend

Exact steps for others to reproduce the error

  • Add a cube
  • Add an empty
  • Disable empty for render
  • Set cube parent to empty
  • Export USD file (Make sure that 'Render' is selected for 'Use Settings for'

NOTE: Use Settings for Viewport will work, Alembic export works.

The source of the crash is in AbstractHierarchyIterator::connect_loose_objects:

      /* 'object->parent' will never be nullptr here, as the export graph contains the
       * root as nullptr and thus will cause a break above. */
      BLI_assert(object->parent != nullptr);

      object = object->parent;
**System Information** Operating system: Linux-5.4.0-65-generic-x86_64-with-glibc2.31 64 Bits Graphics card: AMD Radeon RX 5700 (NAVI10, DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0) X.Org 4.6 (Core Profile) Mesa 20.2.6 **Blender Version** Broken: * version: 2.93.0 Alpha, branch: master, commit date: 2021-02-17 06:07, hash: `17dddc9417` * 2.83.12 Worked: (newest version of Blender that worked as expected) **Short description of error** When exporting render and an object parent is disabled for rendering there it crashes during USD export. [usdtest.blend](https://archive.blender.org/developer/F9811621/usdtest.blend) **Exact steps for others to reproduce the error** * Add a cube * Add an empty * Disable empty for render * Set cube parent to empty * Export USD file (Make sure that 'Render' is selected for 'Use Settings for' NOTE: Use Settings for Viewport will work, Alembic export works. The source of the crash is in `AbstractHierarchyIterator::connect_loose_objects`: ``` /* 'object->parent' will never be nullptr here, as the export graph contains the * root as nullptr and thus will cause a break above. */ BLI_assert(object->parent != nullptr); object = object->parent; ```
Author
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Jeroen Bakker changed title from USD Export Crash When Parent is hidden disabled for rendering. to USD Export Crash When Parent is disabled for rendering. 2021-02-17 09:46:14 +01:00
Member

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

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

Added subscriber: @SonnyCampbell_Unity

Added subscriber: @SonnyCampbell_Unity
Member

I've tested this and it happens for both USD and Alembic.

By default, USD exports with the "Visible Only" flag ticked.

UsdExport.png

By default, Alembic exports with the "Visible Only" flag unticked.

AlembicExport.png

If you set "Use Settings For" to Render and "Visible Only" is ticked, it crashes both when exporting for USD and Alembic.

I've tested this and it happens for both USD and Alembic. By default, USD exports with the "Visible Only" flag ticked. ![UsdExport.png](https://archive.blender.org/developer/F13138151/UsdExport.png) By default, Alembic exports with the "Visible Only" flag unticked. ![AlembicExport.png](https://archive.blender.org/developer/F13138153/AlembicExport.png) If you set "Use Settings For" to Render and "Visible Only" is ticked, it crashes both when exporting for USD and Alembic.
Sonny Campbell self-assigned this 2022-06-13 12:28:53 +02:00
Member

This revision should fix the underlying crash raised in this bug. However I have a question about what the intended outcome is when exporting usd/alembic files.

If I set "Visible Only" and "Use Settings For" to Render, my assumption is that I should only export objects that are visible in a Render. If I disable a parent object for Render, and export the scene as in my screenshot here, should the Empty object be exported in my usd file? Currently it is being exported.

image.png

image.png

This revision should fix the underlying crash raised in this bug. However I have a question about what the intended outcome is when exporting usd/alembic files. If I set "Visible Only" and "Use Settings For" to Render, my assumption is that I should only export objects that are visible in a Render. If I disable a parent object for Render, and export the scene as in my screenshot here, should the Empty object be exported in my usd file? Currently it is being exported. ![image.png](https://archive.blender.org/developer/F13156441/image.png) ![image.png](https://archive.blender.org/developer/F13156443/image.png)

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Nice find!

In #85729#1373702, @SonnyCampbell_Unity wrote:
If I set "Visible Only" and "Use Settings For" to Render, my assumption is that I should only export objects that are visible in a Render. If I disable a parent object for Render, and export the scene as in my screenshot here, should the Empty object be exported in my usd file? Currently it is being exported.

Check the documentation for HierarchyIterator::weak_export:

/* When weak_export=true, the object will be exported only as transform, and only if is an

   * ancestor of an object with weak_export=false.
   *
   * In other words: when weak_export=true but this object has no children, or all descendants also
   * have weak_export=true, this object (and by recursive reasoning all its descendants) will be
   * excluded from the export.
   *
   * The export hierarchy is kept as close to the hierarchy in Blender as possible. As such, an
   * object that serves as a parent for another object, but which should NOT be exported itself, is
   * exported only as transform (i.e. as empty). This happens with objects that are part of a
   * holdout collection (which prevents them from being exported) but also parent of an exported
   * object. */

bool weak_export;

This means that the disabled parent will still be exported, but only as an Empty. Thus, testing this flow with Empties will hide some of the subtleties in the exporter.

Also I now see that the comment should be updated, the special handling of "holdout" collections was removed.

Nice find! > In #85729#1373702, @SonnyCampbell_Unity wrote: > If I set "Visible Only" and "Use Settings For" to Render, my assumption is that I should only export objects that are visible in a Render. If I disable a parent object for Render, and export the scene as in my screenshot here, should the Empty object be exported in my usd file? Currently it is being exported. Check the documentation for `HierarchyIterator::weak_export`: ```lang=c++ ``` /* When weak_export=true, the object will be exported only as transform, and only if is an ``` * ancestor of an object with weak_export=false. * * In other words: when weak_export=true but this object has no children, or all descendants also * have weak_export=true, this object (and by recursive reasoning all its descendants) will be * excluded from the export. * * The export hierarchy is kept as close to the hierarchy in Blender as possible. As such, an * object that serves as a parent for another object, but which should NOT be exported itself, is * exported only as transform (i.e. as empty). This happens with objects that are part of a * holdout collection (which prevents them from being exported) but also parent of an exported * object. */ ``` bool weak_export; ``` ``` This means that the disabled parent will still be exported, but only as an Empty. Thus, testing this flow with Empties will hide some of the subtleties in the exporter. Also I now see that the comment should be updated, the special handling of "holdout" collections was removed.
Member

Ok perfect, I missed that comment. That makes a lot of sense then, I also tested this with the usd_hierarchy_export_test.blend from the unit tests which has a more complex hierarchy of enabled/disabled objects, and that was where I first noticed it.

But yeah if that is expected then this should patch solve the crash. If you'd like I could update that comment to remove the line about the holdout collection too?

Ok perfect, I missed that comment. That makes a lot of sense then, I also tested this with the usd_hierarchy_export_test.blend from the unit tests which has a more complex hierarchy of enabled/disabled objects, and that was where I first noticed it. But yeah if that is expected then this should patch solve the crash. If you'd like I could update that comment to remove the line about the holdout collection too?

If you'd like I could update that comment to remove the line about the holdout collection too?

Thanks for the offer, but I've already done that ;-)

> If you'd like I could update that comment to remove the line about the holdout collection too? Thanks for the offer, but I've already done that ;-)

This issue was referenced by d209629806

This issue was referenced by d209629806aa8c3cd688082027ac5e8f6fefc206

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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
5 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#85729
No description provided.