Mercurial > wow > buffalo2
comparison ObjectiveStyle.lua @ 11:fb80e365bab3
ObjectiveStyle & ObjectiveFrame
- abstract aesthetic details away from ObjectiveFrame
- revise SetBlockStyle into a more general algorithm for every frame
- implement caching of resolved attribute combinations
- use loadstring functions to store resolved attributes and call upon those when, for example, a MouseUp leads a tracker block to restore its original style (removes a lot of very small fps dipping)
| author | Nenue |
|---|---|
| date | Sat, 02 Apr 2016 03:23:12 -0400 |
| parents | f03c75f63566 |
| children | 9455693fc290 |
comparison
equal
deleted
inserted
replaced
| 10:f03c75f63566 | 11:fb80e365bab3 |
|---|---|
| 257 | 257 |
| 258 if not style_cache_func[styleName] then | 258 if not style_cache_func[styleName] then |
| 259 local code = | 259 local code = |
| 260 "return function (frame)\n".. | 260 "return function (frame)\n".. |
| 261 " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n".. | 261 " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n".. |
| 262 " local cache = Veneer.ObjectiveTracker.BlockStyleCache" .. | 262 " local cache = Veneer.ObjectiveTracker.BlockStyleCache" |
| 263 " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) " | 263 --.. " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) " |
| 264 | 264 |
| 265 for elementName, styleset in pairs(style) do | 265 for elementName, styleset in pairs(style) do |
| 266 code = code .. | 266 code = code .. |
| 267 "\n if frame['"..elementName.."'] then" | 267 "\n if frame['"..elementName.."'] then" |
| 268 | 268 |
| 270 if mod.SetBlockAttribute[attributeName] then | 270 if mod.SetBlockAttribute[attributeName] then |
| 271 print(' '..elementName..':'.. attributeName ..'(', value, ')') | 271 print(' '..elementName..':'.. attributeName ..'(', value, ')') |
| 272 | 272 |
| 273 | 273 |
| 274 --mod.SetBlockAttribute[attributeName](region, value) | 274 --mod.SetBlockAttribute[attributeName](region, value) |
| 275 code = code .. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])" .. | 275 code = code |
| 276 "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],".. | 276 --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])" |
| 277 .. "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],".. | |
| 277 " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])" | 278 " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])" |
| 278 | 279 |
| 279 --- Set any frame.blah variables used in Updates | 280 --- Set any frame.blah variables used in Updates |
| 280 if block_vars[elementName .. attributeName] then | 281 if block_vars[elementName .. attributeName] then |
| 281 print('|cFF008800BVar|r', elementName..attributeName) | 282 print('|cFF008800BVar|r', elementName..attributeName) |
| 287 | 288 |
| 288 end | 289 end |
| 289 end | 290 end |
| 290 code = code .. | 291 code = code .. |
| 291 "\n else".. | 292 "\n else".. |
| 292 "\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')".. | 293 --"\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')".. |
| 293 "\n end" | 294 "\n end" |
| 294 end | 295 end |
| 295 code = code .. "\nend" | 296 code = code .. "\nend" |
| 296 local result = assert(loadstring(code)) | 297 local result = assert(loadstring(code)) |
| 297 print('storing style func', styleName, result()) | 298 print('storing style func', styleName, result()) |
