mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into Preview4_0
This commit is contained in:
commit
6a357d8dfb
1537 changed files with 173488 additions and 37732 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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...
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ConsoleDocClass( GuiMaterialCtrl,
|
|||
GuiMaterialCtrl::GuiMaterialCtrl()
|
||||
: mMaterialInst( NULL )
|
||||
{
|
||||
INIT_MATERIALASSET(Material);
|
||||
INIT_ASSET(Material);
|
||||
}
|
||||
|
||||
void GuiMaterialCtrl::initPersistFields()
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ private:
|
|||
protected:
|
||||
|
||||
DECLARE_MATERIALASSET(GuiMaterialCtrl, Material);
|
||||
DECLARE_MATERIALASSET_SETGET(GuiMaterialCtrl, Material);
|
||||
DECLARE_ASSET_SETGET(GuiMaterialCtrl, Material);
|
||||
|
||||
BaseMatInstance *mMaterialInst;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -843,7 +843,11 @@ bool GuiControl::onWake()
|
|||
|
||||
//increment the profile
|
||||
mProfile->incLoadCount();
|
||||
mTooltipProfile->incLoadCount();
|
||||
|
||||
if (mTooltipProfile)
|
||||
{
|
||||
mTooltipProfile->incLoadCount();
|
||||
}
|
||||
|
||||
// Only invoke script callbacks if we have a namespace in which to do so
|
||||
// This will suppress warnings
|
||||
|
|
@ -869,7 +873,11 @@ void GuiControl::onSleep()
|
|||
|
||||
//decrement the profile reference
|
||||
mProfile->decLoadCount();
|
||||
mTooltipProfile->decLoadCount();
|
||||
|
||||
if (mTooltipProfile)
|
||||
{
|
||||
mTooltipProfile->decLoadCount();
|
||||
}
|
||||
|
||||
// Set Flag
|
||||
mAwake = false;
|
||||
|
|
@ -2898,7 +2906,7 @@ static ConsoleDocFragment _sGuiControlSetExtent2(
|
|||
"GuiControl", // The class to place the method in; use NULL for functions.
|
||||
"void setExtent( Point2I p );" ); // The definition string.
|
||||
|
||||
DefineEngineMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""),
|
||||
DefineEngineMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), ("", nullAsType<const char*>()),
|
||||
"( Point2I p | int x, int y ) Set the width and height of the control.\n\n"
|
||||
"@hide" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ GFX_ImplementTextureProfile(GFXGuiCursorProfile,
|
|||
GFX_ImplementTextureProfile(GFXDefaultGUIProfile,
|
||||
GFXTextureProfile::DiffuseMap,
|
||||
GFXTextureProfile::PreserveSize |
|
||||
GFXTextureProfile::Static | GFXTextureProfile::SRGB |
|
||||
GFXTextureProfile::Static | GFXTextureProfile::KeepBitmap | GFXTextureProfile::SRGB |
|
||||
GFXTextureProfile::NoPadding,
|
||||
GFXTextureProfile::NONE);
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ GuiCursor::GuiCursor()
|
|||
mRenderOffset.set(0.0f,0.0f);
|
||||
mExtent.set(1,1);
|
||||
|
||||
INIT_IMAGEASSET(Bitmap);
|
||||
INIT_ASSET(Bitmap);
|
||||
}
|
||||
|
||||
GuiCursor::~GuiCursor()
|
||||
|
|
@ -324,7 +324,7 @@ GuiControlProfile::GuiControlProfile(void) :
|
|||
mMouseOverSelected = false;
|
||||
|
||||
// bitmap members
|
||||
INIT_IMAGEASSET(Bitmap);
|
||||
INIT_ASSET(Bitmap);
|
||||
mUseBitmapArray = false;
|
||||
|
||||
mChildrenProfileName = NULL;
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ private:
|
|||
typedef SimObject Parent;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiCursor, Bitmap, onImageChanged, GFXGuiCursorProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiCursor, Bitmap);
|
||||
DECLARE_ASSET_SETGET(GuiCursor, Bitmap);
|
||||
|
||||
Point2I mHotSpot;
|
||||
Point2F mRenderOffset;
|
||||
|
|
@ -455,7 +455,7 @@ public:
|
|||
StringTableEntry mBitmapName;
|
||||
StringTableEntry mBitmapAssetId;
|
||||
AssetPtr<ImageAsset> mBitmapAsset;
|
||||
GFXTextureProfile* mBitmapProfile = &GFXTexturePersistentSRGBProfile;
|
||||
GFXTextureProfile* mBitmapProfile = &GFXDefaultGUIProfile;
|
||||
public:
|
||||
const StringTableEntry getBitmapFile() const { return mBitmapName; }
|
||||
void setBitmapFile(const FileName& _in) { mBitmapName = StringTable->insert(_in.c_str()); }
|
||||
|
|
@ -555,7 +555,7 @@ public:
|
|||
{
|
||||
return mBitmap;
|
||||
}
|
||||
DECLARE_IMAGEASSET_SETGET(GuiControlProfile, Bitmap);
|
||||
DECLARE_ASSET_SETGET(GuiControlProfile, Bitmap);
|
||||
|
||||
void onBitmapChanged() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,11 +314,13 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
|||
|
||||
String newValue = strData;
|
||||
S32 type= mField->type;
|
||||
ConsoleValue evaluationResult;
|
||||
if( type == TypeS8 || type == TypeS32 || type == TypeF32 )
|
||||
{
|
||||
char buffer[ 2048 ];
|
||||
expandEscape( buffer, newValue );
|
||||
newValue = (const char*)Con::evaluatef( "$f = \"%s\"; return ( %s );", oldValue.c_str(), buffer );
|
||||
evaluationResult = Con::evaluatef("$f = \"%s\"; return ( %s );", oldValue.c_str(), buffer);
|
||||
newValue = evaluationResult.getString();
|
||||
Con::evaluatef("$f=0;");
|
||||
}
|
||||
else if( type == TypeS32Vector
|
||||
|
|
@ -354,13 +356,13 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
|||
char buffer[ 2048 ];
|
||||
expandEscape( buffer, newComponentExpr );
|
||||
|
||||
const char* newComponentVal = Con::evaluatef( "$f = \"%s\"; $v = \"%s\"; return ( %s );",
|
||||
oldComponentVal, oldValue.c_str(), buffer );
|
||||
evaluationResult = Con::evaluatef("$f = \"%s\"; $v = \"%s\"; return ( %s );",
|
||||
oldComponentVal, oldValue.c_str(), buffer);
|
||||
Con::evaluatef("$f=0;$v=0;");
|
||||
|
||||
if( !isFirst )
|
||||
strNew.append( ' ' );
|
||||
strNew.append( newComponentVal );
|
||||
strNew.append( evaluationResult.getString() );
|
||||
|
||||
isFirst = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ GuiVariableInspector::GuiVariableInspector() : mAutoUpdate(true)
|
|||
|
||||
GuiVariableInspector::~GuiVariableInspector()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiVariableInspector);
|
||||
|
|
@ -75,7 +76,7 @@ void GuiVariableInspector::update()
|
|||
|
||||
for (U32 g = 0; g < mGroups.size(); g++)
|
||||
{
|
||||
if (mGroups[g]->getCaption().equal(mFields[i].mGroup))
|
||||
if (mGroups[g]->getCaption().equal(mFields[i]->mGroup))
|
||||
{
|
||||
group = static_cast<GuiInspectorVariableGroup*>(mGroups[g]);
|
||||
break;
|
||||
|
|
@ -89,14 +90,14 @@ void GuiVariableInspector::update()
|
|||
group->setHeaderHidden(false);
|
||||
group->setCanCollapse(true);
|
||||
group->mParent = this;
|
||||
group->setCaption(mFields[i].mGroup);
|
||||
group->setCaption(mFields[i]->mGroup);
|
||||
|
||||
group->registerObject();
|
||||
mGroups.push_back(group);
|
||||
addObject(group);
|
||||
}
|
||||
|
||||
group->addField(&mFields[i]);
|
||||
|
||||
group->addField(mFields[i]);
|
||||
}
|
||||
|
||||
//And now, cue our update for the groups themselves
|
||||
|
|
@ -148,26 +149,26 @@ void GuiVariableInspector::setGroupsExpanded(bool isExpanded)
|
|||
void GuiVariableInspector::addField(const char* name, const char* label, const char* typeName, const char* description,
|
||||
const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj)
|
||||
{
|
||||
VariableField newField;
|
||||
newField.mFieldName = StringTable->insert(name);
|
||||
newField.mFieldLabel = StringTable->insert(label, true);
|
||||
newField.mFieldTypeName = StringTable->insert(typeName);
|
||||
newField.mFieldDescription = StringTable->insert(description);
|
||||
newField.mDefaultValue = StringTable->insert(defaultValue);
|
||||
newField.mDataValues = String(dataValues);
|
||||
newField.mGroup = mCurrentGroup;
|
||||
newField.mSetCallbackName = StringTable->insert(callbackName);
|
||||
newField.mEnabled = true;
|
||||
VariableField* newField = new VariableField;
|
||||
newField->mFieldName = StringTable->insert(name);
|
||||
newField->mFieldLabel = StringTable->insert(label, true);
|
||||
newField->mFieldTypeName = StringTable->insert(typeName);
|
||||
newField->mFieldDescription = StringTable->insert(description);
|
||||
newField->mDefaultValue = StringTable->insert(defaultValue);
|
||||
newField->mDataValues = String(dataValues);
|
||||
newField->mGroup = mCurrentGroup;
|
||||
newField->mSetCallbackName = StringTable->insert(callbackName);
|
||||
newField->mEnabled = true;
|
||||
|
||||
newField.mOwnerObject = ownerObj;
|
||||
newField->mOwnerObject = ownerObj;
|
||||
|
||||
//establish the field on the ownerObject(if we have one)
|
||||
//This way, we can let the field hook into the object's field and modify it when changed
|
||||
if (newField.mOwnerObject != nullptr)
|
||||
if (newField->mOwnerObject != nullptr)
|
||||
{
|
||||
if (!newField.mOwnerObject->isField(newField.mFieldName))
|
||||
if (!newField->mOwnerObject->isField(newField->mFieldName))
|
||||
{
|
||||
newField.mOwnerObject->setDataField(newField.mFieldName, NULL, newField.mDefaultValue);
|
||||
newField->mOwnerObject->setDataField(newField->mFieldName, NULL, newField->mDefaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,40 +176,40 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c
|
|||
//find the field type
|
||||
S32 fieldTypeMask = -1;
|
||||
|
||||
if (newField.mFieldTypeName == StringTable->insert("int"))
|
||||
if (newField->mFieldTypeName == StringTable->insert("int"))
|
||||
fieldTypeMask = TypeS32;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("float"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("float"))
|
||||
fieldTypeMask = TypeF32;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("vector"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("vector"))
|
||||
fieldTypeMask = TypePoint3F;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("vector2"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("vector2"))
|
||||
fieldTypeMask = TypePoint2F;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("material"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("material"))
|
||||
fieldTypeMask = TypeMaterialAssetId;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("image"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("image"))
|
||||
fieldTypeMask = TypeImageAssetId;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("shape"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("shape"))
|
||||
fieldTypeMask = TypeShapeAssetId;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("bool"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("bool"))
|
||||
fieldTypeMask = TypeBool;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("object"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("object"))
|
||||
fieldTypeMask = TypeSimObjectPtr;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("string"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("string"))
|
||||
fieldTypeMask = TypeString;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("colorI"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("colorI"))
|
||||
fieldTypeMask = TypeColorI;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("colorF"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("colorF"))
|
||||
fieldTypeMask = TypeColorF;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("ease"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("ease"))
|
||||
fieldTypeMask = TypeEaseF;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("command"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("command"))
|
||||
fieldTypeMask = TypeCommand;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("filename"))
|
||||
else if (newField->mFieldTypeName == StringTable->insert("filename"))
|
||||
fieldTypeMask = TypeStringFilename;
|
||||
else
|
||||
fieldTypeMask = -1;
|
||||
|
||||
newField.mFieldType = fieldTypeMask;
|
||||
newField->mFieldType = fieldTypeMask;
|
||||
//
|
||||
|
||||
mFields.push_back(newField);
|
||||
|
|
@ -226,6 +227,13 @@ void GuiVariableInspector::addCallbackField(const char* name, const char* label,
|
|||
void GuiVariableInspector::clearFields()
|
||||
{
|
||||
mGroups.clear();
|
||||
|
||||
// Before clearing the fields, dealloc the memory first
|
||||
for (U32 iteration = 0; iteration < mFields.size(); ++iteration)
|
||||
{
|
||||
delete mFields[iteration];
|
||||
}
|
||||
|
||||
mFields.clear();
|
||||
clear();
|
||||
|
||||
|
|
@ -237,9 +245,9 @@ void GuiVariableInspector::setFieldEnabled(const char* name, bool enabled)
|
|||
String fieldName = name;
|
||||
for (U32 i = 0; i < mFields.size(); i++)
|
||||
{
|
||||
if (fieldName.equal(mFields[i].mFieldName, String::NoCase))
|
||||
if (fieldName.equal(mFields[i]->mFieldName, String::NoCase))
|
||||
{
|
||||
mFields[i].mEnabled = enabled;
|
||||
mFields[i]->mEnabled = enabled;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
protected:
|
||||
|
||||
Vector<VariableField> mFields;
|
||||
Vector<VariableField*> mFields;
|
||||
|
||||
String mCurrentGroup;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ DefineEngineMethod( GuiChunkedBitmapCtrl, setBitmap, void, (const char* filename
|
|||
|
||||
GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl()
|
||||
{
|
||||
INIT_IMAGEASSET(Bitmap);
|
||||
INIT_ASSET(Bitmap);
|
||||
|
||||
mUseVariable = false;
|
||||
mTile = false;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ private:
|
|||
protected:
|
||||
|
||||
DECLARE_IMAGEASSET(GuiChunkedBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiChunkedBitmapCtrl, Bitmap);
|
||||
DECLARE_ASSET_SETGET(GuiChunkedBitmapCtrl, Bitmap);
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ GuiProgressBitmapCtrl::GuiProgressBitmapCtrl()
|
|||
mNumberOfBitmaps(0),
|
||||
mDim(0)
|
||||
{
|
||||
INIT_IMAGEASSET(Bitmap);
|
||||
INIT_ASSET(Bitmap);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class GuiProgressBitmapCtrl : public GuiTextCtrl
|
|||
F32 mProgress;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiProgressBitmapCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiProgressBitmapCtrl, Bitmap);
|
||||
DECLARE_ASSET_SETGET(GuiProgressBitmapCtrl, Bitmap);
|
||||
|
||||
bool mUseVariable;
|
||||
bool mTile;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/simBase.h"
|
||||
|
||||
#include "gui/core/guiTypes.h"
|
||||
|
||||
EditorIconRegistry gEditorIcons;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
|
|||
String defaultIconFile = path + "default";
|
||||
|
||||
mDefaultIcon.set( defaultIconFile,
|
||||
&GFXTexturePersistentSRGBProfile,
|
||||
&GFXDefaultGUIProfile,
|
||||
avar("%s() - mIcons[] (line %d)",
|
||||
__FUNCTION__, __LINE__) );
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite )
|
|||
void EditorIconRegistry::add( const String &className, const String &imageFile, bool overwrite )
|
||||
{
|
||||
// First see if we can load the image.
|
||||
GFXTexHandle icon( imageFile, &GFXTexturePersistentSRGBProfile,
|
||||
GFXTexHandle icon( imageFile, &GFXDefaultGUIProfile,
|
||||
avar("%s() - mIcons[] (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( icon.isNull() )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ ConsoleDocClass( GuiMissionAreaCtrl,
|
|||
|
||||
GuiMissionAreaCtrl::GuiMissionAreaCtrl()
|
||||
{
|
||||
INIT_IMAGEASSET(HandleBitmap);
|
||||
INIT_ASSET(HandleBitmap);
|
||||
|
||||
mHandleTextureSize = Point2I::Zero;
|
||||
mHandleTextureHalfSize = Point2F::Zero;
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ protected:
|
|||
GFXStateBlockRef mBlendStateBlock;
|
||||
GFXStateBlockRef mSolidStateBlock;
|
||||
|
||||
DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXTexturePersistentSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap);
|
||||
DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXDefaultGUIProfile);
|
||||
DECLARE_ASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap);
|
||||
|
||||
Point2I mHandleTextureSize;
|
||||
Point2F mHandleTextureHalfSize;
|
||||
|
|
|
|||
|
|
@ -329,11 +329,11 @@ class WorldEditor : public EditTSCtrl
|
|||
ColorI mPopupTextColor;
|
||||
|
||||
DECLARE_IMAGEASSET(WorldEditor, SelectHandle, onSelectHandleChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(WorldEditor, SelectHandle);
|
||||
DECLARE_ASSET_SETGET(WorldEditor, SelectHandle);
|
||||
DECLARE_IMAGEASSET(WorldEditor, DefaultHandle, onDefaultHandleChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(WorldEditor, DefaultHandle);
|
||||
DECLARE_ASSET_SETGET(WorldEditor, DefaultHandle);
|
||||
DECLARE_IMAGEASSET(WorldEditor, LockedHandle, onLockedHandleChanged, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_IMAGEASSET_SETGET(WorldEditor, LockedHandle);
|
||||
DECLARE_ASSET_SETGET(WorldEditor, LockedHandle);
|
||||
|
||||
ColorI mObjectTextColor;
|
||||
bool mObjectsUseBoxCenter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue