Gui profiles
by Gregory "Centove" McLean · in Torque Game Engine · 05/13/2004 (10:55 am) · 11 replies
Looking through the various gui profiles I noticed the following field:
hasBitmapArray
Is this actually used anywhere? I can't seem to find it anywhere in the engine code. Basically what I want to do is have some profiles with a bitmaparray to render and others that don't use it for the same control.
For instance I want an interface with 'skinned' buttons (GuiButtonCtrl) that uses one profile, then another profile that uses the plain old rendering. I figured the easiest way would be to do a check mProfile->hasBitmapArray() and render based on that.
I'm guessing all I would need to do is add that field but I wasn't sure if anything was using it already.
hasBitmapArray
Is this actually used anywhere? I can't seem to find it anywhere in the engine code. Basically what I want to do is have some profiles with a bitmaparray to render and others that don't use it for the same control.
For instance I want an interface with 'skinned' buttons (GuiButtonCtrl) that uses one profile, then another profile that uses the plain old rendering. I figured the easiest way would be to do a check mProfile->hasBitmapArray() and render based on that.
I'm guessing all I would need to do is add that field but I wasn't sure if anything was using it already.
#2
05/13/2004 (10:37 pm)
HasBitmapArray is in fact alive and well. Check out GuiControlProfile::computeBitmapArray() for some details and the check box control for an example.
#3
Are you sure Ben?
---
[gregm@developer torque]$ find -type f -a -name \*.cc -exec grep -li computebitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.cc -exec grep -li hasbitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.h -exec grep -li hasbitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.h -exec grep -li computebitmaparray {} \;
---
I can't find that member or function anywhere. Maybe I'm misunderstanding that field. If the HasBitmapArray is set to false I can't seem to find where that makes any difference in the code. Or even where its checked/set.
If you notice I did the greping from the top of the torque dir and it was case insensitive so it should have found it if its there.
I also checked the documentation and didn't see either mentioned anywhere.
Would it be a persist field or is it a dynamic field?
If its a persist field its not getting added GuiControlProfile::initPersistFields() Adds a bunch (most of em) and calls the parent and so on, chasing the calls up the tree we wind up at the ConsoleObject::initPersistFields() which does nothing.
As a matter of fact the only thing that appears to reference the field is :
[gregm@developer torque]$ find -type f -exec grep -li hasbitmaparray {} \;
./example/common/ui/defaultProfiles.cs
./example/common/ui/defaultProfiles.cs.dso
./example/demo/client/ui/customProfiles.cs
./example/demo/client/ui/defaultGameProfiles.cs
./example/demo/client/ui/customProfiles.cs.dso
./example/demo/client/ui/defaultGameProfiles.cs.dso
./example/starter.fps/client/ui/customProfiles.cs
./example/starter.fps/client/ui/defaultGameProfiles.cs
./example/starter.fps/client/ui/customProfiles.cs.dso
./example/starter.fps/client/ui/defaultGameProfiles.cs.dso
./example/starter.racing/client/ui/customProfiles.cs
./example/starter.racing/client/ui/defaultGameProfiles.cs
All script references.
So I'm confused :)
05/14/2004 (4:43 am)
Quote:
HasBitmapArray is in fact alive and well. Check out GuiControlProfile::computeBitmapArray() for some details and the check box control for an example.
Are you sure Ben?
---
[gregm@developer torque]$ find -type f -a -name \*.cc -exec grep -li computebitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.cc -exec grep -li hasbitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.h -exec grep -li hasbitmaparray {} \;
[gregm@developer torque]$ find -type f -a -name \*.h -exec grep -li computebitmaparray {} \;
---
I can't find that member or function anywhere. Maybe I'm misunderstanding that field. If the HasBitmapArray is set to false I can't seem to find where that makes any difference in the code. Or even where its checked/set.
If you notice I did the greping from the top of the torque dir and it was case insensitive so it should have found it if its there.
I also checked the documentation and didn't see either mentioned anywhere.
Would it be a persist field or is it a dynamic field?
If its a persist field its not getting added GuiControlProfile::initPersistFields() Adds a bunch (most of em) and calls the parent and so on, chasing the calls up the tree we wind up at the ConsoleObject::initPersistFields() which does nothing.
As a matter of fact the only thing that appears to reference the field is :
[gregm@developer torque]$ find -type f -exec grep -li hasbitmaparray {} \;
./example/common/ui/defaultProfiles.cs
./example/common/ui/defaultProfiles.cs.dso
./example/demo/client/ui/customProfiles.cs
./example/demo/client/ui/defaultGameProfiles.cs
./example/demo/client/ui/customProfiles.cs.dso
./example/demo/client/ui/defaultGameProfiles.cs.dso
./example/starter.fps/client/ui/customProfiles.cs
./example/starter.fps/client/ui/defaultGameProfiles.cs
./example/starter.fps/client/ui/customProfiles.cs.dso
./example/starter.fps/client/ui/defaultGameProfiles.cs.dso
./example/starter.racing/client/ui/customProfiles.cs
./example/starter.racing/client/ui/defaultGameProfiles.cs
All script references.
So I'm confused :)
#4
Anyway, at line 186 in gui/guitypes.cc there is code that you might be interested in.
05/14/2004 (5:06 am)
I have no idea what Ben is talking about. I have never ever seen that part before.Anyway, at line 186 in gui/guitypes.cc there is code that you might be interested in.
S32 GuiControlProfile::constructBitmapArray()
{
if(mBitmapArrayRects.size())
return mBitmapArrayRects.size();
GBitmap *bmp = mTextureHandle.getBitmap();
//get the separator color
ColorI sepColor;
if ( !bmp || !bmp->getColor( 0, 0, sepColor ) )
{
AssertFatal( false, "createBitmapArray - failed to get sepearator color!" );
return 0;
}
//now loop through all the scroll pieces, and find the bounding rectangle for each piece in each state
S32 curY = 0;
// ascertain the height of this row...
ColorI color;
mBitmapArrayRects.clear();
while(curY < bmp->getHeight())
{
// skip any sep colors
bmp->getColor( 0, curY, color);
if(color == sepColor)
{
curY++;
continue;
}
// ok, process left to right, grabbing bitmaps as we go...
S32 curX = 0;
while(curX < bmp->getWidth())
{
bmp->getColor(curX, curY, color);
if(color == sepColor)
{
curX++;
continue;
}
S32 startX = curX;
while(curX < bmp->getWidth())
{
bmp->getColor(curX, curY, color);
if(color == sepColor)
break;
curX++;
}
S32 stepY = curY;
while(stepY < bmp->getHeight())
{
bmp->getColor(startX, stepY, color);
if(color == sepColor)
break;
stepY++;
}
mBitmapArrayRects.push_back(RectI(startX, curY, curX - startX, stepY - curY));
}
// ok, now skip to the next seperation color on column 0
while(curY < bmp->getHeight())
{
bmp->getColor(0, curY, color);
if(color == sepColor)
break;
curY++;
}
}
return mBitmapArrayRects.size();
}
#5
I saw that function no-where in it does it consult the hasBitmapArray member of the profile..
For instance lets say you have the following profile:
See that 'hasBitmapArray = true;' try setting it to false. I'm thinking if you set that to false the border shouldn't be rendered with the bitmaparray? Or am I missing the point of that member?
05/14/2004 (5:31 am)
@StefanI saw that function no-where in it does it consult the hasBitmapArray member of the profile..
For instance lets say you have the following profile:
new GuiControlProfile ("ChatHudBorderProfile")
{
bitmap = "./chatHudBorderArray";
hasBitmapArray = true;
opaque = false;
};See that 'hasBitmapArray = true;' try setting it to false. I'm thinking if you set that to false the border shouldn't be rendered with the bitmaparray? Or am I missing the point of that member?
#6
-Uhm. On the other hand, the setting has no real defination in the code somehow.. just like you said.
I tried setting it to false and my profile got screwed up.
STILL, I can't see it in the code either.
05/14/2004 (5:53 am)
Yep, that's correct. If you put it to false, the bitmap border will not draw and it will use the normal border instead.-Uhm. On the other hand, the setting has no real defination in the code somehow.. just like you said.
I tried setting it to false and my profile got screwed up.
STILL, I can't see it in the code either.
#7
05/14/2004 (8:02 am)
Hence my quandry, it appears to work kinda sorta, but WHERE is it doing its stuff?
#8
05/18/2004 (5:03 am)
Anyone else have any clues where this magic happens?
#9
03/10/2005 (5:06 am)
I know it was an old thread, but exactly about what i was wondering today. Any new things about this magic field hasBitmapArray???
#10
08/18/2006 (9:56 am)
Bumpety bump for a new curiosity
#11
08/18/2006 (10:24 am)
It does nothing. You can delete it from your profiles without any problems.
Torque Owner Alex Swanson