[Paraview] vtkSMProxy saving/restoring

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Nov 19 13:14:27 EST 2008


For saving the object inspector properties you'll have to save/restore 
the state for the source proxy (and not merely it's representation proxy).

Utkarsh

Nehme Bilal wrote:
> 
> Thank you Utkarsh !
> 
> it works but I have some problems like:
> - after restoring the proxy, changing some display properties in 
> Paraview has no effect (like color ...)
> - only the display properties are saved/restored. (variables in object 
> inspector "properties" tab are not restored)
> 
> It's probably the way that I'm casting the source proxy and some staff 
> like that.
> 
> I'll try to solve these problems and let you know.
> 
> thank you !
> 
> 
> On Wed, 19 Nov 2008 10:20:52 -0500
>  Utkarsh Ayachit <utkarsh.ayachit at kitware.com> wrote:
>> Here's one way of doing it:
>>
>> vtkSMProxyManager* pxm = vtkSMObject::GetProxyManager();
>> vtkSMProxy *tempProxy = pxm->NewProxy(
>>   src->GetXMLGroup(),
>>   src->GetXMLName());
>> tempProxy->Copy(src);
>>
>> ....
>> src->Copy(tempProxy);
>>
>> Utkarsh
>>
>> Nehme Bilal wrote:
>>>
>>> tempProxy is just a proxy I created using:
>>> vtkSMProxy tempProxy = vtkSMProxy::New();
>>>
>>> I am trying to save/restore all the object properties displayed in 
>>> the object inspector.
>>>
>>> On Wed, 19 Nov 2008 09:30:55 -0500
>>>  Utkarsh Ayachit <utkarsh.ayachit at kitware.com> wrote:
>>>> Nehme,
>>>>
>>>> What properties are you changing/trying to restore? Is "tempProxy" 
>>>> of the same type as "src"?
>>>>
>>>> Utkarsh
>>>>
>>>> Nehme Bilal wrote:
>>>>> Hello,
>>>>>
>>>>> Sorry I missed a few commas in the last message. this is the 
>>>>> correct one:
>>>>>
>>>>> I am looking for a way to save a proxy properties and restore it 
>>>>> later.
>>>>> The only way I found is by saving and restoring the state using:
>>>>> virtual vtkPVXMLElement* SaveState(vtkPVXMLElement* root);
>>>>> virtual int LoadState(vtkPVXMLElement* element, 
>>>>> vtkSMStateLoaderBase* loader);
>>>>>
>>>>> I don't want to use LoadState because this method create a new 
>>>>> proxy. I just want to restore all properties to the existing proxy.
>>>>> There is also a method called Copy (void Copy(vtkSMProxy* src), 
>>>>> this method will copy all src properties to another proxy:
>>>>>
>>>>> //copying properties to tempProxy
>>>>> tempProxy->Copy(src,0,vtkSMProxy::COPY_PROXY_PROPERTY_VALUES_BY_CLONING); 
>>>>>
>>>>>
>>>>> I tried to change some display properties in Paraview and then 
>>>>> restore using:
>>>>> src->Copy(tempProxy,0,vtkSMProxy::COPY_PROXY_PROPERTY_VALUES_BY_CLONING); 
>>>>>
>>>>> src->UpdateVTKObjects();
>>>>>
>>>>> but nothing is restored ! why? Is there any other way to do that?
>>>>> (suppose that I have only on source)
>>>>>
>>>>> Thank you
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ParaView mailing list
>>>>> ParaView at paraview.org
>>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>>
>>>
>>>
> 
> 


More information about the ParaView mailing list