Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-05-08 17:17:08 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-06-19 11:17:41 +0300
commit084c5d6c7e2cf89bb9a7a9a9d00e9ee4475e222f (patch)
tree1af3f45a37e354567aed633c91d92551122cfe32
parentb1ce4ca40c03ab2562863ef8056adc3b2aff5c10 (diff)
IO: Move Abstract Hierarchy Iterator into `io/common`
The goal of the `AbstractHierarchyIterator` class (and supporting classes) was to use it in different exporters. It shouldn't be part of the USD module + namespace any more, now that it will also be used in the upcoming Alembic exporter rewrite. The source files are moved into `io/common`, which is compiled & linked into a new library `bf_io_common`. The unittests are still inside the `tests/gtests/usd` directory. They should be moved to a separate test module too, but that will be delayed until after T73268 has been resolved. Reviewed By: mont29 Differential Revision: https://developer.blender.org/D7669
-rw-r--r--source/blender/io/CMakeLists.txt2
-rw-r--r--source/blender/io/alembic/CMakeLists.txt2
-rw-r--r--source/blender/io/common/CMakeLists.txt45
-rw-r--r--source/blender/io/common/IO_abstract_hierarchy_iterator.h (renamed from source/blender/io/usd/intern/abstract_hierarchy_iterator.h)6
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc (renamed from source/blender/io/usd/intern/abstract_hierarchy_iterator.cc)8
-rw-r--r--source/blender/io/usd/CMakeLists.txt4
-rw-r--r--source/blender/io/usd/intern/usd_hierarchy_iterator.h6
-rw-r--r--source/blender/io/usd/intern/usd_writer_abstract.h5
-rw-r--r--tests/gtests/usd/CMakeLists.txt2
-rw-r--r--tests/gtests/usd/abstract_hierarchy_iterator_test.cc4
-rw-r--r--tests/gtests/usd/hierarchy_context_order_test.cc4
11 files changed, 75 insertions, 13 deletions
diff --git a/source/blender/io/CMakeLists.txt b/source/blender/io/CMakeLists.txt
index bc2f8d628e2..360cacc4360 100644
--- a/source/blender/io/CMakeLists.txt
+++ b/source/blender/io/CMakeLists.txt
@@ -18,6 +18,8 @@
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
+add_subdirectory(common)
+
if(WITH_ALEMBIC)
add_subdirectory(alembic)
endif()
diff --git a/source/blender/io/alembic/CMakeLists.txt b/source/blender/io/alembic/CMakeLists.txt
index 16f2d944876..d864aa51e64 100644
--- a/source/blender/io/alembic/CMakeLists.txt
+++ b/source/blender/io/alembic/CMakeLists.txt
@@ -20,6 +20,7 @@
set(INC
.
+ ../common
../../blenkernel
../../blenlib
../../blenloader
@@ -92,6 +93,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_blenlib
+ bf_io_common
${ALEMBIC_LIBRARIES}
${OPENEXR_LIBRARIES}
diff --git a/source/blender/io/common/CMakeLists.txt b/source/blender/io/common/CMakeLists.txt
new file mode 100644
index 00000000000..4ed6f12762e
--- /dev/null
+++ b/source/blender/io/common/CMakeLists.txt
@@ -0,0 +1,45 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2020, Blender Foundation
+# All rights reserved.
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+ .
+ ../../blenkernel
+ ../../blenlib
+ ../../depsgraph
+ ../../makesdna
+)
+
+set(INC_SYS
+)
+
+set(SRC
+ intern/abstract_hierarchy_iterator.cc
+
+ IO_abstract_hierarchy_iterator.h
+)
+
+set(LIB
+ bf_blenkernel
+ bf_blenlib
+)
+
+blender_add_lib(bf_io_common "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
+
+target_link_libraries(bf_io_common INTERFACE)
diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
index e31d5c91252..480b72ea0cf 100644
--- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
@@ -48,7 +48,8 @@ struct Object;
struct ParticleSystem;
struct ViewLayer;
-namespace USD {
+namespace blender {
+namespace io {
class AbstractHierarchyWriter;
@@ -258,6 +259,7 @@ class AbstractHierarchyIterator {
virtual void delete_object_writer(AbstractHierarchyWriter *writer) = 0;
};
-} // namespace USD
+} // namespace io
+} // namespace blender
#endif /* __ABSTRACT_HIERARCHY_ITERATOR_H__ */
diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index ab83ea2c3c4..5a318485203 100644
--- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -16,7 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#include "abstract_hierarchy_iterator.h"
+#include "IO_abstract_hierarchy_iterator.h"
#include <iostream>
#include <limits.h>
@@ -41,7 +41,8 @@
#include "DEG_depsgraph_query.h"
-namespace USD {
+namespace blender {
+namespace io {
const HierarchyContext *HierarchyContext::root()
{
@@ -649,4 +650,5 @@ bool AbstractHierarchyIterator::should_visit_dupli_object(const DupliObject *dup
return !dupli_object->no_draw;
}
-} // namespace USD
+} // namespace io
+} // namespace blender
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt
index 732a638a255..fc4f45cdef8 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -32,6 +32,7 @@ add_definitions(-DPXR_STATIC)
set(INC
.
+ ../common
../../blenkernel
../../blenlib
../../blenloader
@@ -52,7 +53,6 @@ set(INC_SYS
)
set(SRC
- intern/abstract_hierarchy_iterator.cc
intern/usd_capi.cc
intern/usd_hierarchy_iterator.cc
intern/usd_writer_abstract.cc
@@ -64,7 +64,6 @@ set(SRC
intern/usd_writer_transform.cc
usd.h
- intern/abstract_hierarchy_iterator.h
intern/usd_exporter_context.h
intern/usd_hierarchy_iterator.h
intern/usd_writer_abstract.h
@@ -79,6 +78,7 @@ set(SRC
set(LIB
bf_blenkernel
bf_blenlib
+ bf_io_common
)
list(APPEND LIB
diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.h b/source/blender/io/usd/intern/usd_hierarchy_iterator.h
index a608012a390..c61a0d2bf07 100644
--- a/source/blender/io/usd/intern/usd_hierarchy_iterator.h
+++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.h
@@ -19,7 +19,7 @@
#ifndef __USD_HIERARCHY_ITERATOR_H__
#define __USD_HIERARCHY_ITERATOR_H__
-#include "abstract_hierarchy_iterator.h"
+#include "IO_abstract_hierarchy_iterator.h"
#include "usd.h"
#include "usd_exporter_context.h"
@@ -34,6 +34,10 @@ struct Object;
namespace USD {
+using blender::io::AbstractHierarchyIterator;
+using blender::io::AbstractHierarchyWriter;
+using blender::io::HierarchyContext;
+
class USDHierarchyIterator : public AbstractHierarchyIterator {
private:
const pxr::UsdStageRefPtr stage_;
diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h
index 01b53f4c916..03c4c263e32 100644
--- a/source/blender/io/usd/intern/usd_writer_abstract.h
+++ b/source/blender/io/usd/intern/usd_writer_abstract.h
@@ -19,7 +19,7 @@
#ifndef __USD_WRITER_ABSTRACT_H__
#define __USD_WRITER_ABSTRACT_H__
-#include "abstract_hierarchy_iterator.h"
+#include "IO_abstract_hierarchy_iterator.h"
#include "usd_exporter_context.h"
#include <pxr/usd/sdf/path.h>
@@ -38,6 +38,9 @@ struct Object;
namespace USD {
+using blender::io::AbstractHierarchyWriter;
+using blender::io::HierarchyContext;
+
class USDAbstractWriter : public AbstractHierarchyWriter {
protected:
const USDExporterContext usd_export_context_;
diff --git a/tests/gtests/usd/CMakeLists.txt b/tests/gtests/usd/CMakeLists.txt
index 56759f4ccea..d2bfe5e1306 100644
--- a/tests/gtests/usd/CMakeLists.txt
+++ b/tests/gtests/usd/CMakeLists.txt
@@ -35,6 +35,7 @@ set(INC
..
../../../source/blender/blenlib
../../../source/blender/blenkernel
+ ../../../source/blender/io/common
../../../source/blender/io/usd
../../../source/blender/makesdna
../../../source/blender/depsgraph
@@ -52,6 +53,7 @@ set(LIB
bf_gpu
bf_usd
+ bf_io_common
${BOOST_LIBRARIES}
${TBB_LIBRARIES}
diff --git a/tests/gtests/usd/abstract_hierarchy_iterator_test.cc b/tests/gtests/usd/abstract_hierarchy_iterator_test.cc
index 160dd52f39a..f2e8b09b8d3 100644
--- a/tests/gtests/usd/abstract_hierarchy_iterator_test.cc
+++ b/tests/gtests/usd/abstract_hierarchy_iterator_test.cc
@@ -16,8 +16,8 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
+#include "IO_abstract_hierarchy_iterator.h"
#include "blenloader/blendfile_loading_base_test.h"
-#include "intern/abstract_hierarchy_iterator.h"
extern "C" {
#include "BLI_math.h"
@@ -32,7 +32,7 @@ extern "C" {
* multiple times with different export paths, hence the set. */
typedef std::map<std::string, std::set<std::string>> created_writers;
-using namespace USD;
+using namespace blender::io;
class TestHierarchyWriter : public AbstractHierarchyWriter {
public:
diff --git a/tests/gtests/usd/hierarchy_context_order_test.cc b/tests/gtests/usd/hierarchy_context_order_test.cc
index 4111fc7511e..25cda6d8670 100644
--- a/tests/gtests/usd/hierarchy_context_order_test.cc
+++ b/tests/gtests/usd/hierarchy_context_order_test.cc
@@ -16,7 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#include "intern/abstract_hierarchy_iterator.h"
+#include "IO_abstract_hierarchy_iterator.h"
#include "testing/testing.h"
@@ -24,7 +24,7 @@ extern "C" {
#include "BLI_utildefines.h"
}
-using namespace USD;
+using namespace blender::io;
class HierarchyContextOrderTest : public testing::Test {
};