Repository navigation
Canvases - Part Deux (Loading/Saving + Frontend API) - #11832
Conversation
4804b5c to
8528fc9
Compare
8528fc9 to
49ce592
Compare
5bafb33 to
f3353c3
Compare
PatTheMav
left a comment
There was a problem hiding this comment.
I find the whole mix and match of C types by libobs, "native" C++ types used by the front-end, and "RAII"-wrapper types unfortunate, particularly the back and forth between OBSFrontendCanvas, OBSCanvas, and obs_canvas_t.
I would prefer if Canvas management had been properly encapsulated into its own class (which would also be the owner of the data and pointers) which could potentially make using the RAII wrappers as well as a wrapper around the wrapper for the vector superfluous.
Free standing functions could then serve as factory methods that yield either a vector of Canvas objects or an obs_data_array_t of canvas data. And OBSBasic would just call something like std::vector<OBS::Canvas> OBS::Canvas::LoadCanvases(obs_data_array_t *canvases) which would elide a copy thanks to RVO.
And instead of trying to get the pointer wrapped by the RAII wrapper and calling obs_canvas_remove on each of them, one would be call OBS::Canvas::Erase() or similar for each item in the vector.
Apart from my architectural concerns, the code as-is looks correct. But if we introduce a whole new thing like canvases into the program, I'd like us to do it right and use appropriate encapsulation and abstraction.
That sounds fine, the Where do you think such class should live in the current code structure? |
Yeah (Particularly as the canvas class would "manage" the associated instances of transition-type classes, scene class instances, etc.) |
8f15137 to
f488cb0
Compare
|
I've made some changes based on the above conversation (the diff may be a bit messy due to rebasing, sorry):
I'm not sure where the freestanding functions should be, so right now they're just part of the |
f488cb0 to
579483e
Compare
148fcd5 to
ee501de
Compare
ee501de to
9b579dc
Compare
9b579dc to
9e6bed9
Compare
PatTheMav
left a comment
There was a problem hiding this comment.
Looks good to me - I cannot resolve the comment threads that are still open though.
Description
Adds saving and loading for frontend-owned canvases as well as a frontend API to create/remove/enumerate them.
Motivation and Context
In order to persist additional canvases and their scenes/sources in a way that is reasonably straightforward for API users we want the frontend to own/manage additional canvases that it may interface with.
In the future I'd also like to make transitions and the main canvas part of this abstraction.
How Has This Been Tested?
This was tested with this fork of the vertical canvas plugin that makes use of the new APIs: https://github.com/dsaedtler/obs-vertical-canvas
Types of changes
Checklist: