[Bf-blender-cvs] [cfb6f028700] soc-2019-fast-io: [Fast import/export] Removed clang-format overrides

Hugo Sales noreply at git.blender.org
Fri Jun 28 18:45:12 CEST 2019


Commit: cfb6f028700cb5b2af95e248403d1e9ef9c34987
Author: Hugo Sales
Date:   Fri Jun 28 14:50:19 2019 +0100
Branches: soc-2019-fast-io
https://developer.blender.org/rBcfb6f028700cb5b2af95e248403d1e9ef9c34987

[Fast import/export] Removed clang-format overrides

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

M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/editors/io/intern/common.hpp
M	source/blender/editors/io/intern/iterators.hpp
M	source/blender/editors/io/intern/obj.cpp
M	source/blender/editors/io/io_common.c
M	source/tools

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

diff --git a/release/scripts/addons b/release/scripts/addons
index c43da5fa598..fcf7d4c16b1 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit c43da5fa598d590f7d386e1580125ead12cf1678
+Subproject commit fcf7d4c16b17c34579fc080386425e0774a502d2
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 5781362d811..97fa83e16f2 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 5781362d811bb4a99bee4e38a9d3a69813a8dd04
+Subproject commit 97fa83e16f290b24f0a9c50153c2469b68b8c0aa
diff --git a/source/blender/editors/io/intern/common.hpp b/source/blender/editors/io/intern/common.hpp
index fcaad8fbf67..47e0f56db11 100644
--- a/source/blender/editors/io/intern/common.hpp
+++ b/source/blender/editors/io/intern/common.hpp
@@ -7,52 +7,52 @@
 /* #include "DNA_object_types.h" */
 
 extern "C" {
-/* clang-format off */
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_mesh_runtime.h"
-#include "BKE_modifier.h"
-#include "BKE_library.h"
-#include "BKE_customdata.h"
-#include "BKE_scene.h"
 
-#include "MEM_guardedalloc.h"
+// Clang-format is adding these spaces, but it's not allowed by the standard
+
+#  include "BKE_global.h"
+#  include "BKE_mesh.h"
+#  include "BKE_mesh_runtime.h"
+#  include "BKE_modifier.h"
+#  include "BKE_library.h"
+#  include "BKE_customdata.h"
+#  include "BKE_scene.h"
+
+#  include "MEM_guardedalloc.h"
 
 /* SpaceType struct has a member called 'new' which obviously conflicts with C++
  * so temporarily redefining the new keyword to make it compile. */
-#define new extern_new
-#include "BKE_screen.h"
-#undef new
+#  define new extern_new
+#  include "BKE_screen.h"
+#  undef new
 
-#include "BLI_listbase.h"
-#include "BLI_math_matrix.h"
-#include "BLI_math_vector.h"
-#include "BLI_utildefines.h"
+#  include "BLI_listbase.h"
+#  include "BLI_math_matrix.h"
+#  include "BLI_math_vector.h"
+#  include "BLI_utildefines.h"
 
-#include "bmesh.h"
-#include "bmesh_tools.h"
+#  include "bmesh.h"
+#  include "bmesh_tools.h"
 
-#include "DNA_layer_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
+#  include "DNA_layer_types.h"
+#  include "DNA_meshdata_types.h"
+#  include "DNA_mesh_types.h"
+#  include "DNA_modifier_types.h"
+#  include "DNA_object_types.h"
 
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
+#  include "DEG_depsgraph_build.h"
+#  include "DEG_depsgraph_query.h"
 
-#include "../io_common.h"
+#  include "../io_common.h"
 }
 
