Thread Tools Display Modes
11-20-09, 05:00 AM   #1
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
oUF Portraits help

Hey there. I am a complete noob when it comes to oUF and I am still learning a great deal. I have learned soooo muuuuch already but still don't know enough obviously. I was wondering of anyone could help me with adding portraits to my code, I was trying to add them from various layout code examples as well as other things and I still can't figure it out, i.e. they will not show up and I am boggled as to why they won't >.> Any help is appreciated and I would be greatly thankful and happy if someone could help me! We all start somewhere

Here is the code: http://snipt.org/pkq

Again, if you can help me I am extremely happy that you can, if you can't then I understand cause I can't figure it out either >.>

Thanks again and in advance!!!!

-Ferous
  Reply With Quote
11-20-09, 07:06 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Try to make use of functions.
Code:
  
  --animated portraits yes/no
  local use_3dportraits = 1
  
  --create portraits func
  local function createPortraits(self,unit)
  
    --portrait holder frame
    local ph = CreateFrame("Frame",nil,self)
    ph:SetPoint("CENTER",self,"CENTER",0,0)
    ph:SetWidth(150)
    ph:SetHeight(150)
  
    --3D or 2D
    --3D looks silly on ToT frames of any kind though (because of onUpdate)
    if use_3dportraits == 1 then
      self.Portrait = CreateFrame("PlayerModel", nil, ph)
      self.Portrait:SetAllPoints(ph)
    else
      self.Portrait = self:CreateTexture(nil, "BORDER")
      self.Portrait:SetAllPoints(ph)
    end
  end
  
  --now come your layout style functions
  --call the function there
  
  local function CreatePlayerStyle(self, unit)
    -- ...
    createPortraits(self,unit)
    -- ...
    
  end
__________________
| 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-20-09 at 07:10 AM.
  Reply With Quote
11-20-09, 08:52 AM   #3
jasje
A Chromatic Dragonspawn
 
jasje's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
Dawn answered my question about this question to, this is what he said:

Code:
		local portrait = CreateFrame("PlayerModel", nil, self)
		portrait:SetScript("OnShow", function(self) self:SetCamera(0) end)
		--portrait:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", 4, 0)

		portrait.type = "3D"
		self.Portrait = portrait
		--portrait:SetFrameStrata("LOW")		
		--portrait:SetFrameLevel(11)		
		--portrait:SetAlpha(1)
Originally Posted by Dawn View Post
This is all you need. Commented lines are optional. You have to tell the layout for which frames (like player, target, ....) it should spawn the portrait, though.
__________________

Tukui | Github
  Reply With Quote
11-20-09, 04:58 PM   #4
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
THank you all. I appreciate it greatly. I am still a noob when it comes to Lua but I am learning alot on my own everyday. I thank you alot.

-Ferous
  Reply With Quote
11-20-09, 05:24 PM   #5
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
awesome awesome, you are definitely a very great coder zork, awesome awesome person Here is what I got now! YAY !

  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF Portraits help


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