Re: [Paraview] vtkSMProxy saving/restoring

2008-11-20 Thread Nehme Bilal


Hello,

Instead of saving a copy of a proxy, I'm trying to use 
lookMarkModel state to get the exposed properties and 
restore it to servermanager proxies.

I'm trying to do something like that:

vtkSMProxyManager* pxm = vtkSMObject::GetProxyManager();
vtkSMProxy *smProxy;

1- convert the stored lookmark state from a qstring to a 
vtkPVXMLElement:


  vtkPVXMLParser *parser = vtkPVXMLParser::New();
  parser-Parse(lookMarkState.toAscii().data());
  vtkPVXMLElement *stateElement = 
parser-GetRootElement();

  if(!stateElement)
{
qDebug()  Could not parse lookmark's state.;
parser-Delete();
return;
}

2- now from this state I want to copy the exposed 
properties:

for (?? xmlProxy in stateElement ??)
{
  smProxy = pxm-GetProxy(??xmlProxy groupeName??, 
??xmlProxyName??);
  vtkSMPropertyIterator* iter = 
smProxy-NewPropertyIterator();


  for(iter-Begin(); !iter-IsAtEnd(); iter-Next())
  {
vtkSMProperty* smProp = iter-GetProperty();
vtkSMProperty* xmlProp = 
??xmlProxy-GetProperty(iter-GetKey())from??

if (destProp  srcProp)
{
destProp-Copy(srcProp);
}
   }
   iter-Delete();
 }

how can I do that ?

thanks !

On Wed, 19 Nov 2008 14:01:55 -0500
 Utkarsh Ayachit [EMAIL PROTECTED] wrote:
Ah I think I know the problem. vtkSMProxy::Copy() copies 
all properties even those on the sub proxies. A 
representation is a complex beast with several internal 
subproxies which are linked up internally. You actually 
simply want to save/restore the exposed properties so 
I'd do something 
like follows:


void Copy(vtkSMProxy* src, vtkSMProxy* dest)
{
vtkSMPropertyIterator* iter = 
dest-NewPropertyIterator();

for (iter-Begin(); !iter-IsAtEnd(); iter-Next())
  {
  vtkSMProperty* destProp = iter-GetProperty();
  vtkSMProperty* srcProp = 
src-GetProperty(iter-GetKey());

  if (destProp  srcProp)
{
destProp-Copy(srcProp);
}
  }
iter-Delete();
}

Use the above Copy instead of vtkSMProxy::Copy().

Utkarsh



Nehme Bilal wrote:


Hi again,

I did save and restore the source proxy and 
representations and it's 
working.
All display properties are saved/restored perfectly, but 
after 
restoring, changing color or Style properties from 
the object 
inspector has no effect. Other properties like visible 
or 
Transformation works !


after restoring I called:
vtkSMObject::GetProxyManager()-UpdateRegisteredProxiesInOrder();

but it didn't solve the problem.



On Wed, 19 Nov 2008 13:14:27 -0500
 Utkarsh Ayachit [EMAIL PROTECTED] wrote:
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org

[Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Nehme Bilal

Hello,

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(src0,vtkSMProxy::COPY_PROXY_PROPERTY_VALUES_BY_CLONING);

I tried to change some display properties in Paraview and 
then restore using:

src-Copy(tempProxy0,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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Nehme Bilal

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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit

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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Nehme Bilal


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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview



___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit

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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview





___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Nehme Bilal


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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Geoff Draper

Hello,

I'm also facing a related problem when I save/restore vtkSMProxy's. The 
proxy ID is stored in the XML file. So when I reload the proxies, the 
StateLoader attempts to recreate the proxy with the same ID as before. 
But because I'm running a new ParaView session, sometimes the saved ID 
has already been reserved by another object in the current session, 
causing a collision.


When this happens, ParaView aborts inside the function:
vtkClientServerInterpreter::ProcessCommandAssign(const vtkClientServerStream 
css, int midx)
The error message is Attempt to assign existing ID.

Has anyone else ever dealt with this before?  Is there a known workaround? 
Am I completely off base?


Thank you!
--Geoff

On Wed, 19 Nov 2008, 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit
What state loader are you using? If you use vtkSMPQStateLoader or 
subclass it should not try to reassing IDs.


Utkarsh

Geoff Draper wrote:

Hello,

I'm also facing a related problem when I save/restore vtkSMProxy's. The 
proxy ID is stored in the XML file. So when I reload the proxies, the 
StateLoader attempts to recreate the proxy with the same ID as before. 
But because I'm running a new ParaView session, sometimes the saved ID 
has already been reserved by another object in the current session, 
causing a collision.


When this happens, ParaView aborts inside the function:
vtkClientServerInterpreter::ProcessCommandAssign(const 
vtkClientServerStream css, int midx)

The error message is Attempt to assign existing ID.

Has anyone else ever dealt with this before?  Is there a known 
workaround? Am I completely off base?


Thank you!
--Geoff

On Wed, 19 Nov 2008, 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Geoff Draper
I'm using vtkSMUndoRedoStateLoader, which is the state loader used by 
pqUndoStack.  My proxies are encapsulated within vtkUndoSet objects when 
they are saved/restored.


--Geoff

On Wed, 19 Nov 2008, Utkarsh Ayachit wrote:

What state loader are you using? If you use vtkSMPQStateLoader or subclass it 
should not try to reassing IDs.


Utkarsh

Geoff Draper wrote:

Hello,

I'm also facing a related problem when I save/restore vtkSMProxy's. The 
proxy ID is stored in the XML file. So when I reload the proxies, the 
StateLoader attempts to recreate the proxy with the same ID as before. But 
because I'm running a new ParaView session, sometimes the saved ID has 
already been reserved by another object in the current session, causing a 
collision.


When this happens, ParaView aborts inside the function:
vtkClientServerInterpreter::ProcessCommandAssign(const 
vtkClientServerStream css, int midx)

The error message is Attempt to assign existing ID.

Has anyone else ever dealt with this before?  Is there a known workaround? 
Am I completely off base?


Thank you!
--Geoff

On Wed, 19 Nov 2008, 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview




___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit
UndoRedo states are not meant to loaded across different sessions. If 
loaded in the same session such ID conflicts should not occur.


Utkarsh

Geoff Draper wrote:
I'm using vtkSMUndoRedoStateLoader, which is the state loader used by 
pqUndoStack.  My proxies are encapsulated within vtkUndoSet objects when 
they are saved/restored.


--Geoff

On Wed, 19 Nov 2008, Utkarsh Ayachit wrote:

What state loader are you using? If you use vtkSMPQStateLoader or 
subclass it should not try to reassing IDs.


Utkarsh

Geoff Draper wrote:

Hello,

I'm also facing a related problem when I save/restore vtkSMProxy's. 
The proxy ID is stored in the XML file. So when I reload the proxies, 
the StateLoader attempts to recreate the proxy with the same ID as 
before. But because I'm running a new ParaView session, sometimes the 
saved ID has already been reserved by another object in the current 
session, causing a collision.


When this happens, ParaView aborts inside the function:
vtkClientServerInterpreter::ProcessCommandAssign(const 
vtkClientServerStream css, int midx)

The error message is Attempt to assign existing ID.

Has anyone else ever dealt with this before?  Is there a known 
workaround? Am I completely off base?


Thank you!
--Geoff

On Wed, 19 Nov 2008, 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview






___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview








___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


Re: [Paraview] vtkSMProxy saving/restoring

2008-11-19 Thread Utkarsh Ayachit
Ah I think I know the problem. vtkSMProxy::Copy() copies all properties 
even those on the sub proxies. A representation is a complex beast with 
several internal subproxies which are linked up internally. You actually 
 simply want to save/restore the exposed properties so I'd do something 
like follows:


void Copy(vtkSMProxy* src, vtkSMProxy* dest)
{
vtkSMPropertyIterator* iter = dest-NewPropertyIterator();
for (iter-Begin(); !iter-IsAtEnd(); iter-Next())
  {
  vtkSMProperty* destProp = iter-GetProperty();
  vtkSMProperty* srcProp = src-GetProperty(iter-GetKey());
  if (destProp  srcProp)
{
destProp-Copy(srcProp);
}
  }
iter-Delete();
}

Use the above Copy instead of vtkSMProxy::Copy().

Utkarsh



Nehme Bilal wrote:


Hi again,

I did save and restore the source proxy and representations and it's 
working.
All display properties are saved/restored perfectly, but after 
restoring, changing color or Style properties from the object 
inspector has no effect. Other properties like visible or 
Transformation works !


after restoring I called:
vtkSMObject::GetProxyManager()-UpdateRegisteredProxiesInOrder();

but it didn't solve the problem.



On Wed, 19 Nov 2008 13:14:27 -0500
 Utkarsh Ayachit [EMAIL PROTECTED] wrote:
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@paraview.org
http://www.paraview.org/mailman/listinfo/paraview











___
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview