Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/mantaflow/intern/strings/fluid_script.h4
-rw-r--r--tests/gtests/blenlib/BLI_path_util_test.cc14
2 files changed, 17 insertions, 1 deletions
diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h
index b166ab585b0..977b99e7759 100644
--- a/intern/mantaflow/intern/strings/fluid_script.h
+++ b/intern/mantaflow/intern/strings/fluid_script.h
@@ -502,10 +502,12 @@ gc.collect()\n";
// BAKE
//////////////////////////////////////////////////////////////////////
+/* This has to match the behavior of BLI_path_frame,
+ * for positive and negative frame numbers. */
const std::string fluid_cache_helper =
"\n\
def fluid_cache_get_framenr_formatted_$ID$(framenr):\n\
- return str(framenr).zfill(4) # framenr with leading zeroes\n";
+ return str(framenr).zfill(4) if framenr >= 0 else str(framenr).zfill(5)\n";
const std::string fluid_bake_multiprocessing =
"\n\
diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc
index 480d48d6080..734bbc2b31e 100644
--- a/tests/gtests/blenlib/BLI_path_util_test.cc
+++ b/tests/gtests/blenlib/BLI_path_util_test.cc
@@ -408,6 +408,20 @@ TEST(path_util, Frame)
EXPECT_FALSE(ret);
EXPECT_STREQ("test_middle", path);
}
+
+ /* negative frame numbers */
+ {
+ char path[FILE_MAX] = "test_####";
+ ret = BLI_path_frame(path, -1, 4);
+ EXPECT_TRUE(ret);
+ EXPECT_STREQ("test_-0001", path);
+ }
+ {
+ char path[FILE_MAX] = "test_####";
+ ret = BLI_path_frame(path, -100, 4);
+ EXPECT_TRUE(ret);
+ EXPECT_STREQ("test_-0100", path);
+ }
}
/* BLI_split_dirfile */