[Bf-blender-cvs] [ddc62da0907] temp-io-alembic-changes-up-to-D7672: IO: Move Abstract Hierarchy Iterator into `io/common`
Sybren A. Stüvel
noreply at git.blender.org
Fri May 8 17:57:49 CEST 2020
Commit: ddc62da090784da41c7d0c62ae82987127e1c64a
Author: Sybren A. Stüvel
Date: Fri May 8 16:17:08 2020 +0200
Branches: temp-io-alembic-changes-up-to-D7672
https://developer.blender.org/rBddc62da090784da41c7d0c62ae82987127e1c64a
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.
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.
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 6de7d327d4e..3bad82c9270 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
@@ -93,6 +94,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 68%
copy from source/blender/io/CMakeLists.txt
copy to source/blender/io/common/CMakeLists.txt
index bc2f8d628e2..e107712aeda 100644
--- a/source/blender/io/CMakeLists.txt
+++ b/source/blender/io/common/CMakeLists.txt
@@ -18,18 +18,30 @@
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
-if(WITH_ALEMBIC)
- add_subdirectory(alembic)
-endif()
+set(INC
+ .
+ ../../blenkernel
+ ../../blenlib
+ ../../depsgraph
+ ../../makesdna
+ ../../makesrna
+ ../../../../intern/guardedalloc
+)
-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..a957888936e 100644
--- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
@@ -48,7 +48,7 @@ struct Object;
struct ParticleSystem;
struct ViewLayer;
-namespace USD {
+namespace IO {
class AbstractHierarchyWriter;
@@ -258,6 +258,6 @@ class AbstractHierarchyIterator {
virtual void delete_object_writer(AbstractHierarchyWriter *writer) = 0;
};
-} // namespace USD
+} // namespace IO
#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 9d163222863..5ba13d1f68c 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>
@@ -43,7 +43,7 @@ extern "C" {
#include "DEG_depsgraph_query.h"
}
-namespace USD {
+namespace IO {
const HierarchyContext *HierarchyContext::root()
{
@@ -651,4 +651,4 @@ bool AbstractHierarchyIterator::should_visit_dupli_object(const DupliObject *dup
return !dupli_object->no_draw;
}
-} // namespace USD
+} // namespace IO
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..83050b1ce49 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 IO::AbstractHierarchyIterator;
+using IO::AbstractHierarchyWriter;
+using 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 cf0f7e9d437..85fe5d36b96 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>
@@ -39,6 +39,9 @@ struct Object;
namespace USD {
+using IO::AbstractHierarchyWriter;
+using 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..ac07a871fc1 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 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..bf058e7124f 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 IO;
class HierarchyContextOrderTest : public testing::Test {
};
More information about the Bf-blender-cvs
mailing list