--------------------------------------------------------------------------- No errors are raised if a proxy definition for the requested proxy is not found.
| 390 | // No errors are raised if a proxy definition for the requested proxy is not |
| 391 | // found. |
| 392 | vtkSMProxy* vtkSMSessionProxyManager::GetPrototypeProxy(const char* groupname, const char* name) |
| 393 | { |
| 394 | if (!this->ProxyDefinitionManager) |
| 395 | { |
| 396 | return nullptr; |
| 397 | } |
| 398 | |
| 399 | std::string protype_group = groupname; |
| 400 | protype_group += "_prototypes"; |
| 401 | vtkSMProxy* proxy = this->GetProxy(protype_group.c_str(), name); |
| 402 | if (proxy) |
| 403 | { |
| 404 | return proxy; |
| 405 | } |
| 406 | |
| 407 | // silently ask for the definition. If not found return nullptr. |
| 408 | vtkPVXMLElement* xmlElement = |
| 409 | this->ProxyDefinitionManager->GetCollapsedProxyDefinition(groupname, name, nullptr, false); |
| 410 | if (xmlElement == nullptr) |
| 411 | { |
| 412 | // No definition was located for the requested proxy. |
| 413 | // Cannot create the prototype. |
| 414 | return nullptr; |
| 415 | } |
| 416 | |
| 417 | proxy = this->NewProxy(groupname, name); |
| 418 | if (!proxy) |
| 419 | { |
| 420 | return nullptr; |
| 421 | } |
| 422 | proxy->SetLocation(0); |
| 423 | proxy->SetPrototype(true); |
| 424 | // register the proxy as a prototype. |
| 425 | this->RegisterProxy(protype_group.c_str(), name, proxy); |
| 426 | proxy->Delete(); |
| 427 | return proxy; |
| 428 | } |
| 429 | |
| 430 | //--------------------------------------------------------------------------- |
| 431 | void vtkSMSessionProxyManager::RemovePrototype(const char* groupname, const char* proxyname) |
no test coverage detected