Argument Types

From The Foundry MODO SDK wiki
Jump to: navigation, search

Argument Types are a mechanism that provides usernames and descriptions for TextValueHints. They are commonly used by command arguments and channels to present a localized, human-readable names in place of their internal names when presented in a popup or other user interface construct. They are also used with list-style User Value to provide user strings for each choice.

Argument types are defined through config files. In the case of Command Help config entries, they are included as an ArgumentType atom in the argument's hash. In the case of item channels, they are defined in the Item Help config entries in a similar manner. Alternatively, they can be defined directly on the TextValueHint via a special entry with a leading equal sign, such as "=myArgumentType".

In all cases the argument types are looked up in the config files using methods in ILxMessageService.

Config Format

The config format is fairly striaght-forward, with an each ArgumentType containing a username description, and any number of Option with keys matching the internal strings representing each option, and with each Option also containing a username and description. The ArgumentType hash is a combination of the internal name and an associated language code, similar to what is done for message tables. For example @en_US is used for US English, and is also the default fallback for all languages.

  <atom type="CommandHelp">
    <hash type="ArgumentType" key="select-mode@en_US">
      <atom type="UserName">Selection Mode Specifier</atom>
      <atom type="Desc">Modes modify selection commands to perform different actions.</atom>
      <hash type="Option" key="set">
        <atom type="UserName">Set Primary</atom>
        <atom type="Desc">The selection becomes the primary selected element.</atom>
      </hash>
    </hash>
  </atom>

As another example, an AlignWithEdgeTypes-mode entry might look this:

 <atom type="CommandHelp">
   <hash type="ArgumentType" key="AlignWithEdge-mode@en_US">
     <atom type="UserName">Align With Edge</atom>
     <hash type="Option" key="top">
       <atom type="UserName">Top</atom>
       <atom type="Desc">Top edge</atom>
     </hash>
     <hash type="Option" key="bot">
       <atom type="UserName">Bottom</atom>
       <atom type="Desc">Bottom edge</atom>
     </hash>
     <hash type="Option" key="left">
       <atom type="UserName">Left</atom>
       <atom type="Desc">Left edge</atom>
     </hash>
     <hash type="Option" key="right">
       <atom type="UserName">Right</atom>
       <atom type="Desc">Right edge</atom>
     </hash>
   </hash>
 </atom>

As usual, all of the key values are case sensitive.

More Information