Skip to content

Commit

Permalink
Merge pull request #2083 from zenustech/paramsBase64
Browse files Browse the repository at this point in the history
Params base64
  • Loading branch information
legobadman authored Feb 28, 2025
2 parents bd32335 + d490b2c commit d2b49f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions ui/zenoedit/launch/corelaunch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct LAUNCH_PARAM {
QString zsgPath;
int projectFps = 24;
QString paramPath;
QString paramBase64;
};

void launchProgram(IGraphsModel *pModel, LAUNCH_PARAM param);
Expand Down
14 changes: 13 additions & 1 deletion ui/zenoedit/launch/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ static void serializeGraph(IGraphsModel* pGraphsModel, const QModelIndex& subgId
zeno::log_error("config file is corrupted");
}
}
if (!launchParam.paramBase64.isEmpty()) {
zeno::log_info("base64:{}", launchParam.paramBase64.toStdString());
QByteArray base64Encoded = launchParam.paramBase64.toUtf8();
QByteArray decodedByteArray = QByteArray::fromBase64(base64Encoded);
QString decodedString = QString::fromUtf8(decodedByteArray );
zeno::log_info("json: {}", decodedString.toStdString());
configDoc.Parse(decodedByteArray );

if (!configDoc.IsObject()) {
zeno::log_error("paramsBase64 is corrupted");
}
}

//scan all the nodes in the subgraph.
for (int i = 0; i < pGraphsModel->itemCount(subgIdx); i++)
Expand Down Expand Up @@ -302,7 +314,7 @@ static void serializeGraph(IGraphsModel* pGraphsModel, const QModelIndex& subgId
const QString& objPath = inSockIdx.data(ROLE_OBJPATH).toString();
if (commandParams.contains(objPath))
{
if (!launchParam.paramPath.isEmpty())
if (!launchParam.paramPath.isEmpty() || !launchParam.paramBase64.isEmpty())
{
const QString& command = commandParams[objPath].name;
if (configDoc.HasMember(command.toUtf8()))
Expand Down
5 changes: 5 additions & 0 deletions ui/zenoedit/recordmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ int record_main(const QCoreApplication& app)
{"subzsg", "subgraphzsg", "subgraph zsg file path", ""},
{"cacheautorm", "cacheautoremove", "remove cache after render"},
{"paramsPath", "paramsPath", "paramsPath"},
{"paramsBase64", "paramsBase64", "paramsBase64"},
{"paramsJson", "paramsJson", "paramsJson"},
});
cmdParser.process(app);
Expand Down Expand Up @@ -154,6 +155,10 @@ int record_main(const QCoreApplication& app)
{
launchparam.paramPath = cmdParser.value("paramsPath");
}
if (cmdParser.isSet("paramsBase64"))
{
launchparam.paramBase64 = cmdParser.value("paramsBase64");
}
if (cmdParser.isSet("exitWhenRecordFinish"))
param.exitWhenRecordFinish = cmdParser.value("exitWhenRecordFinish").toLower() == "true";
if (cmdParser.isSet("audio")) {
Expand Down

0 comments on commit d2b49f3

Please sign in to comment.