clvLabs / PyATEMMax

A Python library to monitor and control Blackmagic Design ATEM video switchers.
https://clvlabs.github.io/PyATEMMax/
GNU General Public License v3.0
77 stars 20 forks source link

How to set key #10

Closed internetxs closed 2 years ago

internetxs commented 2 years ago

Hi maybe wrong way to ask but i am trying to find the correct command to set the key 1 to on image

Could you tell me on how to do this?

Thanks

clvLabs commented 2 years ago

Hi internetxs,

Try with: switcher.setTransitionNextTransition(mE, nextTransition)

If you look at the Set methods in the docs, you'll see it says:

    Args:
        mE: see ATEMMixEffects
        nextTransition: see ATEMTransitionStyles

... and if you search for ATEMTransitionStyles you'll end up by finding this:

class ATEMTransitionStyles(ATEMConstantList):
    """TransitionStyle list"""

    mix = ATEMConstant('mix', 0)
    dip = ATEMConstant('dip', 1)
    wipe = ATEMConstant('wipe', 2)
    dVE = ATEMConstant('dVE', 3)
    sting = ATEMConstant('sting', 4)

which doesn't really look as it makes sense.

Looking at the CTTp message in the reverse engineering docs I see I may have made a mistake in the docs... the nextTransition parameter is not expected to be an element of ATEMTransitionStyles.

To correctly buid a value for this field you can use this code for now:

# Define constants for nextTransition flags
NextTrans_BKGD = 1
NextTrans_KEY1 = 2
NextTrans_KEY2 = 4
NextTrans_KEY3 = 8
NextTrans_KEY4 = 16

#
# Some use cases:
#

#  Set next transition on me1 to KEY1
switcher.setTransitionNextTransition("mixEffect1", NextTrans_KEY1)

#  Set next transition on me1 to KEY1 + KEY2
switcher.setTransitionNextTransition("mixEffect1", NextTrans_KEY1 + NextTrans_KEY2)

#  Set next transition on me1 back to BKGD
switcher.setTransitionNextTransition("mixEffect1", NextTrans_BKGD)

Seems that reading the value can be easier, these are available as boolean:

If this works please let me know and I'll fix the docs and create a more user-friendly way to set these flags.