Thread Tools Display Modes
05-27-11, 01:34 AM   #1
leizeQ
A Murloc Raider
 
leizeQ's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2008
Posts: 8
Portrait:SetModelScale(number)

Hi.

I am trying to change the model scale of the player portrait.
i've tried to use the Portrait:PostUpdate() function but without success.

Code:
self.Portrait.PostUpdate = function(self, unit) self:SetModelScale(0.5) end
is it overwritten somewhere else?, is the SetModelScale not the right function to use? or am I missing some other stuff.

thanks.

edit: already answered, please disregard. i can post the solution if anyone has interest

Last edited by leizeQ : 05-27-11 at 01:43 AM.
  Reply With Quote
05-27-11, 07:50 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by leizeQ View Post
edit: already answered, please disregard. i can post the solution if anyone has interest
Posting the solution is always a good idea. It potentially prevents the same question in the future and allows potentially better solutions to be posted.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
05-28-11, 04:46 AM   #3
leizeQ
A Murloc Raider
 
leizeQ's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2008
Posts: 8
Talking

so my intention was to use a portrait for the player without any border or background and placed on the bottom of the screen. but it was zoomed in too much so it was visible where are the borders of portrait frame.

so here are 2 solutions i've found/been told:

1. use Model:SetCamera(1) - this changes the whole portrait to something similar as in character screen (whole body seen), and it should be zoom-able

2. use PlayerModel:SetPortraitZoom(number)
  Reply With Quote
06-11-11, 07:56 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Regarding models. It got me thinking because I refreshed my model viewer today.



To get the camera zoom to the face of a model you have to use

Code:
SetPortraitZoom = 1
To zoom out but stay focus on the face area you can then use

Code:
SetCamDistanceScale = x
The other important values are SetPosition and SetRotation. Both are pretty obvious.

I still have the worgen male problem. Gonna try sth.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
06-11-11, 08:00 AM   #5
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
*edit*

IT WORKED...lol on first try.

@haste the "SetCamera 0" settings seems to be deprecated. Try this:

I changed the portrait.lua and male worgen portraits are now fixed.

Seems like: SetPortraitZoom is the new SetCamera.

lua Code:
  1. local Update = function(self, event, unit)
  2.     if(not unit or not UnitIsUnit(self.unit, unit)) then return end
  3.  
  4.     local portrait = self.Portrait
  5.     if(portrait.PreUpdate) then portrait:PreUpdate(unit) end
  6.  
  7.     if(portrait:IsObjectType'Model') then
  8.         local guid = UnitGUID(unit)
  9.         if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then
  10.             portrait:SetModelScale(4.25)
  11.             portrait:SetPosition(0, 0, -1.5)
  12.             portrait:SetModel"Interface\\Buttons\\talktomequestionmark.mdx"
  13.         elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then
  14.             portrait:SetUnit(unit)
  15.             --portrait:SetCamera(0)
  16.             portrait:SetPortraitZoom(1)
  17.             portrait.guid = guid
  18.         else
  19.             --portrait:SetCamera(0)
  20.             portrait:SetPortraitZoom(1)
  21.         end
  22.     else
  23.         SetPortraitTexture(portrait, unit)
  24.     end
  25.  
  26.     if(portrait.PostUpdate) then
  27.         return portrait:PostUpdate(unit)
  28.     end
  29. end

First worgen male portrait working correctly
__________________
| 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 : 06-11-11 at 08:08 AM.
  Reply With Quote
06-11-11, 09:09 AM   #6
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Delete your post, ASAP! Otherwise, I predict even more of those hairy beasts flooding the game, soon! NOooooO!
__________________
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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Portrait:SetModelScale(number)


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