Skip to content

virtucamera.VCBase Custom Script Methods

shycats edited this page May 14, 2021 · 4 revisions

get_script_labels( vcserver )
Optionally Return a list or tuple of str with the labels of
custom scripts to be called from VirtuCamera App. Each label is
a string that identifies the script that will be showed
as a button in the App.

The order of the labels is important. Later if the App asks
to execute a script, an index based on this order will be provided
to VCBase.execute_script(), so that method must also be implemented.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.

Returns
-------
tuple or list of str
    custom script labels.

Related: VCBase.execute_script()


execute_script( vcserver, script_index, current_camera )
Only required if VCBase.get_script_labels()
has been implemented. This method is called whenever the user
taps on a custom script button in the app.

Each of the labels returned from VCBase.get_script_labels()
identify a custom script that is showed as a button in the app.
The order of the labels is important and 'script_index' is a 0-based
index representing what script to execute from that list/tuple.

This function must return True if the script executed correctly,
False if there where errors. It's recommended to print any errors,
so that the user has some feedback about what went wrong.

You may want to provide a way for the user to refer to the currently
selected camera in their scripts, so that they can act over it.
'current_camera' is provided for this situation.

Parameters
----------
vcserver : virtucamera.VCServer object
    Instance of virtucamera.VCServer calling this method.
script_index : int
    Script number to be executed.
current_camera : str
    Name of the currently selected camera

Related: VCBase.get_script_labels()

Clone this wiki locally