Skip to content
Snippets Groups Projects
Commit 37ca3b5b authored by Mathias Paulin's avatar Mathias Paulin :speech_balloon:
Browse files

[nodeEditor] delegates uuid generation to the libRender Node

parent f46df105
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,7 @@ public Q_SLOTS: // data propagation
private:
// addressing
friend class FlowScene;
QUuid _uid;
// data
......
......@@ -200,6 +200,10 @@ createNode(std::unique_ptr<NodeDataModel> && dataModel)
auto node = detail::make_unique<Node>(std::move(dataModel));
auto ngo = detail::make_unique<NodeGraphicsObject>(*this, *node);
// generates the uuid of the node (delegated to nodeDataModel implementation)
node->_uid = QUuid(node->nodeDataModel()->uuid());
std::cout << "Generating an uuid for newly created node : " << node->_uid.toString().toStdString() << std::endl;
node->setGraphicsObject(std::move(ngo));
auto nodePtr = node.get();
......
......@@ -28,7 +28,6 @@ std::string Node::getUuid() const {
// generates the uuid (need to remove const attribute ...
const_cast<Node*>(this)->generateUuid();
std::string guuid = "{" + uuids::to_string(m_uuid) + "}";
std::cout << "###*** UUId generated for node" << getName() << " : " << guuid << std::endl;
}
std::string struuid = "{" + uuids::to_string(m_uuid) + "}";
return struuid;
......@@ -50,9 +49,7 @@ void Node::fromJson( const nlohmann::json& data ) {
// get the common content of the Node from the json data
std::string struuid = data["id"];
m_uuid = uuids::uuid::from_string(struuid).value();
std::string struuidstored = "{" + uuids::to_string(m_uuid) + "}";
std::cerr << "Radium Node::fromJson : " << struuidstored << " -- uuid from file : " << struuid << std::endl;
std::string readTypeName = data["model"]["name"];
std::string readTypeName = data["model"]["name"];
if ( readTypeName != m_typeName )
{
LOG( logERROR ) << "Node::fromJson : incoherent type names : json data : " << readTypeName
......@@ -89,8 +86,9 @@ void Node::toJson( nlohmann::json& data ) const {
{
if ( key != "id" && key != "model" ) { data.emplace( key, value ); }
}
/*
std::cout << "Node::toJson -- generated json is : \n";
for ( auto& [key, value] : data.items() )
{ std::cout << "\t" << key << " : " << value << "\n"; }
*/
}
......@@ -108,7 +108,10 @@ class NodeBasedRenderer_LIBRARY_API Node
Ra::Engine::Rendering::RenderTechnique& rt ) const {}
/// Gets the name of the node.
const std::string& getName() const { return m_typeName; }
const std::string& getTypeName() const { return m_typeName; }
/// Gets the instance name of the node.
const std::string& getInstanceName() const { return m_instanceName; }
/// Generates the uuid of the node
void generateUuid();
......@@ -147,7 +150,7 @@ class NodeBasedRenderer_LIBRARY_API Node
bool m_initialized{ false };
/// Two nodes are considered equal if there names are the same.
bool operator==( const Node& o_node ) { return m_typeName == o_node.getName(); }
bool operator==( const Node& o_node ) { return m_typeName == o_node.getTypeName(); }
protected:
/// @param instanceName The name of the node
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment