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

@ -58,9 +58,10 @@ ConsoleDocClass( GuiBitmapCtrl,
GuiBitmapCtrl::GuiBitmapCtrl(void)
: mStartPoint( 0, 0 ),
mColor(ColorI::WHITE),
mAngle(0),
mWrap( false )
{
INIT_IMAGEASSET(Bitmap);
INIT_ASSET(Bitmap);
}
bool GuiBitmapCtrl::setBitmapName( void *object, const char *index, const char *data )
@ -83,6 +84,8 @@ void GuiBitmapCtrl::initPersistFields()
addField("color", TypeColorI, Offset(mColor, GuiBitmapCtrl),"color mul");
addField( "wrap", TypeBool, Offset( mWrap, GuiBitmapCtrl ),
"If true, the bitmap is tiled inside the control rather than stretched to fit." );
addField("angle", TypeF32, Offset(mAngle, GuiBitmapCtrl), "rotation");
endGroup( "Bitmap" );
@ -95,7 +98,8 @@ bool GuiBitmapCtrl::onWake()
return false;
setActive(true);
setBitmap(getBitmap());
if (mBitmapName != StringTable->insert("texhandle"))
setBitmap(getBitmap());
return true;
}
@ -149,7 +153,7 @@ void GuiBitmapCtrl::setBitmapHandle(GFXTexHandle handle, bool resize)
{
mBitmap = handle;
mBitmapName = String("texhandle");
mBitmapName = StringTable->insert("texhandle");
// Resize the control to fit the bitmap
if (resize)
@ -187,14 +191,14 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
((texture->mBitmapSize.y*y)+offset.y)-yshift,
texture->mBitmapSize.x,
texture->mBitmapSize.y);
GFX->getDrawUtil()->drawBitmapStretchSR(texture,dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear);
GFX->getDrawUtil()->drawBitmapStretchSR(texture, dstRegion, srcRegion, GFXBitmapFlip_None, GFXTextureFilterLinear, mAngle);
}
}
else
{
RectI rect(offset, getExtent());
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false);
GFX->getDrawUtil()->drawBitmapStretch(mBitmap, rect, GFXBitmapFlip_None, GFXTextureFilterLinear, false, mAngle);
}
}

View file

