make blender generated files unique - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 09167e862353922a1edd2105869321f54440cf44
(DIR) parent 08fa8d72688f79cb4d148c3c2511094becf15c93
(HTM) Author: Josuah Demangeon <me@josuah.net>
Date: Mon, 21 Nov 2022 21:18:05 +0100
make blender generated files unique
The previous version was always writing to the same file, generating
the same link every time.
This commit introduces mktemp to create a new file every time.
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M blender-effect | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/blender-effect b/blender-effect
@@ -14,6 +14,7 @@ shift 2
BLENDER=blender-3.2
BLEND_DIR="$(dirname "$0")/modules/blender"
IMAGE_DIR=/br/gopher/memecache/3d
+IMAGE_NAME="$(mktemp "$NAME.XXXXXXXX")"
# turn "key1=value key2=value key3=value" into variables used by blender-effect.py
for x in "$@"
@@ -25,7 +26,7 @@ ${BLENDER} --background \
"${BLEND_DIR}/${NAME}.blend" \
-E CYCLES \
--python "${BLEND_DIR}/effect.py" \
- --render-output "${IMAGE_DIR}/${NAME}." \
+ --render-output "${IMAGE_DIR}/${IMAGE_NAME}." \
--render-frame 1 \
>&2 \
-&& echo "${NAME}.0001.png"
+&& echo "${IMAGE_NAME}.0001.png"