Skip to content

Commit

Permalink
fix vtk9.2 missing AttributeSmoothingFilter and decimate.MapPointData…
Browse files Browse the repository at this point in the history
…On()
  • Loading branch information
Marco committed Feb 19, 2024
1 parent f988ce1 commit fbcfde3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion vedo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,11 @@ def smooth_data(self,
exclude : (list)
list of arrays to be excluded from smoothing
"""
saf = vtki.new("AttributeSmoothingFilter")
try:
saf = vtki.new("AttributeSmoothingFilter")
except:
vedo.logger.error("smooth_data() only avaialble in VTK>=9.3.0")
return self
saf.SetInputData(self.dataset)
saf.SetRelaxationFactor(relaxation_factor)
saf.SetNumberOfIterations(niter)
Expand Down
6 changes: 5 additions & 1 deletion vedo/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,11 @@ def decimate(self, fraction=0.5, n=None, preserve_volume=True, regularization=0.
if regularization:
decimate.SetRegularize(True)
decimate.SetRegularization(regularization)
decimate.MapPointDataOn()

try:
decimate.MapPointDataOn()
except AttributeError:
pass

decimate.SetTargetReduction(1 - fraction)
decimate.SetInputData(poly)
Expand Down
2 changes: 1 addition & 1 deletion vedo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
_version = '2024.5.1'
_version = '2024.5.1+dev01'

0 comments on commit fbcfde3

Please sign in to comment.