Skip to content

Commit

Permalink
Merge pull request #1639 from 1445643474/master
Browse files Browse the repository at this point in the history
command params
  • Loading branch information
zhxx1987 authored Dec 16, 2023
2 parents 6897841 + 9a22229 commit 3dcd8cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
10 changes: 4 additions & 6 deletions ui/zenoedit/launch/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,8 @@ static void serializeGraph(IGraphsModel* pGraphsModel, const QModelIndex& subgId
const QString& command = commandParams[objPath].name;
if (configDoc.HasMember(command.toUtf8()))
{
const auto& obj = configDoc[command.toStdString().c_str()];
if (obj.IsObject() && obj.HasMember("value"))
defl = UiHelper::parseJsonByType(sockType, obj["value"], nullptr);
const auto& value = configDoc[command.toStdString().c_str()];
defl = UiHelper::parseJsonByType(sockType, value, nullptr);
}
}
else if (commandParams[objPath].bIsCommand)
Expand Down Expand Up @@ -360,9 +359,8 @@ static void serializeGraph(IGraphsModel* pGraphsModel, const QModelIndex& subgId
QString command = commandParams[objPath].name;
if (!configPath.isEmpty() && commandParams.contains(objPath) && configDoc.HasMember(command.toUtf8()))
{
const auto& obj = configDoc[command.toStdString().c_str()];
if (obj.IsObject() && obj.HasMember("value"))
paramValue = UiHelper::parseJsonByType(param_info.typeDesc, obj["value"], nullptr);
const auto& value = configDoc[command.toStdString().c_str()];
paramValue = UiHelper::parseJsonByType(param_info.typeDesc, value, nullptr);
}
else
{
Expand Down
9 changes: 0 additions & 9 deletions ui/zenoedit/panel/zenocommandparamspanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,8 @@ void ZenoCommandParamsPanel::onExport()
if (index.isValid())
{
writer.Key(val.name.toUtf8());

writer.StartObject();

writer.Key("value");
const QString& sockType = index.data(ROLE_PARAM_TYPE).toString();
JsonHelper::AddVariant(val.value, sockType, writer);

writer.Key("description");
writer.String(val.description.toUtf8());

writer.EndObject();
}

}
Expand Down
6 changes: 4 additions & 2 deletions ui/zenomodel/src/subgraphmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,12 @@ void SubGraphModel::_uniqueView(const QModelIndex& index, bool bInSocket, bool b
{
const QModelIndex& keyIdx = pKeyObjModel->index(_r, 0);
ZASSERT_EXIT(keyIdx.isValid());
lst << keyIdx;
PARAM_LINKS links = keyIdx.data(ROLE_PARAM_LINKS).value<PARAM_LINKS>();
if (!links.isEmpty())
lst << keyIdx;
}
}
else
if (lst.isEmpty())
{
lst << sock;
}
Expand Down

0 comments on commit 3dcd8cc

Please sign in to comment.