src/parser.cpp

changeset 152
03f8e6d42e13
parent 144
5d73a6717321
child 176
cd9d6bf6f649
equal deleted inserted replaced
151:e628fc2e0c72 152:03f8e6d42e13
231 231
232 /** 232 /**
233 * @brief Parses the model body into the given model. 233 * @brief Parses the model body into the given model.
234 * @param editor Handle to model edit context 234 * @param editor Handle to model edit context
235 */ 235 */
236 void Parser::parseBody(Model::EditContext& editor) 236 void Parser::parseBody(Model& model)
237 { 237 {
238 bool invertNext = false; 238 bool invertNext = false;
239 while (not this->device.atEnd()) 239 while (not this->device.atEnd())
240 this->bag.append(this->readLine()); 240 this->bag.append(this->readLine());
241 for (const QString& line : this->bag) 241 for (const QString& line : this->bag)
247 { 247 {
248 invertNext = true; 248 invertNext = true;
249 continue; 249 continue;
250 } 250 }
251 std::unique_ptr<ldraw::Object> object = parseFromString(line); 251 std::unique_ptr<ldraw::Object> object = parseFromString(line);
252 auto id = editor.append(std::move(object)); 252 model.append(std::move(object));
253 if (invertNext) 253 if (invertNext)
254 { 254 {
255 editor.invertObject(id); 255 model[model.size() - 1]->invert();
256 } 256 }
257 invertNext = false; 257 invertNext = false;
258 } 258 }
259 /* 259 /*
260 // Test quadrilateral splitting by splitting all the quadrilaterals 260 // Test quadrilateral splitting by splitting all the quadrilaterals

mercurial