| 271 | size_t moduleIndex; |
| 272 | json_t* moduleJ; |
| 273 | json_array_foreach(modulesJ, moduleIndex, moduleJ) { |
| 274 | // module |
| 275 | json_t* idJ = json_object_get(moduleJ, "id"); |
| 276 | if (!idJ) |
| 277 | continue; |
| 278 | int64_t id = json_integer_value(idJ); |
| 279 | // TODO Legacy v0.6? |
| 280 | ModuleWidget* mw = getModule(id); |
| 281 | if (!mw) { |
| 282 | WARN("Cannot find ModuleWidget %lld", (long long) id); |
| 283 | continue; |
| 284 | } |
| 285 | |
| 286 | // pos |
| 287 | math::Vec pos = mw->box.pos.minus(RACK_OFFSET); |
| 288 | pos = pos.div(RACK_GRID_SIZE).round(); |
| 289 | json_t* posJ = json_pack("[i, i]", (int) pos.x, (int) pos.y); |
| 290 | json_object_set_new(moduleJ, "pos", posJ); |
| 291 | } |
| 292 | |
| 293 | // Calculate plug orders |
| 294 | std::map<Widget*, int> plugOrders; |
nothing calls this directly
no test coverage detected