friction2d / friction

Friction Graphics
https://friction.graphics
GNU General Public License v3.0
301 stars 15 forks source link

[Issue] Muting videos not persistent after saving #331

Open KirbysDarkNebula opened 1 week ago

KirbysDarkNebula commented 1 week ago

Platform: Linux (using X11), Appimg, version 1.0.0-beta1 Audio from videos doesn't save its "mute" property to the project, so every time you reopen a project all muted videos are unmuted. This is not the case for normal audio files, as these maintain their mute after saving. Steps to reproduce:

KirbysDarkNebula commented 1 week ago

After checking the files themselves (comparing a file with and without muting a video) it seems like the mute option does get saved to the project file, but that it doesn't get loaded when the project is opened.

rodlie commented 1 week ago

It's all just visibility state in the backend, looking at the code it does load and save visibility state. Will take a look at the issue when I get the time.

rodlie commented 1 week ago

Interesting...

setVisible "sound" true false
setVisible "sound" false false
addCacheHandler "WHATEVER.mp4"
setVisible "sound" false true

So, on project load the sound visibility is set three times (joy! :smile: ), the first time is correct, the second time is ignored (since it's the same), but when the cache handler for the video is added the audio is set to true (regardless if the video is visible or not).

Yeah... a bug.

rodlie commented 1 week ago

And the problem is... :drum: ... https://github.com/friction2d/friction/blob/main/src/core/Boxes/videobox.cpp#L188

This is just stupid IMHO. But I need to test that this does not break something else (stupid), as things tend to do :smile:

Don't ask me why, this was done in enve by the prior maintainer.

KirbysDarkNebula commented 3 days ago

After testing some more it seems as if the mute property gets loaded perfectly now BUT when importing videos (that is, adding to the timeline or bringing from the asset tab) they're muted by default, so it seems like there should be some check in place for whether the media was just imported or loaded from project files.

rodlie commented 3 days ago

https://github.com/friction2d/friction/commit/379f9e3eb8cb8ddf8ffa40aa614de8d8f366c0ee should fix it.

KirbysDarkNebula commented 3 days ago

That fixed it, awesome!