diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index f3530eb..463b2c0 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -128,11 +128,9 @@ class SurfaceManager(): ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces") ps.Publisher().subscribe(self.OnRemove,"Remove surfaces") - ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces") def OnDuplicate(self, pubsub_evt): - selected_items = pubsub_evt.data proj = prj.Project() surface_dict = proj.surface_dict @@ -151,7 +149,6 @@ class SurfaceManager(): volume = original_surface.volume) - def OnRemove(self, pubsub_evt): selected_items = pubsub_evt.data proj = prj.Project() @@ -230,7 +227,6 @@ class SurfaceManager(): def CreateSurfaceFromPolydata(self, polydata, overwrite=False, name=None, colour=None, transparency=None, volume=None): - normals = vtk.vtkPolyDataNormals() normals.SetInput(polydata) normals.SetFeatureAngle(80) @@ -260,10 +256,7 @@ class SurfaceManager(): if name: surface.name = name - # Set actor colour and transparency - actor.GetProperty().SetColor(surface.colour) - actor.GetProperty().SetOpacity(1-surface.transparency) - self.actors_dict[surface.index] = actor + # Append surface into Project.surface_dict proj = prj.Project() @@ -274,6 +267,11 @@ class SurfaceManager(): surface.index = index self.last_surface_index = index + # Set actor colour and transparency + actor.GetProperty().SetColor(surface.colour) + actor.GetProperty().SetOpacity(1-surface.transparency) + self.actors_dict[surface.index] = actor + session = ses.Session() session.ChangeProject() @@ -569,6 +567,7 @@ class SurfaceManager(): index, value = pubsub_evt.data self.ShowActor(index, value) + def ShowActor(self, index, value): """ Show or hide actor, according to given actor index and value. -- libgit2 0.21.2