Questions about status update

Hi everyone,

I have a case of status not updating sliders when i have a color selector in the GUI.
I’ve created 2 basic dummy filters just to test this :

EDIT : please select preset 1

  • dummy works fine but doesn’t have a color selector
  • dummy color status update doesn’t work at all, sliders and color don’t change

Is there a way to update the color selector via the status command?
If there is , am i doing it wrong? :confused:

Thanks for helping :slight_smile:

code :

#@gui Dummy Color : dummycol, dummycol_preview(0)
#@gui : - Presets = choice(0,"0","1")
#@gui : - Testi = int(0,0,7)
#@gui : - Testa = float(0,0,7)
#@gui : - Testo= float(0,0,7)
#@gui : - Color = color(255,0,0,255)
#@gui : - Old Presets = _choice(0,"0","1")_0

dummycol :
preset,testi,testa,testo,cR,cG,cB,cA=${1-8}
deform $testi
to "preset "${preset}

dummycol_preview :
__output=${1--2}
preset,old_preset={[$1,${-1}]}

if $preset==1
variables=1,7,7,7,0,255,0,255

fi

if $preset
  if $preset==$old_preset
    if [$__output]!=[$variables]
      __output=0,${2-8}
    fi
else
  __output=$variables
  fi
fi
preset,testi,testa,testo,cR,cG,cB,cA=$__output

dummycol $__output
u "{"$preset"}""{"$testi"}""{"$testa"}""{"$testo"}""{"$cR"}""{"$cG"}""{"$cB"}""{"$cA"}""{"$preset"}"



#@gui Dummy : dummy, dummy_preview(0)
#@gui : - Presets = choice(0,"0","1")
#@gui : - Testi = int(0,0,7)
#@gui : - Testa = float(0,0,7)
#@gui : - Testo = float(0,0,7)
#@gui : - Old Presets = _choice(0,"0","1")_0

dummy :
preset,testi,testa,testo=${1-4}
deform $testi
to "preset "${preset}

dummy_preview :
__output=${1--2}
preset,old_preset={[$1,${-1}]}

if $preset==1
variables=1,7,7,7
fi

if $preset
  if $preset==$old_preset
    if [$__output]!=[$variables]
      __output=0,${2--2}
    fi
else
  __output=$variables
  fi
fi
preset,testi,testa,testo=$__output

dummy $__output
u "{"$preset"}""{"$testi"}""{"$testa"}""{"$testo"}""{"$preset"}"

When you fill the status to modify values of a color() argument, you need to specify 3 (or 4) values between the braces:

#@gui color = color(100,100,100);
...
foo : 
  ...
  R,G,B=200,100,50
  u "{"$R,$G,$B"}"

The main idea is that there are as much “{…}” as the number of widgets, not the same as the number of command arguments.

I swear I did this u "{"$R,$G,$B"}" yesterday and it didn’t seem to work either, but it was in another code. I’ll try again… Thanks

Well, it worked :slight_smile:
I had one extra value in the list (53 values) because i have 2 versions of the script and probably modified the wrong one while half asleep :sleeping:
BTW, is there a faster way to use status with a lot of values?
Thanks

I wish… I have some script with huge amount of variables, and the slowdown is due to dynamic graphic user interface changing.

Hi,

well it’s not really about slowdown. It’s just that the amount of "{"$vars"}" to add to the status command is… :face_with_spiral_eyes:

Hi,

i have another problem that bugged me for some time now : filter being called twice (or more since i had like 5 or 6 bools?) when i use status update.
After some time playing with it, i found out it was related to bool(0) parameters being updated to 1 in the gui via status.
It doesn’t happen if i make them unresponsive with _bool(0).
Maybe it’s the way the script is written? (had some help from @Reptorian for status update some time ago and this double call appeared)

#@gui Dummy Color : dummycol, dummycol_preview(0)
#@gui : - Presets = choice(0,"0","1")
#@gui : - bool = bool(0)
#@gui : - Testi = int(0,0,7)
#@gui : - Testa = float(0,0,7)
#@gui : - Testo= float(0,0,7)
#@gui : - Color = color(255,0,0,255)
#@gui : - Old Presets = _choice(0,"0","1")_0

dummycol :
preset,bo,testi,testa,testo,cR,cG,cB,cA=${1--1}
deform $testi
to "preset "${preset}

dummycol_preview :
__output=${1--2}
preset,old_preset={[$1,${-1}]}

if $preset==1
variables=1,1,7,7,7,0,255,0,255

fi

if $preset
  if $preset==$old_preset
    if [$__output]!=[$variables]
      __output=0,${2--2}
    fi
else
  __output=$variables
  fi
fi
preset,bo,testi,testa,testo,cR,cG,cB,cA=$__output

dummycol $__output
u "{"$preset"}""{"$bo"}""{"$testi"}""{"$testa"}""{"$testo"}""{"$cR,$cG,$cB,$cA"}""{"$preset"}"

In terminal i can see that the filter is called twice when the bool is set to 1 when selecting the preset 1:

$ echo "" >| ~/.config/gmic/gmic_qt_log
$ tail -f ~/.config/gmic/gmic_qt_log   


[gmic_gimp_qt]./preview/ dummycol_preview 0,0,0,0,0,255,0,0,255,0

[gmic_gimp_qt]./preview/ dummycol_preview 1,0,0,0,0,255,0,0,255,0

[gmic_gimp_qt]./preview/ dummycol_preview 1,1,0,0,0,255,0,0,255,0

I don’t know if it’s a bug or my script though. It seems to call the script with bool 0 then bool 1.

The calling filter twice has now been solved through some update on G’MIC-QT. Your bool get set to 1 because of the code under preset==1. I know that working with status update can be tricky.

Yes that’s what i want actually because in my other filter i use these bools like on/off switches. But status update calls the filter twice ? That’s strange. How should i tick these boxes then?
Maybe i’ll just use sliders instead and see what happens.

See here, that bug has been fixed. It’s not on your end: Get rid of some redundant preview updates · c-koi/gmic-qt@8608469 · GitHub

Ok i believe you, but it still happens in my case (Gimpc/gmic-qt 3.2.3 on Asahi/Arch Linux). I updated definitions too. It only happens with presets, not manual editing.