---------------------------------------------------------------------------
| 1667 | } |
| 1668 | //--------------------------------------------------------------------------- |
| 1669 | void vtkSMSessionProxyManager::LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator) |
| 1670 | { |
| 1671 | // Disable state push |
| 1672 | bool previous = this->StateUpdateNotification; |
| 1673 | this->StateUpdateNotification = false; |
| 1674 | |
| 1675 | // Need to compute differences and just call Register/UnRegister for those items |
| 1676 | std::set<vtkSMProxyManagerEntry> tuplesToUnregister; |
| 1677 | std::set<vtkSMProxyManagerEntry> tuplesToRegister; |
| 1678 | std::set<vtkSMProxyManagerEntry>::iterator iter; |
| 1679 | |
| 1680 | // Fill delta sets |
| 1681 | this->Internals->ComputeDelta(msg, locator, tuplesToRegister, tuplesToUnregister); |
| 1682 | |
| 1683 | // Register new ones |
| 1684 | iter = tuplesToRegister.begin(); |
| 1685 | while (iter != tuplesToRegister.end()) |
| 1686 | { |
| 1687 | this->RegisterProxy(iter->Group.c_str(), iter->Name.c_str(), iter->Proxy); |
| 1688 | iter++; |
| 1689 | } |
| 1690 | |
| 1691 | // Unregister old ones |
| 1692 | iter = tuplesToUnregister.begin(); |
| 1693 | while (iter != tuplesToUnregister.end()) |
| 1694 | { |
| 1695 | this->UnRegisterProxy(iter->Group.c_str(), iter->Name.c_str(), iter->Proxy); |
| 1696 | iter++; |
| 1697 | } |
| 1698 | |
| 1699 | // Manage ProxySelectionModel state |
| 1700 | for (int i = 0, size = msg->ExtensionSize(PXMRegistrationState::registered_selection_model); |
| 1701 | i < size && this->Session; i++) |
| 1702 | { |
| 1703 | vtkTypeUInt32 remoteObjectId = |
| 1704 | msg->GetExtension(PXMRegistrationState::registered_selection_model, i).global_id(); |
| 1705 | const char* name = |
| 1706 | msg->GetExtension(PXMRegistrationState::registered_selection_model, i).name().c_str(); |
| 1707 | |
| 1708 | vtkSMProxySelectionModel* model = this->GetSelectionModel(name); |
| 1709 | |
| 1710 | // Make sure the expected selection model exist by creating a new empty one |
| 1711 | // that will be filled by the LoadState |
| 1712 | if (model == nullptr) |
| 1713 | { |
| 1714 | model = vtkSMProxySelectionModel::New(); |
| 1715 | this->RegisterSelectionModel(name, model); |
| 1716 | model->FastDelete(); |
| 1717 | } |
| 1718 | |
| 1719 | if (!model->HasGlobalID()) |
| 1720 | { |
| 1721 | vtkSMMessage msgTmp; |
| 1722 | msgTmp.set_global_id(remoteObjectId); |
| 1723 | msgTmp.set_location(vtkPVSession::DATA_SERVER_ROOT); |
| 1724 | this->Session->PullState(&msgTmp); |
| 1725 | |
| 1726 | model->LoadState(&msgTmp, locator); |
no test coverage detected