Use a list attribute name as model category
This commit is contained in:
@@ -262,9 +262,10 @@ void ModelsCategory::save(FIL * file)
|
||||
f_puts("]", file);
|
||||
f_putc('\n', file);
|
||||
#else
|
||||
f_puts("- name: ", file);
|
||||
f_puts("- ", file);
|
||||
f_puts(name, file);
|
||||
f_putc('\n', file);
|
||||
//f_puts(" models:\n", file);
|
||||
#endif
|
||||
for (list<ModelCell *>::iterator it = begin(); it != end(); ++it) {
|
||||
(*it)->save(file);
|
||||
|
||||
@@ -89,6 +89,12 @@ static bool find_node(void* ctx, char* buf, uint8_t len)
|
||||
memcpy(mi->current_attr, buf, len);
|
||||
mi->current_attr[len] = '\0';
|
||||
|
||||
list<ModelsCategory *>& cats = mi->root->getCategories();
|
||||
if (mi->level == modelslist_iter::Category) {
|
||||
ModelsCategory* cat = new ModelsCategory(buf,len);
|
||||
cats.push_back(cat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,10 +103,6 @@ static void set_attr(void* ctx, char* buf, uint8_t len)
|
||||
modelslist_iter* mi = (modelslist_iter*)ctx;
|
||||
list<ModelsCategory *>& cats = mi->root->getCategories();
|
||||
switch(mi->level) {
|
||||
case modelslist_iter::Category: {
|
||||
ModelsCategory* cat = new ModelsCategory(buf,len);
|
||||
cats.push_back(cat);
|
||||
} break;
|
||||
|
||||
case modelslist_iter::Model:
|
||||
if (!strcmp(mi->current_attr,"filename")) {
|
||||
|
||||
Reference in New Issue
Block a user