borderColornNA in GuiButtonCtrl does not seem to work
by Demolishun · in Torque 3D Professional · 08/16/2012 (4:42 pm) · 4 replies
I am trying to control the border color on a GuiButtonCtrl for using the GuiButtonProfile. I have changed the value to be darker and use 50% translucent (128) and it does not affect the control when it is not active. That is what the NA is for is when it is not active. I looked in the code of the GuiButtonCtrl:
All I can guess it that I have a theme enabled, but I have no idea how to control that. The code indicates to me that this should work. I don't know why it is not. I have tried restarting the engine, and that does not help. I can confirm the changes are in the profiles.cs when I modify the profile using the engine profile editor.
I honestly cannot tell if this is a bug or just my not understanding how to work with themes.
void GuiButtonCtrl::onRender(Point2I offset,
const RectI& updateRect)
{
bool highlight = mMouseOver;
bool depressed = mDepressed;
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
ColorI fillColor = mActive ? ( highlight ? mProfile->mFillColorHL : mProfile->mFillColor ) : mProfile->mFillColorNA;
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
RectI boundsRect(offset, getExtent());
if( !mHasTheme )
{
if( mProfile->mBorder != 0 )
renderFilledBorder( boundsRect, borderColor, fillColor, mProfile->mBorderThickness );
else
GFX->getDrawUtil()->drawRectFill( boundsRect, fillColor );
}
else
{
S32 indexMultiplier = 1;
if( !mActive )
indexMultiplier = 4;
else if ( mDepressed || mStateOn )
indexMultiplier = 2;
else if ( mMouseOver )
indexMultiplier = 3;
renderSizableBitmapBordersFilled( boundsRect, indexMultiplier, mProfile );
}All I can guess it that I have a theme enabled, but I have no idea how to control that. The code indicates to me that this should work. I don't know why it is not. I have tried restarting the engine, and that does not help. I can confirm the changes are in the profiles.cs when I modify the profile using the engine profile editor.
I honestly cannot tell if this is a bug or just my not understanding how to work with themes.
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
#2
I bet it is something to do with the theme. The theme would allow for rendering bitmap borders is my guess. I just don't understand how to control the theme being active on a specific control.
08/16/2012 (11:54 pm)
Then this is a BIG bug. Like I said the code looks like it would work. But it is not working because something is preventing it. I bet it is something to do with the theme. The theme would allow for rendering bitmap borders is my guess. I just don't understand how to control the theme being active on a specific control.
#3
The reason why the code works as it does is to prevent a button outline draw call from ruining the alpha blended pixel values from the bitmap array for themed buttons. The stock button image used by T3D makes use of these alpha areas of the image and aren't notice able without using the button on several different colored canvases at the same time to see why manually drawing a button outline and using the themed image at the same time would be a bad (and ugly) idea.
TL;DR: You're doing it wrong!
08/17/2012 (3:10 pm)
It is not a bug as it is working as designed. mHasTheme is set to true when the profile that is assigned to the GUIButtonCtrl has an image assigned to it and it was successfully processed to construct a bitmap array which has at least 36 indices as seen in GuiButtonCtrl::onWake(). So, this makes it where it'll either make use of the bitmap to construct a button visual out of the bitmap array or manually draw the button. In your case you're expecting the manual button draw code to execute when there's an image assigned to the profile you're setting the GuiButtonCtrl to use and that's not how it works.The reason why the code works as it does is to prevent a button outline draw call from ruining the alpha blended pixel values from the bitmap array for themed buttons. The stock button image used by T3D makes use of these alpha areas of the image and aren't notice able without using the button on several different colored canvases at the same time to see why manually drawing a button outline and using the themed image at the same time would be a bad (and ugly) idea.
TL;DR: You're doing it wrong!
#4
08/17/2012 (4:46 pm)
Quote:You're doing it wrong!That was my initial assumption. I am still not sure HOW to do it correctly. Do I need to create a new profile that explicitly does not use a bitmap? The problem is I am not sure how to do that.
Ahsan Muzaheed
Default Studio Name
not only borderColornNA,many other profile field does not affect most of those controls.
almost same fields have given to all profiles.but most of them have no effect on 90% controls.
do not know why those field are there,when they have no impact on controls.