Python beginner here, my goal is to write a script or a plugin to interact with some (active) tool attributes through a predefined set of hotkeys. In short, context-sensitive hotkeys. As a bonus goal, I would like to add some settings in the Preferences window to change the hotkeys.
Until now I've managed to write simple python scripts ( but you can call it macros ), like these lines to change bevel mode f.e. :
if c4d.IsCommandChecked(431000015) is True : if tool()[c4d.MDATA_BEVEL_MASTER_MODE] == 0: tool()[c4d.MDATA_BEVEL_MASTER_MODE] = 1 else: tool()[c4d.MDATA_BEVEL_MASTER_MODE] = 0 c4d.EventAdd()
It kind of works but it doesn't affect the active tool, only the UI.
And that's all for the moment. The SDK isn't really useful since I don't know where to start and how implement this, plus I guess there may be some specific constraints due to the interactive part.
So I would like to get some clues on the best way to tackle this. I've watch many C4D Python tutorials, look through the docs, the Python SDK and read few scripts but it doesn't make sense yet. Like baseContainer, what is this thing and why I have to call it to interact with a tool ? ( I'm really a beginner )
From what I've read what I want to do is not possible with a simple script, I should rather write a plugin to have the code running in background to evaluate tool activation and keystrokes. Is that correct ? Is it why the script doesn't trigger the active tool ?