Skip to content

Commit

Permalink
re-enable adding entries in characetrcustom arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
PixelRick committed Jan 16, 2021
1 parent 22808ae commit 97faa93
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Source/csav/cnodes/CCharacterCustomization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct cetr_uk_thing4
// the real struct size is 0x28
struct cetr_uk_thing3
{
CName cn;
CName cn = {};
std::string uk0;
std::string uk1;
uint32_t uk2 = 0;
Expand Down
1 change: 1 addition & 0 deletions Source/widgets/list_widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ inline bool imgui_list_tree_widget(std::list<T>& l, GetTNameStringFn&& name_fn,
bool removed = imgui_close_button(close_button_id, ImVec2(button_x, button_y), height);
*/
bool removed = false;
if (erasable_items)
{
//scoped_imgui_id _sii2("#smallremove");
ImGui::SameLine();
Expand Down
36 changes: 18 additions & 18 deletions Source/widgets/node_editors/CharacetrCustomization_Appearances.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ struct cetr_uk_thing3_widget

bool modified = false;

modified |= CName_widget::draw(x.cn, "some cname##cetr3");
modified |= CName_widget::draw(x.cn, "Entry's CName##cetr3");

modified |= ImGui::InputText("property value##cetr3", &x.uk0);
modified |= ImGui::InputText("property type##cetr3", &x.uk1);
modified |= ImGui::InputText("Property Value##cetr3", &x.uk0);
modified |= ImGui::InputText("Property Type##cetr3", &x.uk1);

modified |= ImGui::InputScalar("uk_u32_1(hex)##cetr3", ImGuiDataType_U32, &x.uk2, NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal);
modified |= ImGui::InputScalar("uk_u32_2(hex)##cetr3", ImGuiDataType_U32, &x.uk3, NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal);
Expand All @@ -87,16 +87,16 @@ struct cetr_uk_thing2_widget

modified |= ImGui::InputText("name##cetr2", &x.uks);

if (ImGui::TreeNode("some array #1##cetr2"))
if (ImGui::TreeNode("Array #1##cetr2"))
{
static auto name_fn = [](const cetr_uk_thing3& y) { return y.cn.name(); };
modified |= imgui_list_tree_widget(x.vuk3, name_fn, &cetr_uk_thing3_widget::draw, 0, false, false);
modified |= imgui_list_tree_widget(x.vuk3, name_fn, &cetr_uk_thing3_widget::draw, 0, true, true);
ImGui::TreePop();
}
if (ImGui::TreeNode("some array #2##cetr2"))
if (ImGui::TreeNode("Array #2##cetr2"))
{
static auto name_fn = [](const cetr_uk_thing4& y) { return y.uk0; };
modified |= imgui_list_tree_widget(x.vuk4, name_fn, &cetr_uk_thing4_widget::draw, 0, false, false);
modified |= imgui_list_tree_widget(x.vuk4, name_fn, &cetr_uk_thing4_widget::draw, 0, true, true);
ImGui::TreePop();
}

Expand All @@ -107,7 +107,7 @@ struct cetr_uk_thing2_widget
struct cetr_uk_thing1_widget
{
// returns true if content has been edited
[[nodiscard]] static inline bool draw(cetr_uk_thing1& x)
[[nodiscard]] static inline bool draw(cetr_uk_thing1& x, bool editable_list = false)
{
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
Expand All @@ -116,7 +116,7 @@ struct cetr_uk_thing1_widget
bool modified = false;

static auto name_fn = [](const cetr_uk_thing2& y) { return y.uks; };
modified |= imgui_list_tree_widget(x.vuk2, name_fn, &cetr_uk_thing2_widget::draw);
modified |= imgui_list_tree_widget(x.vuk2, name_fn, &cetr_uk_thing2_widget::draw, editable_list, editable_list);

return modified;
}
Expand All @@ -141,36 +141,36 @@ struct CCharacterCustomization_widget
modified |= ImGui::InputScalar("unknown #2 (02X)##cetr", ImGuiDataType_U8, &x.uk2, NULL, NULL, "%02X", ImGuiInputTextFlags_CharsHexadecimal);
modified |= ImGui::InputScalar("unknown #3 (02X)##cetr", ImGuiDataType_U8, &x.uk3, NULL, NULL, "%02X", ImGuiInputTextFlags_CharsHexadecimal);

if (ImGui::TreeNode("struct #1##cetr"))
if (ImGui::TreeNode("Struct #1##cetr"))
{
modified |= cetr_uk_thing1_widget::draw(x.ukt0);
ImGui::TreePop();
}

if (ImGui::TreeNode("struct #2##cetr"))
if (ImGui::TreeNode("Struct #2##cetr"))
{
modified |= cetr_uk_thing1_widget::draw(x.ukt1);
modified |= cetr_uk_thing1_widget::draw(x.ukt1, true);
ImGui::TreePop();
}

if (ImGui::TreeNode("struct #3##cetr"))
if (ImGui::TreeNode("Struct #3##cetr"))
{
modified |= cetr_uk_thing1_widget::draw(x.ukt2);
modified |= cetr_uk_thing1_widget::draw(x.ukt2, true);
ImGui::TreePop();
}

if (ImGui::TreeNode("array #1##cetr"))
if (ImGui::TreeNode("Array #1##cetr"))
{
static auto name_fn = [](const cetr_uk_thing5& y) { return std::string("unnamed"); };
modified |= imgui_list_tree_widget(x.ukt5, name_fn, &cetr_uk_thing5_widget::draw, 0, false, false);
modified |= imgui_list_tree_widget(x.ukt5, name_fn, &cetr_uk_thing5_widget::draw, 0, true, true);
ImGui::TreePop();
}

if (ImGui::TreeNode("array #2##cetr"))
if (ImGui::TreeNode("Array #2##cetr"))
{
static auto name_fn = [](const std::string& y) { return y; };
static auto edit_fn = [](std::string& y) { return ImGui::InputText("string", &y); };
modified |= imgui_list_tree_widget(x.uk6s, name_fn, edit_fn, 0, false, false);
modified |= imgui_list_tree_widget(x.uk6s, name_fn, edit_fn, 0, true, true);
ImGui::TreePop();
}

Expand Down

0 comments on commit 97faa93

Please sign in to comment.