Make pqObjectBuilder take optional registration name argument
Every Source/Filter/Reader Proxy instanciated through the Python wrappings do get the possibility to be given a registration name:
mysphere = Sphere(registrationName='mySphereName')
if 'registrationName' in args: registrationName = args['registrationName'] del args['registrationName'] pxm = ProxyManager() pxm.RegisterProxy(registrationGroup, registrationName, self.SMProxy)
Note this also feeds the 'unreliable'
LogName at creation.
However in C++ through
pqObjectBuilder does not offer the same feature, the following methods do not take a
registrationName as argument:
All those call the following method to handle registration :
pqPipelineSource* postCreatePipelineProxy(vtkSMParaViewPipelineController* controller, vtkSMProxy* proxy, pqServer* server, const QString& regName = QString())
regName is only filled by
createReader(...) with the supplied filename, the two others get generated names through following the code flow:
In this last part this is where you get
Currently in c++, to create a 'findable' proxy through
vtkSMSessionProxyManager::GetProxy() you need to :
somepqProxy_type* somepqProxy = builder->createSource/Filter/View/Reader(...) somepqProxy->rename("someName"); // rename somepqProxy->getProxy()->SetLogName("someName"); //just for debug purposes do not rely on it
It looks like adding a
regName argument to pqObjectBuilder creation methods defaulted to an empty QString would not impact much things and streamline the 'create and rename' process in c++ ?
Another benefit I would see is that the following signals would already have the proxies renamed:
Q_EMIT this->sourceCreated(source); Q_EMIT this->proxyCreated(source);
Currently you would need to listen to
vtkCommand::RegisterEvent to get somethign meaningful and get a tight control on 'proxy creation with a specific name '.
Illustrative branch here : arnaud.billon/paraview@master...pqObjectBuilder-takes-reg_name
EDIT: Oddly enough https://gitlab.kitware.com/paraview/paraview/-/blob/master/Qt/Core/pqObjectBuilder.h#L170 mentions
reg_name but does not offer the argument to 'not make it empty'.