Hi Szabolcs,

The way we handle this kind of thing for our custom renderer's options is
that we run a custom "Upgrade" command in response to the siOnEndSceneOpen
event.  The Upgrade command does something like this:

1) Collect all property objects that are candidates for upgrading.  In our
case because there can be a number of renderer options objects in a scene
(e.g. for each pass and for the render regions), we use
Application::FindObjects passing "{76332571-D242-11d0-B69C-00AA003B3EA6}"
which is the class GUID for custom properties.  Then for each custom
property returned, we filter the list down to just our custom renderer
options objects by comparing each object's class GUID (returned by
DataRepository.GetIdentifier) to our known GUID.

2) For each candidate object to upgrade we compare its "version" parameter
with the current version.  If they match, we continue with the upgrade
process for that property.

3) If steps 1 and 2 above resulted in any property objects needing upgrade,
we create a temporary property object which we will use to upgrade the
other property objects in-place.

4) For each parameter (tempParam) on the new temp property object:
        For each property object to upgrade (propertyToUpgrade):
            existingParam
= propertyToUpgrade.GetParameter(tempParam.GetScriptName())
            If existingParam is NOT valid:
                  This is a new parameter, so we add it to
propertyToUpgrade e.g. propertyToUpgrade.AddParameter(
tempParam.GetScriptName(), ...)
            Otherwise, we also check for changes in min/max, default
values, etc... if a mismatch is found, we delete existingParam and re-add.

5) Set the "version" parameter on all upgraded property objects to the
current version

6) Delete the temp property object created in step 3.

Note that the above may be more complicated than necessary for "regular"
properties.  Some of the complexity above results from the fact that it is
not actually possible to delete a custom renderer option property that is
in use, hence the in-place update.  Also note that I omitted a bunch of
extra logic in step 4 that deals with proxy parameters as well - so for
example, a param may have existed, but may have changed from a regular
param to a proxy param or vice-versa.

Hope this helps,

-Nicolas


On Sat, Oct 13, 2012 at 7:46 AM, Eric Thivierge <[email protected]>wrote:

> Can you make an "Update" command that reads all the values of the
> property, deletes the existing one, creates a new one, and fills in the
> data from the old one?
>
> --------------------------------------------
> Eric Thivierge
> http://www.ethivierge.com
>
>
> On Sun, Oct 14, 2012 at 1:33 AM, Szabolcs Matefy <[email protected]>wrote:
>
>> Actually the paramteres are that changes sometimes (added new items) and
>> they are not reflected on an exisiting property…****
>>
>> ** **
>>
>> *From:* [email protected] [mailto:
>> [email protected]] *On Behalf Of *Szabolcs Matefy
>> *Sent:* Saturday, October 13, 2012 4:28 PM
>> *To:* [email protected]
>> *Subject:* PPG question****
>>
>> ** **
>>
>> Hey guys****
>>
>> ** **
>>
>> I’ve got a plugin I wrote, and I change it frequently. The plugin is used
>> in the company. The PPG of the plugin is saved on the Scene root object.
>> How can I make sure that the PPG is always refreshed, and have the
>> additional paramteres, useritems, I add?****
>>
>> ** **
>>
>> At this moment the users must delete the PPG whenever I change the Layout
>> of the PPG, otherwise they do not have the new ui items..****
>>
>> ** **
>>
>> Cheers****
>>
>> ** **
>>
>>
>> Szabolcs****
>>
>> ___
>> This message contains confidential information and is intended only for
>> the individual named. If you are not the named addressee you should not
>> disseminate, distribute or copy this e-mail. Please notify the sender
>> immediately by e-mail if you have received this e-mail by mistake and
>> delete this e-mail from your system. E-mail transmission cannot be
>> guaranteed to be secure or error-free as information could be intercepted,
>> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
>> The sender therefore does not accept liability for any errors or omissions
>> in the contents of this message, which arise as a result of e-mail
>> transmission. If verification is required please request a hard-copy
>> version. Crytek GmbH - http://www.crytek.com - Grüneburgweg 16-18, 60322
>> Frankfurt - HRB77322 Amtsgericht Frankfurt a. Main- UST IdentNr.:
>> DE20432461 - Geschaeftsfuehrer: Avni Yerli, Cevat Yerli, Faruk Yerli****
>>
>
>

Reply via email to