It is currently December 10th, 2018, 8:53 pm

Test of new Container option

Testing and discussion of the conversion of Rainmeter to D2D.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Test of new Container option

jsmorley » November 13th, 2018, 4:36 pm

We would like robut testing of a new capability we are working on for Rainmeter 4.3. We would love it if folks could give it a try. We are looking for feedback, so beat it up... This is almost entirely the work of developer theAzack9, and wow...

Container=SomeMeter

has been added as a general meter option. This means it will work on all meter types.

The intent of this option is two-fold:

1) A meter that has a Container option will in effect be put "inside" the container meter. It will be positioned relative to the container, and will be visibly constrained by it. Only the part of the content that is "inside" the container will be drawn.

Think sliding content, a menu or launcher for instance, into view without needing to start outside the entire skin.

2) The content will be "masked" into any solid pixels in the container meter. So only the part of the content that is masked into a "solid" pixel in the container will be drawn.

Think masking an image into a String meter, or an image into a Shape meter.

Any "content" meter(s) will be positioned relative to the "container", and the "content" will only be drawn on solid pixels of the container. Any content that is positioned outside the container, or that is on a transparent pixel in the container, will not be drawn. Content outside the container is truncated, and in effect doesn't exist. It will not impact the size of the skin.

Any meter type can be a "container" and any meter type can be "content". Go nuts... Some things won't make much sense, like masking a String into an Image, rather than an Image into a String, but who knows what creative stuff can be done.

Some rules:

1) Meters that are "content" meters, that have the Container option on them, are positioned relative to the starting X and Y of the meter being used as a "container". Any X and Y on the first content meter in a container will in effect use the "r" relative positioning option, relative to their container. No actual "r" option is needed.

This has nothing to do with the order of the meters in the skin. The first "content" meter need not be right after its "container", in fact it can be before it, or really anywhere in the skin. The first "content" meter will just always be relative to its "container".

2) Meters that are "content" meters, and follow other content meters in a container, will be relative to each other. In this case, use the "r" and "R" options to position them relative to each other, as you normally would.

3) Meters that follow "content" meters, but are NOT content themselves, that have no Container option on them, will be relative to the first preceding meter that is not "content". In almost all cases, this will be the "container" itself.

4) A meter being used as a "container" will NOT be drawn itself. In a sense, it is just the "shape" of its solid pixels that is being used. If you want the container meter itself to be visible, you will need to create a copy of the meter, not used as a container.

5) Any transparency on both the "container" and "content" meters will be taken into account. In effect they will both be "subtracted" from the opacity of the final result. Generally speaking, you will want the "container" meter to be fully opaque where you want "content" drawn, and use transparency on the "content" to control things. Having partial opacity on both will only be confusing and hard to manage. Not to say there aren't clever uses for it, just be aware of it.

It's important to wrap your head around this. Although container meters are not drawn, everything else about them plays a role. The position, size, and opacity of the container are all factors in how the "content" is treated when placed in the container. If a pixel in the container is fully transparent, any pixel from the "content" placed there will also be fully transparent. That is the key to how the "masking" is done.

6) You may NOT have a "content" meter also be a "container" meter. In other words, you cannot "nest" containers inside of containers. While in theory this is possible with the idea of "container" alone, the "masking" will make this impossible.

Download the latest Rainmeter 4.3 beta from http://www.rainmeter.net

Documentation is at https://docs.rainmeter.net/manual-beta/meters/general-options/container/

Download the .rmskin at the end of the documentation for several examples of using Container.

Here are the skins in that .rmskin to take a look at:

HelloWorld

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
OffSet=130
U=[!UpdateMeasure "MeasureSlideInOut"][!UpdateMeter *][!Redraw]

[MeterSkinBack]
Meter=Shape
Shape=Rectangle 0.5,0.5,169,103,12 | Fill Color 47,47,47,255 | StrokeWidth 1.5 | Stroke Color 150,150,150,255
X=0
Y=0
W=170
H=104

[MeterContainerVisible]
Meter=Shape
; A copy of the container meter, to provide visibility
Shape=Rectangle 0,0,130,84,12 | Fill Color 255,47,47,255 | StrokeWidth 0
X=20
Y=10

[MeterContainer]
Meter=Shape
; Meters used as a container will not be drawn. They are used as a "mask".
; Create a copy of them, as above, to make them visible.
Shape=Rectangle 0,0,130,84,12 | Fill Color 255,47,47,255 | StrokeWidth 0
X=20
Y=10
MouseOverAction=[!CommandMeasure MeasureSlideInOut "Stop 2"][!CommandMeasure MeasureSlideInOut "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureSlideInOut "Stop 1"][!CommandMeasure MeasureSlideInOut "Execute 2"]

[MeterString]
Meter=String
; This meter will be relative to the starting X and Y of its container.
X=#OffSet#
Y=33
FontSize=13
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontWeight=400
AntiAlias=1
Text=Hello World!
DynamicVariables=1
MouseOverAction=[!SetOption MeterString FontColor "0,0,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption MeterString FontColor "255,255,255,255"][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!Log "Clicked me!"]
Container=MeterContainer

[MeasureSlideInOut]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Reset | Wait 1 | Repeat SlideIn, 30, 11
SlideIn=[!SetVariable OffSet "(Clamp(#OffSet#-12,20,130))"]#U#
ActionList2=Repeat SlideOut, 30, 11  | Wait 1 | Reset
SlideOut=[!SetVariable OffSet "(Clamp(#OffSet#-12,-130,20))"]#U#
Reset=[!SetVariable OffSet 130]#U#
IgnoreWarnings=1
DynamicVariables=1
HelloWorld.gif

BarMeter

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Loop]
Measure=Loop
StartValue=0
EndValue=100
MinValue=0
MaxValue=100

[MeterBarBack]
Meter=Image
W=400
H=72
SolidColor=78,65,98,255

[MeterBarAsContainer]
Meter=Bar
; Meters used as a container will not be drawn. They are used as a "mask".
MeasureName=Loop
W=400
H=72
BarColor=0,0,0,255
SolidColor=78,65,98,30
; In this case, the image below is masked into the bar.
; Since the SolidColor of the bar is partially transparent, the image will
; use that transparency, subtracted from the image transparency.
; As the bar is "filled in", that part of the bar will be fully opaque,
; and in that portion, the image will be fully opaque.
BarOrientation=Horizontal

[MeterImage]
Meter=Image
W=400
PreserveAspectRatio=1
Y=-62
ImageName=#@#Images\lampoon.jpg
Container=MeterBarAsContainer
BarMeter.gif

ImageInString

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1

[Counter]
Measure=Loop
StartValue=-75
EndValue=15
Increment=2
LoopCount=1

[MeterStringAsContainer]
Meter=String
; Meters used as a container will not be drawn. They are used as a "mask".
; In this case, we don't want to display the string, only the part of the 
; image that is masked into the string. This creates a "string shaped" image.
FontSize=80
FontWeight=800
FontColor=255,255,255,255
AntiAlias=1
Text=Good Night
LeftMouseUpAction=[!CommandMeasure Counter "Reset"]

[MeterImage]
Meter=Image
; Then we move the image inside the container. This is relative to starting X and Y of the container.
Y=([Counter:])
W=700
PreserveAspectRatio=1
ImageName=#@#Images\Sunset.jpg
DynamicVariables=1
Container=MeterStringAsContainer
Click to Animate
ImageInString.gif

MaskImage

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterMask]
Meter=Image
; Meters used as a container will not be drawn. They are used as a "mask".
ImageName=#@#Images\Puzzle.png

[MeterImage]
Meter=Image
ImageName=#@#Images\Abbey.jpg
Container=MeterMask
MaskImage.png

