vMix Forums
»
General
»
General Discussion
»
Script to determine "parent" of virtual input, then update virtual input?
Rank: Member
Groups: Registered
Joined: 9/30/2021(UTC) Posts: 16
Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
In brief: As my script loops through all the inputs in my preset (For index = 1 to 40), how can it determine that Input.Find(index) is a virtual input, then identify the "parent PTZ" input, then update itself so that the thumbnail for [index] reflects the current room layout, rather than when virtual input [index] was created or last updated? Details: Say that Input 1 is a PTZoptics camera, responsible for (or "parent of") virtual inputs 10,14, and 22. And virtual input 10 is a tight shot of the pulpit. When our Nave is reset, we find that, say, the pulpit has been shifted a foot further back, so that virtual input 10 needs to be tweaked. But of course we don't see it in the thumbnail for input 10, since that shows the pulpit in the old position (when we created or updated 10). If I wanted to update the thumbnails to the current Nave layout, without tweaking the PTZ positions, I could do this manually: Preview input 10, then Preview the underlying Input 1, then Update 10. And so forth for 14 and 22. Then my thumbnails would be aligned with the current Nave layout. As a first attempt at scripting (lots of programming experience, none w/Vmix scripting, and very little with vb.net), I'd like to write a script that handles this problem generally. We actually haven 4 PTZ and dozens of virtual inputs, so it'd be a timesaver.) I've figured out how to loop through inputs. But I'm stuck here: - How do I determine that Input 10 is a Virtual Input (rather than an image or a title)?
- If I'm on Input 10, how do I determine that its parent is Input 1?
- How do I script "update 10"?
Thanks. P.S. Further context, in case you're wondering why we could use this: we've gotten a second laptop as a backup, with synching via Google Drive. Works fine, but the thumbnail images don't get copied over (I've not been able to find where they are stored), so when we copy a preset from Laptop 1 to Laptop 2, and then load it into Vmix on Laptop 2, all the thumbnails are gone (=black). This script would save us some time.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: FoolOnTheHill In brief: As my script loops through all the inputs in my preset (For index = 1 to 40), how can it determine that Input.Find(index) is a virtual input, then identify the "parent PTZ" input, then update itself so that the thumbnail for [index] reflects the current room layout, rather than when virtual input [index] was created or last updated? Details: Say that Input 1 is a PTZoptics camera, responsible for (or "parent of") virtual inputs 10,14, and 22. And virtual input 10 is a tight shot of the pulpit. When our Nave is reset, we find that, say, the pulpit has been shifted a foot further back, so that virtual input 10 needs to be tweaked. But of course we don't see it in the thumbnail for input 10, since that shows the pulpit in the old position (when we created or updated 10). If I wanted to update the thumbnails to the current Nave layout, without tweaking the PTZ positions, I could do this manually: Preview input 10, then Preview the underlying Input 1, then Update 10. And so forth for 14 and 22. Then my thumbnails would be aligned with the current Nave layout. As a first attempt at scripting (lots of programming experience, none w/Vmix scripting, and very little with vb.net), I'd like to write a script that handles this problem generally. We actually haven 4 PTZ and dozens of virtual inputs, so it'd be a timesaver.) I've figured out how to loop through inputs. But I'm stuck here: - How do I determine that Input 10 is a Virtual Input (rather than an image or a title)?
- If I'm on Input 10, how do I determine that its parent is Input 1?
- How do I script "update 10"?
Thanks. P.S. Further context, in case you're wondering why we could use this: we've gotten a second laptop as a backup, with synching via Google Drive. Works fine, but the thumbnail images don't get copied over (I've not been able to find where they are stored), so when we copy a preset from Laptop 1 to Laptop 2, and then load it into Vmix on Laptop 2, all the thumbnails are gone (=black). This script would save us some time. Are you actually going through the Preset file ? Consider using the API XML of a loaded preset and look for inputs that are type="Virtual"
|
|
|
|
Rank: Member
Groups: Registered
Joined: 9/30/2021(UTC) Posts: 16
Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
Thanks. I'll look into the API XML. I think that answers my first question.
Now how do I determine the parent of a virtual input, and then update the thumbnail?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 555
Thanks: 62 times Was thanked: 130 time(s) in 118 post(s)
|
PTZUpdateVirtualInput, see https://www.vmix.com/hel...utFunctionReference.htmlThere is actually no need to determine the parent input for updating. Also, if you open a preset via Open (not via the recent list) it shows you where the files are located in the Open/Append dialogue.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 9/30/2021(UTC) Posts: 16
Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
PTZUpdateVirtualInput - how did I miss that? Thanks.
So something like Input.Find("VirtualInputToBeUpdated").PTZMoveToVirtualInputPosition.PTZUpdateVirtualInput
And I'll check into the Open/Append dialogue, which I've ignored. (I suspect it doesn't show the thumbnail locations, though.)
|
|
|
|
Rank: Member
Groups: Registered
Joined: 9/30/2021(UTC) Posts: 16
Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
With thanks to the commenters here and on /r/vmix, I've gotten this far: dim x as new system.xml.xmldocument ' Create the XML document to parse x.loadxml(API.XML()) ' Load the API into the XML document. ' Select the inputs nodes Dim inputsNode As XmlNode = x.SelectSingleNode("/vmix/inputs") ' Iterate over each input node For Each inputNode As XmlNode In inputsNode.ChildNodes Dim numberValue As Integer = inputNode.Attributes("number").Value Dim typeValue as String = inputNode.Attributes("type").value if ("Virtual" = typeValue) OR ("NDI" = typeValue) Input.Find(numberValue).Function("PreviewInput") Sleep(3000) Input.Find(numberValue).Function("PTZUpdateVirtualInput") End If Next I'm still looking at two upgrades: (a) wait PTZUpdateVirtualInput until the PTZ has reached the current virtual input position (the Sleep statement is a workaround) (b) set the PTZ position speed to the highest possible values while this script is running It seems that Vmix doesn't currently provide the necessary hooks for (b).
|
1 user thanked FoolOnTheHill for this useful post.
|
|
|
vMix Forums
»
General
»
General Discussion
»
Script to determine "parent" of virtual input, then update virtual input?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close