SaveTool: adapt to Mass changes.
This commit is contained in:
parent
5689ec6c1a
commit
e839d1c19b
4 changed files with 325 additions and 229 deletions
|
@ -212,7 +212,12 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
||||||
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
||||||
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
||||||
_massManager->refreshHangar(index);
|
if(!_currentMass || _currentMass != &(_massManager->hangar(index))) {
|
||||||
|
_massManager->refreshHangar(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentMass->setDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -221,7 +226,12 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
||||||
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
||||||
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
||||||
_massManager->refreshHangar(index);
|
if(!_currentMass || _currentMass != &(_massManager->hangar(index))) {
|
||||||
|
_massManager->refreshHangar(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentMass->setDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -233,16 +243,29 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id,
|
||||||
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
||||||
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
||||||
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
||||||
_massManager->refreshHangar(index);
|
|
||||||
|
if(!_currentMass || _currentMass != &(_massManager->hangar(index))) {
|
||||||
|
_massManager->refreshHangar(index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentMass->setDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case efsw::Actions::Moved:
|
case efsw::Actions::Moved:
|
||||||
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
if(Utility::String::endsWith(filename, _currentProfile->steamId() + ".sav")) {
|
||||||
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : ""))) {
|
if(Utility::String::endsWith(old_filename, ".tmp")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Utility::String::beginsWith(filename, Utility::formatString("{}Unit", _currentProfile->type() == ProfileType::Demo ? "Demo" : "")) &&
|
||||||
|
Utility::String::endsWith(old_filename, ".sav"))
|
||||||
|
{
|
||||||
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
int index = ((filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
||||||
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
(filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
||||||
_massManager->refreshHangar(index);
|
_massManager->refreshHangar(index);
|
||||||
|
|
||||||
int old_index = ((old_filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
int old_index = ((old_filename[_currentProfile->type() == ProfileType::Demo ? 8 : 4] - 0x30) * 10) +
|
||||||
(old_filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
(old_filename[_currentProfile->type() == ProfileType::Demo ? 9 : 5] - 0x30);
|
||||||
_massManager->refreshHangar(old_index);
|
_massManager->refreshHangar(old_index);
|
||||||
|
@ -526,8 +549,6 @@ auto SaveTool::findGameDataDirectory() -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveTool::initialiseMassManager() {
|
void SaveTool::initialiseMassManager() {
|
||||||
_currentProfile->refreshValues();
|
|
||||||
|
|
||||||
_massManager.emplace(_saveDir,
|
_massManager.emplace(_saveDir,
|
||||||
_currentProfile->steamId(),
|
_currentProfile->steamId(),
|
||||||
_currentProfile->type() == ProfileType::Demo,
|
_currentProfile->type() == ProfileType::Demo,
|
||||||
|
|
|
@ -105,6 +105,9 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
||||||
|
|
||||||
void drawMassViewer();
|
void drawMassViewer();
|
||||||
void drawFrameInfo();
|
void drawFrameInfo();
|
||||||
|
void drawJointSliders();
|
||||||
|
void drawFramePaint();
|
||||||
|
void drawCustomStyles(Containers::ArrayView<CustomStyle> styles);
|
||||||
|
|
||||||
void drawAbout();
|
void drawAbout();
|
||||||
void drawGameState();
|
void drawGameState();
|
||||||
|
|
|
@ -435,7 +435,7 @@ void SaveTool::drawMassManager() {
|
||||||
drag_drop_index = i;
|
drag_drop_index = i;
|
||||||
ImGui::SetDragDropPayload("Mass", &drag_drop_index, sizeof(int));
|
ImGui::SetDragDropPayload("Mass", &drag_drop_index, sizeof(int));
|
||||||
|
|
||||||
ImGui::Text("%s - Hangar %.2d", _massManager->hangar(i).name().c_str(), i + 1);
|
ImGui::Text("%s - Hangar %.2d", (*_massManager->hangar(i).name()).c_str(), i + 1);
|
||||||
|
|
||||||
ImGui::EndDragDropSource();
|
ImGui::EndDragDropSource();
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ void SaveTool::drawMassManager() {
|
||||||
ImGui::TextDisabled("<invalid>");
|
ImGui::TextDisabled("<invalid>");
|
||||||
break;
|
break;
|
||||||
case Mass::State::Valid:
|
case Mass::State::Valid:
|
||||||
ImGui::TextUnformatted(_massManager->hangar(i).name().c_str());
|
ImGui::TextUnformatted((*_massManager->hangar(i).name()).c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,7 +614,7 @@ auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImGui::Text("Are you sure you want to delete the M.A.S.S. named %s in hangar %.2i ? This operation is irreversible.",
|
ImGui::Text("Are you sure you want to delete the M.A.S.S. named %s in hangar %.2i ? This operation is irreversible.",
|
||||||
_massManager->hangar(mass_index).name().c_str(), mass_index + 1);
|
(*_massManager->hangar(mass_index).name()).c_str(), mass_index + 1);
|
||||||
}
|
}
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <Magnum/ImGuiIntegration/Integration.h>
|
||||||
|
|
||||||
#include "../Maps/StyleNames.h"
|
#include "../Maps/StyleNames.h"
|
||||||
|
|
||||||
#include "../FontAwesome/IconsFontAwesome5.h"
|
#include "../FontAwesome/IconsFontAwesome5.h"
|
||||||
|
@ -24,6 +26,7 @@ void SaveTool::drawMassViewer() {
|
||||||
if(!_currentMass || _currentMass->state() != Mass::State::Valid) {
|
if(!_currentMass || _currentMass->state() != Mass::State::Valid) {
|
||||||
_currentMass = nullptr;
|
_currentMass = nullptr;
|
||||||
_uiState = UiState::MainManager;
|
_uiState = UiState::MainManager;
|
||||||
|
_queue.addToast(Toast::Type::Error, "The selected M.A.S.S. isn't valid anymore.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +41,11 @@ void SaveTool::drawMassViewer() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("Current M.A.S.S.: %s (%s)",
|
ImGui::Text("Current M.A.S.S.: %s (%s)",
|
||||||
_currentMass->name().c_str(),
|
(*_currentMass->name()).c_str(),
|
||||||
_currentMass->filename().c_str());
|
_currentMass->filename().c_str());
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if(ImGui::Button(ICON_FA_ARROW_LEFT " Back to main manager")) {
|
if(ImGui::SmallButton(ICON_FA_ARROW_LEFT " Back to main manager")) {
|
||||||
_currentMass = nullptr;
|
_currentMass = nullptr;
|
||||||
_uiState = UiState::MainManager;
|
_uiState = UiState::MainManager;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +54,17 @@ void SaveTool::drawMassViewer() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextWrapped("WARNING: Colours in this app may look different from in-game colours, due to unavoidable differences in the rendering pipeline.");
|
ImGui::TextWrapped("WARNING: Colours in this app may look different from in-game colours, due to unavoidable differences in the rendering pipeline.");
|
||||||
|
|
||||||
|
ImGui::TextColored(ImColor(255, 255, 0), ICON_FA_EXCLAMATION_TRIANGLE);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextWrapped("Real-time updates are disabled while on this screen. %s", _currentMass->dirty() ? "The save file has been changed." : "");
|
||||||
|
if(_currentMass->dirty()) {
|
||||||
|
ImGui::SameLine();
|
||||||
|
if(ImGui::SmallButton(ICON_FA_SYNC_ALT " Refresh")) {
|
||||||
|
_currentMass->refreshValues();
|
||||||
|
_currentMass->setDirty(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ImGui::BeginChild("##MassInfo",
|
if(ImGui::BeginChild("##MassInfo",
|
||||||
{ImGui::GetContentRegionAvailWidth() * 0.60f, 0.0f},
|
{ImGui::GetContentRegionAvailWidth() * 0.60f, 0.0f},
|
||||||
true, ImGuiWindowFlags_MenuBar))
|
true, ImGuiWindowFlags_MenuBar))
|
||||||
|
@ -96,256 +109,315 @@ void SaveTool::drawFrameInfo() {
|
||||||
|
|
||||||
ImGui::TextUnformatted("Frame type: Skeleton"); // Placeholder for now, replace with actual code once other frames are implemented.
|
ImGui::TextUnformatted("Frame type: Skeleton"); // Placeholder for now, replace with actual code once other frames are implemented.
|
||||||
|
|
||||||
if(ImGui::CollapsingHeader("Joint sliders")) {
|
drawJointSliders();
|
||||||
static Joints sliders = _currentMass->jointSliders();
|
|
||||||
static bool edit = false;
|
|
||||||
static bool dirty = false;
|
|
||||||
|
|
||||||
ImGui::TextWrapped("In-game values are multiplied by 100.\nFor example, 0.500 here is equal to 50 in-game.");
|
drawFramePaint();
|
||||||
|
}
|
||||||
|
|
||||||
if(ImGui::BeginTable("##JointSliderTable", 2, ImGuiTableFlags_Borders)) {
|
void SaveTool::drawJointSliders() {
|
||||||
ImGui::TableSetupColumn("##SliderLabel", ImGuiTableColumnFlags_WidthFixed);
|
if(!ImGui::CollapsingHeader("Joint sliders")) {
|
||||||
ImGui::TableSetupColumn("##Sliders", ImGuiTableColumnFlags_WidthStretch);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
static Joints sliders = _currentMass->jointSliders();
|
||||||
ImGui::TableSetColumnIndex(0);
|
static bool joints_edit = false;
|
||||||
|
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)) {
|
||||||
|
ImGui::TableSetupColumn("##SliderLabel", ImGuiTableColumnFlags_WidthFixed);
|
||||||
|
ImGui::TableSetupColumn("##Sliders", ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Neck");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(joints_edit) {
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if(ImGui::SliderFloat("##NeckSlider", &sliders.neck, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::TextUnformatted("Neck");
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().neck));
|
||||||
ImGui::TableSetColumnIndex(1);
|
}
|
||||||
if(edit) {
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Body");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(joints_edit) {
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if(ImGui::SliderFloat("##BodySlider", &sliders.body, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().body));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Shoulders");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(joints_edit) {
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if(ImGui::SliderFloat("##ShouldersSlider", &sliders.shoulders, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().shoulders));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Hips");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(joints_edit) {
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if(ImGui::SliderFloat("##HipsSlider", &sliders.hips, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().hips));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(ImGui::BeginTable("##UpperLowerLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
||||||
|
ImGui::TableSetupColumn("##Upper", ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
ImGui::TableSetupColumn("##Lower", ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Upper");
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Lower");
|
||||||
|
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Arms");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
if(ImGui::BeginTable("##UpperLowerArmsLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
||||||
|
ImGui::TableSetupColumn("##UpperArms", ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
ImGui::TableSetupColumn("##LowerArms", ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if(joints_edit) {
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
if(ImGui::SliderFloat("##NeckSlider", &sliders.neck, 0.0f, 1.0f)) {
|
if(ImGui::SliderFloat("##UpperArmsSlider", &sliders.upperArms, 0.0f, 1.0f)) {
|
||||||
dirty = true;
|
joints_dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().neck));
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().upperArms));
|
||||||
}
|
}
|
||||||
|
ImGui::TableNextColumn();
|
||||||
ImGui::TableNextRow();
|
if(joints_edit) {
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Body");
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
if(ImGui::SliderFloat("##BodySlider", &sliders.body, 0.0f, 1.0f)) {
|
if(ImGui::SliderFloat("##LowerArmsSlider", &sliders.lowerArms, 0.0f, 1.0f)) {
|
||||||
dirty = true;
|
joints_dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().body));
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().lowerArms));
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Shoulders");
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##ShouldersSlider", &sliders.shoulders, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().shoulders));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Hips");
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##HipsSlider", &sliders.hips, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().hips));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(ImGui::BeginTable("##UpperLowerLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
|
||||||
ImGui::TableSetupColumn("##Upper", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
ImGui::TableSetupColumn("##Lower", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Upper");
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Lower");
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Arms");
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(ImGui::BeginTable("##UpperLowerArmsLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
|
||||||
ImGui::TableSetupColumn("##UpperArms", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
ImGui::TableSetupColumn("##LowerArms", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##UpperArmsSlider", &sliders.upperArms, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().upperArms));
|
|
||||||
}
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##LowerArmsSlider", &sliders.lowerArms, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().lowerArms));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Legs");
|
|
||||||
ImGui::TableSetColumnIndex(1);
|
|
||||||
if(ImGui::BeginTable("##UpperLowerLegsLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
|
||||||
ImGui::TableSetupColumn("##UpperLegs", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
ImGui::TableSetupColumn("##LowerLegs", ImGuiTableColumnFlags_WidthStretch);
|
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##UpperLegsSlider", &sliders.upperLegs, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().upperLegs));
|
|
||||||
}
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
if(edit) {
|
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
|
||||||
if(ImGui::SliderFloat("##LowerLegsSlider", &sliders.lowerLegs, 0.0f, 1.0f)) {
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("%.3f", Double(_currentMass->jointSliders().lowerLegs));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(edit) {
|
ImGui::TableNextRow();
|
||||||
if(!dirty) {
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
|
ImGui::TextUnformatted("Legs");
|
||||||
ImGui::Button(ICON_FA_SAVE " Save changes");
|
ImGui::TableSetColumnIndex(1);
|
||||||
ImGui::SameLine();
|
if(ImGui::BeginTable("##UpperLowerLegsLayoutTable", 2, ImGuiTableFlags_BordersInnerV)) {
|
||||||
ImGui::Button(ICON_FA_UNDO " Reset sliders");
|
ImGui::TableSetupColumn("##UpperLegs", ImGuiTableColumnFlags_WidthStretch);
|
||||||
ImGui::PopStyleVar();
|
ImGui::TableSetupColumn("##LowerLegs", ImGuiTableColumnFlags_WidthStretch);
|
||||||
ImGui::PopItemFlag();
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if(joints_edit) {
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if(ImGui::SliderFloat("##UpperLegsSlider", &sliders.upperLegs, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save changes"); })) {
|
ImGui::AlignTextToFramePadding();
|
||||||
dirty = false;
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().upperLegs));
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::TableNextColumn();
|
||||||
if(ImGui::Button(ICON_FA_UNDO " Reset sliders")) {
|
if(joints_edit) {
|
||||||
sliders = _currentMass->jointSliders();
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
dirty = false;
|
if(ImGui::SliderFloat("##LowerLegsSlider", &sliders.lowerLegs, 0.0f, 1.0f)) {
|
||||||
|
joints_dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
else {
|
||||||
if(ImGui::Button(ICON_FA_TIMES " Cancel editing")) {
|
ImGui::AlignTextToFramePadding();
|
||||||
sliders = _currentMass->jointSliders();
|
ImGui::Text("%.3f", Double(_currentMass->jointSliders().lowerLegs));
|
||||||
dirty = false;
|
|
||||||
edit = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::TextUnformatted("To input out-of-range values, hold Ctrl and click on a slider.");
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(joints_edit) {
|
||||||
|
if(!joints_dirty) {
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
ImGui::Button(ICON_FA_SAVE " Save changes");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_UNDO " Reset sliders");
|
||||||
|
ImGui::EndDisabled();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(ImGui::Button(ICON_FA_EDIT " Edit sliders")) {
|
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save changes"); })) {
|
||||||
edit = true;
|
if(!_currentMass->setSliders(sliders)) {
|
||||||
}
|
_queue.addToast(Toast::Type::Error, "Error writing the joint sliders.");
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ImGui::CollapsingHeader("Paint")) {
|
|
||||||
ImGui::TextUnformatted("Frame styles:");
|
|
||||||
for(Int i = 0; i < 4; i++) {
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("Slot %d:", i + 1);
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::PushID(i);
|
|
||||||
GameState game_state = _gameState;
|
|
||||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
|
||||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
|
|
||||||
}
|
|
||||||
if(ImGui::BeginCombo("##Style", style_names.at(_currentMass->frameStyles()[i]))) {
|
|
||||||
for(const auto& style : style_names) {
|
|
||||||
if(ImGui::Selectable(style.second, _currentMass->frameStyles()[i] == style.first)) {
|
|
||||||
if(!_currentMass->setFrameStyle(i, style.first)) {
|
|
||||||
_queue.addToast(Toast::Type::Error, Mass::lastError());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_currentMass->refreshValues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
joints_dirty = false;
|
||||||
ImGui::EndCombo();
|
joints_edit = false;
|
||||||
}
|
}
|
||||||
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
ImGui::SameLine();
|
||||||
ImGui::PopItemFlag();
|
if(ImGui::Button(ICON_FA_UNDO " Reset sliders")) {
|
||||||
ImGui::PopStyleVar();
|
sliders = _currentMass->jointSliders();
|
||||||
|
joints_dirty = false;
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
static const Int hex_literals[] = {0x3DF68F08, 0x3E791C4C, 0x00000000};
|
|
||||||
static Float colour_components[3];
|
|
||||||
static bool run_once = true;
|
|
||||||
if(run_once) {
|
|
||||||
std::memcpy(colour_components, hex_literals, sizeof(Float) * 3);
|
|
||||||
run_once = false;
|
|
||||||
}
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::TextUnformatted("Eye flare colour:");
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(-1.0f);
|
if(ImGui::Button(ICON_FA_TIMES " Cancel editing")) {
|
||||||
ImGui::ColorEdit3("##EyeFlarePicker", &colour_components[0]);
|
sliders = _currentMass->jointSliders();
|
||||||
|
joints_dirty = false;
|
||||||
|
joints_edit = false;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::TextUnformatted("To input out-of-range values, hold Ctrl and click on a slider.");
|
||||||
|
}
|
||||||
ImGui::TextUnformatted("The frame's custom styles will go here.");
|
else {
|
||||||
|
if(ImGui::Button(ICON_FA_EDIT " Edit sliders")) {
|
||||||
|
sliders = _currentMass->jointSliders();
|
||||||
|
joints_edit = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveTool::drawFramePaint() {
|
||||||
|
if(!ImGui::CollapsingHeader("Paint")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TextUnformatted("Frame styles:");
|
||||||
|
for(Int i = 0; i < 4; i++) {
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::Text("Slot %d:", i + 1);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::PushID(i);
|
||||||
|
GameState game_state = _gameState;
|
||||||
|
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
||||||
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f);
|
||||||
|
}
|
||||||
|
if(ImGui::BeginCombo("##Style", style_names.at(_currentMass->frameStyles()[i]))) {
|
||||||
|
for(const auto& style : style_names) {
|
||||||
|
if(ImGui::Selectable(style.second, _currentMass->frameStyles()[i] == style.first)) {
|
||||||
|
if(!_currentMass->setFrameStyle(i, style.first)) {
|
||||||
|
_queue.addToast(Toast::Type::Error, Mass::lastError());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentMass->refreshValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
if(!_unsafeMode && game_state != GameState::NotRunning) {
|
||||||
|
ImGui::PopItemFlag();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
static bool eye_flare_edit = false;
|
||||||
|
static bool eye_flare_dirty = false;
|
||||||
|
|
||||||
|
static Color4 eye_flare = _currentMass->eyeFlareColour();
|
||||||
|
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
|
ImGui::TextUnformatted("Eye flare colour:");
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
if(eye_flare_edit) {
|
||||||
|
if(ImGui::ColorEdit3("##EyeFlarePicker", &eye_flare.x())) {
|
||||||
|
eye_flare_dirty = true;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
drawHelpMarker("Right-click for more option, click the coloured square for the full picker.", 250.0f);
|
||||||
|
|
||||||
|
if(!eye_flare_dirty) {
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
ImGui::Button(ICON_FA_SAVE " Save");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Button(ICON_FA_UNDO " Reset");
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) {
|
||||||
|
if(!_currentMass->setEyeFlareColour(eye_flare)) {
|
||||||
|
_queue.addToast(Toast::Type::Error, "Error writing the eye flare colour.");
|
||||||
|
}
|
||||||
|
eye_flare_dirty = false;
|
||||||
|
eye_flare_edit = false;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if(ImGui::Button(ICON_FA_UNDO " Reset")) {
|
||||||
|
eye_flare = _currentMass->eyeFlareColour();
|
||||||
|
eye_flare_dirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
if(ImGui::Button(ICON_FA_TIMES " Cancel")) {
|
||||||
|
eye_flare = _currentMass->eyeFlareColour();
|
||||||
|
eye_flare_dirty = false;
|
||||||
|
eye_flare_edit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
ImColor colour{_currentMass->eyeFlareColour()};
|
||||||
|
ImGui::ColorEdit3("##EyeFlarePicker", &colour.Value.x);
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
if(ImGui::Button(ICON_FA_EDIT " Edit")) {
|
||||||
|
eye_flare = _currentMass->eyeFlareColour();
|
||||||
|
eye_flare_edit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue