Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into Preview4_0

This commit is contained in:
JeffR 2022-02-17 18:30:23 -06:00
commit 6a357d8dfb
1537 changed files with 173488 additions and 37732 deletions

View file

@ -128,8 +128,8 @@ GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
mUseStates = true;
setExtent( 140, 30 );
mMasked = false;
INIT_IMAGEASSET(Bitmap);
mColor = ColorI::WHITE;
INIT_ASSET(Bitmap);
}
//-----------------------------------------------------------------------------
@ -142,6 +142,7 @@ void GuiBitmapButtonCtrl::initPersistFields()
"If useStates is false, this will be the file that renders on the control. Otherwise, this will "
"specify the default texture name to which the various state and modifier suffixes are appended "
"to find the per-state and per-modifier (if enabled) textures.");
addField("color", TypeColorI, Offset(mColor, GuiBitmapButtonCtrl), "color mul");
addField( "bitmapMode", TYPEID< BitmapMode >(), Offset( mBitmapMode, GuiBitmapButtonCtrl ),
"Behavior for fitting the bitmap to the control extents.\n"
@ -232,32 +233,7 @@ void GuiBitmapButtonCtrl::inspectPostApply()
{
Parent::inspectPostApply();
Torque::Path path( mBitmapName );
const String& fileName = path.getFileName();
if( mUseStates )
{
// If the filename points to a single state, automatically
// cut off the state part. Makes it easy to select files in
// the editor without having to go in and manually cut off the
// state parts all the time.
static String s_n = "_n";
static String s_d = "_d";
static String s_h = "_h";
static String s_i = "_i";
if( fileName.endsWith( s_n )
|| fileName.endsWith( s_d )
|| fileName.endsWith( s_h )
|| fileName.endsWith( s_i ) )
{
path.setFileName( fileName.substr( 0, fileName.length() - 2 ) );
path.setExtension( String::EmptyString );
}
}
setBitmap( StringTable->insert(path.getFullPath().c_str()) );
setBitmap(getBitmap());
// if the extent is set to (0,0) in the gui editor and appy hit, this control will
// set it's extent to be exactly the size of the normal bitmap (if present)
@ -570,7 +546,8 @@ void GuiBitmapButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
void GuiBitmapButtonCtrl::renderButton( GFXTexHandle &texture, const Point2I &offset, const RectI& updateRect )
{
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->setBitmapModulation(mColor);
switch( mBitmapMode )
{
case BitmapStretched:
@ -668,4 +645,4 @@ bool GuiBitmapButtonCtrl::pointInControl(const Point2I& parentCoordPoint)
return Parent::pointInControl(parentCoordPoint);
}
DEF_IMAGEASSET_BINDS(GuiBitmapButtonCtrl, Bitmap);
DEF_ASSET_BINDS(GuiBitmapButtonCtrl, Bitmap);

View file

@ -119,13 +119,14 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
BitmapMode mBitmapMode;
DECLARE_IMAGEASSET(GuiBitmapButtonCtrl, Bitmap, onBitmapChange, GFXDefaultGUIProfile);
DECLARE_IMAGEASSET_SETGET(GuiBitmapButtonCtrl, Bitmap);
DECLARE_ASSET_SETGET(GuiBitmapButtonCtrl, Bitmap);
/// alpha masking
bool mMasked;
///
Textures mTextures[ NumModifiers ];
ColorI mColor;
virtual void renderButton( GFXTexHandle &texture, const Point2I& offset, const RectI& updateRect );
@ -157,7 +158,10 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
/// @}
void onBitmapChange() {}
void onBitmapChange()
{
setBitmap(getBitmap());
}
public:

View file

@ -85,7 +85,7 @@ ConsoleDocClass( GuiIconButtonCtrl,
GuiIconButtonCtrl::GuiIconButtonCtrl()
{
INIT_IMAGEASSET(Bitmap);
INIT_ASSET(Bitmap);
mTextLocation = TextLocLeft;
mIconLocation = IconLocLeft;
mTextMargin = 4;
@ -412,4 +412,4 @@ void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state)
}
}
DEF_IMAGEASSET_BINDS(GuiIconButtonCtrl, Bitmap);
DEF_ASSET_BINDS(GuiIconButtonCtrl, Bitmap);

View file

@ -42,8 +42,8 @@ private:
protected:
DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXTexturePersistentSRGBProfile);
DECLARE_IMAGEASSET_SETGET(GuiIconButtonCtrl, Bitmap);
DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
DECLARE_ASSET_SETGET(GuiIconButtonCtrl, Bitmap);
S32 mIconLocation;
S32 mTextLocation;

View file

@ -43,9 +43,9 @@ ConsoleDocClass( GuiToolboxButtonCtrl,
//-------------------------------------
GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
{
INIT_IMAGEASSET(NormalBitmap);
INIT_IMAGEASSET(LoweredBitmap);
INIT_IMAGEASSET(HoverBitmap);
INIT_ASSET(NormalBitmap);
INIT_ASSET(LoweredBitmap);
INIT_ASSET(HoverBitmap);
setMinExtent(Point2I(16,16));
setExtent(48, 48);
@ -193,6 +193,6 @@ void GuiToolboxButtonCtrl::renderButton(GFXTexHandle &texture, Point2I &offset,
}
}
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, NormalBitmap);
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, LoweredBitmap);
DEF_IMAGEASSET_BINDS(GuiToolboxButtonCtrl, HoverBitmap);
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, NormalBitmap);
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, LoweredBitmap);
DEF_ASSET_BINDS(GuiToolboxButtonCtrl, HoverBitmap);

View file

@ -39,12 +39,12 @@ private:
protected:
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXTexturePersistentSRGBProfile);
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, NormalBitmap);
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXTexturePersistentSRGBProfile);
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, LoweredBitmap);
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXTexturePersistentSRGBProfile);
DECLARE_IMAGEASSET_SETGET(GuiToolboxButtonCtrl, HoverBitmap);
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXDefaultGUIProfile);
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, NormalBitmap);
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXDefaultGUIProfile);
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, LoweredBitmap);
DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXDefaultGUIProfile);
DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, HoverBitmap);
void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect);
void renderStateRect( GFXTexHandle &texture, const RectI& rect );