[vtkusers] Actor -- isMovable?
Piotr Byzia
piotr.byzia at gmail.com
Wed Nov 4 07:21:35 EST 2009
Hi,
I want to set an actor to be movable or non-movable, depending on
settings which I control through PyQT GUI.
In other words, having a few actors on the scene I want to set
checkboxes in my GUI that would freeze a given actor, and the rest of
them to react as usual to the mouse movements / clicks.
Regarding visibility of the actor I'm using GetProperty().SetOpacity
(0.0) on an instance of any given actor.
I can't see anything related to movement in the GetProperty()
properties, I believe it's somewhere else?
Here are most important parts of the code I'm using to generate a
single actor:
self.ren = vtk.vtkRenderer()
self.ren.SetBackground(0, 0, 0)
self.widget_3d.GetRenderWindow().AddRenderer(self.ren)
apd=vtk.vtkAppendPolyData()
for i in xrange(len(coordinates)):
line=vtk.vtkLineSource()
line.SetPoint1(coordinates[i][0]) # 1st atom coordinates for a
given bond
line.SetPoint2(coordinates[i][1]) # 2nd atom coordinates for a
given bond
line.SetResolution(21)
apd.AddInput(line.GetOutput())
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(apd.GetOutput())
lines_actor = vtk.vtkActor()
lines_actor.SetMapper(mapper)
lines_actor.GetProperty().SetColor(0.7, 0.0, 0.0)
lines_actor.GetProperty().SetOpacity(1.0)
self.ren.AddActor(lines_actor)
I found SetCurrentStyleToTrackballActor(), but I want to control this
behavior from my GUI.
Besides, trackball mode is very inconvenient in my case, with
molecules in "lines" representation (it's hard to pick a single line).
Thanks,
Piotr Byzia
More information about the vtkusers
mailing list