[Bf-blender-cvs] [71966f856fa] sybren-usd: USD: simplified nested condition in USDAbstractWriter::write()

Sybren A. Stüvel noreply at git.blender.org
Thu Jul 25 15:42:01 CEST 2019


Commit: 71966f856fabfc44210663eb0ac820e676fbb192
Author: Sybren A. Stüvel
Date:   Thu Jul 25 14:48:02 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB71966f856fabfc44210663eb0ac820e676fbb192

USD: simplified nested condition in USDAbstractWriter::write()

By flipping a condition the code became much simpler.

No functional changes.

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

M	source/blender/usd/intern/usd_writer_abstract.cc

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

diff --git a/source/blender/usd/intern/usd_writer_abstract.cc b/source/blender/usd/intern/usd_writer_abstract.cc
index 4b5724e6ba2..c7c2496ea33 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -43,14 +43,13 @@ pxr::UsdTimeCode USDAbstractWriter::get_export_time_code() const
 
 void USDAbstractWriter::write(HierarchyContext &context)
 {
-  if (frame_has_been_written_) {
-    if (!is_animated_) {
-      return;
-    }
-  }
-  else {
+  if (!frame_has_been_written_) {
     is_animated_ = export_params.export_animation && check_is_animated(context);
   }
+  else if (!is_animated_) {
+    /* A frame has alrady been written, and without animation one frame is enough. */
+    return;
+  }
 
   do_write(context);



More information about the Bf-blender-cvs mailing list