[Bf-blender-cvs] [d209629806a] master: Fix T85729: Crash when exporting for USD and Alembic

Sonny Campbell noreply at git.blender.org
Tue Jun 14 12:32:20 CEST 2022


Commit: d209629806aa8c3cd688082027ac5e8f6fefc206
Author: Sonny Campbell
Date:   Tue Jun 14 12:16:40 2022 +0200
Branches: master
https://developer.blender.org/rBd209629806aa8c3cd688082027ac5e8f6fefc206

Fix T85729: Crash when exporting for USD and Alembic

Ensure the "null" node graph, which is the root node of the export
graph, always exists.

The crash occured when "Use Settings For" was set to Render, "Visible
Objects Only" was ticked, and a single parent object is in the scene but
disabled for render.

Because the only object attached to the root of the project was disabled
for export, there was no "null" root node added to the export graph.
This change will always add an empty "null" node with no children to the
graph at the start. Other objects will get added to its children as
required.

Reviewed By: sybren

Maniphest Tasks: T85729

Differential Revision: https://developer.blender.org/D15182

===================================================================

M	source/blender/io/common/intern/abstract_hierarchy_iterator.cc

===================================================================

diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index 82bb1c57833..1fbddc45964 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -267,6 +267,11 @@ void AbstractHierarchyIterator::export_graph_construct()
 {
   Scene *scene = DEG_get_evaluated_scene(depsgraph_);
 
+  /* Add a "null" root node with no children immediately for the case where the top-most node in
+   * the scene is not being exported and a root node otherwise wouldn't get added. */
+  ExportGraph::key_type root_node_id = ObjectIdentifier::for_real_object(nullptr);
+  export_graph_[root_node_id] = ExportChildren();
+
   DEG_OBJECT_ITER_BEGIN (depsgraph_,
                          object,
                          DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |



More information about the Bf-blender-cvs mailing list