From 40f623b2a8e20c01dc8e9535454e1a3424156738 Mon Sep 17 00:00:00 2001 From: march3 Date: Thu, 30 Mar 2023 11:30:04 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bodies/fixed_stars/fixed_star.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bodies/fixed_stars/fixed_star.py b/bodies/fixed_stars/fixed_star.py index c60ed07..a2b6069 100644 --- a/bodies/fixed_stars/fixed_star.py +++ b/bodies/fixed_stars/fixed_star.py @@ -65,7 +65,14 @@ class FixedStar(Body): if not os.path.exists(temp_dir): os.mkdir(temp_dir) - save_file = os.path.join(temp_dir, "fixed_star_%s.png" % str(self.__class__.__name__).lower()) + texture_name = os.path.basename(texture). \ + replace(".", "_").replace("/", "_"). \ + replace("\\", "_").replace("__", "_") + + # save_file = os.path.join(temp_dir, "%s_%s.png" % (texture_name, "_".join([str(i) for i in list(self.color)]))) + + save_file = os.path.join(temp_dir, "%s_%s.png" % (texture_name, str(self.__class__.__name__).lower())) + if os.path.exists(save_file): return save_file -- GitLab