WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Portrait options (https://www.wowinterface.com/forums/showthread.php?t=36941)

Lyelu 11-22-10 08:01 AM

Portrait options
 
Hi,
I'm trying to place the 3d Portrait into a round border (square peg in round hole). Since I could not find any easy way to do this, I thought maybe I could change the z-axis, to zoom out, so that my PlayerModel isn't "cut off" into a square. So, I found all of these options for PlayerModel:
http://wowprogramming.com/docs/widgets/PlayerModel

Problem is, I can only get one of them to actually work. I can turn myself red, but nothing else:

Code:

        self.Portrait = CreateFrame("PlayerModel", nil, self.Container)
        self.Portrait:SetWidth(48)
        self.Portrait:SetHeight(48)
        self.Portrait:SetPoint("LEFT", self.Portraitborder, "LEFT", 14, 0)
        --Working: Can turn myself red.
        self.Portrait:SetLight(1, 0, 1, 1, 1, 1 , .8, .2, .2, 1, .8, .8, .64)
        -- Not working: Everything else.
        self.Portrait:SetModelScale(20)
        self.Portrait:SetPosition(12, 12,-5.0)

Zoom and all other functions didn't work either.
Am I missing something obvious?
Thanks.

yj589794 11-22-10 08:14 AM

The portrait element in oUF sets some default values for model scale and position when the portrait is updated.

If you want different values then you either need to provide a self.Portrait.PostUpdate function (make changes after the default update) or a self.Portrait.Override function (replace the default update).

Dawn 11-22-10 08:17 AM

You probably have to use a self.Portrait.Override function and put your own values in it.

Edit: to slow ... :)

Lyelu 11-22-10 08:28 AM

Ah so that's why all of you have PostUpdate on everything... thanks for the advice, once again!

Is there directly an option to make it round?

Dawn 11-22-10 08:31 AM

Quote:

Originally Posted by Lyelu (Post 219059)
Ah so that's why all of you have PostUpdate on everything... thanks for the advice, once again!

Is there directly an option to make it round?

Nope, can be square only.

haste 11-22-10 08:58 AM

Models are kinda buggy currently. A quick trick to workaround stuff is doing this in your post-update:
Code:

element:SetAlpha(.51) -- this can be anything which isn't what :GetAlpha() currently is. (element:SetAlpha(element:GetAlpha() + .01) would also work.
element:SetAlpha(.5) -- Set the value we want to have.

This forces the C code to update the alpha on the model. The same method can be applied to everything[1].

[1] Everything on the PlayerModel that is, not everything general.

yj589794 11-22-10 09:14 AM

Quote:

Originally Posted by Dawn (Post 219060)
Nope, can be square only.

You could probably add a circular mask on top of the portrait, so it gives a circular display (e.g. like the default minimap).

** I've not tried doing this, so it may not be a workable solution **

zork 11-22-10 10:03 AM

Since WHEN is masking portraits possible?

Are you kidding me. If that would be possible I would go rooftop right now because that would fix my square model of fog animations do not fit into round orb problem.

Prove? Afaik that is not possible.

yj589794 11-22-10 10:07 AM

Quote:

Originally Posted by yj589794 (Post 219072)
** I've not tried doing this, so it may not be a workable solution **

It was a guess at a possible solution. I have never tried this, I have no idea if it will work, I do not use portraits and have little knowledge of the playermodel widget.

Lyelu 11-22-10 08:53 PM

I could never get a mask to work on anything but the minimap Yj... which is a shame because it would make many more designs possible.

In case anyone else wants to stick a square peg in a round hole, here's what I did. At the beginning of the file, (after OnInitialize, but before your other functions):

Code:

local Portrait_PostUpdate = function(Portrait, unit)
        if (not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then
                Portrait:Hide()
        else
                Portrait:Show()
                Portrait:SetCamera(1)
                -- workaround for setting portrait alpha ...
                Portrait:SetAlpha(0)
                Portrait:SetAlpha(1)
                Portrait:SetPortraitZoom(1)
                Portrait:SetPortraitZoom(.5)
        end
end

Then in your functions which do LayoutPlayer, LayoutTarget, etc, add:

Code:

        self.Portrait:SetPoint("LEFT", YourAnchorframe, "LEFT", 12, 0)
        self.Portrait.PostUpdate = Portrait_PostUpdate

It sets the view from waste up, so it's skinnier, so only one edge presses against my circular border. Makes it much easier to fit in the circle, although the staff pokes out a little when I animate. Might look for a workaround for that in a bit.


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

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