WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Basic example of spawning nameplates? (https://www.wowinterface.com/forums/showthread.php?t=58234)

aelen 09-30-20 05:52 PM

Basic example of spawning nameplates?
 
Hello! I've been using oUF for a while and until now I've been using plater for unit frames.

In preparation for shadowlands I figured I'd give spawning unit frames with oUF a go as well, however most of the layouts that I look at are quite complex in terms of abstractions. I'm kinda looking for a bare minimum example of spawning a healthbar for a unit, so that I can then apply custom styling.

Anyone know where I can find this, or have some basic code laying around?

aelen 09-30-20 06:10 PM

Ok so I got some basic stuff working (health bar + hp) https://gyazo.com/5d91598c698bd152847663eb94bc0b66

But as you can see the scaling is a bit out of whack compared to my regular unit frames (player frame can be seen on the bottom left) - is this due to me setting a custom UIScale?

Code:

local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event)
        UIParent:SetScale(768/1440)
        f:UnregisterAllEvents()
end)

Is what I have in another addon since I use a 3440x1440 monitor and I'm trying to achieve pixel-perfection. Do I need to apply the same scale to the nameplates, or is there something else I need to do?

Appreciate any help!

aelen 09-30-20 06:12 PM

I'm also getting a bunch of issues trying to style the unit frame, but then the frame does not exist anymore, which I guess is due to the NAME_PLATE_UNIT_REMOVED event - is there a special way to handle this?

neverg 10-03-20 04:44 AM

Hey,

You've got a full example here on my layout: https://github.com/greven/oUF_Lumen/...nameplates.lua

Dunno if it the best way to do it, if there is any alternative but it works fine for my use.

aelen 10-05-20 05:51 AM

Oh awesome, I'm gonna check that out! Like I said I have a basic example working but the scaling is off + there's some lua errors happening whenever nameplates disappear off screen, so hopefully I can find something in your layout to help with these issues.

I think the scaling is a matter of setting the same scaling on nameplates as I do on the UIParent, but the lua errors I'm not sure about.

keivamp 10-15-20 10:36 PM

my super basic oUF Nameplates
 
These have all the basic functionality and fully customizable yo suit what ever you need. https://github.com/keivamp/oUF_Nameplates


All times are GMT -6. The time now is 01:45 AM.

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