Refactor user codebase to use LoadResource helper method.

* Fix small bug when registering resource providers.
* Add test cases for OS filesystem fallback with VFS.
* Rewrite LoadModelFromString using a resource provider (now can pass custom VFSs).

PiperOrigin-RevId: 526959705
Change-Id: Iee1773e5584535d868aab6b206d1bf362e600c8a
This commit is contained in:
Kyle Bayes
2023-04-25 07:23:53 -07:00
committed by Copybara-Service
parent c2115a1f51
commit 23961e24b7
10 changed files with 446 additions and 274 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ const std::string GetModelPath(absl::string_view path);
// Returns a newly-allocated mjModel, loaded from the contents of xml.
// On failure returns nullptr and populates the error array if present.
mjModel* LoadModelFromString(absl::string_view xml, char* error = nullptr,
int error_size = 0);
int error_size = 0, mjVFS* vfs = nullptr);
// Returns a newly-allocated mjModel, loaded from the contents in model_path.
// On failure it asserts that model is null.