Hi @m_adam , thank you for the detailed reply! You're right there are a couple of parts to my question, so it might be helpful if I give a simplified example of what I'm trying to do.
Essentially, I want to create a script that allows me to switch between different camera views (top, right, left, etc) by pressing the number keys. Whilst it would be easy to create a number of '.py' files using
c4d.CallCommand() and then assign them all manually in the 'Customise Commands' manager, I was hoping I'd be able to create a script that runs for the duration that Cinema is open and reads the user's keypresses, returning
c4d.CallCommand() when specified keys are pressed.
Based on the first part of your answer I'd assume I'd need something along the lines of this... but I can't seem to get it to work.
import c4d def main(): bc = c4d.BaseContainer() # If the '7' key is pressed, enter 'Top' View if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_7, bc): if bc[c4d.BFM_INPUT_VALUE] == 1: c4d.CallCommand(12083) # Enters 'Top' View # If the '3' key is pressed, enter 'Right' View elif c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_3, bc): if bc[c4d.BFM_INPUT_VALUE] == 1: c4d.CallCommand(12080) # Enters 'Right' View if __name__=='__main__': main()
Any ideas? Thanks again, Maxime! :)