Resource icon

Source Defaults 1.1.1 test

CodeYan

Member
CodeYan submitted a new resource:

Source Defaults - Configure a source to be your "default" source, copying properties, filters, etc, to new sources!

Source Defaults for OBS Studio
An OBS Studio Plugin that lets you set a source as a "default source". Created sources of the same type will get the settings from the configured default source.

Installation
Click the "Go To Download" button at the top of this page, and download the installer for your platform. For Windows, it is recommend to use the installer (ends with "-Installer.exe"), to prevent installation mistakes and make it easy to uninstall the...

Read more about this resource...
 

AaronD

Active Member
Great plugin! Thank you!

Does it matter if I add it as an A/V Filter or an Effect Filter? It appears in both lists. A/V seems to work at least.

Could you add Transform? The default for that, until a video actually plays, is zero size in the top-left corner. When it plays, it changes to the native resolution, which may not be the canvas size. I want everything to be exactly full-screen regardless, and scale accordingly, which would be the "Fit to screen" transform, but I'm sure there would be other uses for it as well.
 

CodeYan

Member
Great plugin! Thank you!
Thank you too!
Does it matter if I add it as an A/V Filter or an Effect Filter? It appears in both lists. A/V seems to work at least.
Doesn't matter. Added it to both since some sources only have audio, some only have video. I believe one Move Transition filter does this as well.
Could you add Transform? The default for that, until a video actually plays, is zero size in the top-left corner. When it plays, it changes to the native resolution, which may not be the canvas size. I want everything to be exactly full-screen regardless, and scale accordingly, which would be the "Fit to screen" transform, but I'm sure there would be other uses for it as well.
I myself want this too, as I do have to fit to screen most of the time. The reason I did not add it initially is because of how sources vs. scene items are handled in OBS, as Transform is scene-dependent, whereas the already supported features in this plugin are scene-independent. Rest assured, I already have a plan on how to do this, so thank you for also stating that you need it, as it gives me a push.
 

AaronD

Active Member
Transform is scene-dependent, whereas the already supported features in this plugin are scene-independent.
Hmm...that *would* be tricky. Especially to keep the "obvious" (to me at least) workflow of having a Blackout scene that never goes away, with an empty source of each type just to set the defaults for those types. To add new stuff, I just add a scene and then add a source, the usual way, and my custom defaults apply to what I just added.

Having not looked over the code as an end user, it seems surprising to me that the transform would be scene-dependent. I would think that it should only depend on the canvas, which is a global setting. Maybe a closer look would make it obvious, but it seems weird from here.

Keep up the good work! And looking forward to seeing the Transform included too. :-)
 

CodeYan

Member
Having not looked over the code as an end user, it seems surprising to me that the transform would be scene-dependent. I would think that it should only depend on the canvas, which is a global setting. Maybe a closer look would make it obvious, but it seems weird from here.
No, Transform is scene-dependent. Think about it. You can add a source in one scene with Fit to Screen, and in another, the same source can be smaller, or use Stretch to Screen. I would be glad to explain the details further but I don't want to confuse you with code if you are not familiar with the OBS API hahaha
 

AaronD

Active Member
No, Transform is scene-dependent. Think about it. You can add a source in one scene with Fit to Screen, and in another, the same source can be smaller, or use Stretch to Screen. I would be glad to explain the details further but I don't want to confuse you with code if you are not familiar with the OBS API hahaha
I was thinking that each source in each scene was independent, to the extent that the Transform would work the same as the other settings. Or are the other settings linked across scenes? (put the same source in two scenes, look at their settings, change one, and see the other change too) I haven't really tried.

At any rate, you don't really care about existing stuff do you? Only new? I would think that that would render the dependency problem moot anyway, unless there's something else I'm missing?

Not really criticizing so much as trying to understand. Thanks!
 

CodeYan

Member
I was thinking that each source in each scene was independent, to the extent that the Transform would work the same as the other settings.
For example, properties of a source will be the same no matter if they are duplicated in a scene or in other scenes. Even if the layout is different, properties, filter, audio monitoring, etc, will all be the same on any scene. Transform is different because it is on a "scene item", not a source. You can have the same source in a scene, duplicated, with one placed on the left, the other on the right.

The scene-dependency that I was referring to was more about the code. To implement the existing features, the signal handler for source creation already gives the source, where I can modify those stuff directly. However, the source object that is given does not have access to transform. To get access to the transform, you have traverse all scenes (although you could start checking the current scene to account for most cases) and their scene items to find the source that was added. It's not that hard, I just have to find the time to work on it as I'm currently preoccupied with some stuff.
 

AaronD

