Adapt - Almost-Default Animated Portraits

When the UI goes to draw a static portrait, this addon instead draws an animated model to the dimensions of the intended portrait.

Adapt is meant to be configuration-free (especially if you use the default unit frames), but there are some options you can change in the Interface Options Panel.

__ FAQ __

Q: Will it work with my custom unit frames?
A: If your existing unit frames are static portraits and not models already, yes it should. The universal approach this addon takes will attempt to convert any 2d portrait texture into a 3d model (if it's bigger than 30 pixels). However, if Adapt already came with the unit frame addon or UI compilation you use, you may need to get an updated version of that addon/compilation if it made any tweaks to portraits/Adapt.

Q: It's not working or there's a bug.
A: I'd love to hear about it in the comments. Please mention what Unit Frame addon or UI compilation you use.

Q: I use circular unit frames (like default), but when I look closely the model cut off as a square! Can the model be fit into a true circle?
A: Sadly, it can't. Addons have no genuine way to mask models. For circular unit frames the model is shrunk to fit within the circle.

Q: What's an "anonymous portrait"?
A: When this addon was first written in 2006, practically everyone named all their textures(portraits). Nowadays it's more common for textures to go unnamed as a courtesy to the UI ecosystem. For anonymous portraits you can only turn them all on or off, unlike named portraits which you can selectively disable.

Q: I want to disable my default focus frame from animating, but I don't see it in the options list.
A: The list in options is only of portraits it's encountered in that session (and those already disabled). Adapt has no awareness of what frames it will be asked to draw until it encounters them. So in this case you can /focus yourself and then when you go back into options the focus frame should be listed so you can disable it.

08/29/2017 version 2.2.5
- toc update for 7.3 patch

03/28/2016 version 2.2.4
- toc update for 7.2 patch

10/24/2016 version 2.2.3
- toc update for 7.1 patch

07/03/2016 version 2.2.2
- Also workaround for UNIT_MODEL_CHANGED not firing when a player unghosts, causing their model to remain in ghostly form.

07/03/2016 version 2.2.1
- Workaround for UNIT_MODEL_CHANGED not firing when a warrior finishes "leap" out of Skyhold, causing fiery/explody model to continue.

05/14/2016 version 2.2.0
- toc update for 7.0 Legion Beta
- Fix for first render not working on a new model

01/21/2016 version 2.1.0
- Rewrote options panel.
- Restructured settings (some with non-standard settings may need to set them back).
- Added new option "With Overlay Mask" to add a circular texture over models to soften the corners and make them more round.
- Added new option "Smaller Portrait" to bring round portraits in even further.
- "Torso Portrait" mode reworked: model turned to "default rotation" and zoomed in just a bit for a more natural view.
- "Full Model" mode zoomed in a bit.
- All animations now (theoretically) use a standing animation without idle animations (such as undead going off camera).
- Fixed camera issue when changing the UI scale or display size.

I tested Adapt alone, without oUF_Abu, and portraits are not animated at all while in a vehicle, even after reloading UI. When I use both, I have to reload when entering and then when exiting vehicle to make it work. Everything besides that works perfectly, so I don't understand why I would not be compatible...
I asked for help on the oUF_Abu post, though.

Vehicles are a real pain to work with. Every time I get an itch to write a unit frame addon, I remember that vehicles exist and scrap the idea. That 2d portraits are used while in a vehicle is 100% perfectly fine with me.

How Adapt works is it hooks the SetPortraitTexture API call that the default UI (and addons) use to create a portrait of a unit, and then creates a model for that until instead, using the corners of the intented texture to size and position the new model and making the texture's parent the model's parent. That's it. The code is something like 250 lines to actually do this and another 500 lines of code for options. This "blind" universal approach cannot make judgement calls about the behavior of the frames they're attached to.

I've put this on the todo list to research this further later. Maybe this addon can be made to work with vehicles without requiring it to be for default unit frames only. I think the basic problem is that the unit is changing and it doesn't handle units changing. But unfortunately I have a lot of addon work to do between now and Legion and need to prioritize what gets my attention.

I'm currently using your addon with oUF_Abu and I found a bug while in a vehicle. The portrait won't show in the right place unless I reload UI, and it won't be animated anymore right after I exit the vehicle. I don't know if you can do anything about it.

Thanks for the screenshots. I'll look into that tonight.

edit: I had a chance to look into it. I'm afraid the two are incompatable. You'll have to get the models through oUF or oUF_Abu. I don't have the time to research how oUF is doing things differently to begin finding out exactly what's happening.

I tested Adapt alone, without oUF_Abu, and portraits are not animated at all while in a vehicle, even after reloading UI. When I use both, I have to reload when entering and then when exiting vehicle to make it work. Everything besides that works perfectly, so I don't understand why I would not be compatible...
I asked for help on the oUF_Abu post, though.

I'm currently using your addon with oUF_Abu and I found a bug while in a vehicle. The portrait won't show in the right place unless I reload UI, and it won't be animated anymore right after I exit the vehicle. I don't know if you can do anything about it.

Thanks for the screenshots. I'll look into that tonight.

edit: I had a chance to look into it. I'm afraid the two are incompatable. You'll have to get the models through oUF or oUF_Abu. I don't have the time to research how oUF is doing things differently to begin finding out exactly what's happening.

I'm currently using your addon with oUF_Abu and I found a bug while in a vehicle. The portrait won't show in the right place unless I reload UI, and it won't be animated anymore right after I exit the vehicle. I don't know if you can do anything about it.

- The old SetCamera that this addon used to use is an option, but it had issues like worgen and others showing as full model instead of a typical head profile.
- A custom camera to set a position closer, but this would probably require a database of coordinates for different models. This addon is super tiny (<50k) and any such database of absolutely off the table.
- Use the 1.2 SetPortraitZoom and rotate the model a little to the right. If it's a player character model it can rotate a little, and for non-player character models it can rotate even more. I'd have to experiment on the specifics and range of behavior which is an amount of research I don't have time to commit to at the moment, sorry.

Sounds complicated!

Originally Posted by Gello

In the future I may research more on models (it's all very poorly documented, so 90% of work is by experimentation), but for the moment this addon won't help your problem.

I'm asking you: is it possible to add an option to move, zoom in/out and rotate character's model in the player frame to set a custom static (or even animated) player portrait?

Yes and no.

If you open Adapt.lua and find this bit of code (can ctrl+F for SetCamera and it's the second instance of SetCamera in the file):

Code:

function adapt.SetCamera(texture)
local zoom = AdaptSettings.Zoom==3 and 0.33 or AdaptSettings.Zoom==2 and 0.75 or 1
adapt.portraits[texture].modelLayer:SetPortraitZoom(zoom)
end

and change the "or 1" to "or 1.2" it will zoom the camera in a bit more, but it also rotates the character to the model's left a bit.

This has two effects:
1) Since models can't be properly masked into circles, the "squared edges" problem becomes more pronounced. The circular overlay mask softens the corners a bit, but it looks imperfect.
2) NPC models seem to have a different "scale" for this zoom-rotation, so you're looking at the back of the heads for some targets.

There are alternatives:
- The old SetCamera that this addon used to use is an option, but it had issues like worgen and others showing as full model instead of a typical head profile.
- A custom camera to set a position closer, but this would probably require a database of coordinates for different models. This addon is super tiny (<50k) and any such database of absolutely off the table.
- Use the 1.2 SetPortraitZoom and rotate the model a little to the right. If it's a player character model it can rotate a little, and for non-player character models it can rotate even more. I'd have to experiment on the specifics and range of behavior which is an amount of research I don't have time to commit to at the moment, sorry.

In the future I may research more on models (it's all very poorly documented, so 90% of work is by experimentation), but for the moment this addon won't help your problem.

Gello, blizzard developers have been ignoring the portrait bug since WoD release, so I'm asking you: is it possible to add an option to move, zoom in/out and rotate character's model in the player frame to set a custom static (or even animated) player portrait?

Just a heads up for the update posted tonight (2.1.0 on January 21, 2016): If you find your options seem to have reset, go back into options and set them back. There are a couple new options there too. (I try very hard not to reset options on users; but this addon has been around for over 9 years so it's due for a little savedvar cleanup. )

Also this update removes a file and adds two files. You will need to do the update while exited out of the game. If you do an update while logged in, it will error. Just exit the game and log back in to fix everything.

I can't figure out how to get back to that bug report Banknorris sorry. Is your player portrait still not showing? If so is it just for one character or all?

I'll have an update today to turn off the animation of that achievement compare portrait.

edit: figured out how to get back there. Sorry didn't reply earlier. I'll have a fix for the achievement comparison. Probably just disable the model--the way this addon works passively it makes no judgement on the unit it's about to draw. It just passes the unit along. When I get time I'll see if I can experiment with why it's getting the wrong unit.

Just a quick plugin here (a month late) Gello, BobUI no longer uses adapt as the unitframes are now oUF based as of version 6.0

The older files are still available for download however the unitframes.lua file is required as my custom textures I used the the unitframes don't match the default layout.

If peopl are going to use my textures I suggest using BobUI v5.4.1 as that was the last interation of the texture were I fixed a lot of texture issues. I do allow fan updates in the license as well if players would just like to update the UI so long as it's posted on wowinterface or curse.com (and associated websites aka curseforge, wowace, ect)