)]}'
{
  "commit": "d83901f2fe6367f3ebc32765e34252896a9c7b43",
  "tree": "1745ff75131b8039824a449842c62f3471979b39",
  "parents": [
    "04f53a2acab0968d078ae6a3af6363ae456e46e2"
  ],
  "author": {
    "name": "hernan",
    "email": "hernan@rive.app",
    "time": "Sat Nov 21 11:11:39 2026 -0800"
  },
  "committer": {
    "name": "hernan",
    "email": "hernan@rive.app",
    "time": "Sat Nov 21 11:11:39 2026 -0800"
  },
  "message": "feat(scripting): RiveFile.artboard and globals view models from scripts (#15972)\n\n* feat(scripting): RiveFile.artboard, a decoded file\u0027s artboard a script owns\n\nA script that decodes a file with context.decodeFile could only bind its\nartboards (bindableArtboard), and a bound artboard gets its own main view\nmodel instance but none of its file\u0027s global view models. RiveFile.artboard\n(name?) instead returns an Artboard the script owns, advances, draws and\nforwards input to, set up the way a host sets up the artboard of a file it\nloads:\n\n- a top level instance from the file (artboardNamed / artboardDefault, so\n  the file\u0027s watermark too), its default state machine, bound to the file\u0027s\n  default instance of the artboard\u0027s view model (data() returns it) and,\n  through StateMachineInstance::bind\u0027s completion, a default instance of\n  each of the file\u0027s global view models. An artboard without a state\n  machine binds the same on the artboard.\n- its data context has no parent: the script\u0027s own data and globals never\n  reach it, and no two roots share an instance.\n- nothing advances it at creation, so a size the script sets first is the\n  size it first lays out at.\n- it advances through the host\u0027s per-frame entry point\n  (advanceAndApply(float)), as a root does, so its own scripts\u0027 async work\n  is polled.\n- it pins its file, so the RiveFile can be released.\n- instance() on it makes another root from the file, not a copy of its live\n  state; a view model instance passed in binds only when it belongs to that\n  file, else the root gets a default one.\n\nThe shared setup is decodedRoot / decodedRootLike in decoded_file.cpp. The\nwasm lane adds rive_file_v1.artboard (bindings.py, regenerated\nprojections), minting a rive_artboard_v1 handle; AnimaScript\u0027s RiveFile\ngains artboard(name?).\n\nNot in this change: the Luau lane\u0027s RiveFile:artboard, script access to the\nroot\u0027s global instances, hosted assets for decoded files, and the fetch\nsize limit.\n\n* fix(scripting): a decoded game plays embedded, without a splash of its own\n\nA RiveFile.artboard root came from artboardNamed, so a watermarked guest\nfroze behind its pre-roll inside the script\u0027s frame. A script\u0027s artboard is\nembedded content: decodedRoot and decodedRootLike (instance()) now instance\nthrough File::embeddedArtboard, which skips the watermark as bindables do.\nThe same bytes played standalone, and the top level host, keep the splash.\nA root without a state machine keeps ticking while its scripts\u0027 async work\nis pending. Docs: instance() on a decoded artboard binds only its own file\u0027s\ninstances. Regenerates the site REPL bundle for the std change.\n\n* test(scripting): a decoded game moves by frame two; DecodedRoot isn\u0027t assignable\n\nThe rive-cli test now asserts the game and its copy advance a keyed Ticker by\nthe frame after their first, which the pre-roll\u0027s time-zero hold blocks; the\ndraw-path checks alone passed on the watermarked roots too. Member-wise move\nassignment would free the artboard before the old machine that touches it, and\nnothing assigns one, so it\u0027s deleted and pinned by static_assert. Trims test\ncomments and corrects the decoded root\u0027s advance comment.\n\n* fix(scripting): a global view model read in init retries once bound\n\nA script\u0027s init runs when its artboard is instanced, before a host binds\na data context. context.viewModel() and rootViewModel() answer that by\nasking for init to run again once a context arrives; globalViewModel()\nanswered nil for good, in both lanes. A decoded root (RiveFile.artboard)\nalways binds after it is instanced, so a guest script that cached a\nglobal in init never got it.\n\nglobalViewModel now asks for the retry while nothing is bound, and only\nthen: under a bound context, a name the file has no global for stays nil\nand init keeps its result. A host that never binds a data context leaves\nsuch a script waiting, as viewModel() already does.\n\n* feat(scripting): RiveFile:artboard in Luau\n\nThe Luau twin of AnimaScript\u0027s RiveFile.artboard: a decoded file\u0027s\nartboard the script owns, advances, draws and forwards input to, set up\nby decodedRoot as in the wasm lane. ScriptReffedArtboard gains a\nconstructor over a DecodedRoot that pins the file in every build. Its\nadvance takes the root\u0027s per-frame entry point, and instance() makes\nanother root from the file rather than a copy, binding a view model\ninstance only when it is one of that file\u0027s.\n\nThe typings return Artboard\u003cViewModel?\u003e?, so data reads as optional. The\nrive-cli test plays the decoded game in both lanes and expects the same\ndraws.\n\n* fix(scripting): RiveFile.artboard leaks nothing, matches whole names, decodes less\n\nReview fixes:\n\n- Luau made a decoded root before its userdata, so a failed allocation,\n  which longjmps past C++ destructors, leaked the artboard, machine, view\n  model and file. file:artboard() and instance() now make the root inside\n  the ScriptedArtboard constructor, after the allocation.\n- Names reached the lookups as C strings, so \"Game\\0Other\" found Game.\n  decodedRoot, decodedBindable and hostBindableArtboard take the name\u0027s\n  length, in both lanes, so artboard() and bindableArtboard() match the\n  whole name.\n- decodedRootLike compared File::artboard(i), which decodes each deferred\n  body before the match. It compares headers with handsOut, as\n  ArtboardComponentList does. Decoded files don\u0027t defer bodies today, so\n  this only showed under RIVE_LAZY_DECODING.\n\n* fix(scripting): a Luau animation keeps its artboard; a bare decoded root gets a context\n\nReview fixes:\n\n- A Luau Animation held only its LinearAnimationInstance, so a script that\n  kept one after dropping its artboard played into a freed artboard, and\n  for a decoded root into its freed file\u0027s definitions. ScriptedAnimation\n  now keeps the ScriptReffedArtboard, as the wasm lane\u0027s HostAnimation\n  keeps its HostArtboard, and is made inside its userdata.\n- A decoded root with no machine, view model or globals was left without\n  a data context, so a guest script asking for a global in init waited\n  for one forever. bindRoot gives it an empty context, as binding a\n  machine does.\n\n---------\n\nCo-authored-by: Guido Rosso \u003cguido@rive.app\u003e\nRive-Mono-Commit: c57f201d4833d49b09e8edb6de39ab7246155e9b\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "6b5d6398108c224fe996af72949b0b51483e17e1",
      "old_mode": 33188,
      "old_path": "include/rive/file.hpp",
      "new_id": "fa46f19a780b024847111af4c468de578bf046a2",
      "new_mode": 33188,
      "new_path": "include/rive/file.hpp"
    },
    {
      "type": "modify",
      "old_id": "ffa1841ef9d17357f57e06cd25543fd87b29b8e2",
      "old_mode": 33188,
      "old_path": "include/rive/lua/rive_lua_libs.hpp",
      "new_id": "0e4f6239f56170213a2da2a1fc1cb6b05a7f93d2",
      "new_mode": 33188,
      "new_path": "include/rive/lua/rive_lua_libs.hpp"
    },
    {
      "type": "modify",
      "old_id": "0436f71bac819ba3779ce3c0a6ac1f672904dde2",
      "old_mode": 33188,
      "old_path": "include/rive/scripted/decoded_file.hpp",
      "new_id": "98eb023b2d1e66b7d55372b5db0807ce62a1110b",
      "new_mode": 33188,
      "new_path": "include/rive/scripted/decoded_file.hpp"
    },
    {
      "type": "modify",
      "old_id": "e9d89190fcac9170b29d8375c62d087cbd1f66e0",
      "old_mode": 33188,
      "old_path": "include/rive/wasm/rive_bindings_v1.h",
      "new_id": "015633d253795ae2cd93b9724c1c03e1571b695d",
      "new_mode": 33188,
      "new_path": "include/rive/wasm/rive_bindings_v1.h"
    },
    {
      "type": "modify",
      "old_id": "e6c2bc33f5a1eaaa32754e2669333f73f2a3bea4",
      "old_mode": 33188,
      "old_path": "src/lua/lua_artboards.cpp",
      "new_id": "86492e4146fab4475cf478c0364e569bc2beb834",
      "new_mode": 33188,
      "new_path": "src/lua/lua_artboards.cpp"
    },
    {
      "type": "modify",
      "old_id": "bd04e6c09445ce4188c755fd592178125ebfeda8",
      "old_mode": 33188,
      "old_path": "src/lua/lua_rive_file.cpp",
      "new_id": "0ebd657fdd24fcb1c57b749468f0b06c5e6f158b",
      "new_mode": 33188,
      "new_path": "src/lua/lua_rive_file.cpp"
    },
    {
      "type": "modify",
      "old_id": "6576969d3ea8b9eb6e4323e32747dba834b5bc99",
      "old_mode": 33188,
      "old_path": "src/lua/lua_scripted_context.cpp",
      "new_id": "105357e36774e55f95f1ada9062b53719d54e10d",
      "new_mode": 33188,
      "new_path": "src/lua/lua_scripted_context.cpp"
    },
    {
      "type": "modify",
      "old_id": "f1d3ab8587ecda7177deb5bc7a41f32ec3014366",
      "old_mode": 33188,
      "old_path": "src/scripted/decoded_file.cpp",
      "new_id": "40669e6e62e480eeea928784e0ea48cef5d2ae37",
      "new_mode": 33188,
      "new_path": "src/scripted/decoded_file.cpp"
    },
    {
      "type": "modify",
      "old_id": "75c8c3dfe030b59c2f036611cec4f15d59275bd7",
      "old_mode": 33188,
      "old_path": "src/wasm/idl/bindings.py",
      "new_id": "3b664dd76c48a29df3c294528364235847b84a9c",
      "new_mode": 33188,
      "new_path": "src/wasm/idl/bindings.py"
    },
    {
      "type": "modify",
      "old_id": "89d080086f70258fbb0e725aca88f0d957cae6e7",
      "old_mode": 33188,
      "old_path": "src/wasm/idl/contract_v1.txt",
      "new_id": "c61557a9cc0b6b3fb20875a875c57ca4ae2e0b9c",
      "new_mode": 33188,
      "new_path": "src/wasm/idl/contract_v1.txt"
    },
    {
      "type": "modify",
      "old_id": "fc00f86cbcfb2ed56bf177096ce40cc9b8f8015b",
      "old_mode": 33188,
      "old_path": "src/wasm/wasm_natives_gen.hpp",
      "new_id": "f13cb124846056423cf2fc5bb556651f19e3e918",
      "new_mode": 33188,
      "new_path": "src/wasm/wasm_natives_gen.hpp"
    },
    {
      "type": "modify",
      "old_id": "a892ba08ad3420c29c964278f3632d92eb3191fe",
      "old_mode": 33188,
      "old_path": "src/wasm/wasm_natives_web_gen.hpp",
      "new_id": "bf0643582eed4ce9f2b8364081450a5248581ab7",
      "new_mode": 33188,
      "new_path": "src/wasm/wasm_natives_web_gen.hpp"
    },
    {
      "type": "modify",
      "old_id": "6113d29d5e7baecf1d6f4237ef63677d89cf33b4",
      "old_mode": 33188,
      "old_path": "src/wasm/wasm_scripting_vm.cpp",
      "new_id": "ee07c153f59d8f7ca70bd5f1717ee3ebdba109c5",
      "new_mode": 33188,
      "new_path": "src/wasm/wasm_scripting_vm.cpp"
    },
    {
      "type": "modify",
      "old_id": "400c162dbef0466cbaea4b623c229bf30d675d94",
      "old_mode": 33188,
      "old_path": "src/wasm/web/rive_module_imports.mjs",
      "new_id": "37f9c3aa005c58c9f2d8ca79403bf0da1ac93400",
      "new_mode": 33188,
      "new_path": "src/wasm/web/rive_module_imports.mjs"
    },
    {
      "type": "modify",
      "old_id": "3ebd75eebb3770de165bbf7b06d9ec0e1dd67f82",
      "old_mode": 33188,
      "old_path": "src/wasm/web/rive_scripting_pre.js",
      "new_id": "a8df3564320e971f465a488fb52ece62e3fdcefd",
      "new_mode": 33188,
      "new_path": "src/wasm/web/rive_scripting_pre.js"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "2bf4374fc5eba165c70941f1164d1bdb5ceaa0f3",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/assets/decoded_game_guest.riv"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "3c3d73a5e4b64909ce6143f1109ab2cdb67a022e",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/assets/rml/decoded_game_guest.rml"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "240f9465325e203a78fef5909c8ac04ed6152fcf",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/decoded_root_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "26b959a44067a3bbacd469d1c82ea8ed0f551110",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/scripting/scripting_context_test.cpp",
      "new_id": "450b8571ea7925a61732f7e3fd5bc055c7e10bb9",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/scripting/scripting_context_test.cpp"
    },
    {
      "type": "modify",
      "old_id": "8aa57d1de25f55d52363e9b4bfd3c0089a57c920",
      "old_mode": 33188,
      "old_path": "tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp",
      "new_id": "80699ad3beeb4b90b1e0c4f5dc608cdf80580410",
      "new_mode": 33188,
      "new_path": "tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp"
    }
  ]
}
