added deletion of parameters and adding parameters
This commit is contained in:
parent
18f5c9d025
commit
3442f3b03f
1 changed files with 123 additions and 99 deletions
|
|
@ -9,8 +9,10 @@
|
|||
#include "IconsFontAwesome6.h"
|
||||
#include<array>
|
||||
#include "Config/Configs.h"
|
||||
|
||||
struct SimpleVec3 {
|
||||
float x, y, z;
|
||||
|
||||
template<typename t>
|
||||
SimpleVec3(t fromobj) {
|
||||
x = fromobj.X;
|
||||
|
|
@ -41,6 +43,7 @@ void ImGuiDrawSelection(std::string id,t& val,iter optsBegin, iter optsEnd,strin
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename t>
|
||||
void ImGuiDrawLayer(t *obj) {
|
||||
if (ImGui::BeginCombo("Layer##PropWind", ToString(obj->Layer).c_str())) {
|
||||
|
|
@ -93,7 +96,9 @@ void ImGuiDrawElem(Element* elem,std::string Id = ""){
|
|||
ImGui::PushItemWidth(ImGui::GetWindowWidth() / 3);
|
||||
ImGui::InputText(("##PropWindInputName" + Id).c_str(), &elem->Name);
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::SameLine(); ImGui::Text(": "); ImGui::SameLine();
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(": ");
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(ImGui::GetWindowWidth() / 3);
|
||||
ImGui::InputText(("##PropWindInputType" + Id).c_str(), &elem->Type);
|
||||
ImGui::PopItemWidth();
|
||||
|
|
@ -139,17 +144,21 @@ void ImGuiDrawElem(Element* elem,std::string Id = ""){
|
|||
ImGui::Checkbox(("Is Closed?##" + Id).c_str(), &rail->IsClosed);
|
||||
ImGui::Checkbox(("Is Ladder?##" + Id).c_str(), &rail->IsLadder);
|
||||
ImGui::InputInt(("Priority?##" + Id).c_str(), (int *) &rail->Priority);
|
||||
ImGuiDrawSelection("Rail Type",rail->RailType,AllRailTypeOptions.begin(), AllRailTypeOptions.end(),[](RailType t){return ToString(t);});
|
||||
ImGuiDrawSelection("Rail Type", rail->RailType, AllRailTypeOptions.begin(), AllRailTypeOptions.end(),
|
||||
[](RailType t) { return ToString(t); });
|
||||
if (ImGui::CollapsingHeader(("Rail Points##" + Id).c_str())) {
|
||||
ImGui::Indent();
|
||||
unsigned int i = 1;
|
||||
|
||||
for(auto curRailPointRef = rail->Points.begin(); curRailPointRef != rail->Points.end();curRailPointRef++){
|
||||
for (auto curRailPointRef = rail->Points.begin();
|
||||
curRailPointRef != rail->Points.end(); curRailPointRef++) {
|
||||
RailPoint &curRailPoint = *curRailPointRef;
|
||||
if (ImGui::CollapsingHeader((std::to_string(i) + "##RailPoints").c_str())) {
|
||||
ImGui::Indent();
|
||||
ImGuiDrawElem(&curRailPoint,"RailPoint" + std::to_string(i) + std::to_string(curRailPoint.runtimeID));
|
||||
if(ImGui::Button((ICON_FA_TRASH "##PropWindRailPointDelete" + std::to_string(i) + Id).c_str())){
|
||||
ImGuiDrawElem(&curRailPoint,
|
||||
"RailPoint" + std::to_string(i) + std::to_string(curRailPoint.runtimeID));
|
||||
if (ImGui::Button(
|
||||
(ICON_FA_TRASH "##PropWindRailPointDelete" + std::to_string(i) + Id).c_str())) {
|
||||
rail->Points.erase(curRailPointRef);
|
||||
ImGui::Unindent();
|
||||
break;
|
||||
|
|
@ -158,15 +167,11 @@ void ImGuiDrawElem(Element* elem,std::string Id = ""){
|
|||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
if(rail->Points.size() != 1) {
|
||||
if (ImGui::Button((ICON_FA_PLUS "##" + Id).c_str())) {
|
||||
if (ImGui::Button((ICON_FA_PLUS "##RailPointAdd" + Id).c_str())) {
|
||||
RailPoint rp = RailPoint(rail->Points.back());
|
||||
rp.runtimeID = rand();
|
||||
rail->Points.push_back(rp);
|
||||
}
|
||||
}
|
||||
|
||||
if (rail->Points.empty()) {
|
||||
auto &map = GetMainWindow()->loadedMap;
|
||||
|
|
@ -183,7 +188,8 @@ void ImGuiDrawElem(Element* elem,std::string Id = ""){
|
|||
|
||||
if (levelObject) {
|
||||
//ImGuiDrawTeamSelect(levelObject,Id);
|
||||
ImGuiDrawSelection("Team##"+Id,levelObject->Team,Teams::AllOptions.begin(), Teams::AllOptions.end(),Teams::TeamToText);
|
||||
ImGuiDrawSelection("Team##" + Id, levelObject->Team, Teams::AllOptions.begin(), Teams::AllOptions.end(),
|
||||
Teams::TeamToText);
|
||||
Configs::g_imguiDrawOpts("Drop##" + Id, Configs::g_dropIdOpts, levelObject->DropId);
|
||||
}
|
||||
|
||||
|
|
@ -205,27 +211,45 @@ void ImGuiDrawElem(Element* elem,std::string Id = ""){
|
|||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
if(!elem->Parameters.empty()) {
|
||||
if (ImGui::CollapsingHeader(("Parameters##" + Id).c_str())) {
|
||||
ImGui::Indent();
|
||||
for (int i = 0; i < elem->Parameters.size(); i++) {
|
||||
ImGui::InputInt(("Parameter " + std::to_string(i) + "##PropWind" + Id).c_str(),
|
||||
(int *) &elem->Parameters[i]);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button((ICON_FA_TRASH "##ParamDelete" + std::to_string(i) + "th" + Id).c_str())) {
|
||||
auto delparam = elem->Parameters.begin() + i;
|
||||
|
||||
elem->Parameters.erase(delparam);
|
||||
break;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
}
|
||||
if (ImGui::Button((ICON_FA_PLUS "##ParamAdd" + Id).c_str())) {
|
||||
elem->Parameters.push_back(-99);
|
||||
}
|
||||
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
if(!elem->FloatParameters.empty()) {
|
||||
if (ImGui::CollapsingHeader(("Float Parameters##" + Id).c_str())) {
|
||||
ImGui::Indent();
|
||||
for (int i = 0; i < elem->FloatParameters.size(); i++) {
|
||||
ImGui::InputFloat(("Float Parameter " + std::to_string(i) + "##PropWind" + Id).c_str(),
|
||||
ImGui::InputFloat(("Parameter " + std::to_string(i) + "##FloatParamPropWind" + Id).c_str(),
|
||||
&elem->FloatParameters[i]);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button((ICON_FA_TRASH "##FloatParamDelete" + std::to_string(i) + "th" + Id).c_str())) {
|
||||
auto delparam = elem->FloatParameters.begin() + i;
|
||||
|
||||
elem->FloatParameters.erase(delparam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button((ICON_FA_PLUS "##FloatParamAdd" + Id).c_str())) {
|
||||
elem->FloatParameters.push_back(-99.0f);
|
||||
}
|
||||
ImGui::Unindent();
|
||||
}
|
||||
}
|
||||
|
||||
if (!elem->OtherOptions.empty()) {
|
||||
if (ImGui::CollapsingHeader(("Miscellaneous Options##" + Id).c_str())) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue