It is currently October 13th, 2024, 4:23 pm

Lua Scripting - How to TransformMatrix

Discuss the use of Lua in Script measures.
User avatar
Kurou
Posts: 42
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Lua Scripting - How to TransformMatrix

Post by Kurou »

Hello again, kurou here!

Im back with need of help. Im making some kind of scaling function for my suite and i have problem with TransformMatrix scaling width of the meter.
With this provided code, the skin scale depending on the value from scale variable but it looks kinda like this:

Showcase:
example.gif
I would like to know if i have done something wrong or maybe i forgot something.

Rainmter Code (date.ini):

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
DynamicVariables=1
Group=ashuramaru

;   Background
Background=#@#\images\backgrounds\#background#_blank.png
BackgroundMode=3
BackgroundMargins=0,34,0,10

;   Actions
RightMouseDownAction=[!CommandMeasure "Script" "ConfigActive_Toggle('#ROOTCONFIG#\\control\\context', 'context_menu.ini', '-1')"]

[MetaData]
Name=Date Utility
Information=Skin which is displaying current date information
Author=Kurou

[Variables]

;###################
;   Imports
;###################

;   Variables
@Include_Variables_Customization=#@#\variables\customization.inc
@Include_Variables_Settings=#@#\variables\settings.inc

;   Styles
@Include_Style_String=#@#\styles\strings.inc

;###################
;   Measures
;###################

[Script]
Measure=Script
ScriptFile=#@#\lua\clock.lua

[Measure_TranslucentRM]
Measure=Plugin
Plugin=TranslucentRM
Type=#background_effect#
Border=#background_border#
Taskbar=0
Corner=#background_corner#

[Measure_ConfigActive]
Measure=Plugin
Plugin=ConfigActive

;   Upper

[Measure_Day_Name]
Measure=Time
Format=%A
FormatLocale=en_us

[Measure_Day_Number]
Measure=Time
Format=%d
FormatLocale=en_us

[Measure_Month_Name]
Measure=Time
Format=%b
FormatLocale=en_us

[Measure_Year_Number]
Measure=Time
Format=%Y
FormatLocale=en_us

;   Lower

[Measure_Day_Count]
Measure=Time
Format=%#j
FormatLocale=en_us

[Measure_Week_Count]
Measure=Time
Format=%#V
FormatLocale=en_us

[Measure_Month_Count]
Measure=Time
Format=%#m
FormatLocale=en_us

[Measure_Quarter_Count]
Measure=Calc
Formula=Ceil([Measure_Month_Count] / 3)

;###################
;   Meters
;###################

[Background]
Meter=Shape
Shape=Rectangle 0, 0, 200, 40 | Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0
X=0
Y=0

;   Upper

[Day_Name]
Meter=String
MeasureName=Measure_Day_Name
MeterStyle=Date_Name
StringAlign=Center
X=([Background:W] / 4)
Y=([Background:W] / 20)

[Day_Count]
Meter=String
MeasureName=Measure_Day_Number
MeterStyle=Date_Count
X=([Background:W] / 1.8)
Y=0r

[Month_Name]
Meter=String
MeasureName=Measure_Month_Name
MeterStyle=Date_Name
X=([Background:W] / 1.6)
Y=0r

[Year_Count]
Meter=String
MeasureName=Measure_Year_Number
MeterStyle=Date_Count
X=([Background:W] - 10)
Y=0r

;   Seperator

[Seperator]
Meter=Image
SolidColor=100, 100, 100, 170
W=([Background:W] - 10)
H=2
X=5
Y=20r

;   Lower

[Day_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Day:
X=10
Y=10r

[Day_Count_Value]
Meter=String
MeasureName=Measure_Day_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=25R
Y=0r

[Week_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
StringAlign=Center
Text=Week:
X=([Background:W] / 2.5)
Y=0r

[Week_Count_Value]
Meter=String
MeasureName=Measure_Week_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=10R
Y=0r

[Quarter_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Quarter:
X=([Background:W] - 70)
Y=0r

[Quarter_Count_Value]
Meter=String
MeasureName=Measure_Quarter_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=([Background:W] - 10)
Y=0r
Lua Code:

Code: Select all

--  Scale Function
function Scale()
    --  Local variable
    local scale = customization["scale"]

    --  Check for scale
    if scale > "1" then
        if names["file"] == "clock.ini" then
            --  Obtain values
            local meter = SKIN:GetMeter('Background')
            local scale_w = meter:GetW() * scale
            local scale_h = meter:GetH() * scale

            --  Transform Backgrund
            SKIN:Bang("!SetOption", "Background", "Shape", "Rectangle 0,0,"..scale_w..","..scale_h.."| Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0")
            
            --  Set scale
            SKIN:Bang("!SetOption", "Time", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Am_Pm", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
        end

        if names["file"] == "date.ini" then
            --  Obtain values
            local meter = SKIN:GetMeter('Background')
            local scale_w = meter:GetW() * scale
            local scale_h = meter:GetH() * scale

            --  Transform Backgrund
            SKIN:Bang("!SetOption", "Background", "Shape", "Rectangle 0,0,"..scale_w..","..scale_h.."| Fill Color 0, 0, 0, 0 | StrokeWidth 0 | Stroke Color 0,0,0")

            --  Set scale
            SKIN:Bang("!SetOption", "Day_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Day_Count", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Month_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Year_Count", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Seperator", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Day_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Day_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Week_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Week_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Quarter_Count_Name", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
            SKIN:Bang("!SetOption", "Quarter_Count_Value", "TransformationMatrix", scale..";0;0;"..scale..";"..scale..";"..scale)
        end

        --  Redraw
        SKIN:Bang("!Redraw")
    end
end
Lua Code (clock.lua):

Code: Select all

function Initialize()
    --  Include toolkit
    dofile(SKIN:GetVariable('@')..'lua\\toolkit.lua')

    --  Define variables arrey
    settings = {}
    customization = {}

    --  Obtain rainmeter variables
    ObtainDefaultVariables()

    --  Convert variables
    ConvertVariablesList('variables\\settings.inc' ,settings)
    ConvertVariablesList('variables\\customization.inc' ,customization)

    --  Change format
    Change_Format()
    Scale()
end

function Update()
    
end

--  Change time format
function Change_Format()
    if settings["clock_format"] == "24" then
        SKIN:Bang("!SetOption", "Time", "Text", "%1")
        SKIN:Bang("!SetOption", "Time", "X", "([Background:W] / 2)")
        SKIN:Bang("!SetOption", "Am_Pm", "Hidden", "1")
    elseif settings["clock_format"] == "12" then
        SKIN:Bang("!SetOption", "Time", "Text", "%2")
        SKIN:Bang("!SetOption", "Time", "X", "5r")
        SKIN:Bang("!SetOption", "Am_Pm", "Hidden", "0")
    end
    SKIN:Bang("!Redraw", names["root"].."\\skins\\clock", "clock.ini")
end
You do not have the required permissions to view the files attached to this post.
Last edited by Kurou on June 26th, 2023, 10:21 am, edited 1 time in total.
Brought to you by: https://kurou.dev/
User avatar
SilverAzide
Rainmeter Sage
Posts: 2746
Joined: March 23rd, 2015, 5:26 pm

Re: Lua Scripting - How to TransformMatrix

Post by SilverAzide »

Kurou wrote: June 23rd, 2023, 1:44 pm
I didn't look at your code, but why are you doing this with Lua? Lua is completely unnecessary for doing simple scaling.

Just add the TranformationMatix to each meter or as part of a separate style...

Code: Select all

TransformationMatrix=#scale#;0;0;#scale#;#scale#;#scale#
If your skin is fairly simple (i.e., you don't need very precise placement and/or font scaling), you can simply multiply all your X/Y/W/H and font size values in your meters by your scaling factor, eliminating the need for TransformationMatrix altogether.
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 8443
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Lua Scripting - How to TransformMatrix

Post by Yincognito »

Kurou wrote: June 23rd, 2023, 1:44 pm Hello again, kurou here!

Im back with need of help. Im making some kind of scaling function for my suite and i have problem with TransformMatrix scaling width of the meter.
With this provided code, the skin scale depending on the value from scale variable but it looks kinda like this
Apart from what SilverAzide mentioned regarding Lua (which I've been telling you as well in another thread, but that's beside the point), the issue with your code here is that, strictly in terms of positioning, you're scaling twice: once when you're setting the positions based on the (already scaled beforehand) background's width, and the second time when applying the TransformationMatrix (TM).

In other words, if you search and replace all occurrences of [Background:W] in your .ini with, say, 200, then apply a TM of (#Scale#);(0);(0);(#Scale#);(0);(0) (not sure why you're also moving in the last two parameters of TM in your code, I doubt that's necessary here), you'll find out that it works (this is a rudimentary plain Rainmeter code accounting for the code you left out regarding styles, didn't bother to make it perfect):

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
DynamicVariables=1
Group=ashuramaru

;   Background
;Background=#@#\images\backgrounds\#background#_blank.png
;BackgroundMode=3
;BackgroundMargins=0,34,0,10

;   Actions
;RightMouseDownAction=[!CommandMeasure "Script" "ConfigActive_Toggle('#ROOTCONFIG#\\control\\context', 'context_menu.ini', '-1')"]

[MetaData]
Name=Date Utility
Information=Skin which is displaying current date information
Author=Kurou

[Variables]

;###################
;   Imports
;###################

;   Variables
@Include_Variables_Customization=#@#\variables\customization.inc
@Include_Variables_Settings=#@#\variables\settings.inc

;   Styles
@Include_Style_String=#@#\styles\strings.inc

Scale=2.00
W=200
H=60

;###################
;   Measures
;###################

[Script]
Measure=Script
ScriptFile=#@#\lua\clock.lua

[Measure_TranslucentRM]
Measure=Plugin
Plugin=TranslucentRM
Type=#background_effect#
Border=#background_border#
Taskbar=0
Corner=#background_corner#

[Measure_ConfigActive]
Measure=Plugin
Plugin=ConfigActive

;   Upper

[Measure_Day_Name]
Measure=Time
Format=%A
FormatLocale=en_us

[Measure_Day_Number]
Measure=Time
Format=%d
FormatLocale=en_us

[Measure_Month_Name]
Measure=Time
Format=%b
FormatLocale=en_us

[Measure_Year_Number]
Measure=Time
Format=%Y
FormatLocale=en_us

;   Lower

[Measure_Day_Count]
Measure=Time
Format=%#j
FormatLocale=en_us

[Measure_Week_Count]
Measure=Time
Format=%#V
FormatLocale=en_us

[Measure_Month_Count]
Measure=Time
Format=%#m
FormatLocale=en_us

[Measure_Quarter_Count]
Measure=Calc
Formula=Ceil([Measure_Month_Count] / 3)

;###################
;   Styles
;###################

[Date_Name]
Group=Meters
FontColor=255,255,255,255
FontSize=10
FontWeight=700
StringAlign=Left
StringCase=Upper
AntiAlias=1
DynamicVariables=1

[Date_Count]
Group=Meters
FontColor=255,0,0,255
FontSize=10
FontWeight=700
StringAlign=Right
StringCase=None
AntiAlias=1
DynamicVariables=1

;###################
;   Meters
;###################

[Background]
Meter=Shape
Shape=Rectangle 0, 0, #W#, #H#, 6 | Fill Color 64, 64, 64, 255 | StrokeWidth 0 | Stroke Color 0,0,0
X=0
Y=0
LeftMouseDownAction=[!SetVariable W (#W#*#Scale#)][!SetVariable H (#H#*#Scale#)][!SetOptionGroup Meters TransformationMatrix "(#Scale#);(0);(0);(#Scale#);(0);(0)"][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!SetVariable W (#W#/#Scale#)][!SetVariable H (#H#/#Scale#)][!SetOptionGroup Meters TransformationMatrix "1;0;0;1;0;0"][!UpdateMeter *][!Redraw]
DynamicVariables=1

;   Upper

[Day_Name]
Meter=String
MeasureName=Measure_Day_Name
MeterStyle=Date_Name
StringAlign=Center
X=(200 / 4)
Y=(200 / 20)

[Day_Count]
Meter=String
MeasureName=Measure_Day_Number
MeterStyle=Date_Count
X=(200 / 1.8)
Y=0r

[Month_Name]
Meter=String
MeasureName=Measure_Month_Name
MeterStyle=Date_Name
X=(200 / 1.6)
Y=0r

[Year_Count]
Meter=String
MeasureName=Measure_Year_Number
MeterStyle=Date_Count
X=(200 - 10)
Y=0r

;   Seperator

[Seperator]
Group=Meters
Meter=Image
SolidColor=100, 100, 100, 170
W=(200 - 10)
H=2
X=5
Y=20r

;   Lower

[Day_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Day:
X=10
Y=10r

[Day_Count_Value]
Meter=String
MeasureName=Measure_Day_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=25R
Y=0r

[Week_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
StringAlign=Center
Text=Week:
X=(200 / 2.5)
Y=0r

[Week_Count_Value]
Meter=String
MeasureName=Measure_Week_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=10R
Y=0r

[Quarter_Count_Name]
Meter=String
MeterStyle=Date_Name
StringCase=None
FontSize=9
Text=Quarter:
X=(200 - 70)
Y=0r

[Quarter_Count_Value]
Meter=String
MeasureName=Measure_Quarter_Count
MeterStyle=Date_Count
StringCase=None
FontSize=9
X=(200 - 10)
Y=0r
Hold left click down to see scaling in action, release it to revert to normal.

P.S. By the way, you are aware of the drawbacks of TM when it comes to mouse detection, aren't you? Excerpt from the manual:
Also note that the even if the meter's visual location and orientation is changed by the transformation the place where it would be located without the transformation will still be used to define the window size and register the mouse clicks. This might change in the future though.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Kurou
Posts: 42
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Re: Lua Scripting - How to TransformMatrix

Post by Kurou »

SilverAzide wrote: June 23rd, 2023, 8:32 pm I didn't look at your code, but why are you doing this with Lua? Lua is completely unnecessary for doing simple scaling.
Yes it is unnecessary but i want to do it anyway. (i know its stupid but :))
SilverAzide wrote: June 23rd, 2023, 8:32 pm Just add the TranformationMatix to each meter or as part of a separate style...
I will check it.
SilverAzide wrote: June 23rd, 2023, 8:32 pm If your skin is fairly simple (i.e., you don't need very precise placement and/or font scaling), you can simply multiply all your X/Y/W/H and font size values in your meters by your scaling factor, eliminating the need for TransformationMatrix altogether.
Im too lazy to go through all the skins and meters to do that.
Brought to you by: https://kurou.dev/
User avatar
Kurou
Posts: 42
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Re: Lua Scripting - How to TransformMatrix

Post by Kurou »

Yincognito wrote: June 23rd, 2023, 9:23 pm P.S. By the way, you are aware of the drawbacks of TM when it comes to mouse detection, aren't you? Excerpt from the manual:
Yes im aware of that but skins i want to scale doesnt include mouse actions.
Yincognito wrote: June 23rd, 2023, 9:23 pm Apart from what SilverAzide mentioned regarding Lua (which I've been telling you as well in another thread, but that's beside the point), the issue with your code here is that, strictly in terms of positioning, you're scaling twice: once when you're setting the positions based on the (already scaled beforehand) background's width, and the second time when applying the TransformationMatrix (TM).
If i wont scale meters too their size wont change. Background:W is only used for positioning.
Yincognito wrote: June 23rd, 2023, 9:23 pm In other words, if you search and replace all occurrences of [Background:W] in your .ini with, say, 200, then apply a TM of (#Scale#);(0);(0);(#Scale#);(0);(0)
I would like to preserve those [Background:W] becouse itself its 200 or other value. This meter width vary in my skins in this suite.

Yincognito wrote: June 23rd, 2023, 9:23 pm (not sure why you're also moving in the last two parameters of TM in your code, I doubt that's necessary here)
I havent understood TransformMatrix entirely so i used example code i had found and tinkered with it.
Yincognito wrote: June 23rd, 2023, 9:23 pm

Code: Select all

[Day_Name]
Meter=String
MeasureName=Measure_Day_Name
MeterStyle=Date_Name
StringAlign=Center
X=(200 / 4)
Y=(200 / 20)
This change from [Background:W] to 200 isn't just doing the same? [Background:W] is 200 itself, right?
Brought to you by: https://kurou.dev/
User avatar
Yincognito
Rainmeter Sage
Posts: 8443
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Lua Scripting - How to TransformMatrix

Post by Yincognito »

Kurou wrote: June 24th, 2023, 2:52 pm This change from [Background:W] to 200 isn't just doing the same? [Background:W] is 200 itself, right?
Yes. The difference is that the 200 value is static (i.e. it doesn't change the position of other meters when the background is scaled), so only the TM scaling of positioning is applied (i.e. a single scaling), thus making the result correct.
Kurou wrote: June 24th, 2023, 2:52 pm If i wont scale meters too their size wont change. Background:W is only used for positioning.
I would like to preserve those [Background:W] becouse itself its 200 or other value. This meter width vary in my skins in this suite.
I havent understood TransformMatrix entirely so i used example code i had found and tinkered with it.
If you didn't understand TM entirely, then you'll find it difficult to work with - it's not a walk in the park. I understand that you want to have both [Background:W] and scaling with TM, but it doesn't work that way. Using [Background:W] (which is independently scaled by your code) scales your other meters' positioning, and when doing the TM scaling, the positioning of those meters is scaled AGAIN. For example:
- you start with [Background:W] of 200 and you want to scale it to twice that size
- when you apply your code to enlarge the background, the [Background:W] becomes 400
- because of the above, a meter that is positioned at half that width is now positioned at 200 (i.e. the value you want)
- then, when you apply the TM on the above meter, it will use the position of 200 as a base, instead of the original 100, and will scale it again, to 400 (i.e. not what you want)
This is why you got the meter positions wrong with your code. Normally, if you had a similar, consistent meter positioning in your skin, you could just scale to 1 horizontally in the TM (or even use the move parameters of the TM) in order to not repeat the positioning scaling in the formulas, but you can't: some meters use the height of the background, some use subtraction instead of multiplication in relation to the background, and so on, making impossible to apply an uniform TM to all of them.

Bottom line, you should use either similar background based formulas to position your meters and move them back accordingly in the TM (the TM formulas for movex and movey won't be simple), OR don't use those the dynamic [Background:W] and [Background:H] for the meter positioning and let the TM handle it - you can't have both. By the way, not using those dynamic background dimensions in positioning doesn't mean that you can't set different meter widths or formulas in other skins from your suite, it simply means that the redundant positioning of meters based on already scaled values (like the background dimensions) will be avoided and TM will use the original positions to do its own, single scaling on them.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Kurou
Posts: 42
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Re: Lua Scripting - How to TransformMatrix

Post by Kurou »

Yincognito wrote: June 24th, 2023, 6:11 pm Yes. The difference is that the 200 value is static (i.e. it doesn't change the position of other meters when the background is scaled), so only the TM scaling of positioning is applied (i.e. a single scaling), thus making the result correct.


If you didn't understand TM entirely, then you'll find it difficult to work with - it's not a walk in the park. I understand that you want to have both [Background:W] and scaling with TM, but it doesn't work that way. Using [Background:W] (which is independently scaled by your code) scales your other meters' positioning, and when doing the TM scaling, the positioning of those meters is scaled AGAIN. For example:
- you start with [Background:W] of 200 and you want to scale it to twice that size
- when you apply your code to enlarge the background, the [Background:W] becomes 400
- because of the above, a meter that is positioned at half that width is now positioned at 200 (i.e. the value you want)
- then, when you apply the TM on the above meter, it will use the position of 200 as a base, instead of the original 100, and will scale it again, to 400 (i.e. not what you want)
This is why you got the meter positions wrong with your code. Normally, if you had a similar, consistent meter positioning in your skin, you could just scale to 1 horizontally in the TM (or even use the move parameters of the TM) in order to not repeat the positioning scaling in the formulas, but you can't: some meters use the height of the background, some use subtraction instead of multiplication in relation to the background, and so on, making impossible to apply an uniform TM to all of them.

Bottom line, you should use either similar background based formulas to position your meters and move them back accordingly in the TM (the TM formulas for movex and movey won't be simple), OR don't use those the dynamic [Background:W] and [Background:H] for the meter positioning and let the TM handle it - you can't have both. By the way, not using those dynamic background dimensions in positioning doesn't mean that you can't set different meter widths or formulas in other skins from your suite, it simply means that the redundant positioning of meters based on already scaled values (like the background dimensions) will be avoided and TM will use the original positions to do its own, single scaling on them.
I get it now. So in order to get this scaling to work i need to change every occurance of [Background] to its static value like [Background:W] to 200.

Thanks for help, i will tinker with it and get back if i encounter another problem with it. If not then i will mark thread as done :)
Brought to you by: https://kurou.dev/
User avatar
Yincognito
Rainmeter Sage
Posts: 8443
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Lua Scripting - How to TransformMatrix

Post by Yincognito »

Kurou wrote: June 25th, 2023, 11:52 am I get it now. So in order to get this scaling to work i need to change every occurance of [Background] to its static value like [Background:W] to 200.

Thanks for help, i will tinker with it and get back if i encounter another problem with it. If not then i will mark thread as done :)
Yep. If you want to make it easier for other skin scenarios, you could just use a width variable that you set to the desired static value, in various skins. What's important is to not use already scaled values in the meters where you apply the TM, so that only one scaling (the latter) is performed on positions.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Kurou
Posts: 42
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Re: Lua Scripting - How to TransformMatrix

Post by Kurou »

Yincognito wrote: June 25th, 2023, 12:12 pm Yep. If you want to make it easier for other skin scenarios, you could just use a width variable that you set to the desired static value, in various skins. What's important is to not use already scaled values in the meters where you apply the TM, so that only one scaling (the latter) is performed on positions.
Im back with another question. My main skin of the suite statistics doesnt have static height but rather depends on the meters inside it. if some statistic is not wanted its being hidden and moved up a bit. When i use scale the height of the skin is the same. Can i for example multiple overall skin height by scale var?

Showcase:
example.gif
example~2.gif
You do not have the required permissions to view the files attached to this post.
Brought to you by: https://kurou.dev/
User avatar
Yincognito
Rainmeter Sage
Posts: 8443
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Lua Scripting - How to TransformMatrix

Post by Yincognito »

Kurou wrote: June 25th, 2023, 12:49 pm Im back with another question. My main skin of the suite statistics doesnt have static height but rather depends on the meters inside it. if some statistic is not wanted its being hidden and moved up a bit. When i use scale the height of the skin is the same. Can i for example multiple overall skin height by scale var?

Showcase:
example.gifexample~2.gif
I'm not familiar with how the actual code looks like, but I don't think there's a need to multiply the skin height by the scale variable, since the TM already does that and you'll end up having the same issue. There is no problem if your skin doesn't have a static value in relation to its contents, the TM scaling works the same regardless. The key is to not have the meter positioning based on an already scaled value.

So, when I said "static" I meant "not scaled". This means that you can use a dynamic dimension (like the one based on the contents), as long as it's not dynamic because of scaling (like the one you get by using already scaled [Background:WH] as factors in positioning). To produce the correct results, the TM expects the values it works with to be unscaled (or original), irrespective if they are dynamic due to some other reason besides scaling.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth