From 136b1561c189fe080e87f4182b1aec54509af167 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sat, 16 Nov 2024 18:09:38 +0100 Subject: [PATCH] BugFix Custom Filter shader uniform variable Response to issue #159. Allow uniform variable names with numbers and underscore, and values with float numbers (i.e. fixed the regular expression). Plus also fix a display bug in shader editor GUI. --- src/ImageFilter.cpp | 14 +++++++++----- src/ImageFilter.h | 1 + src/ShaderEditWindow.cpp | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ImageFilter.cpp b/src/ImageFilter.cpp index c4095f8..2dae8a2 100644 --- a/src/ImageFilter.cpp +++ b/src/ImageFilter.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of vimix - video live mixer * * **Copyright** (C) 2019-2023 Bruno Herbelin @@ -435,7 +435,8 @@ FilteringProgram ImageFilter::program () const } #define REGEX_UNIFORM_DECLARATION "uniform\\s+float\\s+" -#define REGEX_UNIFORM_VALUE "(\\s*=\\s*[[:digit:]](\\.[[:digit:]])?)?\\s*\\;" +#define REGEX_VARIABLE_NAME "[a-zA-Z_][\\w]+" +#define REGEX_UNIFORM_VALUE "(\\s*=\\s*[[:digit:]]+(\\.[[:digit:]]*)?)?\\s*\\;" void ImageFilter::setProgram(const FilteringProgram &f, std::promise *ret) { @@ -453,7 +454,7 @@ void ImageFilter::setProgram(const FilteringProgram &f, std::promise