Git Product home page Git Product logo

viragdevtool's Introduction

This addon should work after small fixes, but i don't have time to maintain it.

So you can use brittyazel maintained version/fork/rewrite DevTool, Curseforge , Wago.


ViragDevTool Info

ViragDevTool is Lua World of Warcraft addon for addon-developers. Functionality is similar to a debugger.

This addon can help new developers to understand WoW API. Main idea is to examine WoW API or your addon's variables in table-like UI. Much easier to use then default print or chat debug

Curse download page

Video Demo

How To Use

Main (and the only) function you can use is ViragDevTool_AddData(data, "some string name"):

--- Adds data to ViragDevTool UI list to monitor
-- @param data (any type)- is object you would like to track. 
-- Default behavior is reference and not object copy
-- @param dataName (string or nil) - name tag to show in UI for you variable. 
-- Main purpose is to give readable names to objects you want to track.
function ViragDevTool_AddData(data, dataName)
 ...
end

ViragDevTool demo

Lets suppose you have MyModFN function in yours addon

function MyModFN()
    local var = {}
    ... some code here
    ViragDevTool_AddData(var, "My local var in MyModFN")
end

This will add var as new row in ViragDevTool UI HybridScrollFrameTemplate list

For example

ViragDevTool_AddData(_G, "_G")

Output:

ViragDevTool Global vars demo

Id(Row in list) Type Data Name Data Value

Here is how i use ViragDevTool_AddData:

--define print fn so we can easily turn it off 
function MyOtherAddon_Print(strName, tData) 
    if ViragDevTool_AddData and MyOtherAddon.kbDEBUG then 
        ViragDevTool_AddData(tData, strName) 
    end
end

-- use this function all over my code instead of print
MyOtherAddon_Print("MyOtherAddon", MyOtherAddon) -- sends object to UI

How to use sidebar:

There are 3 tabs in sidebar and text field has different behavior in each tab.

  • In \vdt history tab it is just easy way to call /vdt ... for example you can print find Virag and it is the same as printing /vdt find Virag in chat

  • In Events tab textfield can only use eventname or eventname unit and this is the same as /vdt eventadd eventname or /vdt eventadd unit where eventname is Blizzard API event(http://wowwiki.wikia.com/wiki/Events_A-Z_(Full_List)) string name For example: UNIT_AURA player in textbox is the same as /vdt eventadd UNIT_AURA player in chat

if unit then f:RegisterUnitEvent(event, unit)
else f:RegisterEvent(event) end

ViragDevTool events demo

  • In Fn Call Log tab you can type tableName functionName into textfield and it will try to find _G.tableName.functionName and if this field is a function it will be replaced with logger function like this:
tParent[fnName] = function(...)
   ViragDevTool:Add({ ... }) -- will add args to the list
   local result = { savedOldFn(...) }
   ViragDevTool:Add(result) -- will add return value to the list
   return unpack(result)
end

ViragDevTool logger demo

How to use function arguments:

You can specify coma separated arguments that will be passed to the function. Can be string, number, nil, true/false and table to pass table you have to specify prefix t= so lets suppose i want to pass ViragDevToolFrame as a argument, then the string has to be t=ViragDevToolFrame

Demo1: FN Call Args: t=Frame, 12, a12 => someFunction(_G.Frame (table) , 12 (number), a12 (string)) Demo2: FN Call Args: t=Frame.Frame2.Frame3 => someFunction(_G.Frame.Frame2.Frame3 (table))

/CMD

  • /vdt - toggle ui
  • /vdt help - for everything else

Other functionality

  • Clicking on table name will expand and show its children

  • Clicking on function name will try to call the function. WARNING BE CAREFUL

  • If table has WoW API GetObjectType() then its type will be visible in value column

  • Can monitor WoW API events

  • Can log function calls: their input args and return values

  • Note: Strings in value column have no line brakes

TODO list:

ViragDevTool is in beta so there is lots of stuff to add and tune.

  1. Create dynamic text color and size chooser (probably not everyone likes SystemFont_Small)
  2. Add filters by object name and type

Not important:

  • Add predefined buttons for every WoW API (just like _G)
  • Add function args info and description from mapping file
  • Add object deep copy option

How to contribute

For now this addon will be updated only when i need certain feature in my other addon's development

Preferred option is to use Github issue tracker if you have some todos, bugs, feature requests, and more. https://github.com/varren/ViragDevTool/issues

Can also use Curse comments board http://mods.curse.com/addons/wow/varrendevtool

Inspired by Rover addon from Wildstar http://mods.curse.com/ws-addons/wildstar/220043-rover

ViragDevTool is Rover for WoW

viragdevtool's People

Contributors

varren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

viragdevtool's Issues

VDT does not capture COMBAT_LOG_EVENT_UNFILTERED args in 8.0.

Blizzard added a necessary function call to retrieve combat log args when COMBAT_LOG_EVENT_UNFILTERED fires: CombatLogGetCurrentEventInfo()

Here's a potential fix (Modules/ViragDevToolEvents.lua line 75):

function cleuHelper( args, ... )
    for i = 1, select( "#", ... ) do
        args[i+1] = select( i, ... )
    end
end


function ViragDevTool:SetMonitorEventScript()
    local f = self:GetListenerFrame()

    f:SetScript("OnEvent", function(this, ...)
        local args = { ... }
        local event = args[1]
		
        local showAllEvents = ViragDevTool:GetMonitoredEvent("ALL")
        if ViragDevTool:GetMonitoredEvent(event) or (showAllEvents and showAllEvents.active) then
            if event == 'COMBAT_LOG_EVENT_UNFILTERED' then cleuHelper( args, CombatLogGetCurrentEventInfo() ) end
            if #args == 1 then args = args[1] end
            ViragDevTool:Add(args, date("%X") .. " " .. event)
        end
    end);
end

nil value in DragResizeColumn

When I tried to resize the columns in the main table I ended up with an unusable column width, a non-interactive width adjustment button, and about 10 of the same lua error every second any time the window is open.

5886x ViragDevTool\ViragDevTool-0.22.lua:530: attempt to perform arithmetic on a nil value
[string "@ViragDevTool\ViragDevTool-0.22.lua"]:530: in function `DragResizeColumn'
[string "*:OnUpdate"]:3: in function <[string "*:OnUpdate"]:1>

Locals:
self = <table> {
 LoadInterfaceOptions = <function> defined @ViragDevTool\ViragDevToolOptions.lua:8
 UIUpdateMainTableButton = <function> defined @ViragDevTool\ViragDevTool.lua:652
 CalculatePosition = <function> defined @ViragDevTool\ViragDevTool.lua:550
 tablelength = <function> defined @ViragDevTool\ViragDevTool.lua:1185
 ToggleFnLogger = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:97
 waitFrame = ViragDevToolWaitFrame {
 }
 list = <table> {
 }
 ProcessCallFunctionData = <function> defined @ViragDevTool\ViragDevTool.lua:971
 ToggleMonitorEvent = <function> defined @ViragDevTool\Modules/ViragDevToolEvents.lua:65
 UpdateUI = <function> defined @ViragDevTool\ViragDevTool.lua:472
 ToUIString = <function> defined @ViragDevTool\ViragDevTool.lua:673
 UpdateScrollFrameRowSize = <function> defined @ViragDevTool\ViragDevTool.lua:601
 StartMonitorEvent = <function> defined @ViragDevTool\Modules/ViragDevToolEvents.lua:13
 ForceUpdateMainTableUI = <function> defined @ViragDevTool\ViragDevTool.lua:559
 GetParentTable = <function> defined @ViragDevTool\ViragDevTool.lua:945
 ToggleSidebar = <function> defined @ViragDevTool\ViragDevTool.lua:770
 SubmitEditBoxSidebar = <function> defined @ViragDevTool\ViragDevTool.lua:776
 DeactivateLogFunctionCalls = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:82
 IsMetaTableNode = <function> defined @ViragDevTool\ViragDevTool.lua:427
 SetVisible = <function> defined @ViragDevTool\ViragDevTool.lua:489
 ScrollBar_AddChildren = <function> defined @ViragDevTool\ViragDevTool.lua:642
 TryCallFunction = <function> defined @ViragDevTool\ViragDevTool.lua:914
 Toggle = <function> defined @ViragDevTool\ViragDevTool.lua:485
 ColapseCell = <function> defined @ViragDevTool\ViragDevTool.lua:463
 CMD = <table> {
 }
 METATABLE_NAME = "$metatable"
 ExpandCell = <function> defined @ViragDevTool\ViragDevTool.lua:379
 OnLoad = <function> defined @ViragDevTool\ViragDevTool.lua:1052
 SetArgForFunctionCallFromString = <function> defined @ViragDevTool\ViragDevTool.lua:1024
 AddToHistory = <function> defined @ViragDevTool\Modules/ViragDevToolHistory.lua:7
 CreateColorPickerFrame = <function> defined @ViragDevTool\ViragDevToolOptions.lua:28
 ActivateLogFunctionCalls = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:36
 SetMainTableButtonScript = <function> defined @ViragDevTool\ViragDevTool.lua:883
 GetListenerFrame = <function> defined @ViragDevTool\Modules/ViragDevToolEvents.lua:6
 StartLogFunctionCalls = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:7
 round = <function> defined @ViragDevTool\ViragDevTool.lua:1208
 SaveOldFn = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:113
 ToggleUI = <function> defined @ViragDevTool\ViragDevTool.lua:477
 GetObjectInfoFromWoWAPI = <function> defined @ViragDevTool\ViragDevTool.lua:691
 ClearData = <function> defined @ViragDevTool\ViragDevTool.lua:374
 GetLogFunctionCalls = <function> defined @ViragDevTool\Modules/ViragDevToolFunctionLogger.lua:134
 default_settings = <table> {
 }
 tempOldFns = <table> {
 }
 initialized = true
 listenerFrame = ViragDevToolListenerFrame {
 }
 settings = <table> {
 }
 Add = <function> defined @ViragDevTool\ViragDevTool.lua:327
 TryCallAPIFn = <function> defined @ViragDevTool\ViragDevTool.lua:736
 ShowColorPicker = <function> defined @ViragDevTool\ViragDevToolOp

image

EDIT: Formatting

input fields for arguments and variable search

Hi,
i noticed that the input fields for global variable search and arguments are not always clickable, so inputting something is not possible. it seems like that it has something todo that long lists shown in the frames above(and behind) the input boxes are causing this issue.

Any updates planned? Mind a rebuilt/renamed ~fork?

This was, and is, a great addon. It really helped me understand a lot of what was going on behind the scenes when I was just getting into addon development.

A while ago I remember it breaking and have had my own forked version since, with so far very little changes outside of getting it working. I feel a lot of others would benefit from this tool being continued and expanded.

I just wanted to get permission to engage in the initial steps of more or less rebuilding the addon, which would eventually end up on Curseforge after some new features on top of the re-write.

I see a few forks already exist and having it all on GitHub makes it easy for you to see, but mine, at least initially, won't be.. so I just wanted to ask directly.

If you have plans to get it updated just so its functional I could look back at my changes to let you know; otherwise I'd like to start some larger changes, starting from scratch using my approach to development, with you addon as a reference.

What you offered here was something that I'm sure saved me hours of headache and reduced debugging greatly. I just would like keep that going and hopefully help some others, while also helping myself who is still actively developing.

Function calls report incorrect return values

Steps:

  1. Add GetChatTypeIndex
  2. Set arguments to "RAID"
  3. Press the function in list to execute
  4. Observe return value

Expected: 4 (as reported by /dump GetChatTypeIndex("RAID"))

Actual: 0

Screenshots:
Log screenshot
Chat screenshot with /dump

DragonFlight 10.0 Fixes

ViragDevTool.XML:
combine lines 316 and 317 into this:

             self:SetResizeBounds(635, 200, UIParent:GetWidth(), UIParent:GetHeight());

ViragDevTool.lua:
Combine lines 514 and 515 into this:

              local minX, minY, maxX, maxY = parentFrame:GetResizeBounds()

Should clear the Lua errors and give you a functioning UI again.

Tried to set a font today with SetFont(), didn't work

Hi, i tried to use this addon to call a function with arguments today. I typed "Fonts\FRIZQT__.TTF", 11, "OUTLINE, MONOCHROME" into the arguments field and pressed enter. Since this Function doesn't give any feedback if the font was successfully changed i called GetFont() afterwards. It showed me that the SetFont() wasn't successful. Calling the same function per /run with the same arguments worked. I guess it has something todo with the handling of the \ character.

1x ViragDevTool\ViragDevTool-v0.18.lua:1172: bad argument #1 to 'pairs' (table expected, got string)

When a table has a __metatable key which returns something that is not a table (protected metatable usually return a string here), you have this error.

you can fix very quickly changing line 414 (function ViragDevTool:NewMetatableNode) from
if mt then
to
if type(mt)=="table"

A nicer way would be displaying the value (but this require digging in your code more than I had time to).

Btw, this tool is priceless, many thanks for developing it

Lua error

Lua error.

If the addon's window is NOT showing when I enter the world and if my addons are sending messages to this addons windows, I get the following error when I bring up this addons window and try to scroll (also, no data is showing until I try to scroll. I get the error below and then the data shows):

2x SharedXML\HybridScrollFrame.lua:67: attempt to perform arithmetic on local 'stepSize' (a nil value)
SharedXML\HybridScrollFrame.lua:67: in function <SharedXML\HybridScrollFrame.lua:57>

.... (a lot more, but I didn't paste it all)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.