Goal:
I want to dynamically set a chromakey when I trigger a layer, so that the blue background of a video w/ text is rendered transparent.
below is the code I'm using in the DirectEvent script block:
variables used in the code:
mClip = the midi value that is mapped to a video clip in the media set
vt = text or non-text flag - determines whether to set the chromakey for that particular media
cLayer = the layer # of the layer on which the media is triggered to play (In this example, cLayer = layer 6)
cLoop = flag for looping mode of layer
mov = the media ID of the video clip to play in the layer
Code: Select all
if mClip != 0 :
modul8.setValue('ctrl_layer_activated',1,cLayer)
modul8.setValue('ctrl_layer_media',mov,cLayer)
modul8.setValue('ctrl_layer_transition_type',0.0, cLayer)
modul8.setValue('ctrl_layer_hidden',0, cLayer)
modul8.setValue('ctrl_layer_movie_loopMode',cLoop, cLayer)
# set chromakey filter if media is a text video
if vt == "t" :
modul8.setFilters([{'FILTER': '(M8) Chroma Key', 'PARAMETERS': {'Blue': 255, 'Green': 40, 'Tolerance': 1.0, 'Red': 67}}], cLayer, False)
elif vt == "v" :
modul8.setFilters([], cLayer, False)
This is what is supposed to happen:
1) when the midi trigger is passed, modul8 activates a layer and plays the associated media (mov) from the media set
2) if the vt flag == "t", the chroma key filter is applied to the layer
3) if the vt flag == "v", the chroma key is not applied to the layer
Actual results:
layer is activated, and media clip plays, but chroma key is never set, regardless of the vt flag.
I know I'm using the correct color values, because when I turn on the Chromakey (layer) module and enter the same values, the background to my text videos is transparent.
I've confirmed via "print" statements that the vt flag is being set correctly.