Compare commits

..

No commits in common. "51602c713a4e8adf6589350e846f3272fec689b9" and "7fb269f86237d6cc25ed0ce716331055de158a57" have entirely different histories.

3 changed files with 48 additions and 58 deletions

View file

@ -248,14 +248,5 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
std::string _releaseLink;
std::string _downloadLink;
bool _jointsDirty{false};
bool _stylesDirty{false};
bool _eyeFlareDirty{false};
Containers::StaticArray<38, Int> _selectedArmourDecals{ValueInit};
Containers::StaticArray<38, Int> _selectedArmourAccessories{ValueInit};
Int _selectedWeaponPart{0};
Int _selectedWeaponDecal{0};
Int _selectedWeaponAccessory{0};
bool _cheatMode{false};
};

View file

@ -409,7 +409,7 @@ void SaveTool::drawMassManager() {
ImGui::TableSetupColumn("##Hangar", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##MASSName", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("##Active", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##Buttons", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("##DeleteButton", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupScrollFreeze(0, 1);
@ -504,11 +504,6 @@ void SaveTool::drawMassManager() {
}
ImGui::SameLine(0.0f, 2.0f);
}
else{
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.0f);
ImGui::SmallButton(ICON_FA_SEARCH);
ImGui::PopStyleVar();
}
if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_TRASH_ALT)) {
mass_to_delete = i;
ImGui::OpenPopup(mass_deletion_popup_ID);

View file

@ -74,9 +74,6 @@ void SaveTool::drawMassViewer() {
if(ImGui::SmallButton(ICON_FA_SYNC_ALT " Refresh")) {
_currentMass->refreshValues();
_currentMass->setDirty(false);
_jointsDirty = false;
_stylesDirty = false;
_eyeFlareDirty = false;
}
}
@ -85,15 +82,7 @@ void SaveTool::drawMassViewer() {
current_weapon = nullptr;
_currentMass = nullptr;
_uiState = UiState::MainManager;
_jointsDirty = false;
_stylesDirty = false;
_eyeFlareDirty = false;
_selectedArmourDecals = Containers::StaticArray<38, Int>{ValueInit};
_selectedArmourAccessories = Containers::StaticArray<38, Int>{ValueInit};
_selectedWeaponPart = 0;
_selectedWeaponDecal = 0;
_selectedWeaponAccessory = 0;
};
}
ImGui::EndTable();
}
@ -212,6 +201,8 @@ void SaveTool::drawJointSliders() {
return;
}
static bool joints_dirty = false;
ImGui::TextWrapped("In-game values are multiplied by 100.\nFor example, 0.500 here is equal to 50 in-game.");
if(ImGui::BeginTable("##JointSliderTable", 2, ImGuiTableFlags_Borders)) {
@ -225,7 +216,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##NeckSlider", &_currentMass->jointSliders().neck, 0.0f, 1.0f)) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextRow();
@ -235,7 +226,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##BodySlider", &_currentMass->jointSliders().body, 0.0f, 1.0f)) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextRow();
@ -245,7 +236,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##ShouldersSlider", &_currentMass->jointSliders().shoulders, 0.0f, 1.0f)) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextRow();
@ -255,7 +246,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##HipsSlider", &_currentMass->jointSliders().hips, 0.0f, 1.0f)) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextRow();
@ -271,12 +262,12 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##UpperArmsSlider", &_currentMass->jointSliders().upperArms, 0.0f, 1.0f, "Upper: %.3f")) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##LowerArmsSlider", &_currentMass->jointSliders().lowerArms, 0.0f, 1.0f, "Lower: %.3f")) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::EndTable();
@ -296,12 +287,12 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##UpperLegsSlider", &_currentMass->jointSliders().upperLegs, 0.0f, 1.0f, "Upper: %.3f")) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##LowerLegsSlider", &_currentMass->jointSliders().lowerLegs, 0.0f, 1.0f, "Lower: %.3f")) {
_jointsDirty = true;
joints_dirty = true;
}
ImGui::EndTable();
@ -311,7 +302,7 @@ void SaveTool::drawJointSliders() {
ImGui::EndTable();
}
if(!_jointsDirty) {
if(!joints_dirty) {
ImGui::BeginDisabled();
ImGui::Button(ICON_FA_SAVE " Save");
ImGui::SameLine();
@ -323,12 +314,12 @@ void SaveTool::drawJointSliders() {
if(!_currentMass->writeJointSliders()) {
_queue.addToast(Toast::Type::Error, "Error: " + Mass::lastError());
}
_jointsDirty = false;
joints_dirty = false;
}
ImGui::SameLine();
if(ImGui::Button(ICON_FA_UNDO " Reset")) {
_currentMass->getJointSliders();
_jointsDirty = false;
joints_dirty = false;
}
}
}
@ -338,6 +329,8 @@ void SaveTool::drawFrameStyles() {
return;
}
static bool styles_dirty = false;
for(Int i = 0; i < 4; i++) {
ImGui::AlignTextToFramePadding();
ImGui::Text("Slot %d:", i + 1);
@ -350,7 +343,7 @@ void SaveTool::drawFrameStyles() {
for(const auto& style : style_names) {
if(ImGui::Selectable(getStyleName(style.first, _currentMass->frameCustomStyles()), _currentMass->frameStyles()[i] == style.first)) {
_currentMass->frameStyles()[i] = style.first;
_stylesDirty = true;
styles_dirty = true;
}
}
@ -360,7 +353,7 @@ void SaveTool::drawFrameStyles() {
ImGui::PopID();
}
if(!_stylesDirty) {
if(!styles_dirty) {
ImGui::BeginDisabled();
ImGui::Button(ICON_FA_SAVE " Save");
ImGui::SameLine();
@ -372,12 +365,12 @@ void SaveTool::drawFrameStyles() {
if(!_currentMass->writeFrameStyles()) {
_queue.addToast(Toast::Type::Error, "Error: " + Mass::lastError());
}
_stylesDirty = false;
styles_dirty = false;
}
ImGui::SameLine();
if(ImGui::Button(ICON_FA_UNDO " Reset")) {
_currentMass->getFrameStyles();
_stylesDirty = false;
styles_dirty = false;
}
}
}
@ -387,11 +380,13 @@ void SaveTool::drawEyeColourPicker() {
return;
}
static bool eye_flare_dirty = false;
if(ImGui::ColorPicker3("##EyeFlarePicker", &_currentMass->eyeFlareColour().x())) {
_eyeFlareDirty = true;
eye_flare_dirty = true;
}
if(!_eyeFlareDirty) {
if(!eye_flare_dirty) {
ImGui::BeginDisabled();
ImGui::Button(ICON_FA_SAVE " Save");
ImGui::SameLine();
@ -403,12 +398,12 @@ void SaveTool::drawEyeColourPicker() {
if(!_currentMass->writeEyeFlareColour()) {
_queue.addToast(Toast::Type::Error, "Error writing the eye flare colour.");
}
_eyeFlareDirty = false;
eye_flare_dirty = false;
}
ImGui::SameLine();
if(ImGui::Button(ICON_FA_UNDO " Reset")) {
_currentMass->getEyeFlareColour();
_eyeFlareDirty = false;
eye_flare_dirty = false;
}
}
}
@ -459,6 +454,9 @@ void SaveTool::drawArmour() {
return;
}
static Containers::StaticArray<38, Int> selected_decals{ValueInit};
static Containers::StaticArray<38, Int> selected_accessories{ValueInit};
for(UnsignedInt i = 0; i < _currentMass->armourParts().size(); i++) {
ImGui::PushID(i);
@ -545,10 +543,10 @@ void SaveTool::drawArmour() {
ImGui::TextUnformatted("Showing/editing decal");
for(UnsignedLong j = 0; j < part.demoDecals; j++) {
ImGui::SameLine();
ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], j);
ImGui::RadioButton(std::to_string(j + 1).c_str(), &selected_decals[i], j);
}
drawDecalEditor(part.decals[_selectedArmourDecals[i]]);
drawDecalEditor(part.decals[selected_decals[i]]);
ImGui::PopID();
@ -561,10 +559,10 @@ void SaveTool::drawArmour() {
ImGui::TextUnformatted("Showing/editing accessory");
for(UnsignedInt j = 0; j < part.accessories.size(); j++) {
ImGui::SameLine();
ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], j);
ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &selected_accessories[i], j);
}
drawAccessoryEditor(part.accessories[_selectedArmourAccessories[i]], _currentMass->armourCustomStyles());
drawAccessoryEditor(part.accessories[selected_accessories[i]], _currentMass->armourCustomStyles());
ImGui::PopID();
}
@ -874,17 +872,19 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::Separator();
if(ImGui::CollapsingHeader("Weapon parts")) {
static Int selected_part = 0;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Viewing/editing part:");
for(Int i = 0; UnsignedLong(i) < weapon.parts.size(); i++) {
if(UnsignedLong(_selectedWeaponPart) >= weapon.parts.size()) {
_selectedWeaponPart = 0;
if(UnsignedLong(selected_part) >= weapon.parts.size()) {
selected_part = 0;
}
ImGui::SameLine();
ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponPart, i);
ImGui::RadioButton(std::to_string(i + 1).c_str(), &selected_part, i);
}
auto& part = weapon.parts[_selectedWeaponPart];
auto& part = weapon.parts[selected_part];
ImGui::Text("ID: %i", part.id);
@ -917,14 +917,16 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::PushID("Decal");
static Int selected_decal = 0;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Showing/editing decal");
for(UnsignedLong i = 0; i < part.demoDecals; i++) {
ImGui::SameLine();
ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, i);
ImGui::RadioButton(std::to_string(i + 1).c_str(), &selected_decal, i);
}
drawDecalEditor(part.decals[_selectedWeaponDecal]);
drawDecalEditor(part.decals[selected_decal]);
ImGui::PopID();
@ -933,14 +935,16 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::PushID("Accessory");
static Int selected_accessory = 0;
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Showing/editing accessory");
for(UnsignedLong i = 0; i < part.accessories.size(); i++) {
ImGui::SameLine();
ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &_selectedWeaponAccessory, i);
ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &selected_accessory, i);
}
drawAccessoryEditor(part.accessories[_selectedWeaponAccessory], weapon.customStyles);
drawAccessoryEditor(part.accessories[selected_accessory], weapon.customStyles);
ImGui::PopID();
}