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
}
// Check if vtkClassOrScriptName is a valid vtk className
vtkSmartPointer<vtkObject> objectPointer;
objectPointer.TakeReference(vtkInstantiator::CreateInstance(vtkClassOrScriptName));
if (!objectPointer)
vtkSmartPointer<vtkObject> objectSmartPointer;
objectSmartPointer.TakeReference(vtkInstantiator::CreateInstance(vtkClassOrScriptName));
if (!objectSmartPointer || !objectSmartPointer->IsA("vtkMRMLAbstractDisplayableManager"))
{
#ifdef MRMLDisplayableManager_USE_PYTHON
// Check if vtkClassOrScriptName is a python script
......@@ -241,8 +241,8 @@ vtkMRMLDisplayableManagerGroup* vtkMRMLDisplayableManagerFactory::InstantiateDis
// Object will be unregistered when the SmartPointer will go out-of-scope
vtkSmartPointer<vtkObject> objectSmartPointer;
objectSmartPointer.TakeReference(vtkInstantiator::CreateInstance(classOrScriptName));
vtkMRMLAbstractThreeDViewDisplayableManager* displayableManager =
vtkMRMLAbstractThreeDViewDisplayableManager::SafeDownCast(objectSmartPointer);
vtkMRMLAbstractDisplayableManager* displayableManager =
vtkMRMLAbstractDisplayableManager::SafeDownCast(objectSmartPointer);
if (!displayableManager)
{
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