From bbd11543cdf08fd94ba8ae79986e7896159277f3 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Fri, 6 Oct 2023 23:21:07 -0400 Subject: [PATCH] Add support for "groupe" label --- fgen.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/fgen.sh b/fgen.sh index f50e000..b6a45c2 100755 --- a/fgen.sh +++ b/fgen.sh @@ -70,6 +70,13 @@ function get_scene_id() echo "${token}" } +# Arg1: line +function get_group_id() +{ + group=$(echo "${1}" | grep -e "label:groupe.*" | ${SED} "s/.*label:groupe-\(.*\),geometry.*/\1/g") + echo "${group}" +} + print_usage() { echo "${PROG_NAME} -- Générateur de séquence d'images PNG à partir d'un fichier Photoshop (PSD)." @@ -170,12 +177,34 @@ if [ ${trames} -eq 1 ]; then nf="" oldnf="" files="" + group="" while read l; do scene=$(get_scene_id "${l}") label=$(get_label "${l}") p=$(get_pos "${l}") nf=$(get_frame_id "${l}") + ng=$(get_group_id "${l}") + + # Only change group if ng is set... + if [ x"${ng}" != x"" ]; then + if which ffmpeg 1> /dev/null 2>&1; then + if [ -f ${dest}/${group}-f1.png ]; then + # Conversion vidéo: + ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 + fi + fi + + group="${ng}" + log_dbg "New group: ${ng}" + + nf="" + oldnf="" + files="" + + # Skip image from group ID... + continue + fi log_dbg "Layer ${scene}" log_dbg " nom: ${label}" @@ -198,14 +227,9 @@ if [ ${trames} -eq 1 ]; then fi log_dbg "New frame ID: ${nf}" - convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/f${nf}.png + convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/${group}-f${nf}.png files="" oldnf="${nf}" fi done <${layers} fi - -if which ffmpeg 1> /dev/null 2>&1; then - # Conversion vidéo: - ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/f%d.png ${dest}/sequence.mp4 -fi -- 2.20.1