Thread Tools Display Modes
11-22-10, 08:01 AM   #1
Lyelu
A Cyclonian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 44
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.
  Reply With Quote
11-22-10, 08:14 AM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
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).
  Reply With Quote
11-22-10, 08:17 AM   #3
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
You probably have to use a self.Portrait.Override function and put your own values in it.

Edit: to slow ...
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
11-22-10, 08:28 AM   #4
Lyelu
A Cyclonian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 44
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?
  Reply With Quote
11-22-10, 08:31 AM   #5
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by Lyelu View Post
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.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
11-22-10, 08:58 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
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.
__________________
「貴方は1人じゃないよ」

Last edited by haste : 11-22-10 at 08:59 AM. Reason: clarification of my everything.
  Reply With Quote
11-22-10, 09:14 AM   #7
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Dawn View Post
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 **
  Reply With Quote
11-22-10, 10:03 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
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.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-22-10 at 10:06 AM.
  Reply With Quote
11-22-10, 10:07 AM   #9
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by yj589794 View Post
** 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.
  Reply With Quote
11-22-10, 08:53 PM   #10
Lyelu
A Cyclonian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 44
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.

Last edited by Lyelu : 11-23-10 at 12:15 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Portrait options


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