Skip to content

Commit

Permalink
Merge pull request #1644 from 1445643474/master
Browse files Browse the repository at this point in the history
create material subgraph api
  • Loading branch information
legobadman authored Dec 18, 2023
2 parents 3fa1860 + b955983 commit fda0f2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions ui/zenomodel/include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions ui/zenomodel/src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit fda0f2b

Please sign in to comment.