[Bf-blender-cvs] [084c5d6c7e2] master: IO: Move Abstract Hierarchy Iterator into `io/common`
Sybren A. Stüvel
noreply at git.blender.org
Fri Jun 19 10:22:11 CEST 2020
Commit: 084c5d6c7e2cf89bb9a7a9a9d00e9ee4475e222f
Author: Sybren A. Stüvel
Date: Fri May 8 16:17:08 2020 +0200
Branches: master
https://developer.blender.org/rB084c5d6c7e2cf89bb9a7a9a9d00e9ee4475e222f
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
===================================================================
M source/blender/io/CMakeLists.txt
M source/blender/io/alembic/CMakeLists.txt
A source/blender/io/common/CMakeLists.txt
R099 source/blender/io/usd/intern/abstract_hierarchy_iterator.h source/blender/io/common/IO_abstract_hierarchy_iterator.h
R099 source/blender/io/usd/intern/abstract_hierarchy_iterator.cc source/blender/io/common/intern/abstract_hierarchy_iterator.cc
M source/blender/io/usd/CMakeLists.txt
M source/blender/io/usd/intern/usd_hierarchy_iterator.h
M source/blender/io/usd/intern/usd_writer_abstract.h
M tests/gtests/usd/CMakeLists.txt
M tests/gtests/usd/abstract_hierarchy_iterator_test.cc
M tests/gtests/usd/hierarchy_context_order_test.cc
===================================================================
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/CMakeLists.txt b/source/blender/io/common/CMakeLists.txt
similarity index 71%
copy from source/blender/io/CMakeLists.txt
copy to source/blender/io/common/CMakeLists.txt
index bc2f8d628e2..4ed6f12762e 100644
--- a/source/blender/io/CMakeLists.txt
+++ b/source/blender/io/common/CMakeLists.txt
@@ -18,18 +18,28 @@
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
-if(WITH_ALEMBIC)
- add_subdirectory(alembic)
-endif()
+set(INC
+ .
+ ../../blenkernel
+ ../../blenlib
+ ../../depsgraph
+ ../../makesdna
+)
-if(WITH_CODEC_AVI)
- add_subdirectory(avi)
-endif()
+set(INC_SYS
+)
-if(WITH_OPENCOLLADA)
- add_subdirectory(collada)
-endif()
+set(SRC
+ intern/abstract_hierarchy_iterator.cc
-if(WITH_USD)
- add_subdirectory(usd)
-endif()
+ 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
similarity index 99%
rename from source/blender/io/usd/intern/abstract_hierarchy_iterator.h
rename to 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
similarity index 99%
rename from source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
rename to 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 {
};
More information about the Bf-blender-cvs
mailing list