Active Member
For example, properties of a source will be the same no matter if they are duplicated in a scene or in other scenes. Even if the layout is different, properties, filter, audio monitoring, etc, will all be the same on any scene. Transform is different because it is on a "scene item", not a source. You can have the same source in a scene, duplicated, with one placed on the left, the other on the right.

The scene-dependency that I was referring to was more about the code. To implement the existing features, the signal handler for source creation already gives the source, where I can modify those stuff directly. However, the source object that is given does not have access to transform. To get access to the transform, you have traverse all scenes (although you could start checking the current scene to account for most cases) and their scene items to find the source that was added. It's not that hard, I just have to find the time to work on it as I'm currently preoccupied with some stuff.
Oh crud! Yeah, I'd call that an oversight on OBS's side, to not specify the scene where a new thing was created. It would have to *have* that information, so why not pass it on?

And it sounds like the same source in different scenes does have its settings linked, from what you describe, so that changing them in one scene would also change them in the other scenes. I'm not sure whether to call that a feature or a bug, since I can see it being useful both ways. I guess that's why there are two ways to Duplicate - Reference and Copy - though they're not always both available.
 

CodeYan

Member
Oh crud! Yeah, I'd call that an oversight on OBS's side, to not specify the scene where a new thing was created. It would have to *have* that information, so why not pass it on?
Well, it doesn't have that information, scenes do. See Jim's reply here https://discord.com/channels/348973006581923840/731208645848727593/1002227394737877083. I'd say it's more of a design decision, rather than an oversight, as this is not how filters were intended to be used, though Jim himself agrees that this is better user experience.
And it sounds like the same source in different scenes does have its settings linked, from what you describe, so that changing them in one scene would also change them in the other scenes. I'm not sure whether to call that a feature or a bug, since I can see it being useful both ways. I guess that's why there are two ways to Duplicate - Reference and Copy - though they're not always both available.
That's definitely a feature. I use it in many ways.
 

AaronD

Active Member
Well, it doesn't have that information, scenes do. See Jim's reply here https://discord.com/channels/348973006581923840/731208645848727593/1002227394737877083. I'd say it's more of a design decision, rather than an oversight, as this is not how filters were intended to be used, though Jim himself agrees that this is better user experience.
I meant that the callback when a new source is created should also include the scene that it's on. Then you don't have to search for it. That's the oversight.

I don't have a Discord account, so I can't see the reference. Can you copy/paste, perhaps? Thanks!
 

CodeYan

Member
I don't have a Discord account, so I can't see the reference. Can you copy/paste, perhaps? Thanks!
1670564519177.png

1670564572733.png
1670564587473.png
 

CodeYan

Member
I meant that the callback when a new source is created should also include the scene that it's on. Then you don't have to search for it. That's the oversight.
You do have a point, but I'd say that's more because scenes, transitions, and filters are also considered sources in the backend, which do not necessarily have to be added to a scene. The signal handler for source creation is called when these are created, not just the input sources. So considering all these in mind, simplicity is better.
 

AaronD

Active Member
...scenes, transitions, and filters are also considered sources in the backend, which do not necessarily have to be added to a scene. The signal handler for source creation is called when these are created, not just the input sources. So considering all these in mind, simplicity is better.
Oh. Okay. But as I've seen in building media systems (sound, lighting, video, etc.), "simplicity" becomes highly deceptive because of the irreducible complexity of what it's trying to be. You can move the complexity to where you don't normally see it, but you can't get rid of it. And if you move it too far from where it normally wants to sit, you have to add *more* complexity overall just to make it appear "simple". (a manager/wrapper, for example)

When a project doesn't do much to start with (app, media rig, whatever), it seems like a good idea to go a certain way, then as it grows, a different way becomes more natural but there's a lot of legacy stuff with hard connections to the old way. (including cognitive rigidity of the operators, who grossly abuse the word "simple" when they really mean "familiar", and subsequently abuse the principles surrounding real simplicity in their arguments)

It seems to me that OBS has reached that point. That's a good thing, that means it's growing and becoming more useful to more people, but at some point it's going to need yet another major incompatible version (like from 27 to 28 broke some plugins), or slowly become an unmaintainable mess. Not spaghetti code, but spaghetti data flow. Slightly different, but the same idea.
I've been there myself with some of my own apps:
"Ooo! That'd be a cool feature! Now how do I get the data for it from where it is to where it's needed?..." And I end up creating a new path through the entire object structure, touching almost every source file, just to support that one feature.

From that perspective, iterating through all the scenes and their contents looking for the one that you've just been given the handle for, doesn't seem all that bad. But it could still be better if OBS would include the scene, which could be null, as part of the signal handler.
 

CodeYan

Member
Oh. Okay. But as I've seen in building media systems (sound, lighting, video, etc.), "simplicity" becomes highly deceptive because of the irreducible complexity of what it's trying to be. You can move the complexity to where you don't normally see it, but you can't get rid of it. And if you move it too far from where it normally wants to sit, you have to add *more* complexity overall just to make it appear "simple". (a manager/wrapper, for example)

When a project doesn't do much to start with (app, media rig, whatever), it seems like a good idea to go a certain way, then as it grows, a different way becomes more natural but there's a lot of legacy stuff with hard connections to the old way. (including cognitive rigidity of the operators, who grossly abuse the word "simple" when they really mean "familiar", and subsequently abuse the principles surrounding real simplicity in their arguments)

It seems to me that OBS has reached that point. That's a good thing, that means it's growing and becoming more useful to more people, but at some point it's going to need yet another major incompatible version (like from 27 to 28 broke some plugins), or slowly become an unmaintainable mess. Not spaghetti code, but spaghetti data flow. Slightly different, but the same idea.
I've been there myself with some of my own apps:
"Ooo! That'd be a cool feature! Now how do I get the data for it from where it is to where it's needed?..." And I end up creating a new path through the entire object structure, touching almost every source file, just to support that one feature.

From that perspective, iterating through all the scenes and their contents looking for the one that you've just been given the handle for, doesn't seem all that bad. But it could still be better if OBS would include the scene, which could be null, as part of the signal handler.
I mostly agree, especially with including the scene, but it's not for me to say. I haven't contributed much yet to the OBS project to have a say in things. What's more, this is probably a very niche use case so I doubt OBS devs would approve of such breaking change with very little gain. Keep in mind that bigger plugin devs like Exeldro and Warmuptill have written bigger and more plugins so if this was actually something they needed, they would have asked for it long ago. Anyway, there's a function to retrieve the current scene, so that will let me skip iterating through all scenes like 99% of the time. The 1% is just from custom scripts doing their thing and adding sources to other scenes.
 

AaronD

Active Member
Anyway, there's a function to retrieve the current scene, so that will let me skip iterating through all scenes like 99% of the time. The 1% is just from custom scripts doing their thing and adding sources to other scenes.
Ah! Okay. So it's not all *that* bad.

And yes, the relatively rare things that bite you when you don't account for them despite their rarity. Been there too. :-/
("It just worked, and now it doesn't! What happened?!...Oh.")

Sounds to me like:
Code:
search current_scene
if found
    return current_scene
for all scenes
    search scene
    if found
        return scene
return null
 

CodeYan

Member
Ah! Okay. So it's not all *that* bad.

And yes, the relatively rare things that bite you when you don't account for them despite their rarity. Been there too. :-/
("It just worked, and now it doesn't! What happened?!...Oh.")

Sounds to me like:
Code:
search current_scene
if found
    return current_scene
for all scenes
    search scene
    if found
        return scene
return null
yep, that's exactly the algorithm i'm planning to implement. just can't start right now since i've still got some deadlines to meet, and from my experience, even relatively small changes lead to long testing and debugging time hahaha
 

CodeYan

Member
started to work on it. well, i guess it isn't as easy as i thought. it's not just the new scene item that I don't have access to, but also the parent source. again, there's no way to retrieve the scene item of the source other than enumerating the scenes and sources, because a source can have multiple scene items. so i think one way we could do this is to have a scene selection in the Source Defaults filter option to select the scene of the default source
 

AaronD

Active Member
started to work on it. well, i guess it isn't as easy as i thought. it's not just the new scene item that I don't have access to, but also the parent source. again, there's no way to retrieve the scene item of the source other than enumerating the scenes and sources, because a source can have multiple scene items. so i think one way we could do this is to have a scene selection in the Source Defaults filter option to select the scene of the default source
Ooohhh, I think that's right. I think I do remember the same source in multiple scenes having the same filters too. I had forgotten about that because I don't normally do things that way. But yes, it is something that must be accounted for.

And I think I'd do it the way you described too. While you're doing all this work anyway, what else would be useful to add, so that you only have to do it once?
 

CodeYan

Member
And I think I'd do it the way you described too. While you're doing all this work anyway, what else would be useful to add, so that you only have to do it once?
I'm not really sure what else, but I'm thinking whether i need to separate the options for copying Transform stuff, like position, crop, etc. Personally I don't think I need to separate them. Just have a "Transform" option and that will copy the bounding box size and crop, similar to what the "Copy/Paste Transform" on the context menu does.

I guess this method would also allow automatically hiding the new sources as the sceneitem visibility is also sceneitem-based, though i'm not sure if that's going to be useful. There also might be a short time interval before it gets hidden.

Also, I might have to make "Copy Transform" default to off.

Thoughts?
 
Top