@ -40,11 +40,12 @@ class GuiBitmapCtrl : public GuiControl
/// Name of the bitmap file. If this is 'texhandle' the bitmap is not loaded
/// from a file but rather set explicitly on the control.
DECLARE_IMAGEASSET(GuiBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
DECLARE_IMAGEASSET_SETGET(GuiBitmapCtrl, Bitmap);
DECLARE_ASSET_SETGET(GuiBitmapCtrl, Bitmap);
Point2I mStartPoint;
ColorI mColor;
F32 mAngle;
/// If true, bitmap tiles inside control. Otherwise stretches.
bool mWrap;

View file

@ -543,7 +543,8 @@ Point2I GuiGameListMenuCtrl::getMinExtent() const
{
Point2I parentMin = Parent::getMinExtent();
GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile;
GuiGameListMenuProfile * profile = dynamic_cast<GuiGameListMenuProfile*>(mProfile);
AssertFatal(profile, "Invalid profile for GuiGameListMenuCtrl!");
S32 minHeight = 0;
S32 rowHeight = profile->getRowHeight();
@ -632,10 +633,13 @@ void GuiGameListMenuCtrl::enforceConstraints()
void GuiGameListMenuCtrl::updateHeight()
{
S32 minHeight = getMinExtent().y;
if (getHeight() < minHeight)
if (hasValidProfile())
{
setHeight(minHeight);
S32 minHeight = getMinExtent().y;
if (getHeight() < minHeight)
{
setHeight(minHeight);
}
}
}

View file

@ -268,7 +268,7 @@ GuiMLTextCtrl::GuiMLTextCtrl()
{
mActive = true;
//mInitialText = StringTable->EmptyString();
Sim::findObject("InputDeniedSound", mDeniedSound);
INIT_ASSET(DeniedSound);
}
//--------------------------------------------------------------------------
@ -290,7 +290,7 @@ void GuiMLTextCtrl::initPersistFields()
addField("lineSpacing", TypeS32, Offset(mLineSpacingPixels, GuiMLTextCtrl), "The number of blank pixels to place between each line.\n");
addField("allowColorChars", TypeBool, Offset(mAllowColorChars, GuiMLTextCtrl), "If true, the control will allow characters to have unique colors.");
addField("maxChars", TypeS32, Offset(mMaxBufferSize, GuiMLTextCtrl), "Maximum number of characters that the control will display.");
addField("deniedSound", TypeSFXTrackName, Offset(mDeniedSound, GuiMLTextCtrl), "If the text will not fit in the control, the deniedSound is played.");
INITPERSISTFIELD_SOUNDASSET(DeniedSound, GuiMLTextCtrl, "If the text will not fit in the control, the deniedSound is played.");
addField("text", TypeCaseString, Offset( mInitialText, GuiMLTextCtrl ), "Text to display in this control.");
addField("useURLMouseCursor", TypeBool, Offset(mUseURLMouseCursor, GuiMLTextCtrl), "If true, the mouse cursor will turn into a hand cursor while over a link in the text.\n"
"This is dependant on the markup language used by the GuiMLTextCtrl\n");
@ -323,6 +323,9 @@ bool GuiMLTextCtrl::onAdd()
if (!mTextBuffer.length() && mInitialText[0] != 0)
setText(mInitialText, dStrlen(mInitialText)+1);
_setDeniedSound(getDeniedSound());
return true;
}
@ -917,8 +920,8 @@ void GuiMLTextCtrl::insertChars(const char* inputChars,
if (numCharsToInsert <= 0)
{
// Play the "Denied" sound:
if ( numInputChars > 0 && mDeniedSound )
SFX->playOnce(mDeniedSound);
if ( numInputChars > 0 && getDeniedSoundProfile())
SFX->playOnce(getDeniedSoundProfile());
return;
}

View file

@ -31,6 +31,10 @@
#include "core/stringBuffer.h"
#endif
#ifndef SOUND_ASSET_H
#include "T3D/assets/SoundAsset.h"
#endif
class GFont;
class SFXTrack;
@ -258,8 +262,8 @@ class GuiMLTextCtrl : public GuiControl
bool mUseURLMouseCursor;
// Too many chars sound:
SFXTrack* mDeniedSound;
DECLARE_SOUNDASSET(GuiMLTextCtrl, DeniedSound);
DECLARE_ASSET_SETGET(GuiMLTextCtrl, DeniedSound);
//-------------------------------------- Protected interface
protected:
// Inserting and deleting character blocks...

View file

@ -45,7 +45,7 @@ ConsoleDocClass( GuiMaterialCtrl,
GuiMaterialCtrl::GuiMaterialCtrl()
: mMaterialInst( NULL )
{
INIT_MATERIALASSET(Material);
INIT_ASSET(Material);
}
void GuiMaterialCtrl::initPersistFields()

View file

@ -41,7 +41,7 @@ private:
protected:
DECLARE_MATERIALASSET(GuiMaterialCtrl, Material);
DECLARE_MATERIALASSET_SETGET(GuiMaterialCtrl, Material);
DECLARE_ASSET_SETGET(GuiMaterialCtrl, Material);
BaseMatInstance *mMaterialInst;

View file

@ -278,8 +278,8 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void)
mBackgroundCancel = false; // Added
mReverseTextList = false; // Added - Don't reverse text list if displaying up
INIT_IMAGEASSET_ARRAY(Bitmap, 0);
INIT_IMAGEASSET_ARRAY(Bitmap, 1);
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 0);
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 1);
mBitmapBounds.set(16, 16); // Added
mIdMax = -1;

View file

@ -126,7 +126,7 @@ protected:
NumBitmapModes = 2
};
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, GFXDefaultGUIProfile, NumBitmapModes);
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes);
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap);
Point2I mBitmapBounds; // Added

View file

@ -329,8 +329,8 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void)
mBackgroundCancel = false; // Added
mReverseTextList = false; // Added - Don't reverse text list if displaying up
INIT_IMAGEASSET_ARRAY(Bitmap, Normal);
INIT_IMAGEASSET_ARRAY(Bitmap, Depressed);
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Normal);
INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Depressed);
mBitmapBounds.set(16, 16); // Added
mHotTrackItems = false;

View file

@ -127,7 +127,7 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl
NumBitmapModes = 2
};
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, GFXDefaultGUIProfile, NumBitmapModes);
DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes);
DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap);
Point2I mBitmapBounds; // Added

View file

@ -1880,7 +1880,7 @@ bool GuiTreeViewCtrl::buildIconTable(const char * icons)
dStrncpy( buf, start, getMin( sizeof( buf ) / sizeof( buf[ 0 ] ) - 1, len ) );
buf[ len ] = '\0';
mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXTexturePersistentProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) );
mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXDefaultGUIProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) );
}
else
mIconTable[ numIcons ] = GFXTexHandle();