diff --git a/ui/zenomodel/include/api.h b/ui/zenomodel/include/api.h index e294ab2561..61e19fd774 100644 --- a/ui/zenomodel/include/api.h +++ b/ui/zenomodel/include/api.h @@ -8,6 +8,7 @@ ZENO_ERROR Zeno_NewFile(); ZENO_ERROR Zeno_OpenFile(const std::string& fn); ZENO_ERROR Zeno_SaveAs(const std::string& fn); +ZENO_HANDLE Zeno_CreateGraph(const std::string& name, int type); ZENO_HANDLE Zeno_CreateGraph(const std::string& name); ZENO_ERROR Zeno_DeleteGraph(ZENO_HANDLE hSubgraph); ZENO_HANDLE Zeno_GetGraph(const std::string& name); diff --git a/ui/zenomodel/src/api.cpp b/ui/zenomodel/src/api.cpp index 875aed3c74..c9ad1fcf01 100644 --- a/ui/zenomodel/src/api.cpp +++ b/ui/zenomodel/src/api.cpp @@ -27,6 +27,18 @@ ZENO_HANDLE Zeno_CreateGraph(const std::string& name) return subgIdx.internalId(); } +ZENO_HANDLE Zeno_CreateGraph(const std::string& name, int type) +{ + IGraphsModel* pModel = GraphsManagment::instance().currentModel(); + if (!pModel) + return Err_ModelNull; + + const QString& qsName = QString::fromStdString(name); + pModel->newSubgraph(QString::fromStdString(name), (SUBGRAPH_TYPE)type); + QModelIndex subgIdx = pModel->index(qsName); + return subgIdx.internalId(); +} + ZENO_ERROR Zeno_DeleteGraph(ZENO_HANDLE hSubgraph) { IGraphsModel* pModel = GraphsManagment::instance().currentModel();