Yincognito wrote: ↑September 11th, 2020, 3:08 pm
Normally, if the meters were Shapes, things would have been easier, I think, since one can use radial gradients there, like I mentioned in my previous reply to balala. However, since the meters are Roundlines and only a single "normal" color can be specified in
its LineColor option, not to mention we deal with Lua here which automatically writes to the .inc files, we must use only the tools that we have at our disposal.
First, make a backup of your current settings in VisBubble, as we're going to modify some files.
Next, paste this into your
Factory.lua script, replacing its contents:
Code: Select all
-- @author Malody Hoe / GitHub: undefinist / Twitter: undefinist
-- Structure of Script Measure:
---- IncFile=
---- Number=
---- SectionName=
---- OptionN=
---- ValueN=
---- where N is an ordered number from 0
-- Use %% to substitute it as the iteration number (which is specified by the Number option)
---- For example, if you specify 10, it will create 10 sections and replace the first section's %%
---- with 0, the second section's %% with 1, etc...
-- Wrap any formulas you want to parse in {} that otherwise RM would treat as a string
---- For example, [Measure{%%+1}] will have this script parse it for you
function Initialize()
local num = SELF:GetNumberOption("Number")
local GsectionName = SELF:GetOption("GSectionName")
local sectionName = SELF:GetOption("SectionName")
local file = io.open(SKIN:MakePathAbsolute(SELF:GetOption("IncFile")), "w")
local t = { "; auto-generated by " .. SELF:GetName() }
for i = 0, num-1 do
table.insert(t, "[" .. doSub(GsectionName, i) .. "]")
local j = 0
while true do
local opt = SELF:GetOption("GOption" .. j)
if opt == "" then
break
end
table.insert(t, opt .. "=" .. doSub(SELF:GetOption("GValue" .. j), i))
j = j + 1
end
table.insert(t, "[" .. doSub(sectionName, i) .. "]")
local j = 0
while true do
local opt = SELF:GetOption("Option" .. j)
if opt == "" then
break
end
table.insert(t, opt .. "=" .. doSub(SELF:GetOption("Value" .. j), i))
j = j + 1
end
end
file:write(table.concat(t, "\n"))
file:close()
end
-- does all the substitution!
function doSub(value, i)
return value:gsub("%%%%", i):gsub("{.-}", parseFormula)
end
-- sub to remove {the curly braces}, then add (parentheses), then parse it
function parseFormula(formula)
return SKIN:ParseFormula("(" .. formula:sub(2, -2) .. ")")
end
This allows specifying 2 sets of
[Section] and
Key=Value parts that
Factory.lua will write into your
Lines.inc file, instead of just one. Therefore, we're now able to create some sort of a "duplicate" Roundline meter for each normal meter in
Lines.inc - and those duplicates, starting with "G" (from "glow") are going to be our glow simulation.
Next, paste the following into your
BarExtrude.ini, replacing its contents:
Code: Select all
[Metadata]
Name=VisBubble
Author=undefinist
Version=3.1
License=CC BY-NC-SA 3.0
Information=The default | Double-click for settings.
[Rainmeter]
Update=25
ContextTitle=SETTINGS (double-click)
ContextAction=[!ActivateConfig "#ROOTCONFIG#\SettingsWindow"]
ContextTitle2=SETTINGS FILE
ContextAction2=["#ROOTCONFIGPATH#Settings.inc"]
[Variables]
@Include=Settings.inc
FORMULA_SUM=([mBand%%]+(#Smoothing#=0?0:(%%={#NumOfItems#-1}?0:[mBand{(%%+1)%#NumOfItems#}])+(%%=0?0:[mBand{%%=0?#NumOfItems#-1:%%-1}])))
FORMULA_SUM_FULL=([mBand%%]+(#Smoothing#=0?0:[mBand{(%%+1)%#NumOfItems#}]+[mBand{%%=0?#NumOfItems#-1:%%-1}]))
FORMULA_AVG_NUM=((%%={#NumOfItems#-1}||%%=0)?2:3)
FORMULA_AVG_NUM_FULL=3
FORMULA_AVG=#FORMULA_SUM_FULL#/#FORMULA_AVG_NUM_FULL#
FORMULA_THETA=(#AngleTotal#-#AngleTotal#/#NumOfItems#*(#ClockWise#=0?%%:#NumOfItems#-%%-1)+#AngleStart#)
@Include2=#INC#Common.inc
GlowColor=0,0,0,0
[mFullCircle]
Measure=Calc
IfCondition=#AngleTotal# >= PI * 2
IfTrueAction=[!WriteKeyValue Variables FORMULA_AVG "#*FORMULA_SUM_FULL*#/#*FORMULA_AVG_NUM_FULL*#"]
IfFalseAction=[!WriteKeyValue Variables FORMULA_AVG "#*FORMULA_SUM*#/#*FORMULA_AVG_NUM*#"]
UpdateDivider=-1
[mGlowColor]
Measure=String
String=#ItemColor#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(\d+)$":"32"
OnUpdateAction=[!SetVariable GlowColor "[mGlowColor]"]
DynamicVariables=1
;=
; base measures
;============================
[mAudioOut]
Bands=(#NumOfItems#+4)
;=
; meterstyles
;============================
[styleGlow]
LineColor=#GlowColor#
LineWidth=(#ItemWidth#*3)
RotationAngle=(#Inward#*PI)
ControlAngle=0
AntiAlias=1
DynamicVariables=1
[styleLine]
LineColor=#ItemColor#
LineWidth=(#ItemWidth#/2)
RotationAngle=(#Inward#*PI)
ControlAngle=0
AntiAlias=1
DynamicVariables=1
;=
; meters + scripts + includes
;============================
[sFactoryBandMeasures]
Measure=Script
ScriptFile=#SCRIPT#Factory.lua
IncFile=#INC#BandMeasures.inc
Number=#NumOfItems#
SectionName=mBand%%
Option0=Measure
Value0=Plugin
Option1=Plugin
Value1=AudioLevel
Option2=Parent
Value2=mAudioOut
Option3=Type
Value3=Band
Option4=BandIdx
Value4={%%+1}
UpdateDivider=-1
@Include=#INC#BandMeasures.inc
[sFactoryBars]
Measure=Script
ScriptFile=#SCRIPT#Factory.lua
IncFile=#INC#Lines.inc
Number=#NumOfItems#
SectionName=%%
Option0=Meter
Value0=Roundline
Option1=MeterStyle
Value1=styleLine
Option2=StartAngle
Value2={#FORMULA_THETA#}
Option3=X
Value3={#Radius#*Cos(#FORMULA_THETA#%(PI*2))+#Radius#+#ExtrudeMax#}
Option4=Y
Value4={#RadiusY#*Sin(#FORMULA_THETA#%(PI*2))+#RadiusY#+#ExtrudeMax#}
Option5=LineLength
Value5=((#FORMULA_AVG#=0)?{#ExtrudeMin#=0?-1:#ExtrudeMin#}:((#FORMULA_AVG#-[mBand%%])*{#Smoothing#}+[mBand%%])*{#ExtrudeMax#-#ExtrudeMin#}+#ExtrudeMin#)
Option6=DynamicVariables
Value6=1
GSectionName=G%%
GOption0=Meter
GValue0=Roundline
GOption1=MeterStyle
GValue1=styleGlow
GOption2=StartAngle
GValue2={#FORMULA_THETA#}
GOption3=X
GValue3={#Radius#*Cos(#FORMULA_THETA#%(PI*2))+#Radius#+#ExtrudeMax#}
GOption4=Y
GValue4={#RadiusY#*Sin(#FORMULA_THETA#%(PI*2))+#RadiusY#+#ExtrudeMax#}
GOption5=LineLength
GValue5=((#FORMULA_AVG#=0)?{#ExtrudeMin#=0?-1:#ExtrudeMin#}:((#FORMULA_AVG#-[mBand%%])*{#Smoothing#}+[mBand%%])*{#ExtrudeMax#-#ExtrudeMin#}+#ExtrudeMin#)
GOption6=DynamicVariables
GValue6=1
UpdateDivider=-1
@Include=#INC#Lines.inc
; Helper script to always refresh skin twice instead of once
; This is so that it loads the updated .inc files
[sRefresher]
Measure=Script
ScriptFile=#SCRIPT#Refresher.lua
UpdateDivider=-1
Refreshed=0
[sColor]
Measure=Script
ScriptFile=#SCRIPT#Color.lua
UpdateDivider=-1
NumOfItems=#NumOfItems#
Color=#ItemColor#
;C4FB7200:0|C4FB72cc:30|85ECF099:60|85ECF099:80|85ECF000
This modifies the Alpha value (i.e. the adjustable transparency, currently being set to
32 in
[mGlowColor]) of
#ItemColor# and stores the result into the
#GlowColor# variable. A new style named
[styleGlow] is created to apply it to the future "glow Roundline meters", where, beside the use of
#GlowColor#, the
LineWidth of the Roundline is increased by a factor of 3. Finally, the glow meters are created by adding the "G....." options to
[sFactoryBars], taking advantage of the fact that we modified the
Factory.lua script beforehand to write another meter before each original one.
This doesn't look as good as a gradient glow, but it's a start - if anyone else has a better idea on how to do this, feel free to share your thoughts.