Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XElement? #3

Open
Falsen opened this issue Jul 6, 2016 · 1 comment
Open

Update XElement? #3

Falsen opened this issue Jul 6, 2016 · 1 comment

Comments

@Falsen
Copy link

Falsen commented Jul 6, 2016

When im updating an element like this:
config.GetParent().GetParent().GetElement(u"Image").SetString(u"path",u"")
nothing happends until i reload the source manually, i saw that the sceneitem has SceneItem.Update() but how can i find the SceneItem from my XElement? Or is there another way?
Thanks!

@TheAndyRoid
Copy link
Owner

Your are correct it's a 2 step process:
Updating the relevant config and then calling UpdateSettings() on the SceneItem:
Below should work for the current scene, not sure if you can do it for items in other scenes that are not active scene never tried.

OBS.GetSceneElement().GetElement("sources").GetElement(sourceName).GetElement("data")
Set the values you want then call
OBS.GetScene().GetSceneItemByName(sourceName).UpdateSettings()

It should be noted that if a source is not active when you call UpdateSettings it can crash obs. Eg changing the text in a disabled text source and calling UpdateSettings() will segfault obs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants