Re: [script] Events "FileName" argument

Date : Tue, 6 Dec 2005 18:06:44 -0500
To : <XSI(at)Softimage.COM>
From : <francois.painchaud(at)sympatico.ca>
Subject : Re: [script] Events "FileName" argument
The one file example I sent earlier works fine here, on Linux CentOS 4.2. It could also be that it only works with certain 4.2 QFEs. Here is another example, a VBScript one, that also works fine:

' Begin file MyFrameEvent.vbs

function XSILoadPlugin( in_oReg )

   in_oReg.Name   = "MyFrameEvent"
   in_oReg.Major  = 1
   in_oReg.Minor  = 0
   in_oReg.Author = "Francois Painchaud"

   ' The last Advise parameter is false to avoid persisting the event binding.
   Advise "OnBeginFrame",in_oReg.Filename,,"VBScript","MyFrameEvent",,,false

   XSILoadPlugin = true

end function

function XSIApplication_OnBeginFrame( in_vCustomData, _
                                      in_eRenderType, _
                                      in_sOutputFileName, _
                                      in_nFrameNumber, _
                                      in_nSequenceNumber, _
                                      in_eFieldType, _
                                      out_bAbort )

   LogMessage "STARTING FRAME: " & in_nFrameNumber & " - " & in_sOutputFileName

end function

' End file MyFrameEvent.vbs

François
 
> De: Aloys Baillet <aloys.baillet(at)gmail.com>
> Date: 2005/12/06 mar. PM 05:20:06 GMT-05:00
> À: XSI(at)Softimage.COM
> Objet: Re: [script] Events "FileName" argument
> 
> Hi Bernard,
> 
> As far as I remember, we didn't manage to make this thing work in only one
> file: we always had to do the registration from a plugin, and put the event
> file outside the Plugins hierarchy (in a sibling folder called Events).
> Its a pain...
> I don't know what the status in 5, though.
> 
> Aloys
> 
> On 07/12/05, Bernard Lebel <3dbernard(at)gmail.com> wrote:
> >
> > Salut François,
> >
> > Well it sort of works as far as installation/registration goes.
> > But then, the event has to named specifically this way:
> >
> > function XSIApplication::OnBeginFrame( CustomData, RenderType,
> > FileName, Frame, Sequence, RenderField, Abort )
> > {
> >    Application.LogMessage( "Progress: STARTING FRAME - " + Frame + " - " + FileName );
> > }
> >
> > Now when the plugin loads, I get an error about XSIApplication not
> > being defined. If I changed that to Application, then I don't get the
> > error but the event is not triggered.
> >
> > Btw I changed to JScript, since the Python version was giving a weird
> > type error.
> >
> > Thanks
> > Bernard
> >
> > On 12/6/05, francois.painchaud(at)sympatico.ca wrote:
> > > Salut Bernard,
> > >
> > > Then, you can use my home-brewed 4.2 self-installing events. For example:
> > >
> > > # Begin file MySelectionChangeEvent.py
> > >
> > > def XSILoadPlugin( in_oReg ) :
> > >
> > >    in_oReg.Name   = "MySelectionChangeEvent"
> > >    in_oReg.Major  = 1
> > >    in_oReg.Minor  = 0
> > >    in_oReg.Author = "Francois Painchaud"
> > >
> > >    try:
> > >       Application.Advise( "OnSelectionChange",
> > >                           in_oReg.Filename,
> > >                           "",
> > >                           "Python",
> > >                           "MySelectionChangeEvent",
> > >                           None,
> > >                           None,
> > >                           False )
> > >    except:
> > >       pass
> > >
> > >    return True
> > >
> > > def XSIApplication_OnSelectionChange( in_vCustomData, in_eChangeType ) :
> > >
> > >    l_sNewSel = Application.Selection.GetAsText()
> > >
> > >    Application.LogMessage( "New selection: " + l_sNewSel )
> > >
> > >    return False
> > >
> > > # End file MySelectionChangeEvent.py
> > >
> > > François
> > >
> > > > De: Bernard Lebel <3dbernard(at)gmail.com>
> > > > Date: 2005/12/06 mar. PM 02:12:27 GMT-05:00
> > > > À: XSI(at)Softimage.COM
> > > > Objet: Re: [script] Events "FileName" argument
> > > >
> > > > 4.2
> > > >
> > > > On 12/6/05, francois.painchaud(at)sympatico.ca wrote:
> > > > > XSI 4.2 or 5.0?
> > > > >
> > > > > > De: Bernard Lebel <3dbernard(at)gmail.com>
> > > > > > Date: 2005/12/06 mar. PM 12:20:07 GMT-05:00
> > > > > > À: XSI(at)Softimage.COM
> > > > > > Objet: [script] Events "FileName" argument
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > Let say you install an Event using Advise(). Is there a way to tell
> > > > > > the FileName argument to use the actual plugin file that installs the
> > > > > > event? That is, without composing a path to that file, something along
> > > > > > the lines of "use myself"?
> > > > > >
> > > > > > I'd like a way to setup the events so they don't require other files
> > > > > > than the plugins.
> > > > > >
> > > > > > I'm using Python.
> > > > > >
> > > > > > Thanks
> > > > > > Bernard


---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.