Browse Source

Remove wireOpacity and wireTension from patch json format

tags/v0.3.1
Andrew Belt 7 years ago
parent
commit
e2211e21a8
3 changed files with 5 additions and 23 deletions
  1. +1
    -1
      include/math.hpp
  2. +0
    -18
      src/app/RackWidget.cpp
  3. +4
    -4
      src/settings.cpp

+ 1
- 1
include/math.hpp View File

@@ -63,7 +63,7 @@ inline float eucmodf(float a, float base) {
If min < max, returns max
*/
inline float clampf(float x, float min, float max) {
return fmaxf(min, fminf(max, x));
return x > max ? max : x < min ? min : x;
}

/** If the magnitude of x if less than eps, return 0 */


+ 0
- 18
src/app/RackWidget.cpp View File

@@ -89,14 +89,6 @@ json_t *RackWidget::toJson() {
json_t *versionJ = json_string(gApplicationVersion.c_str());
json_object_set_new(rootJ, "version", versionJ);

// wireOpacity
json_t *wireOpacityJ = json_real(dynamic_cast<RackScene*>(gScene)->toolbar->wireOpacitySlider->value);
json_object_set_new(rootJ, "wireOpacity", wireOpacityJ);

// wireTension
json_t *wireTensionJ = json_real(dynamic_cast<RackScene*>(gScene)->toolbar->wireTensionSlider->value);
json_object_set_new(rootJ, "wireTension", wireTensionJ);

// modules
json_t *modulesJ = json_array();
std::map<ModuleWidget*, int> moduleIds;
@@ -162,16 +154,6 @@ void RackWidget::fromJson(json_t *rootJ) {
printf("JSON version mismatch, attempting to convert JSON version %s to %s\n", version, gApplicationVersion.c_str());
}

// wireOpacity
json_t *wireOpacityJ = json_object_get(rootJ, "wireOpacity");
if (wireOpacityJ)
dynamic_cast<RackScene*>(gScene)->toolbar->wireOpacitySlider->value = json_number_value(wireOpacityJ);

// wireTension
json_t *wireTensionJ = json_object_get(rootJ, "wireTension");
if (wireTensionJ)
dynamic_cast<RackScene*>(gScene)->toolbar->wireTensionSlider->value = json_number_value(wireTensionJ);

// modules
std::map<int, ModuleWidget*> moduleWidgets;
json_t *modulesJ = json_object_get(rootJ, "modules");


+ 4
- 4
src/settings.cpp View File

@@ -18,12 +18,12 @@ static json_t *settingsToJson() {
// opacity
float opacity = dynamic_cast<RackScene*>(gScene)->toolbar->wireOpacitySlider->value;
json_t *opacityJ = json_real(opacity);
json_object_set_new(rootJ, "opacity", opacityJ);
json_object_set_new(rootJ, "wireOpacity", opacityJ);

// tension
float tension = dynamic_cast<RackScene*>(gScene)->toolbar->wireTensionSlider->value;
json_t *tensionJ = json_real(tension);
json_object_set_new(rootJ, "tension", tensionJ);
json_object_set_new(rootJ, "wireTension", tensionJ);

return rootJ;
}
@@ -35,12 +35,12 @@ static void settingsFromJson(json_t *rootJ) {
gToken = json_string_value(tokenJ);

// opacity
json_t *opacityJ = json_object_get(rootJ, "opacity");
json_t *opacityJ = json_object_get(rootJ, "wireOpacity");
if (opacityJ)
dynamic_cast<RackScene*>(gScene)->toolbar->wireOpacitySlider->value = json_number_value(opacityJ);

// tension
json_t *tensionJ = json_object_get(rootJ, "tension");
json_t *tensionJ = json_object_get(rootJ, "wireTension");
if (tensionJ)
dynamic_cast<RackScene*>(gScene)->toolbar->wireTensionSlider->value = json_number_value(tensionJ);
}


Loading…
Cancel
Save