theatre-js / theatre

Motion design editor for the web
https://www.theatrejs.com
Apache License 2.0
10.82k stars 338 forks source link

Return sheetObject without reconfiguring #480

Closed akre54 closed 1 month ago

akre54 commented 1 month ago

It would be nice if sheet.object(key) would return the existingObject if you didn't pass in a config. Right now we need to keep track of the objects in userland, which involves a bit of bookkeeping and state passing.

My use case is I'm trying to set the studio selection, and you need the sheetObject to do this. Most places I already have access to the Sheet through a Provider, and I use string keys for everything else. Is this doable? Thanks!

vimlesh1975 commented 1 month ago

Or something like sheet.getObject(key)

AriaMinaei commented 1 month ago

@akre54 yolo'd this one. Upgrade to 0.7.1 and use sheet.__experimental_getExistingObject('key').