Quantcast Needs Graphics Help regarding frame level and layers. - Page 2 - WoWInterface
Thread Tools Display Modes
02-29-16, 02:31 AM   #21
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
You can solve any framelevel and strata issues via frame stacking. This can be done by parenting any frame to the last frame you created.

Like if you want power below health you create power first with all the desired layers and anchor your base health frame to your highest power frame (overlay?).

Example:
local power = CreateFrame("Statusbar",nil,self)
power.overlay = CreateFrame("Frame",nil,power)
local health = CreateFrame("Statusbar",nil,power.overlay)
self.power =power
self.health = health

For statusbar texture. Your texture is 258x34 pixel. If that is the case that is the wrong size. It has to be 256x32 pixel. (Multiplier of 8).

By default any statusbar is stretched into the space given. StatusbarTexture accepts two types of variables. A texture path string and a texture object. You could create a texture beforehand and pass into to SetStatusbarTexture. You do not have to do it that way because GetStatusbarTexture will return the texture object.

Either way. A texture objext can have SetVertTile and SetHorizTile. This will prevent texture stretching and will repeat the texture the way you defined it.

http://wowprogramming.com/docs/widgets/Texture
http://wowprogramming.com/docs/widgets/StatusBar
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 02-29-16 at 02:33 AM.
  Reply With Quote
03-03-16, 05:31 AM   #22
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Originally Posted by zork View Post
You can solve any framelevel and strata issues via frame stacking. This can be done by parenting any frame to the last frame you created.

Like if you want power below health you create power first with all the desired layers and anchor your base health frame to your highest power frame (overlay?).

Example:
local power = CreateFrame("Statusbar",nil,self)
power.overlay = CreateFrame("Frame",nil,power)
local health = CreateFrame("Statusbar",nil,power.overlay)
self.power =power
self.health = health

For statusbar texture. Your texture is 258x34 pixel. If that is the case that is the wrong size. It has to be 256x32 pixel. (Multiplier of 8).

By default any statusbar is stretched into the space given. StatusbarTexture accepts two types of variables. A texture path string and a texture object. You could create a texture beforehand and pass into to SetStatusbarTexture. You do not have to do it that way because GetStatusbarTexture will return the texture object.

Either way. A texture objext can have SetVertTile and SetHorizTile. This will prevent texture stretching and will repeat the texture the way you defined it.

http://wowprogramming.com/docs/widgets/Texture
http://wowprogramming.com/docs/widgets/StatusBar
Hi zork!

First of all, the reason why my texture had a size of 258x34 was because the website that I use to upload does only support .jpeg/.png/.gif and some kind of basic image formats.

I could've just change the format of this texture with some utilities (like BLP2PNG(?)), but was too lazy to do so ...

So, after all, I just captured an image and the image got the size of 258x34 and the format of .png.



And about the SetStatusBarTexture/GetStatusBarTexture, could you please explain me with some in details?

In order to create a texture object, don't I need a frame which is going to use that particular texture object?

Like:
Lua Code:
  1. frame.texture = frame:CreateTexture(nil, "OVERLAY");

If so, you mean by this?
Lua Code:
  1. frame.texture = frame:CreateTexture(nil, "OVERLAY");
  2.  
  3. frame.texture:SetTexCoord(0, 1, 1, 0);
  4.  
  5. frame:SetStatusBarTexture(frame.texture);
  Reply With Quote
03-03-16, 06:37 AM   #23
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
Any texture you want to create needs a frame to be created on.
A statusbar is just a subtype of the frame element with an additional set of functions.

Make sure to read all the statusbar functions.
http://wowprogramming.com/docs/widgets/StatusBar

To be honest I really don't understand your issue. The statusbar has a rich set of functions providing possible solutions for anything you want. If it does not have what you are looking for do not use a statusbar at all. Instead use a texture object and apply any transformations manually via :SetTexCoord().
http://wowprogramming.com/docs/widge...re/SetTexCoord

You can create a fake statusbar in oUF and hook the "OnValueChanged" event on the fake statusbar to trigger any math calculations on your texture.