MaskShape

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterShapeAsContainer]
Meter=Shape
; Meters used as a container will not be drawn. They are used as a "mask".
; Be careful that shapes are not drawn outside their meter, or they will
; be truncated when masked. Content is only drawn inside the confines of 
; the container meter's W and H.
Shape=Ellipse 100,100,100 | Fill Color 255,255,255,255 | StrokeWidth 0
; Note that any transparency in the container will impact the final result.
SolidColor=0,0,0,90

[MeterImage]
Meter=Image
; This meter will be relative to the starting X and Y of its container.
; Use X and Y to position the image in the container.
X=-43
Y=-85
ImageName=#@#Images\Abbey.jpg
Container=MeterShapeAsContainer
MaskShape.png

NiceWeather

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterWeatherVisible]
Meter=Image
; We want to display the entire image, as well as the part
; masked into the string, so we use this Image meter to
; display our slightly muted image as a background.
ImageName=#@#Images\NiceWeather.jpg
W=400
PreserveAspectRatio=1
ImageTint=180,180,180,255

[MeterTemperatureShadow]
Meter=String
; The actual text of this meter will be overlaid by the
; string we are using as mask, but the shadow will
; be displayed around it.
X=90
Y=50
FontSize=120
FontWeight=700
FontColor=255,255,255,255
InlineSetting=Shadow | 2 | 2 | 3.5 | 0,0,0,255
AntiAlias=1
Text=41°

[MeterTemperatureMask]
Meter=String
X=90
Y=50
FontSize=120
FontWeight=700
; Note that no FontColor is needed, as long as it is fully opaque,
; which the default FontColor for a String meter is.
AntiAlias=1
Text=41°

[MeterWeatherMasked]
Meter=Image
ImageName=#@#Images\NiceWeather.jpg
; Since we set an X and Y on the String meter, and this image
; content will be relative to the start of that, we need to 
; move the image up and left so it aligns the result with
; the "visible" Image meter, and masks correctly into the
; String meter.
X=-90
Y=-50
W=400
PreserveAspectRatio=1
Container=MeterTemperatureMask
NiceWeather.jpg

Relative

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterImageVisible]
Meter=Image
ImageName=#@#Images\Puzzle.png
ImageTint=0,0,0,255

[MeterImageMask]
Meter=Image
; Meters used as a container will not be drawn. They are used as a "mask".
; Use a copy of the meter, as above, to make it visible.
ImageName=#@#Images\Puzzle.png
; Uncomment this SolidColor to see what is going on.
;SolidColor=0,255,0,90

[MeterString1]
Meter=String
; The first meter used as content will be positioned relative to the starting X and Y of its container.
; This meter will be positioned 20 pixels to the right of the start of MeterImageMask,
; and will be positioned 30 pixels below the start of MeterImageMask.
X=20
Y=30
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 1 of 9 in the mask
Container=MeterImageMask

[MeterString2]
Meter=String
; Subsequent meters in the same container will be relative to each other.
; This meter will be positioned 4 pixels to the right of the start of MeterString1,
; and will be positioned 10 pixels below the end of MeterString1.
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 2 of 9 in the mask
Container=MeterImageMask

[MeterString3]
Meter=String
; This meter will be positioned 4 pixels to the right of the start of MeterString2,
; and will be positioned 10 pixels below the end of MeterString2.
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 3 of 9 in the mask
Container=MeterImageMask

[MeterString4]
Meter=String
; And so on...
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 4 of 9 in the mask
Container=MeterImageMask

[MeterString5]
Meter=String
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 5 of 9 in the mask
Container=MeterImageMask

[MeterString6]
Meter=String
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 6 of 9 in the mask
Container=MeterImageMask

[MeterString7]
Meter=String
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 7 of 9 in the mask
Container=MeterImageMask

[MeterString8]
Meter=String
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 8 of 9 in the mask
Container=MeterImageMask

[MeterString9]
Meter=String
X=4r
Y=10R
FontSize=14
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=This is line 9 of 9 in the mask
Container=MeterImageMask

[MeterStringOutsideContainer]
Meter=String
; Meters not in the container will be relative to the immediately preceding
; meter that is not "content". In this case that would be the container meter.
; So this will be relative to [MeterImageMask].
X=10r
Y=15R
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=This string is outside the container
Relative.png].png

