Skip to content

Commit d3f9e17

Browse files
author
susan101566
committed
libraries: serialize library artboards as local artboards
Fixes https://github.com/orgs/rive-app/projects/15/views/1?pane=issue&itemId=104718681&issue=rive-app%7Crive%7C9356 Fixes https://github.com/rive-app/rive/issues/9324#issue-2966381868 ### Overview Currently we do not export LibraryArtboards to runtime, as C++ won't understand them. As such, currently, if you have ArtboardX that contains NestedArtboard_ofALibraryArtboard, a NestedArtboard that points to ArtboardX won't work. This PR makes it such that a NestedArtboard to ArtboardX would show. Moreover, its statemachine will play too. ### There are a few main changes 1. LibraryAsset: cached library artboards in LibraryAsset are referenced by ID instead of by name. This ID is the original artboard's ID in the library asset file, and is persisted in our schema as LibraryArtboard.artboardId. Same same with caching statemachines and linear animations. I've added LibraryStateMachine.animationId and LibraryLinearAnimation.animationId. 2. NestedArtboard: before this PR, there was logic that checks whether the source artboard was a LibraryArtboard or just an Artboard. Now, it's just Artboard, because the runtime exporter only exports Artboards. 3. Runtime exporter: I've created the idea of MappedContext, which maps a library identifier to its various remaps, like globalIndexMapper, nestedIds, eventIds, etc. ### The mapping NestedArtboard.artboardId -> LibraryArtboard.id LibraryArtboard.artboardId -> LibraryAsset's rev file's Artboard.id NestedStateMachine.animationId -> LibraryStateMachine.id LibraryStateMachine.animationId -> LibraryAsset's rev file's State Machine.id ### Order of export Currently, when we export we only go over the host file, and the order looks like Backboard_ofHost FileAssets_ofHost DataModels_ofHost Artboard1_ofHost Artboard1_components_ofHost (e.g. paints, nested artboards, state machines, etc.) Now, I'm recursively also exporting the library files. So the order looks like Backboard_ofHost [XXX] **--FileAssets_ofLibrary --DataModels_ofLibrary --Artboard1_ofLibrary --Artboard1_components_ofLibrary** FileAssets_ofHost DataModels_ofHost Artboard1_ofHost Artboard1_components_ofHost Basically, we insert the indented section, which represents the library file. And if Library uses other library assets, it should go into the [XXX] section. Tho we currently don't support this, as we don't decode library assets used from a library asset. If we aggregate all the artboards, [0, total count) is the range of valid artboard indices in C++. ### Tests I'll fix the TODO's in the tests Diffs= e75974b896 libraries: serialize library artboards as local artboards (#9419)
1 parent 27b2c27 commit d3f9e17

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.rive_head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
689a455e677b68ac54ce7af3bbc6bd28b617a7cc
1+
e75974b8969006de706c0da14875e26efa6d1886

0 commit comments

Comments
 (0)