On 02/06/2015 at 07:34, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13.061
Platform: Windows ;
Language(s) : C++ ;
---------
Hi there,
the problem:
Our plugin needs access to the CTRL+"C", CTRL+"V" and CTRL+"X" keyboard shortcuts. Meaning, the plugin must be started when the modeler uses these shortcuts in the scenegraph window.
I experimented with the api and found the following issues:
1.) adding the shortcut via AddShortcut() does not work. AddShortcut() returns True, but probably the shortcut is overwritten by a previous set shortcut?
Here is the code i use:
BaseContainer bc;
bc.SetLong(SHORTCUT_PLUGINID, PID_CMD_AMT_COPY);
bc.SetLong(SHORTCUT_ADDRESS, 0);
bc.SetLong(SHORTCUT_OPTIONMODE, 0);
bc.SetLong(0, 2);
bc.SetLong(1, 67);
Bool res= AddShortcut(bc);
2.) Finding other shortcuts which use the same keys, removing them and then adding the shortcut does not work. Here is the code:
BaseContainer bc;
bc.SetLong(SHORTCUT_PLUGINID, PID_CMD_AMT_COPY);
bc.SetLong(SHORTCUT_ADDRESS, 0);
bc.SetLong(SHORTCUT_OPTIONMODE, 0);
bc.SetLong(0, 2);
bc.SetLong(1, 67);
LONG nr= FindShortcuts(bc, shortCuts, sizeof(shortCuts)/sizeof(LONG));
for (int i=0; i< nr; i++)
{
Bool ok= RemoveShortcut(shortCuts[i]); // failes
}
Bool res= AddShortcut(bc); // succeeds, but does not work
FindShortcuts() in the code above finds 2 shortcuts (indizes are: 13543, 12107), trying to remove them fails. LONG im= GetShortcutCount(); gives 319, so both these indizes are out of range.
3.) The only way to assign the shortcut correctly is via LoadShortcutSet(Filename("AMTShortcuts.txt"), FALSE); but this deletes all registered shortcuts, making it impossible for the modeler to set her own shortcuts. Using LoadShortcutSet(Filename("AMTShortcuts.txt"), TRUE); does not work.
So how can I get these three shortcuts to work?
Thanks in advance.