RE: [script] Self-installed property global names defined multiple times?

Date : Fri, 5 May 2006 10:10:36 -0400
To : <XSI(at)Softimage.COM>
From : "Stephen Blair" <Stephen_Blair(at)Softimage.COM>
Subject : RE: [script] Self-installed property global names defined multiple times?
Hi Bernard

I wasn't able to repro your problem until I put a call to PPG.Refresh into my OnInit.

And if I call PPG.Refresh from an OnChanged callback, then my custom command in global scope is triggered again. 

I would think of it this way: PPG.Refresh is going to reparse your plugin code, and so your global code is going to be executed again. I didn't look into the code to see what actually happens, but it looks like that is what happens.

Steve



-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Bernard Lebel
Sent: May 5, 2006 9:58 AM
To: XSI(at)Softimage.COM
Subject: Re: [script] Self-installed property global names defined multiple times?

Stephen: yes, I call PPG.Refresh() in a custom function. This is the only place where I call it. So the Refresh() call, even if done in a function scope, takes place in the global scope?

Btw, the function that calls Refresh, is called in many circumpstances (like if the user edits a text field), and when it is called, I see the custom command defined in the global scope is not called.



Guy: The reason is that the parameters are added in the Define callback, while the layout is built in a custom function. Few of these parameters are control combos.

To populate these combos with items, I call a custom command that lists the directories in a specific location. Since I never know in advance what directories will be there, I want to set the default value of the parameters with the first item in the list, and use the same list to build the control combo itself. Also, the function that populates the layout may be called several times during the PPG inspection. I would avoid calling the same commands over and over.

Threfore, I felt logical to do this process only in one place, in the global scope.


Bernard


On 5/5/06, Guy Rabiller <guy(at)alamaison.fr> wrote:
>
> Hi Bernard,
>
> just out by curiosity, could you explain why you need those global 
> variables actualy ?
>
> I mean can't you call the command from within your rebuild layout 
> function directly and use local variables instead ?
>
> --
> guy rabiller | 3d technical director (at) LaMaison
>
>
> Bernard Lebel a écrit :
> > Hello,
> >
> > I'm creating a self-installed property. In the top of the file, I 
> > define a bunch of globals that I want to use at various points 
> > during the PPG inspection.
> >
> > One of these names is a list that gets populated by calling a custom 
> > command. I noticed that every time the PPG gets inspected, the 
> > command is called twice. The command is also called twice when I 
> > update the plugin.
> >
> > I would prefer not the two calls happen.
> >
> >
> > Any suggestion?
> >
> >
> > Thanks
> > Bernard
> >
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > body:
> > unsubscribe xsi
> >
> >
> >
>
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>

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

---
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.