ハンドラ関数が値を戻すか(true)戻さないか(false)を示すBoolean値を戻します。false に設定すると、関数が実際に値を戻そうとしても、戻り値がないものとして扱われます。
デフォルトの true に設定すると、Softimage は値を戻します。コマンドから何も戻されない場合は、空のVariantが戻されます。
// get accessor Boolean rtn = Command.ReturnValue; // set accessor Command.ReturnValue = Boolean; |
'First command has no return value 'and is implemented as a vbscript "sub" set cmd = Application.CreateCommand("NoReturnValue") cmd.ScriptingName = "NoReturnValue" cmd.Handler = "Foo" cmd.Code = _ "sub Foo() " & vbCrLf & _ " Logmessage ""NoReturnValue called"" " & vbCrLf & _ "end sub" cmd.Language = "VBScript" cmd.ReturnValue = false Application.AddCommand cmd 'The second command does return the value 56 'and is implemented as a vbscript "function" set cmd = Application.CreateCommand("ReturnValue") cmd.ScriptingName = "ReturnValue" cmd.Handler = "Foo" cmd.Code = _ "function Foo() " & vbCrLf & _ " Foo = 56" & vbCrLf & _ "end function" cmd.Language = "VBScript" cmd.ReturnValue = true Application.AddCommand cmd ' Call our new commands NoReturnValue LogMessage( ReturnValue ) 'Cleanup Application.RemoveCommand( "NoReturnValue" ) Application.RemoveCommand( "ReturnValue" ) 'The following results will be logged 'INFO : NoReturnValue called 'INFO : 56 |