Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/editor/grapheditor/editor/graph/abstractnodegraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ void AbstractNodeGraph::load(const QString &path) {
save(path);
}
}

emit graphLoaded();
}

void AbstractNodeGraph::save(const QString &path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class NODEGRAPH_EXPORT AbstractNodeGraph : public QObject {

signals:
void graphUpdated();
void graphLoaded();

void messageReported(int node, const QString &text);

Expand Down
6 changes: 6 additions & 0 deletions modules/editor/grapheditor/editor/graph/graphcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ AbstractNodeGraph *GraphController::graph() {
void GraphController::setGraph(AbstractNodeGraph *graph) {
m_graph = graph;

m_focusedWidget = nullptr;
m_drag = false;

m_selectedItems.clear();
m_softSelectedItems.clear();

if(m_graph->rootNode()) {
setSelected({ m_graph->rootNode() });
emit m_view->itemsSelected(m_selectedItems);
Expand Down
6 changes: 6 additions & 0 deletions modules/editor/grapheditor/editor/graph/graphview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void GraphView::setGraph(AbstractNodeGraph *graph) {
static_cast<GraphController *>(m_controller)->setGraph(graph);

connect(graph, &AbstractNodeGraph::graphUpdated, this, &GraphView::onGraphUpdated);
connect(graph, &AbstractNodeGraph::graphLoaded, this, &GraphView::onGraphLoaded);

// Create menu
for(auto &it : graph->nodeList()) {
Expand Down Expand Up @@ -325,6 +326,11 @@ void GraphView::onGraphUpdated() {
composeLinks();
}

void GraphView::onGraphLoaded() {
GraphController *ctrl = static_cast<GraphController *>(m_controller);
ctrl->setGraph(ctrl->graph());
}

void GraphView::reselect() {
auto list = static_cast<GraphController *>(m_controller)->selectedItems();
emit itemsSelected(list);
Expand Down
2 changes: 2 additions & 0 deletions modules/editor/grapheditor/editor/graph/graphview.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ private slots:

void onGraphUpdated();

void onGraphLoaded();

void onDraw() override;

protected:
Expand Down