| 3436 | } |
| 3437 | |
| 3438 | static bool parseObjects(const Element& root, Scene& scene, u16 flags, Allocator& allocator, JobProcessor job_processor, void* job_user_ptr) { |
| 3439 | if (!job_processor) job_processor = &sync_job_processor; |
| 3440 | |
| 3441 | const bool ignore_geometry = (flags & (u16)LoadFlags::IGNORE_GEOMETRY) != 0; |
| 3442 | const bool ignore_blend_shapes = (flags & (u16)LoadFlags::IGNORE_BLEND_SHAPES) != 0; |
| 3443 | const bool ignore_cameras = (flags & (u16)LoadFlags::IGNORE_CAMERAS) != 0; |
| 3444 | const bool ignore_lights = (flags & (u16)LoadFlags::IGNORE_LIGHTS) != 0; |
| 3445 | const bool ignore_textures = (flags & (u16)LoadFlags::IGNORE_TEXTURES) != 0; |
| 3446 | const bool ignore_skin = (flags & (u16)LoadFlags::IGNORE_SKIN) != 0; |
| 3447 | const bool ignore_bones = (flags & (u16)LoadFlags::IGNORE_BONES) != 0; |
| 3448 | const bool ignore_pivots = (flags & (u16)LoadFlags::IGNORE_PIVOTS) != 0; |
| 3449 | const bool ignore_animations = (flags & (u16)LoadFlags::IGNORE_ANIMATIONS) != 0; |
| 3450 | const bool ignore_materials = (flags & (u16)LoadFlags::IGNORE_MATERIALS) != 0; |
| 3451 | const bool ignore_poses = (flags & (u16)LoadFlags::IGNORE_POSES) != 0; |
| 3452 | const bool ignore_videos = (flags & (u16)LoadFlags::IGNORE_VIDEOS) != 0; |
| 3453 | const bool ignore_limbs = (flags & (u16)LoadFlags::IGNORE_LIMBS) != 0; |
| 3454 | const bool ignore_meshes = (flags & (u16)LoadFlags::IGNORE_MESHES) != 0; |
| 3455 | const bool ignore_models = (flags & (u16)LoadFlags::IGNORE_MODELS) != 0; |
| 3456 | |
| 3457 | const Element* objs = findChild(root, "Objects"); |
| 3458 | if (!objs) return true; |
| 3459 | |
| 3460 | scene.m_root = allocator.allocate<Root>(scene, root); |
| 3461 | scene.m_root->id = 0; |
| 3462 | scene.m_object_map[0] = {&root, scene.m_root}; |
| 3463 | |
| 3464 | const Element* object = objs->child; |
| 3465 | while (object) |
| 3466 | { |
| 3467 | if (object->first_property) { |
| 3468 | if (!isLong(object->first_property) && !isString(object->first_property)) |
| 3469 | { |
| 3470 | Error::s_message = "Invalid ID"; |
| 3471 | return false; |
| 3472 | } |
| 3473 | |
| 3474 | u64 id = toObjectID(scene, object->first_property); |
| 3475 | scene.m_object_map[id] = {object, nullptr}; |
| 3476 | } |
| 3477 | object = object->sibling; |
| 3478 | } |
| 3479 | |
| 3480 | std::vector<ParseDataJob> jobs; |
| 3481 | |
| 3482 | for (auto iter : scene.m_object_map) |
| 3483 | { |
| 3484 | OptionalError<Object*> obj = nullptr; |
| 3485 | |
| 3486 | if (iter.second.object == scene.m_root) continue; |
| 3487 | |
| 3488 | if (iter.second.element->id == "Geometry" && !ignore_geometry) |
| 3489 | { |
| 3490 | Property* last_prop = iter.second.element->first_property; |
| 3491 | while (last_prop->next) last_prop = last_prop->next; |
| 3492 | if (last_prop && last_prop->value == "Mesh") |
| 3493 | { |
| 3494 | GeometryImpl* geom = allocator.allocate<GeometryImpl>(scene, *iter.second.element); |
| 3495 | parseGeometry(*iter.second.element, *geom, jobs, allocator); |
no test coverage detected