It is currently April 18th, 2024, 1:49 am

[bug or suggestion] change imagename to empty dont work

Report bugs with the Rainmeter application and suggest features.
User avatar
Setsukka
Posts: 19
Joined: March 20th, 2018, 9:53 am
Location: China

[bug or suggestion] change imagename to empty dont work

Post by Setsukka »

4.2.0 r3111 64-bit (Jul 8 2018) - Chinese (Simplified) (2052)
Windows 10 Home China 1803 64-bit (build 17134) - Chinese (Simplified) (2052)

We have found that there is one tip in the ImageName option that
When ImageName is hard-coded with an image file name, the image will be loaded and "cached", to avoid reloading the image from disk on every meter update. If there is an external process that is changing the image file, while leaving the name the same, use DynamicVariables=1 on the meter to force the image to be reloaded from disk on every meter update.
But in fact, not only the same name, when changing the image file to empty, the image do not be reloaded as well.
Lets look at the example below.

Code: Select all

[Rainmeter]
Update=5000

[Variables]
EmptyImage=
OriginImage=1.png

[Image]
Meter=Image
ImageName=#OriginImage#
W=200

[Button]
Meter=String
X=300
W=20
H=20
SolidColor=255,100,100
LeftMouseUpAction=[!SetOption Image ImageName "#EmptyImage#"][!Update]
When we load the skin, and click the Button, the image should disappear, because we have set the imagename to " "(empty). But in fact, not, unless we change the code to below:

Code: Select all

[Image]
Meter=Image
ImageName=#OriginImage#
W=200
DynamicVariables=1
This can cause an issue among Launcher skins when the icon image is empty. And I dont think Set Every Icon Meter DynamicVariables=1 is a good idea. Just as below.

Code: Select all

[Rainmeter]
Update=5000

[Variables]
Icon1=
Name1=Disk C
Path1=C:\

Icon2=2.png
Name2=Disk D
Path2=D:\

Icon3=3.png
Name3=Disk E
Path3=E:\

[Icon1]
Meter=Image
ImageName=#Icon1#
W=200
H=200
LeftMouseUpAction=["#Path1#"]

[Text1]
Meter=String
Y=200
FontColor=000000
FontSize=15
SolidColor=FFFFFF
Text=#Name1#
AntiAlias=1

[Icon2]
Meter=Image
ImageName=#Icon2#
X=210
W=200
H=200
LeftMouseUpAction=["#Path2#"]

[Text2]
Meter=String
X=r
Y=200
FontColor=000000
FontSize=15
SolidColor=FFFFFF
Text=#Name2#
AntiAlias=1

[NextPage]
Meter=String
Y=250
FontColor=FFFFFF
FontSize=15
SolidColor=255,100,100
Text=>
AntiAlias=1
LeftMouseUpAction=[!SetOption Icon1 ImageName "#Icon2#"][!SetOption Icon2 ImageName "#Icon3#"][!SetOption Icon1 LeftMouseUpAction """["#Path2#"]"""][!SetOption Icon2 LeftMouseUpAction """["#Path3#"]"""][!SetOption Text1 Text "#Name2#"][!SetOption Text2 Text "#Name3#"][!Update]

[PrePage]
Meter=String
X=100
Y=250
FontColor=FFFFFF
FontSize=15
SolidColor=0,0,255
Text=<
AntiAlias=1
LeftMouseUpAction=[!SetOption Icon1 ImageName "#Icon1#"][!SetOption Icon2 ImageName "#Icon2#"][!SetOption Icon1 LeftMouseUpAction """["#Path1#"]"""][!SetOption Icon2 LeftMouseUpAction """["#Path2#"]"""][!SetOption Text1 Text "#Name1#"][!SetOption Text2 Text "#Name2#"][!Update]
Image

For some skins more complex, it can be a big problem like below.
Image
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [bug or suggestion] change imagename to empty dont work

Post by jsmorley »

We will look into this. While setting DynamicVariables=1 does correct the issue, I agree that it shouldn't be needed, The way !SetOption is supposed to work is that it sets the target section with DynamicVariables for one update, so the change is detected without having to have the section re-evaluated entirely on every update.
User avatar
Brian
Developer
Posts: 2678
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [bug or suggestion] change imagename to empty dont work

Post by Brian »

This has been fixed for the next beta. Thanks for reporting!

-Brian