\param theClassName Python class name
\return Python class object or None object if class is not found
*/
-static PyObject* GetPyClass( const char* theClassName )
+static PyTypeObject* GetPyClass( const char* theClassName )
{
static PyObject* aVTKModule = 0;
PyObject* aPyClass = 0;
if ( aVTKModule ) {
PyObject* aVTKDict = PyModule_GetDict( aVTKModule );
aPyClass = PyDict_GetItemString(aVTKDict, const_cast<char*>( theClassName ) );
+ if (!PyType_Check(aPyClass))
+ return 0;
}
- return aPyClass;
+ return (PyTypeObject *)aPyClass;
}
/*!
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderer" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderer" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderWindow" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderWindow" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}
: myResult( Py_None ), myCreate( toCreate ) {}
virtual void Execute()
{
- PyObject* aPyClass = ::GetPyClass( "vtkRenderWindowInteractor" );
+ PyTypeObject* aPyClass = ::GetPyClass( "vtkRenderWindowInteractor" );
SVTK_ViewWindow* aVTKViewWindow =
::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate );
if( aVTKViewWindow && aPyClass ) {
#if VTK_XVERSION < 50700
myResult = PyVTKObject_New( aPyClass, aVTKObject );
#else
- myResult = PyVTKObject_New( aPyClass, NULL, aVTKObject );
+ myResult = PyVTKObject_FromPointer( aPyClass, NULL, aVTKObject );
#endif
}
}