RoundLineGradiant

Code: Select all

[Rainmeter]
Update=100
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1
LeftMouseUpAction=[!CommandMeasure MeasureLoop "Reset"]

[MeasureLoop]
Measure=Loop
StartValue=0
Increment=1
EndValue=100
MaxValue=100
LoopCount=1

[MeterRoundlineBack]
Meter=Roundline
X=10
Y=0
W=120
H=120
StartAngle=4.712
RotationAngle=6.283
LineStart=50
LineLength=60
LineColor=60,60,60,255
Solid=1
AntiAlias=1

[MeterRoundlineContainer]
Meter=Roundline
MeasureName=MeasureLoop
X=10
Y=0
W=120
H=120
StartAngle=4.712
RotationAngle=6.283
LineStart=50
LineLength=60
Solid=1
AntiAlias=1

[MeterGradient]
Meter=Image
ImageName=#@#Images\Gradient.jpg
Container=MeterRoundlineContainer
RoundLineGradient.gif

ScaleShapeMask

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
ScaleFactor=1.0

[MeterShape]
Meter=Shape
X=15
Y=15
Shape=Path MyPath1 | StrokeWidth 0  | Fill LinearGradient MyGradient
MyPath1=0,0 | LineTo 200,0 | ArcTo 200,200 | LineTo 0,200 | CurveTo 0,0,50,100 | ClosePath 1
MyGradient=180 | 50,50,50,255 ; 0.0 | 255,255,255,255 ; 1.0
Shape2=Ellipse 90,100,90
Shape3=Ellipse 200,100,50
Shape4=Combine Shape | Union Shape2 | XOR Shape3 | Scale #ScaleFactor#,#ScaleFactor#,0,0,0,0
DynamicVariables=1
MouseScrollUpAction=[!SetVariable ScaleFactor "(Clamp(#ScaleFactor# - 0.05,0.2,2.5))"][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable ScaleFactor "(Clamp(#ScaleFactor# + 0.05,0.2,2.5))"][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!Refresh]