Lua Code:
  1. local fakePowerBar = CreateFrame("Statusbar",nil,self)
  2. local powerBar = self:CreateTexture(nil,"BACKGROUND",nil,-8)
  3. powerBar:SetPoint("RIGHT") --or "LEFT", "TOP", "BOTTOM" ... whatever you need
  4. self.Power = fakePowerBar
  5. local function UpdatePowerBar(...)
  6.   print(...)
  7.   local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy
  8.   local width, height
  9.   --calculations are pretty easy. Just take a piece of paper IRL and mark the corners. Now flip it in any direction you want. That is your conversion UL becomes UR and UR becomes UL and so on.
  10.   --What is important is since the texture needs to be cut off once you loose value you need to ajust the corners properly.
  11.   --Your texture will be stretched to full width/height, thus you need to adjust the size to make it look right.
  12.   powerBar:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
  13.   powerBar:SetSize(width,height)
  14. end
  15.  
  16. self.Power:SetScript("OnValueChanged", UpdatePowerBar)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

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

Last edited by zork : 03-03-16 at 06:58 AM.
  Reply With Quote
03-04-16, 07:15 PM   #24
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Originally Posted by zork View Post
Any texture you want to create needs a frame to be created on.
A statusbar is just a subtype of the frame element with an additional set of functions.

Make sure to read all the statusbar functions.
http://wowprogramming.com/docs/widgets/StatusBar

To be honest I really don't understand your issue. The statusbar has a rich set of functions providing possible solutions for anything you want. If it does not have what you are looking for do not use a statusbar at all. Instead use a texture object and apply any transformations manually via :SetTexCoord().
http://wowprogramming.com/docs/widge...re/SetTexCoord

You can create a fake statusbar in oUF and hook the "OnValueChanged" event on the fake statusbar to trigger any math calculations on your texture.

Lua Code:
  1. local fakePowerBar = CreateFrame("Statusbar",nil,self)
  2. local powerBar = self:CreateTexture(nil,"BACKGROUND",nil,-8)
  3. powerBar:SetPoint("RIGHT") --or "LEFT", "TOP", "BOTTOM" ... whatever you need
  4. self.Power = fakePowerBar
  5. local function UpdatePowerBar(...)
  6.   print(...)
  7.   local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy
  8.   local width, height
  9.   --calculations are pretty easy. Just take a piece of paper IRL and mark the corners. Now flip it in any direction you want. That is your conversion UL becomes UR and UR becomes UL and so on.
  10.   --What is important is since the texture needs to be cut off once you loose value you need to ajust the corners properly.
  11.   --Your texture will be stretched to full width/height, thus you need to adjust the size to make it look right.
  12.   powerBar:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
  13.   powerBar:SetSize(width,height)
  14. end
  15.  
  16. self.Power:SetScript("OnValueChanged", UpdatePowerBar)
Hi again zork,

My issue is that Texture:SetTexCoord() simply not working on my code at all (well... within ouF). So, creating fake status bar did not fix the fault here ...

Since I'm guessing the problem(?) is between oUF and the place where Texture:SetTexCoord() function is called (as it works fine outside oUF), I'll go back to oUF forum and ask if they have any clues regarding this.

Last edited by Layback_ : 03-04-16 at 07:24 PM.
  Reply With Quote
03-05-16, 06:50 AM   #25
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
I posted a working solution here:
http://www.wowinterface.com/forums/s...31&postcount=2
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
03-05-16, 08:40 AM   #26
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 175
Originally Posted by Yukyuk View Post
Oops, my bad. I also get a error while opening a blp file.

What can I say, long day with lots of programming and creating tga files
This is what I do to get BLP files.
Open the file with XNview and do "save as" and choose the TGA format.
Gimp 2 can read TGA files and can save them as CXF files.

This way I can I can edit them if I want.
And save them and Export them as TGA files.
Then they can be used in an Adonn.
__________________
Better to fail then never have tried at all.
  Reply With Quote
03-05-16, 09:17 AM   #27
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,347
You can use BLPNG Converter to change to .blp's. Read the page, it tells you what it can convert to .blp's. Gimp2 can export them all, so it's a "win-win" situation. You can use Blpc to convert various formats, also, but I linked it because it is a .blp viewer. You can get BLPView if you want to view .blp's natively on your machine. It's a shell extension, so it will provide thumbnail views on a Window's machine. I have a Window's 10 machine, and all of them work for me.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!

Last edited by jeffy162 : 03-05-16 at 09:30 AM.
  Reply With Quote
03-05-16, 12:12 PM   #28
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 175
@jeffy162, thanks for the pointers, will check them out.
__________________
Better to fail then never have tried at all.
  Reply With Quote
03-05-16, 03:39 PM   #29
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,347
You're welcome.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote

WoWInterface » Developer Discussions » Graphics Help » Needs Graphics Help regarding frame level and layers.

Thread Tools
Display Modes

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