Skip to content

Commit

Permalink
ncnn显示未设定值
Browse files Browse the repository at this point in the history
  • Loading branch information
scarsty committed Jan 24, 2022
1 parent 39536e2 commit 295c564
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
22 changes: 16 additions & 6 deletions nn-editor/ncnnloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@ void ncnnLoader::nodesToFile(const std::deque<Node>& nodes, const std::string& f
std::vector<std::string> v;
for (auto& kv : n->values)
{
if (string_to_int_[n->type].count(kv.first))
if (!kv.second.empty())
{
v.push_back(string_to_int_[n->type][kv.first] + "=" + kv.second + " ");
}
else
{
v.push_back(kv.first + "=" + kv.second + " ");
if (string_to_int_[n->type].count(kv.first))
{
v.push_back(string_to_int_[n->type][kv.first] + "=" + kv.second + " ");
}
else
{
v.push_back(kv.first + "=" + kv.second + " ");
}
}
}
std::sort(v.begin(), v.end());
Expand Down Expand Up @@ -211,6 +214,13 @@ void ncnnLoader::refreshNodeValues(Node& n)
n.values[kv[0]] = kv[1];
}
}
for (auto& kv: string_to_int_[n.type])
{
if (!n.values.count(kv.first) && kv.first!="")
{
n.values[kv.first] = "";
}
}
}
n.text = "";
}
Expand Down
5 changes: 3 additions & 2 deletions nn-editor/nn_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class ColorNodeEditor
public:
SDL_Event event;

ColorNodeEditor() : nodes_(), root_node_id_(-1),
ColorNodeEditor() :
minimap_location_(ImNodesMiniMapLocation_BottomRight)
{
loader_ = create_loader("");
Expand Down Expand Up @@ -712,7 +712,8 @@ class ColorNodeEditor
loader_->refreshNodeValues(node);
if (ImGui::BeginTable("value", 2, 0, { node_width, 0 }))
{
ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthFixed, 80);
ImGui::TableSetupColumn("value1", ImGuiTableColumnFlags_WidthFixed, 120);
ImGui::TableSetupColumn("value2", ImGuiTableColumnFlags_WidthFixed, 60);
for (auto& kv : node.values)
{
ImGui::TableNextColumn();
Expand Down

0 comments on commit 295c564

Please sign in to comment.