diff --git a/graf3d/eve/inc/TEveGeoNode.h b/graf3d/eve/inc/TEveGeoNode.h index be7aee74d9567a85ceae2dd03b170f8674a8c5bf..c068853d513353208c9b954ab456ddf1cee501f2 100644 --- a/graf3d/eve/inc/TEveGeoNode.h +++ b/graf3d/eve/inc/TEveGeoNode.h @@ -137,14 +137,15 @@ public: TEveGeoShape(const Text_t* name="TEveGeoShape", const Text_t* title=0); virtual ~TEveGeoShape(); - virtual Bool_t CanEditMainColor() const { return kTRUE; } + virtual Bool_t CanEditMainColor() const { return kTRUE; } virtual Bool_t CanEditMainTransparency() const { return kTRUE; } virtual UChar_t GetMainTransparency() const { return fTransparency; } virtual void SetMainTransparency(UChar_t t) { fTransparency = t; } - Color_t GetColor() const { return fColor; } - TGeoShape* GetShape() { return fShape; } + Color_t GetColor() const { return fColor; } + TGeoShape* GetShape() { return fShape; } + void SetShape(TGeoShape* s); virtual void Paint(Option_t* option=""); diff --git a/graf3d/eve/src/TEveGeoNode.cxx b/graf3d/eve/src/TEveGeoNode.cxx index 5a50afecd1e1c659b64690c2f0aa58145ec67e63..1433339d443d96b2a4fb8b3d57bb4f4e66ec87c1 100644 --- a/graf3d/eve/src/TEveGeoNode.cxx +++ b/graf3d/eve/src/TEveGeoNode.cxx @@ -476,11 +476,23 @@ TEveGeoShape::~TEveGeoShape() { // Destructor. + SetShape(0); +} + +//______________________________________________________________________________ +void TEveGeoShape::SetShape(TGeoShape* s) +{ + // Set TGeoShape shown by this object. + if (fShape) { fShape->SetUniqueID(fShape->GetUniqueID() - 1); if (fShape->GetUniqueID() == 0) delete fShape; } + fShape = s; + if (fShape) { + fShape->SetUniqueID(fShape->GetUniqueID() + 1); + } } /******************************************************************************/ @@ -598,9 +610,7 @@ TEveGeoShape* TEveGeoShape::SubImportShapeExtract(TEveGeoShapeExtract* gse, gsre->fTransparency = (UChar_t) (100.0f*(1.0f - rgba[3])); gsre->SetRnrSelf(gse->GetRnrSelf()); gsre->SetRnrChildren(gse->GetRnrElements()); - gsre->fShape = gse->GetShape(); - if (gsre->fShape) - gsre->fShape->SetUniqueID(gsre->fShape->GetUniqueID() + 1); + gsre->SetShape(gse->GetShape()); if (parent) parent->AddElement(gsre); diff --git a/graf3d/eve/src/TEveManager.cxx b/graf3d/eve/src/TEveManager.cxx index d53862ac34385023a797133560d59212436b5d44..58df24c2fdbe1eac9011ee84238351db88718814 100644 --- a/graf3d/eve/src/TEveManager.cxx +++ b/graf3d/eve/src/TEveManager.cxx @@ -481,6 +481,7 @@ TGeoManager* TEveManager::GetGeometry(const TString& filename) // Get geometry with given filename. // This is cached internally so the second time this function is // called with the same argument the same geo-manager is returned. + // gGeoManager is set to the return value. static const TEveException eh("TEveManager::GetGeometry "); @@ -491,11 +492,20 @@ TGeoManager* TEveManager::GetGeometry(const TString& filename) std::map<TString, TGeoManager*>::iterator geom = fGeometries.find(filename); if (geom != fGeometries.end()) { - return geom->second; + gGeoManager = geom->second; } else { gGeoManager = 0; - if (TGeoManager::Import(filename) == 0) - throw(eh + "GeoManager::Import() failed for '" + exp_filename + "'."); + Bool_t locked = TGeoManager::IsLocked(); + if (locked) { + Warning(eh, "TGeoManager is locked ... unlocking it."); + TGeoManager::UnlockGeometry(); + } + if (TGeoManager::Import(filename) == 0) { + throw(eh + "TGeoManager::Import() failed for '" + exp_filename + "'."); + } + if (locked) { + TGeoManager::LockGeometry(); + } gGeoManager->GetTopVolume()->VisibleDaughters(1); @@ -520,8 +530,8 @@ TGeoManager* TEveManager::GetGeometry(const TString& filename) } fGeometries[filename] = gGeoManager; - return gGeoManager; } + return gGeoManager; } //______________________________________________________________________________