diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..675f50e68df4239f6ac524529576ba6942e7a158 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "stduuid"] + path = src/libRender/Dependencies/stduuid + url = git@github.com:MathiasPaulin/stduuid.git diff --git a/src/libRender/CMakeLists.txt b/src/libRender/CMakeLists.txt index 8a4f6979f2b42f270868dc395e00fbd45caea129..130fbe79205b27a141cf399a6e7db20e88953af8 100644 --- a/src/libRender/CMakeLists.txt +++ b/src/libRender/CMakeLists.txt @@ -178,6 +178,14 @@ set(resources Resources/RadiumNBR/RenderGraphs/fullfeaturerenderer.flow ) +# std::uuid dependency +# Note, follow the progress of integration of uuid generator in the C++ std lib. When supported by std, remove this dependency +set(UUID_BUILD_TESTS OFF) +set(UUID_SYSTEM_GENERATOR ON) +set(UUID_USING_CXX20_SPAN OFF) # change this when going to C++20 as language standard for Radium libs +add_subdirectory(Dependencies/stduuid) +# TODO verify correct installation and usage in Config.cmake.in + # Our library project uses these sources and headers. add_library( @@ -200,6 +208,7 @@ target_link_libraries( PUBLIC Radium::Core Radium::Engine + stduuid ) if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/src/libRender/Config.cmake.in b/src/libRender/Config.cmake.in index f645bde9eb155d465a0bfaa977fa4610f3a692d8..4ed6ecfebab99934d646d847e97f923dc4b71b25 100644 --- a/src/libRender/Config.cmake.in +++ b/src/libRender/Config.cmake.in @@ -28,6 +28,7 @@ if ( NOT Radium_FOUND) endif() if (NBR_FOUND) + # TODO : search for installed stduuid include("${CMAKE_CURRENT_LIST_DIR}/NBRTargets.cmake" ) radium_exported_resources( TARGET RadiumNBR::NBR diff --git a/src/libRender/Dependencies/stduuid b/src/libRender/Dependencies/stduuid new file mode 160000 index 0000000000000000000000000000000000000000..5c538cca02932aa0266659661d5b4726f3a317c7 --- /dev/null +++ b/src/libRender/Dependencies/stduuid @@ -0,0 +1 @@ +Subproject commit 5c538cca02932aa0266659661d5b4726f3a317c7 diff --git a/src/libRender/RadiumNBR/NodeGraph/Node.cpp b/src/libRender/RadiumNBR/NodeGraph/Node.cpp index 59d3352ff3aa0df9dfd2a4c6bb7301f0de2857a6..44b1c5abf183f59304b47b081ab1fddb4ddc6bad 100644 --- a/src/libRender/RadiumNBR/NodeGraph/Node.cpp +++ b/src/libRender/RadiumNBR/NodeGraph/Node.cpp @@ -15,7 +15,8 @@ void Node::fromJson( const nlohmann::json& data ) { #endif // get the common content of the Node from the json data - m_uuid = data["id"]; + std::string struuid = data["id"]; + m_uuid = uuids::uuid::from_string(struuid).value(); std::string readTypeName = data["model"]["name"]; if ( readTypeName != m_typeName ) { @@ -37,7 +38,8 @@ void Node::fromJson( const nlohmann::json& data ) { void Node::toJson( nlohmann::json& data ) const { // write the common content of the Node to the json data - data["id"] = m_uuid; + std::string struuid = "{" + uuids::to_string(m_uuid) + "}"; + data["id"] = struuid; nlohmann::json model; model["instance"] = m_instanceName; diff --git a/src/libRender/RadiumNBR/NodeGraph/Node.hpp b/src/libRender/RadiumNBR/NodeGraph/Node.hpp index aaa3c211c09c2470654c5a73a796e62794e66f8c..cd9ecc47380a4be5470654c0d28fca391248b03c 100644 --- a/src/libRender/RadiumNBR/NodeGraph/Node.hpp +++ b/src/libRender/RadiumNBR/NodeGraph/Node.hpp @@ -5,6 +5,8 @@ #include <RadiumNBR/externals/json.hpp> +#include <uuid.h> + #include <cstdint> #include <iostream> #include <memory> @@ -194,7 +196,8 @@ class NodeBasedRenderer_LIBRARY_API Node /// The uuid of the node (TODO, use https://github.com/mariusbancila/stduuid instead of a /// string) - std::string m_uuid; + //std::string m_uuid; + uuids::uuid m_uuid; /// The type name of the node std::string m_typeName; /// The instance name of the node