OnBeginSceneSaveAs (XSIApplication)

Description

Fired before a scene save as operation is performed, such as the SaveSceneAs command.

This event is installed using the XSIApplication.Advise method and can be removed using the XSIApplication.Unadvise method, please see these methods for a detailed example of installing and uninstalling events.

The event may be temporarily muted via the EventInfo.Mute property. All installed events can be viewed in the plugin manager dialog's event tab.

NOTE: The prefered and alternative method of installing this is event is as a self-installing plugin. See PluginRegistrar.RegisterEvent method for more details.

Scripting Syntax

XSIApplication.OnBeginSceneSaveAs ([CustomData], [FileName], [Abort])

Parameters

Parameter

Type

Description

CustomData

Variant

Custom data passed to the event handler. This argument is optional; you can specify one when binding an event with XSIApplication.Advise. The data is passed to the event handler whenever the event is fired, an empty value is passed if no custom data is specified.

FileName

String

The name of the scene to save.

Abort [out]

Boolean

The handler can set this argument to true for aborting this operation.

PythonScript, PerlScript and JScript do not support output arguments. Use the return value to pass the abort status. PythonScript and PerlScript do not define a Boolean type so pass 1 for True and 0 for False.

Return Value

Boolean (true to abort operation).

Examples

1. VBScript Example

function XSIApplication_OnBeginSceneSaveAs( CustomData, FileName, Abort )
   call Application.LogMessage( "*** VBScript Event - XSIApplication_OnBeginSceneSaveAs ***")
   Abort = False
       end function

2. JScript Example

function XSIApplication::OnBeginSceneSaveAs( CustomData, FileName, Unused )
{
   Application.LogMessage( "*** JScript Event - XSIApplication::OnBeginSceneSaveAs ***");
   // your code here
   // return abort status in return code
var abort=false;
   return abort;
}

3. PerlScript Example

sub XSIApplication_OnBeginSceneSaveAs
{
   my ($CustomData, $FileName, $Unused) = @_;
   $Application->LogMessage( "*** PerlScript Event - XSIApplication_OnBeginSceneSaveAs ***");
   # your code here
   # return consumed status in return code
my $abort=0;
   return $abort;
}

4. Python Example

def XSIApplication_OnBeginSceneSaveAs( CustomData, FileName, Unused ):
   Application.LogMessage( '*** PythonScript Event - XSIApplication_OnBeginSceneSaveAs ***')
   # your code here
   abort=0
   return abort

5. C++ Example

//
// This example illustrates how to implement an event handler for the
// OnBeginSceneSaveAs event in C++/COM.
//
HRESULT WINAPI XSIOnEvent
(
   LONG        in_lEventID,
   LPVARIANT   in_pVar,
   LONG        in_lNum
)
{
   switch (in_lEventID)
   {
       case siOnBeginSceneSaveAs:
       {
          if (!CanSaveScene(in_pVar[1]))
          {
              // abort the operation using the predefined abort argument
              LPVARIANT pVar = V_VARIANTREF(&in_pVar[2]);
              V_BOOL(pVar) = VARIANT_TRUE;
          }
       }
       break;
   };
   return S_OK;
}

See Also

XSIApplication.OnEndSceneSaveAs

PluginRegistrar.RegisterEvent

XSIApplication.Advise

XSIApplication.Unadvise

XSIApplication.EventInfos