diff --git a/docs/changes.md b/docs/changes.md index 69a096eb..49eab757 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,5 +1,6 @@ ## Main changes + - general improvements to the `vedo` command line - `colorcet` [colormaps](https://colorcet.holoviz.org) are directly usable in `vedo`. Check example `basic/mesh_custom.py` @@ -14,9 +15,10 @@ Check example `basic/mesh_custom.py` `vedo --info some_image.jpg https://vedo.embl.es/examples/data/porsche.ply` - pressing `shift-A` toggles antialiasing for the whole rendering window -- pressing `shift-D` toggles depth-peeling algorithm (to visualize transparent object) +- pressing `shift-D` toggles depth-peeling algorithm for the current renderer - antialiasing set by default on vtk9 +- balloon-style flags are disabled because of a bug in vtk9. --- ### `base.py` @@ -26,8 +28,8 @@ Check example `basic/mesh_custom.py` ### `addons.py` - added `addSplineTool()` to interactively spline points in space - added `labelRotation` in addScalarBar3D -- added `xAxisRotation` to rotate the whole axis (ticks and labels) - added `xShiftAlongY` keywords in `Axes` to slide the whole axis position along another axis +- added `xAxisRotation` to rotate the whole axis (ticks and labels) - `addScalarBar3D()` can now render categorical data --- @@ -57,9 +59,6 @@ Check example `basic/mesh_custom.py` ### `pointcloud.py` - added `cutWithBox()`, `cutWithLine()`, `cutWithSphere()` and `cutWithCylinder()` methods ---- -### `pyplot.py` - --- ### `shapes.py` - fixed small bug in `Glyph` diff --git a/examples/advanced/timer_callback2.py b/examples/advanced/timer_callback2.py index 1f14593a..a25a135c 100644 --- a/examples/advanced/timer_callback2.py +++ b/examples/advanced/timer_callback2.py @@ -23,8 +23,8 @@ def initialize(self): return self def show(self, *args, **kwargs): - self.plotter.show(*args, **kwargs) - return self + plt = self.plotter.show(*args, **kwargs) + return plt def _buttonfunc(self): if self.timerId is not None: diff --git a/examples/basic/colorcubes.py b/examples/basic/colorcubes.py index 51a784c1..ae09bd2f 100644 --- a/examples/basic/colorcubes.py +++ b/examples/basic/colorcubes.py @@ -1,6 +1,6 @@ """Show a cube for each available color name""" print(__doc__) -from vedo import Cube, Text2D, show, settings, interactive +from vedo import Cube, Text2D, show, settings from vedo.colors import colors from operator import itemgetter @@ -17,6 +17,7 @@ cbs.append([tname, cb]) print("click on any cube and press i or I") plt1= show(cbs, N=len(cbs), azimuth=.2, size='full', title="matplotlib colors", interactive=0) +plt1.render() # sort by name (bootstrap5 colors): sorted_colors2 = sorted(colors.items(), key=itemgetter(0)) @@ -28,6 +29,5 @@ cbs.append([cname, cb]) plt2= show(cbs, shape=(11,9), azimuth=.2, size=(800,1000), title="bootstrap5 colors", new=True) -interactive() -plt1.close() plt2.close() +plt1.close() diff --git a/examples/pyplot/customAxes3.py b/examples/pyplot/customAxes3.py index 62ab409c..c0101016 100644 --- a/examples/pyplot/customAxes3.py +++ b/examples/pyplot/customAxes3.py @@ -22,6 +22,6 @@ xyShift=0.2, # move xy plane 20% along z yzShift=0.2, # move yz plane 20% along x zxShift=0.2, # move zx plane 20% along y - ) +) show(sph, axs, __doc__).close() diff --git a/vedo/plotter.py b/vedo/plotter.py index 81e09a81..2f9f52c8 100644 --- a/vedo/plotter.py +++ b/vedo/plotter.py @@ -2577,7 +2577,7 @@ def _keypress(self, iren, event): self.escaped = True # window will be escaped ASAP iren.ExitCallback() return - + elif key == "F1": vedo.printc('\nExecution aborted. Exiting python kernel now.', c='r') #settings.plotter_instance.close() @@ -3001,9 +3001,13 @@ def _keypress(self, iren, event): acts = self.getMeshes() for ia in acts: if ia.GetPickable() and isinstance(ia, vedo.Mesh): - ia.computeNormals() - intrp = (ia.GetProperty().GetInterpolation()+1)%3 - ia.GetProperty().SetInterpolation(intrp) + ia.computeNormals(cells=False) + intrp = ia.GetProperty().GetInterpolation() + # print(intrp, ia.GetProperty().GetInterpolationAsString()) + if intrp > 0: + ia.GetProperty().SetInterpolation(0) #flat + else: + ia.GetProperty().SetInterpolation(2) #phong elif key == "n": # show normals to an actor if self.clickedActor in self.getMeshes():