logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
FoolOnTheHill  
#1 Posted : Wednesday, February 14, 2024 7:59:28 AM(UTC)
FoolOnTheHill

Rank: Member

Groups: Registered
Joined: 9/30/2021(UTC)
Posts: 16

Thanks: 2 times
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:
  1. How do I determine that Input 10 is a Virtual Input (rather than an image or a title)?
  2. If I'm on Input 10, how do I determine that its parent is Input 1?
  3. 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.
doggy  
#2 Posted : Wednesday, February 14, 2024 9:14:29 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,084
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
Originally Posted by: FoolOnTheHill Go to Quoted Post
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:
  1. How do I determine that Input 10 is a Virtual Input (rather than an image or a title)?
  2. If I'm on Input 10, how do I determine that its parent is Input 1?
  3. 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"
FoolOnTheHill  
#3 Posted : Wednesday, February 14, 2024 12:25:05 PM(UTC)
FoolOnTheHill

Rank: Member

Groups: Registered
Joined: 9/30/2021(UTC)
Posts: 16

Thanks: 2 times
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?
dmwkr  
#4 Posted : Thursday, February 15, 2024 4:12:49 PM(UTC)
dmwkr

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 513

Thanks: 62 times
Was thanked: 119 time(s) in 108 post(s)
PTZUpdateVirtualInput, see https://www.vmix.com/hel...utFunctionReference.html

There 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.
FoolOnTheHill  
#5 Posted : Sunday, February 18, 2024 2:32:59 AM(UTC)
FoolOnTheHill

Rank: Member

Groups: Registered
Joined: 9/30/2021(UTC)
Posts: 16

Thanks: 2 times
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.)
FoolOnTheHill  
#6 Posted : Monday, April 15, 2024 8:09:40 AM(UTC)
FoolOnTheHill

Rank: Member

Groups: Registered
Joined: 9/30/2021(UTC)
Posts: 16

Thanks: 2 times
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).
Users browsing this topic
Guest
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.