Added duplicate selection (CTRL+D), undo and redo (CTRL+Z/Y) with scene history. #133
Conversation
…odes as the performance was bad. Added OpenGL rendering for flow view.
…hat have no endpoint on selection
… data model to nodes when duplicating
|
My laptop is in repair and I was busy with our small baby last weeks. Thanks |
… performance benefits
# Conflicts: # src/FlowView.cpp # src/FlowView.hpp
|
Indenting is not consistent with the project. Copy and Pasting a node from a scene to another should not throw in case the node is not registered in second scene but just not performing the operation. |
| QString modelName = nodeJson["model"].toObject()["name"].toString(); | ||
| auto dataModel = registry().create(modelName); | ||
|
|
||
| if (!dataModel) |
Daguerreo
Apr 19, 2019
Consider this scenario:
Scene S1 with a set of registered models M1.
Scene S2 with a set of registered models M2.
where M1 != M2 or M2 subset of M1.
If you try to copy and paste a node from S1 to S2 which not belong to M2 it will throw.
A more correct approach would be returning with doing anything with a simple warning message.
Consider this scenario:
Scene S1 with a set of registered models M1.
Scene S2 with a set of registered models M2.
where M1 != M2 or M2 subset of M1.
If you try to copy and paste a node from S1 to S2 which not belong to M2 it will throw.
A more correct approach would be returning with doing anything with a simple warning message.
| @@ -55,7 +55,8 @@ class NODE_EDITOR_PUBLIC Connection | |||
|
|
|||
| QJsonObject | |||
| save() const override; | |||
|
|
|||
|
|
|||
| QJsonObject copyWithNewID(QUuid in, QUuid out); | |||
Daguerreo
Apr 19, 2019
Indentation in headers is not consisteng
Indentation in headers is not consisteng
| } | ||
|
|
||
| void FlowScene::Undo() | ||
| { | ||
| std::cout << "Undo" << std::endl; |
Daguerreo
Apr 19, 2019
Remove cout. Same in Redo()
Remove cout. Same in Redo()
| @@ -491,6 +535,11 @@ saveToMemory() const | |||
| } | |||
|
|
|||
|
|
|||
| void FlowScene::saveToClipBoard() | |||
| { | |||
|
|
|||
Daguerreo
Apr 19, 2019
Why is it empty?
Why is it empty?
| @@ -122,6 +143,10 @@ class NODE_EDITOR_PUBLIC FlowScene | |||
| std::unordered_map<QUuid, SharedConnection> _connections; | |||
| std::unordered_map<QUuid, UniqueNode> _nodes; | |||
| std::shared_ptr<DataModelRegistry> _registry; | |||
|
|
|||
| int historyInx; | |||
Daguerreo
Apr 19, 2019
private member should start with _
private member should start with _
| @@ -126,6 +128,8 @@ class NODE_EDITOR_PUBLIC NodeDataModel | |||
| virtual | |||
| NodePainterDelegate* painterDelegate() const { return nullptr; } | |||
|
|
|||
| QString toolTipText(); | |||
Daguerreo
Apr 19, 2019
Should be const and inline as other getters
Should be const and inline as other getters
| @@ -39,3 +40,15 @@ setNodeStyle(NodeStyle const& style) | |||
| { | |||
| _nodeStyle = style; | |||
| } | |||
|
|
|||
|
|
|||
| void NodeDataModel::setToolTipText(QString text) | |||
Daguerreo
Apr 19, 2019
change to const QString& text
change to const QString& text
| @@ -54,6 +59,10 @@ class NODE_EDITOR_PUBLIC FlowScene | |||
|
|
|||
| Node&restoreNode(QJsonObject const& nodeJson); | |||
|
|
|||
| QUuid pasteNode(QJsonObject &json); | |||
Daguerreo
Apr 19, 2019
make it const reference
make it const reference
| _scene->UpdateHistory(); | ||
| } | ||
|
|
||
| void FlowView::duplicateSelectedNode() |
Daguerreo
Apr 19, 2019
a lot of implicit conversion warning float-double
a lot of implicit conversion warning float-double
|
|
||
| //create nodes | ||
| std::vector<Node*> createdNodes; | ||
| std::vector<Node*> couterpartNode; |
Daguerreo
Apr 19, 2019
maybe "counterPart" ?
maybe "counterPart" ?
| @@ -123,6 +132,20 @@ restoreConnection(QJsonObject const &connectionJson) | |||
| return createConnection(*nodeIn, portIndexIn, *nodeOut, portIndexOut); | |||
| } | |||
|
|
|||
| void FlowScene::pasteConnection(QJsonObject const &connectionJson, QUuid newIn, QUuid newOut) | |||
| { | |||
| QUuid nodeInId = QUuid(connectionJson["in_id"].toString()); | |||
Daguerreo
Apr 19, 2019
unused nodeInId and nodeOutId
unused nodeInId and nodeOutId
| if(j >=0 && k>=0 && j < couterpartNode.size() && k < couterpartNode.size()) | ||
| { | ||
| auto connection = _scene->createConnection(*createdNodes[j], portIndexIn, *createdNodes[k], portIndexOut); | ||
| auto& connectionRef = connection; |
Daguerreo
Apr 19, 2019
unused variable
unused variable
No description provided.