During the Define callback, all parameters are added to the property.
One of these parameters is the "project", wich is later presented as a
series of choices in a combo. Even though the combo is not added to
the layout at this stage, I still need a "default" value for the
"project" parameter. An empty string is not acceptable for me :-)
Like I said, I never know in advance the list of projects, that list
is built by calling a custom command. But to get a reliable default
value, I need that list right away so I can get the first item.
Later, during the custom rebuild function, the combo is added to the
layout, using the list previously created during the Define callback.
Since names bound in a scope are generally exclusive to that scope, I
needed a way to propagate my list from the Define callback to the
custom rebuild function.
I first tried typical globals (names bound in the top-level of the
plugin file), but it seems it is not a good idea! So instead I
implement these global as parameters of the property.
Does that make sense?
Berrnard
On 5/5/06, Guy Rabiller <guy(at)alamaison.fr> wrote:
> ../.. wich is generally quite short, as it is
> inspected in modal mode ../..
doh.. I'm even more puzzled then, to understand why you need globals oO
Anyway, I've surely missunderstood something, forgive me :-)
--
guy rabiller | 3d technical director (at) LaMaison
Bernard Lebel a écrit :
> Thanks for the suggestion, Guy.
>
> In the end, what I did is I added a bunch of "invisible" parameters.
> These parameters hold the globals, and are unlikely to ever change
> throughout the PPG life (wich is generally quite short, as it is
> inspected in modal mode).
>
> Fast and reliable enough, although it's a pity that every time I need
> to populate my combos I have to parse strings.
>
>
> Cheers
> Bernard
>
>
>
> On 5/5/06, Guy Rabiller <guy(at)alamaison.fr> wrote:
>>
>> Then I guess your CustomRebuild function is called:
>> 1) When OnInit event
>> 2) When a OnParameterChange
>> 3) Optionaly when OnButtonClick
>>
>> From what I understand, you want your command called only for 1).
>>
>> Can't you add an additional boolean parameter to your CustomRebuild
>> function so that when called from 2) or 3) it wont trigger the
>> command(s) ?
>>
>> In this case, before clearing the layout you can save the content of the
>> populated combo(s) in local variable(s) and refill on the fly.
>>
>> This way you shouldn't need global variables.
>>
>> Could this work ?
>>
>> --
>> guy rabiller | 3d technical director (at) LaMaison
>>
>>
>>
>> Bernard Lebel a écrit :
>> > 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
>>
>
> ---
> 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