Yasuaki Honda
Prototype declaration of Sony_BindSharedNode{} is extended to include a new field action.
PROTO Sony_BindSharedNode [ field SFNode transformNode NULL field SFNode scriptNode NULL field MFString action "SonyActionPanel: Hello,sonybrowser:Hello,,,; Smile,sonybrowser:Smile,,,; Wao!,sonybrowser:Wao,,Wao,; Umm,sonybrowser:Umm,,,; Wooo!,sonybrowser:Wooo,,Wooo,; Bye,sonybrowser:Bye,,," ] {}
What's new here is the field named action. URN or URL can be specified in this field. Expected mime type of the specified URL/URN is text. In addition to the standard URL protocol specification, you can use the custom protocol SonyActionPanel: to indicate the inlined description. In case usual URL is specified with relative URL syntax, the origin (or root) is the directory where the file that contains this Sony_BindSharedNode{} is placed is used.
The Sony_BindSharedNode{} is used to define a shared object and its behavior in general and not restricted to avatar like shared objects. However, the action field is only meaningfull when specified for avatar shared objects. Thus, we limit the scope of effectiveness of this field only when appeared in files placed in the "avtwrl" directory where avatar VRML files are placed.
The following BNF specifies the avatar custom action panel description syntax.
CustomizeDescription ::= ActionDescriptions ActionDescriptions ::= ActionDescription | ActionDescription SEMICOLON ActionDescriptions ActionDescription ::= ActionName COMMA IconURL COMMA EventName COMMA EventValue COMMA LocalFlag ActionName ::= String IconURL ::= String EventName ::= String EventValue ::= String SEMICOLON ::= ';' COMMA ::= ',' LocalFlag ::= String
String consists of utf8 characters except for double-quote ("), semicolon (;), and comma (:). First white space characters and tail white characters in String are ignored. You can enclose String in double-quotes to include head and/or tail white space chars in the String.
White space characters are space, tab, and return.
For IconURL, you can specify any URL for the action panel icon image. In addition to the standard URL protocols, you can use the custom protocol sonybrowser: to indicate browser internal icon names such as hello or smile. Valid names are: Hello, Smile, Wao, Umm, Wooo, and Bye.
String "Local" or "Remote" should be used for LocalFlag.
Here are a couple of examples:
Hello, http://tako.com/hello.jpg, avatarAction, Hello,; Bye, sonybrowser:Bye, avatarAction, Bye, Remote; "Hai Guys", "actionIcon/Hei Guys.bmp", sonyAvatarPosture, HaiGuys, ; Hi,,,,;
Action panel customization description consists of a set of action descriptions. Currently we allow at most 6 action descriptions to be specified in the customization description. If the action panel customization description inlcludes more than 6 action descriptions, first 6 descriptions are used and rest are ignored.
An action description consists of an action name, an icon URL, an event name, an event value, and a local flag. The action name or the icon image specified as the icon URL is used as the action button UI. If the icon URL is NOT specified, the action name will be displayed in the action button. If the icon URL is specified, (and suppose it is http://xxx/yyy.jpg), then the image is used as the button when the button is available and not pressed. In addition, the auther must supply http://xxx/yyy1.jpg and http://xxx/yyy2.jpg. They are used as the button images when the button is available and pressed, and when the button is not available, respectively.
The event name and the event value are used to generate a message when the button is pressed. On pressing the button, a message is sent to the avatar using Vscp.sendApplSpecific() API with the function name argument (the second argument) as the event name and the function parameter (the third argument) as the event value. At the receiver side, the message appears as an eventIn to the Script node specified in the scriptNode field of Sony_BindSharedNode{}. The eventIn's name is the event name and its value is the event value.
You can generate the event on the avatar either on the remote clients or the local machine that the avatar is loaded. If you specify 'Remote' (which is the usual case), all other clients that display the avatar will receive the message. If you specify 'Local', the event happens only on the client machine the button is pressed.
You can omit either the action name or the action URL, or both. If you don't specify the action name, names are automatically generated. They are: Act1, Act2, ...
If the icon URL is omitted, the action name will be displayed in the button instead of graphics.
If you specify the action name, you can omit the event value. In that case the event value is the same as the action name.
You can omit the event name. The default value is "sonyAvatarPosture".
You can omit the local flag. The default value is "Remote".
If don't specify anything to the action field of Sony_BindSharedNode{}, the default value specified in the prototype declaration will be used. If you specify empty string (""), the action panel will be disabled.
Thus, if you specify the following one action description:
,,,,,,;
For the first description, the action name is generated as Act1, which will be used for the button display and also for the event value. Thus, on clicking the button, Vscp.sendApplSpecific(target, "sonyAvatarPosture", "Act1") will be performed.