[MeterSize]
Meter=String
FontSize=(Ceil(15 * #ScaleFactor#))
X=(Ceil(15 * #ScaleFactor#))
Y=(Ceil(5 * #ScaleFactor#))R
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=Scale: #ScaleFactor##CRLF#Size: [MeterShape:W] X [MeterShape:H]

[MeterImage]
Meter=Image
ImageName=#@#Images\Abbey.jpg
W=(300 * #ScaleFactor#)
H=(300 * #ScaleFactor#)
PreserveAspectRatio=1
DynamicVariables=1
Container=MeterShape
Click to Animate
ScaleShapeMask.gif

ScrollText

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Scroll=10

[MeasureText]
Measure=WebParser
URL=file://#@#Text\Charge of the Light Brigade.txt
RegExp=(?siU)^(.*)$
StringIndex=1

[MeterContainerVisible]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,240,502 | Fill Color 47,47,47,255 | StrokeWidth 2 | Stroke Color 255,255,255,255

[MeterContainer]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,240,502 | StrokeWidth 2

[MeterText]
Meter=String
MeasureName=MeasureText
X=11
Y=(#Scroll#)
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
MouseScrollDownAction=[!SetVariable Scroll "(Clamp(#Scroll#-10,-580,11))"][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable Scroll "(Clamp(#Scroll#+10,-580,11))"][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!Log "Clicked String!"]
Container=MeterContainer

Click to Animate
ScrollText.gif
You do not have the required permissions to view the files attached to this post.
User avatar
StArL0rd84
Posts: 271
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Test of new Container option

StArL0rd84 » November 13th, 2018, 6:23 pm

Christmas came early this year!
I see a lot the wishes of the community came true.
Just tried out the image masking with a shape meter for now.
And yeah, wow...
So powerful but easy to use.
Thank you theAzack9 and Rainmeter team.

EDIT:
Whoops, spoke too soon.
When i add the container line, it sends the skin into a refresh loop.
Not sure if it's actually a refresh loop, but that's what it looks like.
Looks like its trying to load different elements but fails.

Code: Select all

[WnpThumbnailMask]
 Meter=Shape
 X=r
 Y=r
 Shape=Rectangle 5,5,530,298,(#Roundness#-3)
 MeterStyle=BGShapeStyle
 Group=Wnp
[WnpThumbnail]
 Meter=Image
 MeasureName=mWnpThumbnail
 Container=WnpThumbnailMask
 X=5r
 Y=5r
 W=530
 AntiAlias=1
 Hidden=1
 Group=Wnp
Last edited by StArL0rd84 on November 13th, 2018, 6:52 pm, edited 10 times in total.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 6:25 pm

Just one more example I wanted to toss out there...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterContainer1Visible]
Meter=Shape
Shape=Rectangle 1,1,200,60 | StrokeWidth 1.5

[MeterContainer2Visible]
Meter=Shape
Shape=Rectangle 1,1,200,60 | StrokeWidth 1.5
X=40R

[MeterContainer1]
Meter=Shape
Shape=Rectangle 1,1,200,60 | StrokeWidth 1.5
LeftMouseUpAction=[!SetOption MeterString Container "MeterContainer2"][!UpdateMeter *][!Redraw]

[MeterContainer2]
Meter=Shape
Shape=Rectangle 1,1,200,60 | StrokeWidth 1.5
X=40R
LeftMouseUpAction=[!SetOption MeterString Container "MeterContainer1"][!UpdateMeter *][!Redraw]

[MeterString]
Meter=String
X=102
Y=32
StringAlign=CenterCenter
FontSize=14
FontWeight=400
FontColor=0,0,0,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Hello World
Container=MeterContainer1
Click to Animate
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 6:39 pm

StArL0rd84 wrote:
November 13th, 2018, 6:23 pm
Christmas came early this year!
I see a lot the wishes of the community came true.
Just tried out the image masking with a shape meter for now.
And yeah, wow...
So powerful but easy to use.
Thank you theAzack9 and Rainmeter team.

EDIT:
Whoops, spoke too soon.
When i add the container line, it sends the skin into a refresh loop.
Not sure if it's actually a refresh loop, but that's what it looks like.
Looks like its trying to load different elements but fails.

Code: Select all

[WnpThumbnailMask]
 Meter=Shape
 X=r
 Y=r
 Shape=Rectangle 5,5,530,298,(#Roundness#-3)
 MeterStyle=BGShapeStyle
 Group=Wnp
[WnpThumbnail]
 Meter=Image
 MeasureName=mWnpThumbnail
 Container=WnpThumbnailMask
 X=5r
 Y=5r
 W=530
 AntiAlias=1
 Hidden=1
 Group=Wnp
Need a small but complete skin .zip or .rmskin that demonstrates this...
User avatar
StArL0rd84
Posts: 271
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Test of new Container option

StArL0rd84 » November 13th, 2018, 6:41 pm

jsmorley wrote:
November 13th, 2018, 6:39 pm
Need a small but complete skin .zip or .rmskin that demonstrates this...
...Figured it out, can't use math in the shape mask meter (#Roundness#-3)
Gotta use whole numbers.

Well now im not sure anymore, lol
Removed the math, worked fine for a few minutes, but then went haywire again.
Will try and make an example skin and see if i can reproduce the error in there for you.
Hang on.
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 7:04 pm

StArL0rd84 wrote:
November 13th, 2018, 6:41 pm
...Figured it out, can't use math in the shape mask meter (#Roundness#-3)
Gotta use whole numbers.

Well now im not sure anymore, lol
Removed the math, worked fine for a few minutes, but then went haywire again.
Will try and make an example skin and see if i can reproduce the error in there for you.
Hang on.
I'm suspicious of the X=r and Y=r in the "container" meter, but we will see.
User avatar
StArL0rd84
Posts: 271
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Test of new Container option

StArL0rd84 » November 13th, 2018, 7:31 pm

Ok, I think iv'e homed in on the symptom / issue.

My skin is menu based where i hide and show meters when i click on the menu.
And it was when i clicked the menu things got weird.

Here's what i learned from the example skin i made:
  • If the mask meter belongs a group that gets hidden, it somehow hides ALL the groups.
  • If the mask meter is hidden to begin with (Hidden=1) ALL elements in the skin are hidden.
No need to pack a skin for you now lol.
In the process of making this post and the example skin i learned NOT to hide the mask.
You even told us that the mask meter wont be drawn so i don't know why i even hid it in the first place. :oops:
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 7:39 pm

StArL0rd84 wrote:
November 13th, 2018, 7:31 pm
Here's what i learned from the example skin i made:
  • If the mask meter belongs a group that gets hidden, it somehow hides ALL the groups.
  • If the mask meter is hidden to begin with (Hidden=1) ALL elements in the skin are hidden.
I'm not sure I fully follow, but don't like the sound of those. Can you still put together something simple that demonstrates?
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 7:43 pm

Never mind, I can replicate the issue. theAzack9 will take a look at it later today.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
OffSet=130
U=[!UpdateMeasure "MeasureSlideInOut"][!UpdateMeter *][!Redraw]

[MeterSkinBack]
Meter=Shape
Shape=Rectangle 0.5,0.5,169,103,12 | Fill Color 47,47,47,255 | StrokeWidth 1.5 | Stroke Color 150,150,150,255
X=0
Y=0
W=170
H=104

[MeterContainerVisible]
Meter=Shape
; A copy of the container meter, to provide visibility
Shape=Rectangle 0,0,130,84,12 | Fill Color 255,47,47,255 | StrokeWidth 0
X=20
Y=10
MouseOverAction=[!ShowMeter MeterContainer]

[MeterContainer]
Meter=Shape
; Meters used as a container will not be drawn. They are used as a "mask".
; Create a copy of them, as above, to make them visible.
Shape=Rectangle 0,0,130,84,12 | Fill Color 255,47,47,255 | StrokeWidth 0
X=r
Y=r
Hidden=1
MouseOverAction=[!CommandMeasure MeasureSlideInOut "Stop 2"][!CommandMeasure MeasureSlideInOut "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureSlideInOut "Stop 1"][!CommandMeasure MeasureSlideInOut "Execute 2"]

[MeterString]
Meter=String
; This meter will be relative to the starting X and Y of its container.
X=#OffSet#
Y=33
FontSize=13
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontWeight=400
AntiAlias=1
Text=Hello World!
DynamicVariables=1
MouseOverAction=[!SetOption MeterString FontColor "0,0,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption MeterString FontColor "255,255,255,255"][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!Log "Clicked me!"]
Container=MeterContainer

[MeasureSlideInOut]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Reset | Wait 1 | Repeat SlideIn, 30, 11
SlideIn=[!SetVariable OffSet "(Clamp(#OffSet#-12,20,130))"]#U#
ActionList2=Repeat SlideOut, 30, 11  | Wait 1 | Reset
SlideOut=[!SetVariable OffSet "(Clamp(#OffSet#-12,-130,20))"]#U#
Reset=[!SetVariable OffSet 130]#U#
IgnoreWarnings=1
DynamicVariables=1

Some strange behavior indeed when the "container" meter is hidden...
User avatar
jsmorley
Developer
Posts: 18445
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

jsmorley » November 13th, 2018, 7:57 pm

BTW, small thing, but we would prefer if we talked about "container" meters and "content" meters when describing this. I'd like to stay away from "mask" as a way of referring to a "container" meter. Yes, content is masked into containers, but that is a verb in a sense, not a noun in this case. Just hoping to keep things as straightforward as possible for new users, and not get confused with MaskImage (which in my view is now entirely deprecated, since it sucks) and the like. I know... I have a couple of places in my example skins where I talk about "mask" more than I should. I'll correct those at some point.