Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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:
c4d.CallCommand(id)
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!
This may be an alternative to your current approach (or possibly exactly the same?): You could make your own UserArea and draw the icons manually yourself. Then you can handle any number of modifier keys and call your commands using the SubID to indicate to the script what it should do (CommandData.ExecuteSubID).
Hi @JohnSmith,
thank you for reaching out to us and thanks @kbar for jumping in. What is not quite clear to us about your problem, is the nature of your plugins and scripts.
It would be nice if you could clarify the scope of them. Are they all provided by yourself / have you authority on their code or are you seeking a general solution?
CommandData
CommandData.ExecuteSubID
c4d.CallCommand
ToolData
If we misunderstood your problem, please feel free to clarify any misunderstandings.
Cheers Ferdinand
For some reason that I do not understand, the modifier keys did not work before, now they work. Implementation of the plugin via UserArea instead of GeDialog will be more convenient, thank you for your answers, I will study this part of the SDK further.