Commit 88107cb4 authored by jcfr's avatar jcfr
Browse files

BUG: vtkMRMLDisplayableManagerFactory::Instantiate - Do not cast to...

BUG: vtkMRMLDisplayableManagerFactory::Instantiate - Do not cast to vtkMRMLAbstractThreeDViewDisplayableManager

The factory should be able to deal with any sort of DisplayableManager.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15638 3bd1e089-480b-0410-8dfb-8563597acbee
parent 2f240aac
...@@ -138,9 +138,9 @@ bool vtkMRMLDisplayableManagerFactory::RegisterDisplayableManager(const char* vt ...@@ -138,9 +138,9 @@ bool vtkMRMLDisplayableManagerFactory::RegisterDisplayableManager(const char* vt
} }
// Check if vtkClassOrScriptName is a valid vtk className // Check if vtkClassOrScriptName is a valid vtk className
vtkSmartPointer<vtkObject> objectPointer; vtkSmartPointer<vtkObject> objectSmartPointer;
objectPointer.TakeReference(vtkInstantiator::CreateInstance(vtkClassOrScriptName)); objectSmartPointer.TakeReference(vtkInstantiator::CreateInstance(vtkClassOrScriptName));
if (!objectPointer) if (!objectSmartPointer || !objectSmartPointer->IsA("vtkMRMLAbstractDisplayableManager"))
{ {
#ifdef MRMLDisplayableManager_USE_PYTHON #ifdef MRMLDisplayableManager_USE_PYTHON
// Check if vtkClassOrScriptName is a python script // Check if vtkClassOrScriptName is a python script
...@@ -241,8 +241,8 @@ vtkMRMLDisplayableManagerGroup* vtkMRMLDisplayableManagerFactory::InstantiateDis ...@@ -241,8 +241,8 @@ vtkMRMLDisplayableManagerGroup* vtkMRMLDisplayableManagerFactory::InstantiateDis
// Object will be unregistered when the SmartPointer will go out-of-scope // Object will be unregistered when the SmartPointer will go out-of-scope
vtkSmartPointer<vtkObject> objectSmartPointer; vtkSmartPointer<vtkObject> objectSmartPointer;
objectSmartPointer.TakeReference(vtkInstantiator::CreateInstance(classOrScriptName)); objectSmartPointer.TakeReference(vtkInstantiator::CreateInstance(classOrScriptName));
vtkMRMLAbstractThreeDViewDisplayableManager* displayableManager = vtkMRMLAbstractDisplayableManager* displayableManager =
vtkMRMLAbstractThreeDViewDisplayableManager::SafeDownCast(objectSmartPointer); vtkMRMLAbstractDisplayableManager::SafeDownCast(objectSmartPointer);
if (!displayableManager) if (!displayableManager)
{ {
vtkErrorMacro(<<"InstantiateDisplayableManagers - Failed to instantiate " << classOrScriptName); vtkErrorMacro(<<"InstantiateDisplayableManagers - Failed to instantiate " << classOrScriptName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment