Advertisement
Infus

Weakauras patch adding unit's model support

Sep 10th, 2014
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. From 1761c510db2c96251f3629ac44fc32c515871a3f Mon Sep 17 00:00:00 2001
  2. Date: Wed, 10 Sep 2014 23:46:44 +0200
  3. Subject: [PATCH 1/2] Model: Add a checkbox for unit's models
  4.  
  5. ---
  6. WeakAuras/RegionTypes/model.lua | 13 +++++++++++--
  7. WeakAurasOptions/RegionOptions/model.lua | 22 +++++++++++++++-------
  8. 2 files changed, 26 insertions(+), 9 deletions(-)
  9.  
  10. diff --git a/WeakAuras/RegionTypes/model.lua b/WeakAuras/RegionTypes/model.lua
  11. index 325e7f3..0da05e2 100644
  12. --- a/WeakAuras/RegionTypes/model.lua
  13. +++ b/WeakAuras/RegionTypes/model.lua
  14. @@ -4,6 +4,7 @@ local SharedMedia = LibStub("LibSharedMedia-3.0");
  15. -- Default settings
  16. local default = {
  17. model_path = "Creature/Arthaslichking/arthaslichking.m2",
  18. + modelIsUnit = false,
  19. model_x = 0,
  20. model_y = 0,
  21. model_z = 0,
  22. @@ -70,7 +71,11 @@ local function modify(parent, region, data)
  23. if tonumber(data.model_path) then
  24. model:SetDisplayInfo(tonumber(data.model_path))
  25. else
  26. - model:SetModel(data.model_path);
  27. + if (data.modelIsUnit) then
  28. + model:SetUnit(data.model_path)
  29. + else
  30. + model:SetModel(data.model_path);
  31. + end
  32. end
  33. model:SetPosition(data.model_z, data.model_x, data.model_y);
  34.  
  35. @@ -145,7 +150,11 @@ local function modify(parent, region, data)
  36. if tonumber(data.model_path) then
  37. model:SetDisplayInfo(tonumber(data.model_path))
  38. else
  39. - model:SetModel(data.model_path);
  40. + if (data.modelIsUnit) then
  41. + model:SetUnit(data.model_path)
  42. + else
  43. + model:SetModel(data.model_path);
  44. + end
  45. end
  46. -- end
  47. end
  48. diff --git a/WeakAurasOptions/RegionOptions/model.lua b/WeakAurasOptions/RegionOptions/model.lua
  49. index 8f21428..ad19bcd 100644
  50. --- a/WeakAurasOptions/RegionOptions/model.lua
  51. +++ b/WeakAurasOptions/RegionOptions/model.lua
  52. @@ -13,11 +13,10 @@ local function createOptions(id, data)
  53. name = L["Model"],
  54. order = 0
  55. },
  56. - space1 = {
  57. - type = "execute",
  58. - name = "",
  59. - order = 2,
  60. - image = function() return "", 0, 0 end,
  61. + modelIsUnit = {
  62. + type = "toggle",
  63. + name = L["Show model of unit "],
  64. + order = 3
  65. },
  66. space2 = {
  67. type = "execute",
  68. @@ -168,13 +167,21 @@ local function modifyThumbnail(parent, region, data, fullModify, size)
  69. if tonumber(data.model_path) then
  70. model:SetDisplayInfo(tonumber(data.model_path))
  71. else
  72. - model:SetModel(data.model_path);
  73. + if (data.modelIsUnit) then
  74. + model:SetUnit(data.model_path)
  75. + else
  76. + model:SetModel(data.model_path);
  77. + end
  78. end
  79. model:SetScript("OnShow", function()
  80. if tonumber(data.model_path) then
  81. model:SetDisplayInfo(tonumber(data.model_path))
  82. else
  83. - model:SetModel(data.model_path);
  84. + if (data.modelIsUnit) then
  85. + model:SetUnit(data.model_path)
  86. + else
  87. + model:SetModel(data.model_path);
  88. + end
  89. end
  90. end);
  91. model:SetPosition(data.model_z, data.model_x, data.model_y);
  92. @@ -184,6 +191,7 @@ end
  93. local function createIcon()
  94. local data = {
  95. model_path = "Creature/Arthaslichking/arthaslichking.m2",
  96. + modelIsUnit = false,
  97. model_x = 0,
  98. model_y = 0,
  99. model_z = 0.35,
  100. --
  101. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement