refactor: replace raw object pointers with SmartPointer in ObjectsContext and update dependent codebases
This commit is contained in:
@@ -49,8 +49,8 @@ void ObjectsContext::Synchronize() {
|
||||
// 1. Identify objects to add and remove
|
||||
const auto &objects = m_Context->GetObjects();
|
||||
std::map<uLib::Object *, bool> currentObjects;
|
||||
for (auto obj : objects)
|
||||
currentObjects[obj] = true;
|
||||
for (const auto& obj : objects)
|
||||
currentObjects[obj.get()] = true;
|
||||
|
||||
// Remove Prop3Ds for objects no longer in context
|
||||
for (auto it = m_Prop3Ds.begin(); it != m_Prop3Ds.end();) {
|
||||
@@ -71,11 +71,11 @@ void ObjectsContext::Synchronize() {
|
||||
}
|
||||
|
||||
// Add Prop3Ds for new objects
|
||||
for (auto obj : objects) {
|
||||
if (m_Prop3Ds.find(obj) == m_Prop3Ds.end()) {
|
||||
Prop3D *prop3d = this->CreateProp3D(obj);
|
||||
for (const auto& obj : objects) {
|
||||
if (m_Prop3Ds.find(obj.get()) == m_Prop3Ds.end()) {
|
||||
Prop3D *prop3d = this->CreateProp3D(obj.get());
|
||||
if (prop3d) {
|
||||
m_Prop3Ds[obj] = prop3d;
|
||||
m_Prop3Ds[obj.get()] = prop3d;
|
||||
if (auto *p3d = vtkProp3D::SafeDownCast(prop3d->GetProp()))
|
||||
m_Assembly->AddPart(p3d);
|
||||
this->Prop3DAdded(prop3d);
|
||||
|
||||
Reference in New Issue
Block a user