我面临着完全相同的问题。任何 mayavi 代码都会导致AttributeError:SetViewPlaneNormal
错误。
我的平台是 Win 7 Pro x64,带有 Python 2.7.5、VTK 5.10.1、Mayavi 4.3.0。
请注意,即使是官方的 python 示例也会导致错误,但尽管控制台中不断打印错误,但图形仍能正确显示。
这是完整的堆栈跟踪:
, trait: view_plane_normal, old value: [ 0.57735027 0.57735027 0.57735027], new value: [ 0.57735027 0.57735027 0.57735027]
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\traits\trait_notifiers.py", line 381, in call_3
self.handler( object, old, new )
File "C:\Python27\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\camera.py", line 82, in _view_plane_normal_changed
self._do_change(self._vtk_obj.SetViewPlaneNormal,
AttributeError: SetViewPlaneNormal
Exception occurred in traits notification handler for object: vtkOpenGLCamera (092BF010)
Debug: Off
Modified Time: 890617
Reference Count: 2
Registered Events:
Registered Observers:
vtkObserver (0A1AA3C8)
Event: 33
EventName: ModifiedEvent
Command: 0A867210
Priority: 0
Tag: 1
ClippingRange: (1.56289, 5.47286)
DirectionOfProjection: (-0.57735, -0.57735, -0.57735)
Distance: 3.29037
EyeAngle: 2
FocalDisk: 1
FocalPoint: (1, 1, 1)
ViewShear: (0, 0, 1)
ParallelProjection: Off
ParallelScale: 0.851612
Position: (2.8997, 2.8997, 2.8997)
Stereo: Off
Left Eye: 1
Thickness: 3.90998
ViewAngle: 30
UseHorizontalViewAngle: 0
UserTransform: (none)
(none)
ViewPlaneNormal: (0.57735, 0.57735, 0.57735)
ViewUp: (0, 0, 1)
WindowCenter: (0, 0)
UseOffAxisProjection: (0)
ScreenBottomLeft: (-0.5, -0.5, -0.5)
ScreenBottomRight: (0.5, -0.5, -0.5)
ScreenTopRight: (0.5, 0.5, -0.5)
EyeSeparation: (0.06)
WorldToScreenMatrix: (03996300
Debug: Off
Modified Time: 881548
Reference Count: 1
Registered Events: (none)
Elements:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
)
EyeTransformMatrix: (039954F0
Debug: Off
Modified Time: 881550
Reference Count: 1
Registered Events: (none)
Elements:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
)
ModelTransformMatrix: (039955E0
Debug: Off
Modified Time: 881552
Reference Count: 1
Registered Events: (none)
Elements:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
)
, trait: view_plane_normal, old value: [ 0.57735027 0.57735027 0.57735027], new value: [ 0.57735027 0.57735027 0.57735027]
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\traits\trait_notifiers.py", line 381, in call_3
self.handler( object, old, new )
File "C:\Python27\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\camera.py", line 82, in _view_plane_normal_changed
self._do_change(self._vtk_obj.SetViewPlaneNormal,
AttributeError: SetViewPlaneNormal
每次渲染都会打印多次上述堆栈跟踪。如果我们移动相机导致 FPS 大幅下降,就会继续发生这种情况。
导致此错误的最简单代码的示例:
from mayavi import mlab
mlab.points3d([1], [1], [1])