feat(Outfit Editor): Add [+] & [-] buttons (#1441)

* And other general UI improvements
This commit is contained in:
tupoy-ya
2023-06-23 13:44:06 +05:00
committed by GitHub
parent 8bc6648100
commit 1eae251012
28 changed files with 415 additions and 381 deletions

View File

@ -92,9 +92,11 @@ namespace big
ImGui::BeginGroup();
for (auto& item : components.items)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
ImGui::SetNextItemWidth(120);
if (ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
{
outfit::check_bounds_drawable(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
g_fiber_pool->queue_job([item] {
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, 0, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
});
@ -107,9 +109,11 @@ namespace big
ImGui::BeginGroup();
for (auto& item : components.items)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
ImGui::SetNextItemWidth(120);
if (ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
{
outfit::check_bounds_texture(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
g_fiber_pool->queue_job([item] {
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, item.texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
});
@ -122,9 +126,11 @@ namespace big
ImGui::BeginGroup();
for (auto& item : props.items)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0))
ImGui::SetNextItemWidth(120);
if (ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
{
outfit::check_bounds_drawable(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
g_fiber_pool->queue_job([item] {
if (item.drawable_id == -1)
PED::CLEAR_PED_PROP(self::ped, item.id, 1);
@ -140,9 +146,11 @@ namespace big
ImGui::BeginGroup();
for (auto& item : props.items)
{
ImGui::SetNextItemWidth(60);
if (ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0))
ImGui::SetNextItemWidth(120);
if (ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
{
outfit::check_bounds_texture(&item); // The game does this on it's own but seems to crash if we call OOB values to fast.
g_fiber_pool->queue_job([item] {
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, item.texture_id, TRUE, 1);
});

View File

@ -85,8 +85,8 @@ namespace big
ImGui::BeginGroup();
for (auto& item : components.items)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id), 0);
ImGui::SetNextItemWidth(120);
ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id));
}
ImGui::EndGroup();
@ -95,8 +95,8 @@ namespace big
ImGui::BeginGroup();
for (auto& item : components.items)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id), 0);
ImGui::SetNextItemWidth(120);
ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id));
}
ImGui::EndGroup();
@ -105,8 +105,8 @@ namespace big
ImGui::BeginGroup();
for (auto& item : props.items)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} [0,{}]", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id), 0);
ImGui::SetNextItemWidth(120);
ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id));
}
ImGui::EndGroup();
@ -115,8 +115,8 @@ namespace big
ImGui::BeginGroup();
for (auto& item : props.items)
{
ImGui::SetNextItemWidth(60);
ImGui::InputInt(std::format("{} {} [0,{}]", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id), 0);
ImGui::SetNextItemWidth(120);
ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id));
}
ImGui::EndGroup();
}