From 16fbeaba5b15d299e1c180372c5a1778359665d5 Mon Sep 17 00:00:00 2001 From: Bane Sullivan Date: Sun, 2 Feb 2020 21:42:15 -0700 Subject: [PATCH] Deep copy textures in copy_meta_from (#564) --- pyvista/core/common.py | 5 +++-- pyvista/core/objects.py | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyvista/core/common.py b/pyvista/core/common.py index 95baf10bc7..f6618b3366 100644 --- a/pyvista/core/common.py +++ b/pyvista/core/common.py @@ -1006,8 +1006,9 @@ def copy_meta_from(self, ido): self._active_scalars_info = ido.active_scalars_info self._active_vectors_info = ido.active_vectors_info if hasattr(ido, '_textures'): - self._textures = ido._textures - + self._textures = {} + for name, tex in ido._textures.items(): + self._textures[name] = tex.copy() @property def point_arrays(self): diff --git a/pyvista/core/objects.py b/pyvista/core/objects.py index 2bb50693fe..f77a31452a 100644 --- a/pyvista/core/objects.py +++ b/pyvista/core/objects.py @@ -499,3 +499,7 @@ def repeat(self): @repeat.setter def repeat(self, flag): self.SetRepeat(flag) + + def copy(self): + """Make a copy of this textrue.""" + return Texture(self.to_image().copy())