Add support for groupe-ref
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 7 Oct 2023 04:01:46 +0000 (00:01 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Sat, 7 Oct 2023 15:57:56 +0000 (11:57 -0400)
fgen.sh

diff --git a/fgen.sh b/fgen.sh
index 9fbd121..385e211 100755 (executable)
--- a/fgen.sh
+++ b/fgen.sh
@@ -79,6 +79,14 @@ function get_group_id()
     echo "${group}"
 }
 
+# Arg1: group name
+function get_group_ref()
+{
+    local token
+    token=$(echo "${1}" | grep -e "^ref" | ${SED} "s/^\(ref\).*/\1/g")
+    echo "${token}"
+}
+
 # Get duplicate from. Ex: "label:dup1-7 planXYZ,geometry..." will return 1
 # Arg1: line
 function get_dup_from()
@@ -202,9 +210,6 @@ if [ ${trames} -eq 1 ]; then
     # Remove background line:
     ${SED} -i -e /label:${bg_layer_name},.*/d ${layers}
 
-    # Remove reference lines:
-    ${SED} -i -e /label:${ref_layer_prefix}.*/d ${layers}
-
     # Create background frame:
     convert -size ${size} xc:none ${dest}/background.png
 
@@ -219,7 +224,6 @@ if [ ${trames} -eq 1 ]; then
         p=$(get_pos "${l}")
         nf=$(get_frame_id "${l}")
         ng=$(get_group_id "${l}")
-
         dup_from=$(get_dup_from "${l}")
         dup_to=$(get_dup_to "${l}")
 
@@ -228,9 +232,18 @@ if [ ${trames} -eq 1 ]; then
             nf=${dup_from}
         fi
 
+        log_dbg "Layer ${scene}"
+        log_dbg "  nom: ${label}"
+        log_dbg "  pos: ${p}"
+
+        group_ref=$(get_group_ref "${group}")
+        log_dbg "  group_ref: ${group_ref}"
+
         # Only change group if ng is set...
         if [ x"${ng}" != x"" ]; then
-            generate_video
+            if [ x"${group_ref}" != x"ref" ]; then
+                generate_video
+            fi
 
             group="${ng}"
             log_dbg "New group: ${ng}"
@@ -243,9 +256,11 @@ if [ ${trames} -eq 1 ]; then
             continue
         fi
 
-        log_dbg "Layer ${scene}"
-        log_dbg "  nom: ${label}"
-        log_dbg "  pos: ${p}"
+        if [ x"${group_ref}" != x"" ]; then
+            # Ignore all images in groupe-ref:
+            log_dbg "  ignore (groupe-ref)"
+            continue
+        fi
 
         files="${files} -page ${p} ${src}[${scene}]"