Hello! I created an interactive toolbar where content (plugins and scripts) appear depending on the conditions set in the plugin settings.
The problem is that many of my scripts have multiple trigger modes with modifier keys, and I call them using the c4d.CallCommand(id)
command.
I can find out which key is pressed like this:
bc = c4d.BaseContainer()
c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_CHANNEL, bc)
key = bc[c4d.BFM_INPUT_QUALIFIER]
How to run a c4d.CallCommand(id)
given the key pressed?
I use c4d.CallCommand(id)
because I first create a list of dictionaries, each of which describes a button and its logic. Here is the dictionary example:
section = 'button1'
Btype = 'button'
number = 1 # for sorting buttons
pID = 600000028
types = [5100, 5101]
logic_modes = [11, 5, 6, 13]
selection = 'True'
{'name': section, 'type': Btype, 'number': number, 'plugin_id': pID, 'obj_types': types, 'logic_modes': modes, 'selection': selection}
I write data to an ini file using configparser. After reading the data from the file, I register each button under the plugin id and check if it was clicked:
def Command(self, paramid, msg):
for button in self.button_data:
if button['type'] == 'button' and paramid == button['plugin_id']:
c4d.CallCommand(button['plugin_id'])
return True
I hope this description will help you better understand my problem. Thanks!