| 451 | } |
| 452 | |
| 453 | void EditorUI::createLeafNodeUI(Reflection::ReflectionInstance& instance) |
| 454 | { |
| 455 | Reflection::FieldAccessor* fields; |
| 456 | int fields_count = instance.m_meta.getFieldsList(fields); |
| 457 | |
| 458 | for (size_t index = 0; index < fields_count; index++) |
| 459 | { |
| 460 | auto field = fields[index]; |
| 461 | if (field.isArrayType()) |
| 462 | { |
| 463 | Reflection::ArrayAccessor array_accessor; |
| 464 | if (Reflection::TypeMeta::newArrayAccessorFromName(field.getFieldTypeName(), array_accessor)) |
| 465 | { |
| 466 | void* field_instance = field.get(instance.m_instance); |
| 467 | int array_count = array_accessor.getSize(field_instance); |
| 468 | m_editor_ui_creator["TreeNodePush"]( |
| 469 | std::string(field.getFieldName()) + "[" + std::to_string(array_count) + "]", nullptr); |
| 470 | auto item_type_meta_item = |
| 471 | Reflection::TypeMeta::newMetaFromName(array_accessor.getElementTypeName()); |
| 472 | auto item_ui_creator_iterator = m_editor_ui_creator.find(item_type_meta_item.getTypeName()); |
| 473 | for (int index = 0; index < array_count; index++) |
| 474 | { |
| 475 | if (item_ui_creator_iterator == m_editor_ui_creator.end()) |
| 476 | { |
| 477 | m_editor_ui_creator["TreeNodePush"]("[" + std::to_string(index) + "]", nullptr); |
| 478 | auto object_instance = Reflection::ReflectionInstance( |
| 479 | Piccolo::Reflection::TypeMeta::newMetaFromName(item_type_meta_item.getTypeName().c_str()), |
| 480 | array_accessor.get(index, field_instance)); |
| 481 | createClassUI(object_instance); |
| 482 | m_editor_ui_creator["TreeNodePop"]("[" + std::to_string(index) + "]", nullptr); |
| 483 | } |
| 484 | else |
| 485 | { |
| 486 | if (item_ui_creator_iterator == m_editor_ui_creator.end()) |
| 487 | { |
| 488 | continue; |
| 489 | } |
| 490 | m_editor_ui_creator[item_type_meta_item.getTypeName()]( |
| 491 | "[" + std::to_string(index) + "]", array_accessor.get(index, field_instance)); |
| 492 | } |
| 493 | } |
| 494 | m_editor_ui_creator["TreeNodePop"](field.getFieldName(), nullptr); |
| 495 | } |
| 496 | } |
| 497 | auto ui_creator_iterator = m_editor_ui_creator.find(field.getFieldTypeName()); |
| 498 | if (ui_creator_iterator == m_editor_ui_creator.end()) |
| 499 | { |
| 500 | Reflection::TypeMeta field_meta = |
| 501 | Reflection::TypeMeta::newMetaFromName(field.getFieldTypeName()); |
| 502 | if (field.getTypeMeta(field_meta)) |
| 503 | { |
| 504 | auto child_instance = |
| 505 | Reflection::ReflectionInstance(field_meta, field.get(instance.m_instance)); |
| 506 | m_editor_ui_creator["TreeNodePush"](field_meta.getTypeName(), nullptr); |
| 507 | createClassUI(child_instance); |
| 508 | m_editor_ui_creator["TreeNodePop"](field_meta.getTypeName(), nullptr); |
| 509 | } |
| 510 | else |
nothing calls this directly
no test coverage detected