Jageet, Attached is patch to a bug that got introduced in 3.12. I've pushed it to git and it will be included in 3.14. This was causing the issue that you were seeing with 3.12. Thanks for bringing this to our attention.
Utkarsh On Fri, Jan 20, 2012 at 9:09 AM, Utkarsh Ayachit <utkarsh.ayac...@kitware.com> wrote: > I presume all you're missing is a call to this->view()->render() after > all's done. > > Utkarsh > > On Tue, Jan 17, 2012 at 4:07 PM, Jagjeet Nain <jagjeet.n...@gmail.com> wrote: >> Hi, >> I had a reader plugin which used to work fine with ParaView 3.8.1, but >> stopped working when it was compiled with paraview 3.12. >> >> This reader used to load image geometry as points and then used to load >> image as texture to be overlaid on points. >> After porting to Paraview 3.12, only Points geometry gets displayed but >> image does not get displayed . >> After executing the reader, I can see that image name is populated in the >> "Apply Texture" list of Display panel and it is also active but still image >> is not shown. >> When I select "None" and then re-select same(as previous) image name in the >> drop down list of "Apply Texture", then image gets displayed. >> So in short although correct image name is getting populated in the list and >> that is active as well but image only gets displayed in the second >> activation. This was not the case with Paraview 3.8.1. >> Below is the code which loads texture as image. This method is connected to >> the dataUpdated(pqPipelineSource*) >> >> bool loadTexture() >> { >> >> QFileInfo finfo(this->filename); >> if (!finfo.isReadable() ) >> { >> return false; >> } >> >> vtkSMSourceProxy* sp = vtkSMSourceProxy::SafeDownCast(this->proxy()); >> vtkSMStringVectorProperty *name = vtkSMStringVectorProperty::SafeDownCast( >> sp->GetProperty("FileName") ); >> this->filename = name->GetElement(0); >> >> pqPipelineSource* ps = >> qobject_cast<pqPipelineSource*>(this->referenceProxy()); >> //we should never have more than 1 view for this, so we don't need to worry >> about this >> pqDataRepresentation *rep = ps->getRepresentation( this->view() ); >> if ( rep ) >> { >> vtkSMProxyManager* pxm = vtkSMProxyManager::GetProxyManager(); >> vtkSMProxy* texture = pxm->NewProxy("textures", "ImageTexture"); >> //texture->SetConnectionID( this->proxy()->GetConnectionID() ); >> //texture->SetServers(vtkProcessModule::CLIENT|vtkProcessModule::RENDER_SERVER); >> >> pqSMAdaptor::setElementProperty(texture->GetProperty("FileName"), filename); >> pqSMAdaptor::setEnumerationProperty(texture->GetProperty("SourceProcess"), >> "Client"); >> texture->UpdateVTKObjects(); >> >> pxm->RegisterProxy(TEXTURESGROUP, >> vtksys::SystemTools::GetFilenameName(filename.toAscii().data()).c_str(), >> texture); >> >> vtkSMProperty* textureProperty = rep->getProxy()->GetProperty("Texture"); >> if ( textureProperty ) >> { >> pqSMAdaptor::setProxyProperty(textureProperty, texture); >> texture->UpdateVTKObjects(); >> } >> texture->Delete(); >> } >> return true; >> } >> >> >> Can somebody please point me out what extra should I do in the above code to >> make it Paraview 3.12 compatible. >> with regards >> Jagjeet >> >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the ParaView Wiki at: >> http://paraview.org/Wiki/ParaView >> >> Follow this link to subscribe/unsubscribe: >> http://www.paraview.org/mailman/listinfo/paraview >>
From fee8b238e43e829064aa43a6286324e3eaba27f3 Mon Sep 17 00:00:00 2001 From: Utkarsh Ayachit <utkarsh.ayac...@kitware.com> Date: Fri, 3 Feb 2012 16:43:08 -0500 Subject: [PATCH] Fixed BUG #12910. Proxy property was not being pushed correctly. The problem was vtkSIProxyProperty was not determining the state correctly, and ended up clearing the just set value in some cases. Fixed that. Also make vtkSMProxyProperty fire fewer modified events in Copy(). --- .../ServerImplementation/vtkSIProxyProperty.cxx | 131 ++++++-------------- ParaViewCore/ServerManager/vtkSMProxyProperty.cxx | 3 + 2 files changed, 39 insertions(+), 95 deletions(-) diff --git a/ParaViewCore/ServerImplementation/vtkSIProxyProperty.cxx b/ParaViewCore/ServerImplementation/vtkSIProxyProperty.cxx index 201d01f..7aae30a 100644 --- a/ParaViewCore/ServerImplementation/vtkSIProxyProperty.cxx +++ b/ParaViewCore/ServerImplementation/vtkSIProxyProperty.cxx @@ -16,101 +16,30 @@ #include "vtkClientServerStream.h" #include "vtkObjectFactory.h" -#include "vtkSIProxy.h" -#include "vtkSIObject.h" #include "vtkPVXMLElement.h" +#include "vtkSIObject.h" +#include "vtkSIProxy.h" +#include "vtkSmartPointer.h" #include "vtkSMMessage.h" +#include <algorithm> #include <assert.h> +#include <iterator> #include <set> -#include <vtkSmartPointer.h> //****************************************************************************/ // Internal Classes and typedefs //****************************************************************************/ -class vtkSIProxyProperty::InternalCache +class vtkSIProxyProperty::InternalCache : public std::set<vtkTypeUInt32> { -public: - InternalCache(vtkSIProxyProperty* parent) - { - this->Parent = parent; - } - - //-------------------------------------------------------------------------- - void SetVariant(const Variant *variant) - { - this->NumberOfDependancyToDelete = this->Dependancy.size(); - this->VariantSet.clear(); - for (int cc=0; cc < variant->proxy_global_id_size(); cc++) - { - this->VariantSet.insert( variant->proxy_global_id(cc) ); - vtkSIObject* obj = this->Parent->GetSIObject(variant->proxy_global_id(cc)); - if(obj) - { - this->Dependancy.push_back(obj); - } - } - } - - //-------------------------------------------------------------------------- - void CleanCommand() - { - this->RegisteredProxy.clear(); - } - //-------------------------------------------------------------------------- - void GetProxyToRemove( std::vector<vtkTypeUInt32> &proxyToRemove ) - { - proxyToRemove.clear(); - std::set<vtkTypeUInt32>::iterator iter = this->RegisteredProxy.begin(); - while(iter != this->RegisteredProxy.end()) - { - if(this->VariantSet.find(*iter) == this->VariantSet.end()) - { - proxyToRemove.push_back(*iter); - } - // Go to next item - iter++; - } - } - //-------------------------------------------------------------------------- - void GetProxyToAdd( std::vector<vtkTypeUInt32> &proxyToAdd ) - { - proxyToAdd.clear(); - std::set<vtkTypeUInt32>::iterator iter = this->VariantSet.begin(); - while(iter != this->VariantSet.end()) - { - if(this->RegisteredProxy.find(*iter) == this->RegisteredProxy.end()) - { - proxyToAdd.push_back(*iter); - } - // Go to next item - iter++; - } - } - //-------------------------------------------------------------------------- - void UpdateRegisteredProxy() - { - std::vector<vtkSmartPointer<vtkSIObject> >::iterator iterEnd = this->Dependancy.begin(); - iterEnd += this->NumberOfDependancyToDelete; - this->Dependancy.erase(this->Dependancy.begin(), iterEnd); - this->NumberOfDependancyToDelete = 0; - this->RegisteredProxy = VariantSet; - this->VariantSet.clear(); - } - //-------------------------------------------------------------------------- -private: - std::set<vtkTypeUInt32> RegisteredProxy; - std::set<vtkTypeUInt32> VariantSet; - std::vector<vtkSmartPointer<vtkSIObject> > Dependancy; - vtkSIProxyProperty* Parent; - size_t NumberOfDependancyToDelete; }; + //****************************************************************************/ vtkStandardNewMacro(vtkSIProxyProperty); //---------------------------------------------------------------------------- vtkSIProxyProperty::vtkSIProxyProperty() { - this->Cache = new InternalCache(this); + this->Cache = new InternalCache(); this->CleanCommand = NULL; this->RemoveCommand = NULL; this->ArgumentType = vtkSIProxyProperty::VTK; @@ -185,8 +114,13 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) offset); assert(strcmp(prop->name().c_str(), this->GetXMLName()) == 0); - this->Cache->SetVariant(&prop->value()); - std::vector<vtkTypeUInt32> proxy_ids; + std::set<vtkTypeUInt32> new_value; + for (int cc=0; cc < prop->value().proxy_global_id_size(); cc++) + { + new_value.insert( prop->value().proxy_global_id(cc) ); + } + + std::set<vtkTypeUInt32> to_add = new_value; vtkClientServerStream stream; vtkObjectBase* object = this->GetVTKObject(); @@ -194,7 +128,6 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) // Deal with previous values to remove if (this->CleanCommand) { - this->Cache->CleanCommand(); stream << vtkClientServerStream::Invoke << object << this->CleanCommand @@ -202,13 +135,15 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) } else if(this->RemoveCommand) { - // in all honesty, do we really need this anymore? It isn't a huge - // performance bottleneck if all inputs to a filter are re-set every time - // one changes. - this->Cache->GetProxyToRemove(proxy_ids); - for (size_t cc=0; cc < proxy_ids.size(); cc++) + std::set<vtkTypeUInt32> to_remove; + std::set_difference(this->Cache->begin(), this->Cache->end(), + new_value.begin(), new_value.end(), + std::inserter(to_remove, to_remove.begin())); + + for (vtkstd::set<vtkTypeUInt32>::iterator iter = to_remove.begin(); + iter != to_remove.end(); ++iter) { - vtkObjectBase* arg = this->GetObjectBase(proxy_ids[cc]); + vtkObjectBase* arg = this->GetObjectBase(*iter); if(arg != NULL) { stream << vtkClientServerStream::Invoke @@ -222,15 +157,19 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) vtkWarningMacro("Try to REMOVE a Proxy to a ProxyProperty but the proxy was not found"); } } + + to_add.clear(); + std::set_difference(new_value.begin(), new_value.end(), + this->Cache->begin(), this->Cache->end(), + std::inserter(to_add, to_add.begin())); } // Deal with proxy to add - this->Cache->GetProxyToAdd(proxy_ids); - for (size_t cc=0; cc < proxy_ids.size(); cc++) + for (vtkstd::set<vtkTypeUInt32>::iterator iter = to_add.begin(); + iter != to_add.end(); ++iter) { - vtkObjectBase* arg = this->GetObjectBase(proxy_ids[cc]); - - if(arg != NULL || this->IsValidNull(proxy_ids[cc])) + vtkObjectBase* arg = this->GetObjectBase(*iter); + if(arg != NULL || this->IsValidNull(*iter)) { stream << vtkClientServerStream::Invoke << object @@ -245,7 +184,7 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) } // Take care of the Empty case - if (this->NullOnEmpty && this->CleanCommand == NULL && proxy_ids.size() == 0) + if (this->NullOnEmpty && this->CleanCommand == NULL && new_value.size() == 0) { stream << vtkClientServerStream::Invoke << object @@ -254,7 +193,9 @@ bool vtkSIProxyProperty::Push(vtkSMMessage* message, int offset) << vtkClientServerStream::End; } - this->Cache->UpdateRegisteredProxy(); + this->Cache->clear(); + std::copy(new_value.begin(), new_value.end(), + std::inserter(*this->Cache, this->Cache->begin())); // Save to cache when pulled for collaboration this->SaveValueToCache(message, offset); diff --git a/ParaViewCore/ServerManager/vtkSMProxyProperty.cxx b/ParaViewCore/ServerManager/vtkSMProxyProperty.cxx index 90bca89..09b599b 100644 --- a/ParaViewCore/ServerManager/vtkSMProxyProperty.cxx +++ b/ParaViewCore/ServerManager/vtkSMProxyProperty.cxx @@ -525,6 +525,8 @@ void vtkSMProxyProperty::Copy(vtkSMProperty* src) { this->Superclass::Copy(src); + bool prev = this->SetBlockModifiedEvents(true); + this->RemoveAllProxies(); this->RemoveAllUncheckedProxies(); @@ -548,6 +550,7 @@ void vtkSMProxyProperty::Copy(vtkSMProperty* src) this->ImmediateUpdate = imUpdate; } + this->SetBlockModifiedEvents(prev); this->Modified(); this->InvokeEvent(vtkCommand::UncheckedPropertyModifiedEvent); } -- 1.7.2.5
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview