How to hook virtual="true" controls? - ESOUI
Thread Tools Display Modes
03/06/21, 05:42 AM   #1
Join Date: Jul 2019
Posts: 2
How to hook virtual="true" controls?

Actually I am working on a patch and pixel-perfect Addon for the keyboard interface. (there are many bugs)
This means I only need to change minior bugs mostly in the xml files and dont want to hook whole functions.
Instead I am using the cool API Hooks like "RedirectTexture()" or "ApplyTemplateToControl()".

But how I can change small things of an xml Control that already has the virtual="true" status?
Mostly they are used directly in a lua function OR by other xml controls. Even if I hook into the lua function and replace the whole xml control there will be other controls who still use the original Control.
There are some premade API Hooking for that?

As example, how I can change TextureCoords in this Control? (Texture=its like an Control)
<Texture name="ZO_TargetAttributeFrameRightAngle_Keyboard_Template" textureFile="EsoUI/Art/UnitAttributeVisualizer/targetBar_dynamic_frame.dds" virtual="true">
    <Dimensions x="21" y="23" />
    <TextureCoords left="0.5546875" right="0.71875" top="0.328125" bottom="0.6875"/>
InGame: @Pino-DE

Last edited by Pino : 03/06/21 at 05:45 AM.
  Reply With Quote
03/06/21, 11:24 AM   #2
Super Moderator
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,753
If you talk about PerfectPixel: It is still maintained where needed, so please ask for help/fixes for compatibility in the addon comments instead of creating patches where you modify the files.
PP provides base possibilities to reanchor controls of standard ESO UI and other addons (based on scenes, fragments, controls, etc.) and there is a given structure of filenames and subfolders (scenes, eg.) to support this AND keep track of where was changed what.

Adding new files or modifying them only at some places will most likely fix it for your 1 addon but break 4 others the same time!
So better do the following please: Tell me in the addon comments what is miss placed/not working.
Provide the standard information like "what addons are enabled as it is shown wrong", "does it work if only 1 addon and PP is enabled?" -> so other addons break it, and "do you already know what to change so it will work for all addons in combination?".

You always have to have a look at the whole picture and as there are like 400+ UI changing addons this is not as easy as you think it will be

Thanks for your understanding AND doing the homework with the tests before trying to fix something that might break more than you know/think off. AND thank you as well for using the given ways PP changes other controls anchors/scenes/fragments/hooks, instead of changing the base virtual controls or changng the xml controls.

About your question:
A virtual control is a template. You cannot change it directly. You need to use inherits="theVirtualControl" and override="true" BUT then you will also need to override ALL following functions and related XML controls properly, or it might/will throw errors.
In your example you need to create your own <texture name="ZO_TargetAttributeFrameRightAngle_Keyboard_TemplateNew" inherits="ZO_TargetAttributeFrameRightAngle_Keyboard_Template" virtual="true" overwrite="true"...>
and then you'd be able to change the texture coordinates of it (maybe). But this would also need you to change other parameters and code AND assign this new template ZO_TargetAttributeFrameRightAngle_Keyboard_TemplateNew to the controls that normally used ZO_TargetAttributeFrameRightAngle_Keyboard_Template.
Maybe there is any easier way, but I do not know any so far.

PP therefor does not change these controls where not needed but just checks which addons are activated and reanchors them properly to the other controls.
This won't change the base, maybe creating multiple problems even in lua code, but just changes the visuals as they are shown/hidden.

Last edited by Baertram : 03/06/21 at 11:47 AM.
  Reply With Quote
03/06/21, 12:08 PM   #3
Join Date: Jul 2019
Posts: 2
Originally Posted by Baertram View Post
If you talk about PerfectPixel: It is still maintained where needed, so please ask for help/fixes for compatibility in the addon comments instead of creating patches where you modify the files.
Ahh, no I created a "patch" for the default UI because it has many bugs and stretched textures. I also replaced many textures and remove gloss or munge effects (thats why I said "pixelperfect")... By Replacing textures and ApplyTemplateToControl() it is intended that other addons also use this textures and fixes when they call some original functions for window borders etc... That's also why I asked for a API hook like ApplyTemplateToControl().

Thanks I will try it
InGame: @Pino-DE
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » How to hook virtual="true" controls?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off