Thread Tools Display Modes
12-30-10, 04:30 PM   #1
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Color & texture questions

I have tons of questions, but I'll limit them to two for now . I recently decided to try my hand at porting an old Stuf layout of mine to oUF using oUF_Freeb. Things are going quite well for the most part, largely thanks to Freebaser's great layout. Here's a shot of my old Stuf frames:



I ran into a little trouble in oUF when trying to make the health background class/reaction colored, while maintaining the dark gray color for the statusbar texture. A dirty workaround was to hardcode a color value at oUF\elements\health.lua line 49 thereby restricting the class/reaction coloring to the background texture:

Code:
-- Edited:
	
	if(b) then
		health:SetStatusBarColor(.15, .15, .15, 1) -- hardcoded rgb

		local bg = health.bg
		if(bg) then local mu = bg.multiplier or 1
			bg:SetVertexColor(r * mu, g * mu, b * mu)
		end
	end
		
-- Original:
	
	if(b) then
		health:SetStatusBarColor(r, g, b)

		local bg = health.bg
		if(bg) then local mu = bg.multiplier or 1
			bg:SetVertexColor(r * mu, g * mu, b * mu)
		end
	end
I have a feeling that oUF might already provide layout support for this type of color scheme without having to hack a core file or redo the class/reaction coloring rules in the layout itself. A nudge in the right direction (or even another layout to study) would be very helpful.

Another question I have involves the statusbar texture appearance as the health value changes. In the Stuf screenshot above, the statusbar and the background use the same Perl texture, and the textures are "aligned" (for lack of a better term) visually. The fully opaque statusbar maintains this appearance of alignment as it moves in either direction. It's as if the statusbar texture is simultaneously translucent and opaque.

In the below shot of my oUF frames, my opaque statusbar texture moves like an accordion, distorting horizontaly on the way down, and restoring on the way up.



A quick workaround for the accordion effect was to use a smooth statusbar texure with transparency:



This leaves me with somewhat of a paradox as in order to see the Perl texture at all, I must also see some of the underlying class/reaction color (the goal being to have an opaque dark gray Perl statusbar, and a class/reaction colored Perl background).

I hope that makes sense . I continue to poke around in the Stuf guts to see how it's being done there, but any help from the oUF community would be much appreciated.
  Reply With Quote
12-31-10, 07:30 AM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
For the first question:
Just remove the color* variables on the health bar, and color it initially only. If you look above the code you edited in oUF; you'll see that it checks for them, and colors based on which one is set. It will just fall through and do nothing if none of them are set.

Second question:
Not entirely sure what you mean, but based on the image it looks like you want to stretch the texture and have it grow/shrink by cropping.

We can't really do this with a statusbar. The closest you can get is tiling based on width of the texture with cropping. We can't really stretch it as the statusbar widget works by changing the corner coordinates on its texture.

Below is a quick example of this:
Code:
	local internalTexture = Health:CreateTexture()
	internalTexture:SetTexture(insertTexture, true)
	internalTexture:SetHorizTile(true)
	Health:SetStatusBarTexture(internalTexture)
If you want to replicate what you had, then you'll have to implement your own statusbar through texture(s).
__________________
「貴方は1人じゃないよ」
  Reply With Quote
01-05-11, 04:40 PM   #3
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
Originally Posted by haste View Post
Below is a quick example of this:
Code:
	local internalTexture = Health:CreateTexture()
	internalTexture:SetTexture(insertTexture, true)
	internalTexture:SetHorizTile(true)
	Health:SetStatusBarTexture(internalTexture)
If you want to replicate what you had, then you'll have to implement your own statusbar through texture(s).
Thanks for the reply. If I understand correctly, I would need a script within my oUF layout to make invisible (or visible) a percentage of the texture based upon health value changes (and not create a statusbar at all)? Are you aware of any examples of this I could study? It seems a challenging endeavor (for me), but also a great chance to learn.
  Reply With Quote
01-08-11, 04:54 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Code:
	local Health = CreateFrame("StatusBar", nil, self)
	Health:SetHeight(20)
	Health:SetStatusBarTexture(TEXTURE)

	Health:SetPoint"TOP"
	Health:SetPoint"LEFT"
	Health:SetPoint"RIGHT"

	local internalTexture = Health:CreateTexture()
	internalTexture:SetTexture(insertTexture, true)
	internalTexture:SetHorizTile(true)
	Health:SetStatusBarTexture(internalTexture)

	self.Health = Health
This still isn't exactly what you want (as mentioned), but closer than what you had.

If you want something closer to what you had with stuf; you'll need to implement your own statusbar, and I'm not going to give you an example of that :P.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
01-09-11, 01:06 AM   #5
Aprikot
A Frostmaul Preserver
 
Aprikot's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 284
It seems my texture of choice was working against me, and SetHorizTile(true) was what I was looking for all along.

It looked terrible until I realized I need a texture whose width meets or exceeds that of my statusbar. The 64 pixel Perl texture tiled in my 230 pixel bar was hideous, but a 256 pixel texture in the same bar gave me precisely what I wanted.

Thanks very much for your help.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Color & texture questions


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