-#include <utility>
-#include <string>
-#include <vector>
-#include <set>
-#include <array>
-#include <typeinfo>
-#include <iterator>
-
-/* clang-format on */
+#  include <utility>
+#  include <string>
+#  include <vector>
+#  include <set>
+#  include <array>
+#  include <typeinfo>
+#  include <iterator>
 
 namespace common {
 using ulong = unsigned long;
diff --git a/source/blender/editors/io/intern/iterators.hpp b/source/blender/editors/io/intern/iterators.hpp
index c3bc3bf9f29..e934a24ef06 100644
--- a/source/blender/editors/io/intern/iterators.hpp
+++ b/source/blender/editors/io/intern/iterators.hpp
@@ -2,7 +2,7 @@
 #define __io_intern_iterators_h__
 
 extern "C" {
-/* clang-format off */
+
 #include "BKE_customdata.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
@@ -27,39 +27,68 @@ extern "C" {
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/iterator/iterator_adaptor.hpp>
 
-/* clang-format on */
-
 namespace common {
 
-/* clang-format off */
 // Adapt a pointer-size pair as a random access iterator
 // This makes use of `boost::iterator_facade` and makes it possible to use
 // for each style loops, as well as cleanly hiding how the underlying Blender
 // data structures are accessed
-template<typename T, typename Tag = std::random_access_iterator_tag>
-struct pointer_iterator_base {
+template<typename T, typename Tag = std::random_access_iterator_tag> struct pointer_iterator_base {
   using difference_type = ptrdiff_t;
   using value_type = T;
-  using pointer    = T *;
-  using reference  = T &;
+  using pointer = T *;
+  using reference = T &;
   using iterator_category = Tag;
-  pointer_iterator_base(pointer p, size_t size) : first(p), curr(p), size(size) {}
-  pointer_iterator_base(const pointer_iterator_base &pib) : first(pib.first), curr(pib.curr), size(pib.size) {}
+  pointer_iterator_base(pointer p, size_t size) : first(p), curr(p), size(size)
+  {
+  }
+  pointer_iterator_base(const pointer_iterator_base &pib)
+      : first(pib.first), curr(pib.curr), size(pib.size)
+  {
+  }
   // Conversion to base pointer
-  operator pointer() const { return curr; }
-  pointer_iterator_base &operator=(const pointer_iterator_base &p) {
+  operator pointer() const
+  {
+    return curr;
+  }
+  pointer_iterator_base &operator=(const pointer_iterator_base &p)
+  {
     // Placement new: construct a new object in the position of `this`
     // Doesn't actually allocate memory
     new (this) pointer_iterator_base(p);
     return *this;
   }
-  pointer_iterator_base begin() const { return {this->first, this->size}; }
-  pointer_iterator_base end()   const { return {this->first + this->size, this->size}; }
-  pointer_iterator_base & operator++() { ++curr; return *this; }
-  pointer_iterator_base & operator--() { --curr; return *this; }
-  pointer_iterator_base & operator+(difference_type n) { curr += n; return *this; }
-  difference_type operator-(const pointer_iterator_base &other) const { return other.curr - curr; }
-  bool operator==(const pointer_iterator_base &other) const { return curr == other.curr; }
+  pointer_iterator_base begin() const
+  {
+    return {this->first, this->size};
+  }
+  pointer_iterator_base end() const
+  {
+    return {this->first + this->size, this->size};
+  }
+  pointer_iterator_base &operator++()
+  {
+    ++curr;
+    return *this;
+  }
+  pointer_iterator_base &operator--()
+  {
+    --curr;
+    return *this;
+  }
+  pointer_iterator_base &operator+(difference_type n)
+  {
+    curr += n;
+    return *this;
+  }
+  difference_type operator-(const pointer_iterator_base &other) const
+  {
+    return other.curr - curr;
+  }
+  bool operator==(const pointer_iterator_base &other) const
+  {
+    return curr == other.curr;
+  }
   pointer first;
   pointer curr;
   size_t size;
@@ -67,9 +96,11 @@ struct pointer_iterator_base {
 
 template<typename T>
 struct pointer_iterator : pointer_iterator_base<T, std::random_access_iterator_tag> {
-  using pointer_iterator_base<T, std::random_access_iterator_tag>
-      ::pointer_iterator_base;
-  inline const T & operator*() const { return *this->curr; }
+  using pointer_iterator_base<T, std::random_access_iterator_tag>::pointer_iterator_base;
+  inline const T &operator*() const
+  {
+    return *this->curr;
+  }
 };
 
 // An iterator that iterates over doubly linked lists
@@ -77,46 +108,92 @@ template<typename SourceT,
          typename ResT = SourceT &,
          typename Tag = std::bidirectional_iterator_tag>
 struct list_iterator : pointer_iterator_base<SourceT, Tag> {
-  list_iterator(SourceT *p) : pointer_iterator_base<SourceT, Tag>(p, 0) {}
-  list_iterator begin() const { return {this->first}; }
-  list_iterator end()   const { return {nullptr}; }
-  list_iterator & operator++() { this->curr = this->curr->next; return *this; }
-  list_iterator & operator--() { this->curr = this->curr->prev; return *this; }
-  inline const ResT operator*() const { return *this->curr; }
+  list_iterator(SourceT *p) : pointer_iterator_base<SourceT, Tag>(p, 0)
+  {
+  }
+  list_iterator begin() const
+  {
+    return {this->first};
+  }
+  list_iterator end() const
+  {
+    return {nullptr};
+  }
+  list_iterator &operator++()
+  {
+    this->curr = this->curr->next;
+    return *this;
+  }
+  list_iterator &operator--()
+  {
+    this->curr = this->curr->prev;
+    return *this;
+  }
+  inline const ResT operator*() const
+  {
+    return *this->curr;
+  }
 };
 
 // Represents an offset into an array (base for iterators like material_iter)
 template<typename T>
 struct offset_iterator : pointer_iterator_base<T, std::random_access_iterator_tag> {
-  offset_iterator(size_t size)
-    : pointer_iterator_base<T, std::random_access_iterator_tag>(0, size) {}
-  size_t offset() const { return ((size_t) this->curr) / sizeof(T); }
+  offset_iterator(size_t size) : pointer_iterator_base<T, std::random_access_iterator_tag>(0, size)
+  {
+  }
+  size_t offset() const
+  {
+    return ((size_t)this->curr) / sizeof(T);
+  }
 };
 
 // Iterator over the polygons of a mesh
 struct poly_iter : pointer_iterator<MPoly> {
-  poly_iter(const Mesh *const m) : pointer_iterator(m->mpoly, m->totpoly) {}
-  poly_iter(MPoly * const poly, size_t size) : pointer_iterator(poly, size) {}
-  poly_iter begin() const { return {this->first, this->size}; }
-  poly_iter end()   const { return {this->first + this->size, this->size}; }
+  poly_iter(const Mesh *const m) : pointer_iterator(m->mpoly, m->totpoly)
+  {
+  }
+  poly_iter(MPoly *const poly, size_t size) : pointer_iterator(poly, size)
+  {
+  }
+  poly_iter begin() const
+  {
+    return {this->first, this->size};
+  }
+  poly_iter end() const
+  {
+    return {this->first + this->size, this->size};
+  }
   // poly_iter(const pointer_iterator &p) : pointer_iterator(p) {}
   // poly_iter(pointer_iterator &&p) : pointer_iterator(std::move(p)) {}
 };
 
 // Iterator over the vertices of a mesh
 struct vert_iter : pointer_iterator<MVert> {
-  vert_iter(const Mesh *const m) : pointer_iterator(m->mvert, m->totvert) {}
+  vert_iter(const Mesh *const m) : pointer_iterator(m->mvert, m->totvert)
+  {
+  }
 };
 
 struct transformed_vertex_iter : pointer_iterator_base<MVert> {
-  using Mat = const float(*)[4]; // Must actually be float[4][4]
+  using Mat = const float (*)[4];  // Must actually be float[4][4]
   transformed_vertex_iter(const Mesh *const m, Mat &mat)
-    : pointer_iterator_base(m->mvert, m->totvert), mat(mat) {}
-  transformed_vertex_iter(MVert * const mvert, size_t size, Mat &mat)
-    : pointer_iterator_base(mvert, size), mat(mat) {}
-  transformed_vertex_iter

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list