Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / C++ SDK: Custom Menu Item Hotkeys
  RSS 2.0 ATOM  

C++ SDK: Custom Menu Item Hotkeys
Rate this thread
 
48989
 
Permlink of this thread  
avatar
  • Total Posts: 101
  • Joined: 31 August 2010 07:17 AM

Dear all,

Softimage SDK Guide mentiones that it is possible to have Menu Items associated with Keyboard Hotkeys.
This is done via implementation of Command Hotkeys according to the SDK Guide.

However, how is this done in C++? I have’t seen neither any documentation nor any relevant member functions in Command class.

Thanks.



Replies: 0
avatar

The section “What Can I Customize with Menus” in Softimage SDK Guide says the following:

If there is a hotkey assigned to the command it automatically appears next to the label (the text that actually appears in the menu).

There were pictures with a hotkey after a Command with Hotkey. How to programatically (using c++) assign a Hotkey to a command?

I even tried to assign Hotkey via Softimage UI, but no results in my custom menu.



Replies: 0
avatar

I don’t think you can do it programmatically.
You have to call Command.SetFlag in the Init callback of the command, and then use the Keyboard Mapping to assign the hotkey.



Replies: 1
/img/forum/dark/default_avatar.png

Do you know wich flag to set via Command.SetFlag()?  I tried siSupportsKeyAssignment, but this one is ON by default for any Custom Command.

I had a hotkey defined for my custom command Alt+E, but no hotkey gets appeared in the Custom Menu. Is there any other flag I should call in the command Init()?

XSIPLUGINCALLBACK CStatus FileExportGameData_InitCRefin_ctxt )
{
 
// Construct a Context from the CRef
 
Context ctxtin_ctxt );

 
// Get the Command object from the Context
 
Command oCmd;
 
oCmd ctxt.GetSource();

 
// Set some basic command properties
 
oCmd.PutDescription(L"File Export Game Data");
 
oCmd.PutTooltip(L"FileExportGameData");

 
// The command returns a value
 
oCmd.EnableReturnValue(true);
 
oCmd.SetFlag(siSupportsKeyAssignmenttrue);
 
oCmd.Update();

 
// Add an argument
 
ArgumentArray oArgs;
 
oArgs oCmd.GetArguments();
 
oArgs.Add(L"Arg0");

 return 
CStatus::OK;
}

Unfortunately, there is no sample code and no description how to add hotkeys in custom menus, within Softimage SDK.

Author: Bunkai.Satori

Replied: 02 November 2010 07:06 AM  
avatar

Dear all,

does anybody know a way no how to display Hotkeys in Custom Menus, best in C++ SDK?

I tried many combinations, but I am not able to display the Hotkeys. Atlhough, my Custom Commands get evoked by the specified Hotkeys.

The Softimage SDK claims, it is possible to display a Menu Item Hotkey, but does not show how.

I develop a game scene export plug-in, I wish to distribute publicly, so this feature is important.



Attachment Attachment
Attachment Attachment
Attachment Attachment
Attachment Attachment
Attachment Attachment
Attachment Attachment
Replies: 0
avatar

Custom menus don’t show the keyboard shortcut.
You’ll the shortcut only on Softimage menus (like the Help or Window menus).



Replies: 0
avatar

Hi Stephen,

Are you 100% sure with the statement above? Based on Softimage SDK Guide, I can highlight the following:

The MenuItem object represents an individual item of a custom Menu. With the MenuItem object you can attach a command or a callback function to a menu item and fire it when you click on the menu item.

Other features of custom menu items include:

- Menu items set with a command are greyed out if the command is disabled.

- Menu items will show the origin of the command or callback ([ u] for user, [w] for workgroup).

- Menu items that point to a command will show the hotkey associated with the command.

The above looks like clear statement from Softimage Labs, that Custom Menu Items can show the hotkey associated with the command.

Another place in the Softimage SDK Guide tells the following:

When a command is attached to a menu item, the caption is set as follows: item_name [origin] hotkey
...where ‘item_name’ = the name of the menu item, ‘origin’ = the origin of the command ([ u] for user, [w] for workgroup) and ‘hotkey’ = the hotkey associated with the command.

I am able to display [ u] or [w] in front of the menu item, but I have no luck with “hotkeys”

Are you Softimage employee? Could I kindly ask you to talk to your colleagues for a way how to show the hotkey in Custom Menu?



Replies: 0
avatar

I’m the team lead for Softimage support at Autodesk.

I tested this with a C++ plugin. The hotkeys don’t appear beside commands on custom menus.
The hotkeys appear beside commands on the standard, factory-default Softimage menus.



Replies: 0
avatar

Thank you for your effort, Stephen.

Does any kind of workaround come to your mind, on how to display the hotkey in custom menus? (maybe to combine C++ with C#, VB, JS..(if any of the later mentioned work)).



Replies: 0