WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Moving ClassNameplate (https://www.wowinterface.com/forums/showthread.php?t=53716)

liquidbase 06-14-16 06:07 AM

Moving ClassNameplate
 
Hello everyone!

At the moment I try to move the new class nameplate (health, power & ressources) coming with Legion. My problem is that I have not yet found approach, how I can move the whole unit or assign a fixed position.
Don't get me wrong, the new nameplates are perfect. However, players display moves, depending on the camera position in impossible places, which follow the display can be more complex than useful.

If someone had a starting for me, with whom I could start working, I would be pleased to hear about this.

Thanks in advance for alle help :)

greetz
liquid

siweia 06-14-16 10:54 PM

Quote:

NamePlatePlayerResourceFrame:ClearAllPoints();
NamePlatePlayerResourceFrame:SetPoint("CENTER", UIParent, 0, 0)
NamePlatePlayerResourceFrame.SetPoint=function() return end
Something like this?

zork 06-15-16 12:36 AM

Don't do this. Just look into the Blizzard Interface files and find the function you need to hook.

https://github.com/tomrus88/Blizzard...ard_NamePlates
https://github.com/tomrus88/Blizzard...tUnitFrame.lua

https://github.com/tomrus88/Blizzard...rame.lua#L1752

Lua Code:
  1. --SetupPlayerNamePlate
  2. local function SetupPlayerNamePlate(frame, setupOptions, frameOptions)
  3.   if not UnitIsUnit(frame.displayedUnit, "player") then return end
  4.   local parent = frame:GetParent()
  5.   local nameplate = C_NamePlate.GetNamePlateForUnit("player")
  6.   print(parent:GetName(),frame:Getname(),nameplate:GetName())
  7.   --apply setpoint to parent
  8.   print(parent:GetPoint())
  9.   parent:ClearAllPoints()
  10.   parent:SetPoint("CENTER")
  11. end
  12. hooksecurefunc("DefaultCompactNamePlateFrameSetupInternal", SetupPlayerNamePlate)

liquidbase 06-16-16 11:02 AM

Quote:

Originally Posted by zork (Post 315728)
Don't do this. Just look into the Blizzard Interface files and find the function you need to hook.

https://github.com/tomrus88/Blizzard...ard_NamePlates
https://github.com/tomrus88/Blizzard...tUnitFrame.lua

https://github.com/tomrus88/Blizzard...rame.lua#L1752

Lua Code:
  1. --SetupPlayerNamePlate
  2. local function SetupPlayerNamePlate(frame, setupOptions, frameOptions)
  3.   if not UnitIsUnit(frame.displayedUnit, "player") then return end
  4.   local parent = frame:GetParent()
  5.   local nameplate = C_NamePlate.GetNamePlateForUnit("player")
  6.   print(parent:GetName(),frame:Getname(),nameplate:GetName())
  7.   --apply setpoint to parent
  8.   print(parent:GetPoint())
  9.   parent:ClearAllPoints()
  10.   parent:SetPoint("CENTER")
  11. end
  12. hooksecurefunc("DefaultCompactNamePlateFrameSetupInternal", SetupPlayerNamePlate)

Thanks Zork!
That is was I searched for. I think I have it overseen in the Blizzardfiles.

liquidbase 06-17-16 05:15 AM

Tested the function with some changes and a problem occur. The entire nameplate-script is here (@line 286 & @line 317). Changes I had made are:
  • removed the if-statements
  • removed local for nameplate
Positions are printed as should but the repostioning infight seems like is protected for the class-nameplate.

outfight with target:
Code:

NamePlate1 NamePlate1UnitFrame
CENTER table: 0000018DD96EB610 CENTER 0 0

infight with target:
Code:

NamePlate2 NamePlate2UnitFrame
Interface action failed because of an AddOn

Error message:
Code:

1x [ADDON_ACTION_BLOCKED] AddOn 'DuffedUI' tried to call the protected function 'NamePlate2:ClearAllPoints()'.
!BugGrabber\BugGrabber.lua:573: in function <!BugGrabber\BugGrabber.lua:573>
[C]: in function `ClearAllPoints'
...ceDuffedUI\modules\nameplates\nameplates.lua:291: in function <...ceDuffedUI\modules\nameplates\nameplates.lua:286>
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
...
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: in function `DefaultCompactNamePlateFrameSetupInternal'
FrameXML\CompactUnitFrame.lua:1748: in function `func'
FrameXML\CompactUnitFrame.lua:201: in function `CompactUnitFrame_SetUpFrame'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:68: in function `ApplyFrameOptions'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:57: in function `OnNamePlateAdded'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:24: in function <...eBlizzard_NamePlates\Blizzard_NamePlates.lua:18>

Locals:


lieandswell 06-19-16 03:21 PM

Quote:

Originally Posted by liquidbase (Post 315772)
...repostioning infight seems like is protected for the class-nameplate.

Yes, all NamePlate# frames are protected unit frames. I'm pretty sure, however, that the NamePlate#UnitFrame frames aren't protected. They're not clickable and are just there to show information. You should be able to use zork's code on them.

liquidbase 06-20-16 01:02 AM

Quote:

Originally Posted by lieandswell (Post 315815)
Yes, all NamePlate# frames are protected unit frames. I'm pretty sure, however, that the NamePlate#UnitFrame frames aren't protected. They're not clickable and are just there to show information. You should be able to use zork's code on them.

That is the problem. I use the code from zork and here I got the posted error.

Code:

if not UnitIsUnit(frame.displayedUnit, "player") then return end
produces on login, reload, combat start or visible / present nameplates a error. Same issue happens if I adjust the code for my nameplate-script. Outside of combat the positioning works very well, but infight ...
That's the reason why I mentioned that repositing is protected infight. Infight the class nameplate moves with the cameraposition and do no stay at my prevered position (bottom, 0, 370).

zork 06-20-16 07:11 AM

The code above was a drycode to give you an idea.
If you have troubles applying the setpoint to the nameplate parent try to apply it to the frame instead. It is possible that you may not succeed if all the frames are protected.

liquidbase 06-20-16 10:15 AM

I know that it was a dry code with pretty good functionalty. At the moment I work on it, to find a solution.
Problem is here I can only add textures or colors to the frame, but moving cause a taint for health or energy bar (not tried with resources).

semlar 06-20-16 11:06 AM

Wouldn't it be simpler to just create your own frame and inherit the same template?

liquidbase 06-20-16 03:37 PM

Quote:

Originally Posted by semlar (Post 315832)
Wouldn't it be simpler to just create your own frame and inherit the same template?

That is the current situation on the live servers, but I want to remove the current resource bars and the use of Blizzard and adjust accordingly to the layout of the interface.
However, if it turns out that you can not edit the Class Name Plates I will probably stay with the current model.


All times are GMT -6. The time now is 04:54 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI