| 254 | |
| 255 | |
| 256 | void CableWidget::fromJson(json_t* rootJ) { |
| 257 | json_t* colorJ = json_object_get(rootJ, "color"); |
| 258 | if (colorJ && json_is_string(colorJ)) { |
| 259 | color = color::fromHexString(json_string_value(colorJ)); |
| 260 | } |
| 261 | else { |
| 262 | // In <v0.6.0, cables used JSON objects instead of hex strings. Just ignore them if so and use the existing cable color. |
| 263 | // In <=v1, cable colors were not serialized. |
| 264 | color = APP->scene->rack->getNextCableColor(); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | |
| 269 | static math::Vec getSlumpPos(math::Vec pos1, math::Vec pos2) { |
nothing calls this directly
no test coverage detected