mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Changes for BaseUI Update
This commit is contained in:
parent
90951b3cc8
commit
ed36cf2c5c
20 changed files with 156 additions and 45 deletions
|
|
@ -319,6 +319,12 @@ U32 MaterialAsset::getAssetByMaterialName(StringTableEntry matName, AssetPtr<Mat
|
||||||
AssetDatabase.releaseAsset(query.mAssetList[i]); //cleanup if that's not the one we needed
|
AssetDatabase.releaseAsset(query.mAssetList[i]); //cleanup if that's not the one we needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Somehow we failed to bind an asset, so just use the fallback and mark the failure
|
||||||
|
matAsset->setAssetId(MaterialAsset::smNoMaterialAssetFallback);
|
||||||
|
(*matAsset)->mLoadedState = AssetErrCode::UsingFallback;
|
||||||
|
return AssetErrCode::UsingFallback;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTableEntry MaterialAsset::getAssetIdByMaterialName(StringTableEntry matName)
|
StringTableEntry MaterialAsset::getAssetIdByMaterialName(StringTableEntry matName)
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,9 @@ AssetImportConfig::AssetImportConfig() :
|
||||||
importSounds(true),
|
importSounds(true),
|
||||||
VolumeAdjust(false),
|
VolumeAdjust(false),
|
||||||
PitchAdjust(false),
|
PitchAdjust(false),
|
||||||
SoundsCompressed(false)
|
SoundsCompressed(false),
|
||||||
|
AlwaysAddSoundSuffix(false),
|
||||||
|
AddedSoundSuffix("_sound")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,6 +318,8 @@ void AssetImportConfig::loadImportConfig(Settings* configSettings, String config
|
||||||
VolumeAdjust = dAtof(configSettings->value(String(configName + "/Sounds/VolumeAdjust").c_str()));
|
VolumeAdjust = dAtof(configSettings->value(String(configName + "/Sounds/VolumeAdjust").c_str()));
|
||||||
PitchAdjust = dAtof(configSettings->value(String(configName + "/Sounds/PitchAdjust").c_str()));
|
PitchAdjust = dAtof(configSettings->value(String(configName + "/Sounds/PitchAdjust").c_str()));
|
||||||
SoundsCompressed = dAtob(configSettings->value(String(configName + "/Sounds/Compressed").c_str()));
|
SoundsCompressed = dAtob(configSettings->value(String(configName + "/Sounds/Compressed").c_str()));
|
||||||
|
AlwaysAddSoundSuffix = dAtob(configSettings->value(String(configName + "/Sounds/AlwaysAddSoundSuffix").c_str()));
|
||||||
|
AddedSoundSuffix = configSettings->value(String(configName + "/Sounds/AddedSoundSuffix").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetImportConfig::CopyTo(AssetImportConfig* target) const
|
void AssetImportConfig::CopyTo(AssetImportConfig* target) const
|
||||||
|
|
@ -406,6 +410,8 @@ void AssetImportConfig::CopyTo(AssetImportConfig* target) const
|
||||||
target->VolumeAdjust = VolumeAdjust;
|
target->VolumeAdjust = VolumeAdjust;
|
||||||
target->PitchAdjust = PitchAdjust;
|
target->PitchAdjust = PitchAdjust;
|
||||||
target->SoundsCompressed = SoundsCompressed;
|
target->SoundsCompressed = SoundsCompressed;
|
||||||
|
target->AlwaysAddSoundSuffix = AlwaysAddSoundSuffix;
|
||||||
|
target->AddedSoundSuffix = AddedSoundSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleDocClass(AssetImportObject,
|
ConsoleDocClass(AssetImportObject,
|
||||||
|
|
@ -607,6 +613,7 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
||||||
assetName.replace('*', '_');
|
assetName.replace('*', '_');
|
||||||
assetName.replace('-', '_');
|
assetName.replace('-', '_');
|
||||||
assetName.replace('+', '_');
|
assetName.replace('+', '_');
|
||||||
|
assetName.replace('&', '_');
|
||||||
|
|
||||||
assetImportObj->assetType = assetType;
|
assetImportObj->assetType = assetType;
|
||||||
assetImportObj->filePath = filePath;
|
assetImportObj->filePath = filePath;
|
||||||
|
|
@ -622,6 +629,14 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
|
||||||
assetImportObj->importStatus = AssetImportObject::NotProcessed;
|
assetImportObj->importStatus = AssetImportObject::NotProcessed;
|
||||||
assetImportObj->generatedAsset = false;
|
assetImportObj->generatedAsset = false;
|
||||||
|
|
||||||
|
//If the config is marked to always set the directory prefix, do that now
|
||||||
|
if (activeImportConfig->AddDirectoryPrefixToAssetName)
|
||||||
|
{
|
||||||
|
assetName = getFolderPrefixedName(assetImportObj);
|
||||||
|
assetImportObj->assetName = assetName;
|
||||||
|
assetImportObj->cleanAssetName = assetName;
|
||||||
|
}
|
||||||
|
|
||||||
if (parentItem != nullptr)
|
if (parentItem != nullptr)
|
||||||
{
|
{
|
||||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Added Child Importing Asset to %s", parentItem->assetName.c_str());
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Added Child Importing Asset to %s", parentItem->assetName.c_str());
|
||||||
|
|
@ -1976,6 +1991,12 @@ void AssetImporter::processSoundAsset(AssetImportObject* assetItem)
|
||||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Preparing Sound for Import: %s", assetItem->assetName.c_str());
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Preparing Sound for Import: %s", assetItem->assetName.c_str());
|
||||||
activityLog.push_back(importLogBuffer);
|
activityLog.push_back(importLogBuffer);
|
||||||
|
|
||||||
|
if (activeImportConfig->AlwaysAddSoundSuffix)
|
||||||
|
{
|
||||||
|
assetItem->assetName += activeImportConfig->AddedSoundSuffix;
|
||||||
|
assetItem->cleanAssetName = assetItem->assetName;
|
||||||
|
}
|
||||||
|
|
||||||
assetItem->importStatus = AssetImportObject::Processed;
|
assetItem->importStatus = AssetImportObject::Processed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2165,7 +2186,49 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
||||||
{
|
{
|
||||||
//Set trailing number
|
//Set trailing number
|
||||||
String renamedAssetName = assetItem->assetName;
|
String renamedAssetName = assetItem->assetName;
|
||||||
renamedAssetName = Sim::getUniqueName(renamedAssetName.c_str());
|
String renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||||
|
|
||||||
|
String addedSuffix;
|
||||||
|
|
||||||
|
if (assetItem->assetType == String("ShapeAsset"))
|
||||||
|
addedSuffix = activeImportConfig->AddedShapeSuffix;
|
||||||
|
else if (assetItem->assetType == String("MaterialAsset"))
|
||||||
|
addedSuffix = activeImportConfig->AddedMaterialSuffix;
|
||||||
|
else if (assetItem->assetType == String("ImageAsset"))
|
||||||
|
addedSuffix = activeImportConfig->AddedImageSuffix;
|
||||||
|
else if (assetItem->assetType == String("SoundAsset"))
|
||||||
|
addedSuffix = activeImportConfig->AddedSoundSuffix;
|
||||||
|
|
||||||
|
//do the suffix if it isn't already on it
|
||||||
|
if (!renamedAssetName.endsWith(addedSuffix.c_str()))
|
||||||
|
{
|
||||||
|
renamedAssetName += addedSuffix;
|
||||||
|
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||||
|
assetItem->assetName = renamedAssetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if still conflicted
|
||||||
|
//add the directory prefix
|
||||||
|
if (AssetDatabase.isDeclaredAsset(renamedAssetId.c_str()))
|
||||||
|
{
|
||||||
|
renamedAssetName = getFolderPrefixedName(assetItem);
|
||||||
|
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName;
|
||||||
|
assetItem->assetName = renamedAssetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool appendedNumber = false;
|
||||||
|
U32 uniqueNumber = 0;
|
||||||
|
while (AssetDatabase.isDeclaredAsset(renamedAssetId.c_str()))
|
||||||
|
{
|
||||||
|
uniqueNumber++;
|
||||||
|
renamedAssetId = assetItem->moduleName + ":" + renamedAssetName + String::ToString(uniqueNumber);
|
||||||
|
appendedNumber = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appendedNumber)
|
||||||
|
{
|
||||||
|
renamedAssetName += String::ToString(uniqueNumber);
|
||||||
|
}
|
||||||
|
|
||||||
//Log it's renaming
|
//Log it's renaming
|
||||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
||||||
|
|
@ -2186,25 +2249,7 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
|
||||||
}
|
}
|
||||||
else if (activeImportConfig->DuplicateAutoResolution == String("FolderPrefix"))
|
else if (activeImportConfig->DuplicateAutoResolution == String("FolderPrefix"))
|
||||||
{
|
{
|
||||||
String renamedAssetName = assetItem->assetName;
|
String renamedAssetName = getFolderPrefixedName(assetItem);
|
||||||
|
|
||||||
//Set trailing number
|
|
||||||
S32 dirIndex = assetItem->filePath.getDirectoryCount() - 1;
|
|
||||||
while (dirIndex > -1)
|
|
||||||
{
|
|
||||||
renamedAssetName = assetItem->assetName;
|
|
||||||
String owningFolder = assetItem->filePath.getDirectory(dirIndex);
|
|
||||||
|
|
||||||
renamedAssetName = owningFolder + "_" + renamedAssetName;
|
|
||||||
|
|
||||||
if (AssetDatabase.isDeclaredAsset(renamedAssetName))
|
|
||||||
{
|
|
||||||
dirIndex--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Log it's renaming
|
//Log it's renaming
|
||||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,15 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool SoundsCompressed;
|
bool SoundsCompressed;
|
||||||
|
|
||||||
|
/// When importing an image, this indicates if it should automatically add a standard suffix onto the name
|
||||||
|
/// </summary>
|
||||||
|
bool AlwaysAddSoundSuffix;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If AlwaysAddSoundSuffix is on, this is the suffix to be added
|
||||||
|
/// </summary>
|
||||||
|
String AddedSoundSuffix;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AssetImportConfig();
|
AssetImportConfig();
|
||||||
virtual ~AssetImportConfig();
|
virtual ~AssetImportConfig();
|
||||||
|
|
@ -934,4 +943,27 @@ public:
|
||||||
//
|
//
|
||||||
void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
|
void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
|
||||||
const String& getTargetModuleId() { return targetModuleId; }
|
const String& getTargetModuleId() { return targetModuleId; }
|
||||||
|
|
||||||
|
String getFolderPrefixedName(AssetImportObject* assetItem)
|
||||||
|
{
|
||||||
|
String renamedAssetName = assetItem->assetName;
|
||||||
|
S32 dirIndex = assetItem->filePath.getDirectoryCount() - 1;
|
||||||
|
while (dirIndex > -1)
|
||||||
|
{
|
||||||
|
renamedAssetName = assetItem->assetName;
|
||||||
|
String owningFolder = assetItem->filePath.getDirectory(dirIndex);
|
||||||
|
|
||||||
|
renamedAssetName = owningFolder + "_" + renamedAssetName;
|
||||||
|
|
||||||
|
if (AssetDatabase.isDeclaredAsset(renamedAssetName))
|
||||||
|
{
|
||||||
|
dirIndex--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return renamedAssetName;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ void VEditorButton::onRender( Point2I offset, const RectI& updateRect )
|
||||||
{
|
{
|
||||||
RectI boundsRect( offset, getExtent() );
|
RectI boundsRect( offset, getExtent() );
|
||||||
|
|
||||||
if ( mDepressed || mStateOn || mMouseOver )
|
if ( mDepressed || mStateOn || mHighlighted )
|
||||||
{
|
{
|
||||||
renderFilledBorder( boundsRect, mProfile->mBorderColorHL, mProfile->mFillColorHL );
|
renderFilledBorder( boundsRect, mProfile->mBorderColorHL, mProfile->mFillColorHL );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ void afxSpellButton::onRender(Point2I offset, const RectI& updateRect)
|
||||||
|
|
||||||
if (mActive)
|
if (mActive)
|
||||||
{
|
{
|
||||||
if (mMouseOver) state = HILIGHT;
|
if (mHighlighted) state = HILIGHT;
|
||||||
if (mDepressed || mStateOn) state = DEPRESSED;
|
if (mDepressed || mStateOn) state = DEPRESSED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void SimNameDictionary::insert(SimObject* obj)
|
||||||
SimObject* checkForDup = find(obj->getName());
|
SimObject* checkForDup = find(obj->getName());
|
||||||
|
|
||||||
if (checkForDup)
|
if (checkForDup)
|
||||||
Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->getName());
|
Con::warnf("Warning! You have a duplicate object name of %s. This can cause problems. You should rename one of them.", obj->getName());
|
||||||
|
|
||||||
Mutex::lockMutex(mutex);
|
Mutex::lockMutex(mutex);
|
||||||
#ifndef USE_NEW_SIMDICTIONARY
|
#ifndef USE_NEW_SIMDICTIONARY
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl
|
||||||
if( mActive )
|
if( mActive )
|
||||||
{
|
{
|
||||||
if( mDepressed || mStateOn ) return DEPRESSED;
|
if( mDepressed || mStateOn ) return DEPRESSED;
|
||||||
if( mMouseOver ) return HILIGHT;
|
if( mHighlighted ) return HILIGHT;
|
||||||
return NORMAL;
|
return NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ void GuiBorderButtonCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mMouseOver )
|
if ( mHighlighted )
|
||||||
{
|
{
|
||||||
RectI bounds( offset, getExtent() );
|
RectI bounds( offset, getExtent() );
|
||||||
for ( S32 i=0; i < mProfile->mBorderThickness; i++ )
|
for ( S32 i=0; i < mProfile->mBorderThickness; i++ )
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ EndImplementEnumType;
|
||||||
GuiButtonBaseCtrl::GuiButtonBaseCtrl()
|
GuiButtonBaseCtrl::GuiButtonBaseCtrl()
|
||||||
{
|
{
|
||||||
mDepressed = false;
|
mDepressed = false;
|
||||||
mMouseOver = false;
|
mHighlighted = false;
|
||||||
mActive = true;
|
mActive = true;
|
||||||
static StringTableEntry sButton = StringTable->insert( "Button" );
|
static StringTableEntry sButton = StringTable->insert( "Button" );
|
||||||
mButtonText = sButton;
|
mButtonText = sButton;
|
||||||
|
|
@ -288,14 +288,14 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
|
||||||
if(isMouseLocked())
|
if(isMouseLocked())
|
||||||
{
|
{
|
||||||
mDepressed = true;
|
mDepressed = true;
|
||||||
mMouseOver = true;
|
mHighlighted = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( mActive && mProfile->mSoundButtonOver )
|
if ( mActive && mProfile->mSoundButtonOver )
|
||||||
SFX->playOnce(mProfile->mSoundButtonOver);
|
SFX->playOnce(mProfile->mSoundButtonOver);
|
||||||
|
|
||||||
mMouseOver = true;
|
mHighlighted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,7 +309,7 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)
|
||||||
onMouseLeave_callback();
|
onMouseLeave_callback();
|
||||||
if( isMouseLocked() )
|
if( isMouseLocked() )
|
||||||
mDepressed = false;
|
mDepressed = false;
|
||||||
mMouseOver = false;
|
mHighlighted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -542,3 +542,17 @@ DefineEngineMethod( GuiButtonBaseCtrl, resetState, void, (),,
|
||||||
{
|
{
|
||||||
object->resetState();
|
object->resetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiButtonBaseCtrl, setHighlighted, void, (bool highlighted), (false),
|
||||||
|
"Reset the mousing state of the button.\n\n"
|
||||||
|
"This method should not generally be called.")
|
||||||
|
{
|
||||||
|
object->setHighlighted(highlighted);
|
||||||
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiButtonBaseCtrl, isHighlighted, bool, (),,
|
||||||
|
"Reset the mousing state of the button.\n\n"
|
||||||
|
"This method should not generally be called.")
|
||||||
|
{
|
||||||
|
return object->isHighlighted();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class GuiButtonBaseCtrl : public GuiControl
|
||||||
StringTableEntry mButtonText;
|
StringTableEntry mButtonText;
|
||||||
StringTableEntry mButtonTextID;
|
StringTableEntry mButtonTextID;
|
||||||
bool mDepressed;
|
bool mDepressed;
|
||||||
bool mMouseOver;
|
bool mHighlighted;
|
||||||
bool mStateOn;
|
bool mStateOn;
|
||||||
S32 mButtonType;
|
S32 mButtonType;
|
||||||
S32 mRadioGroup;
|
S32 mRadioGroup;
|
||||||
|
|
@ -95,7 +95,10 @@ class GuiButtonBaseCtrl : public GuiControl
|
||||||
bool getStateOn() const { return mStateOn; }
|
bool getStateOn() const { return mStateOn; }
|
||||||
|
|
||||||
void setDepressed( bool depressed ) { mDepressed = depressed; }
|
void setDepressed( bool depressed ) { mDepressed = depressed; }
|
||||||
void resetState() {mDepressed = false; mMouseOver = false;}
|
void resetState() {mDepressed = false; mHighlighted = false;}
|
||||||
|
|
||||||
|
void setHighlighted(bool highlighted) { mHighlighted = highlighted; }
|
||||||
|
bool isHighlighted() { return mHighlighted; }
|
||||||
|
|
||||||
void acceleratorKeyPress(U32 index);
|
void acceleratorKeyPress(U32 index);
|
||||||
void acceleratorKeyRelease(U32 index);
|
void acceleratorKeyRelease(U32 index);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ bool GuiButtonCtrl::onWake()
|
||||||
void GuiButtonCtrl::onRender(Point2I offset,
|
void GuiButtonCtrl::onRender(Point2I offset,
|
||||||
const RectI& updateRect)
|
const RectI& updateRect)
|
||||||
{
|
{
|
||||||
bool highlight = mMouseOver;
|
bool highlight = mHighlighted;
|
||||||
bool depressed = mDepressed;
|
bool depressed = mDepressed;
|
||||||
|
|
||||||
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
|
||||||
|
|
@ -107,7 +107,7 @@ void GuiButtonCtrl::onRender(Point2I offset,
|
||||||
indexMultiplier = 4;
|
indexMultiplier = 4;
|
||||||
else if ( mDepressed || mStateOn )
|
else if ( mDepressed || mStateOn )
|
||||||
indexMultiplier = 2;
|
indexMultiplier = 2;
|
||||||
else if ( mMouseOver )
|
else if ( mHighlighted )
|
||||||
indexMultiplier = 3;
|
indexMultiplier = 3;
|
||||||
|
|
||||||
renderSizableBitmapBordersFilled( boundsRect, indexMultiplier, mProfile );
|
renderSizableBitmapBordersFilled( boundsRect, indexMultiplier, mProfile );
|
||||||
|
|
@ -123,3 +123,4 @@ void GuiButtonCtrl::onRender(Point2I offset,
|
||||||
//render the children
|
//render the children
|
||||||
renderChildControls( offset, updateRect);
|
renderChildControls( offset, updateRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
|
ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
|
||||||
ColorI fontColor = mActive ? (mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? (mHighlighted ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
|
||||||
ColorI insideBorderColor = isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;
|
ColorI insideBorderColor = isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;
|
||||||
|
|
||||||
// just draw the check box and the text:
|
// just draw the check box and the text:
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ void GuiIconButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
|
|
||||||
void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
{
|
{
|
||||||
bool highlight = mMouseOver;
|
bool highlight = mHighlighted;
|
||||||
bool depressed = mDepressed;
|
bool depressed = mDepressed;
|
||||||
|
|
||||||
ColorI fontColor = mActive ? (highlight ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? (highlight ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
|
||||||
|
|
@ -236,7 +236,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
else
|
else
|
||||||
renderSlightlyLoweredBox(boundsRect, mProfile);
|
renderSlightlyLoweredBox(boundsRect, mProfile);
|
||||||
}
|
}
|
||||||
else if(mMouseOver && mActive)
|
else if(mHighlighted && mActive)
|
||||||
{
|
{
|
||||||
// If there is a bitmap array then render using it.
|
// If there is a bitmap array then render using it.
|
||||||
// Otherwise use a standard fill.
|
// Otherwise use a standard fill.
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ bool GuiSwatchButtonCtrl::onWake()
|
||||||
|
|
||||||
void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
|
void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
{
|
{
|
||||||
bool highlight = mMouseOver;
|
bool highlight = mHighlighted;
|
||||||
|
|
||||||
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ void GuiToggleButtonCtrl::onPreRender()
|
||||||
void GuiToggleButtonCtrl::onRender(Point2I offset,
|
void GuiToggleButtonCtrl::onRender(Point2I offset,
|
||||||
const RectI& updateRect)
|
const RectI& updateRect)
|
||||||
{
|
{
|
||||||
bool highlight = mMouseOver;
|
bool highlight = mHighlighted;
|
||||||
bool depressed = mDepressed;
|
bool depressed = mDepressed;
|
||||||
|
|
||||||
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? ( highlight ? mProfile->mFontColorHL : mProfile->mFontColor ) : mProfile->mFontColorNA;
|
||||||
|
|
@ -89,7 +89,7 @@ void GuiToggleButtonCtrl::onRender(Point2I offset,
|
||||||
indexMultiplier = 4;
|
indexMultiplier = 4;
|
||||||
else if ( mDepressed || mStateOn )
|
else if ( mDepressed || mStateOn )
|
||||||
indexMultiplier = 2;
|
indexMultiplier = 2;
|
||||||
else if ( mMouseOver )
|
else if ( mHighlighted )
|
||||||
indexMultiplier = 3;
|
indexMultiplier = 3;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
RectI r(offset, getExtent());
|
RectI r(offset, getExtent());
|
||||||
if ( mDepressed || mStateOn )
|
if ( mDepressed || mStateOn )
|
||||||
renderStateRect( mLoweredBitmap , r );
|
renderStateRect( mLoweredBitmap , r );
|
||||||
else if ( mMouseOver )
|
else if ( mHighlighted )
|
||||||
renderStateRect( mHoverBitmap , r );
|
renderStateRect( mHoverBitmap , r );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ bool GuiGradientSwatchCtrl::onWake()
|
||||||
|
|
||||||
void GuiGradientSwatchCtrl::onRender( Point2I offset, const RectI &updateRect )
|
void GuiGradientSwatchCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
{
|
{
|
||||||
bool highlight = mMouseOver;
|
bool highlight = mHighlighted;
|
||||||
|
|
||||||
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
||||||
RectI renderRect( offset, getExtent() );
|
RectI renderRect( offset, getExtent() );
|
||||||
|
|
@ -632,4 +632,4 @@ DefineEngineMethod(GuiGradientCtrl, getColor, LinearColorF, (S32 idx), , "Get co
|
||||||
}
|
}
|
||||||
|
|
||||||
return LinearColorF::ONE;
|
return LinearColorF::ONE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -706,6 +706,9 @@ bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent)
|
||||||
if (mCursorEnabled || mForceMouseToGUI ||
|
if (mCursorEnabled || mForceMouseToGUI ||
|
||||||
(mAlwaysHandleMouseButtons && inputEvent.objType == SI_BUTTON) )
|
(mAlwaysHandleMouseButtons && inputEvent.objType == SI_BUTTON) )
|
||||||
{
|
{
|
||||||
|
if (inputEvent.objType != SI_AXIS && inputEvent.action == SI_MAKE)
|
||||||
|
bool asdfasdf = true;
|
||||||
|
|
||||||
return processMouseEvent(inputEvent);
|
return processMouseEvent(inputEvent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ ConsoleDocClass( GuiInputCtrl,
|
||||||
GuiInputCtrl::GuiInputCtrl()
|
GuiInputCtrl::GuiInputCtrl()
|
||||||
: mSendAxisEvents(false),
|
: mSendAxisEvents(false),
|
||||||
mSendBreakEvents(false),
|
mSendBreakEvents(false),
|
||||||
mSendModifierEvents(false)
|
mSendModifierEvents(false),
|
||||||
|
mIgnoreMouseEvents(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,6 +77,8 @@ void GuiInputCtrl::initPersistFields()
|
||||||
"If true, break events for all devices will generate callbacks (Default false).");
|
"If true, break events for all devices will generate callbacks (Default false).");
|
||||||
addField("sendModifierEvents", TypeBool, Offset(mSendModifierEvents, GuiInputCtrl),
|
addField("sendModifierEvents", TypeBool, Offset(mSendModifierEvents, GuiInputCtrl),
|
||||||
"If true, Make events will be sent for modifier keys (Default false).");
|
"If true, Make events will be sent for modifier keys (Default false).");
|
||||||
|
addField("ignoreMouseEvents", TypeBool, Offset(mIgnoreMouseEvents, GuiInputCtrl),
|
||||||
|
"If true, any events from mouse devices will be passed through.");
|
||||||
endGroup("GuiInputCtrl");
|
endGroup("GuiInputCtrl");
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
@ -97,7 +100,7 @@ bool GuiInputCtrl::onWake()
|
||||||
if ( !Parent::onWake() )
|
if ( !Parent::onWake() )
|
||||||
return( false );
|
return( false );
|
||||||
|
|
||||||
if( !smDesignTime )
|
if( !smDesignTime && !mIgnoreMouseEvents)
|
||||||
mouseLock();
|
mouseLock();
|
||||||
|
|
||||||
setFirstResponder();
|
setFirstResponder();
|
||||||
|
|
@ -151,6 +154,9 @@ IMPLEMENT_CALLBACK(GuiInputCtrl, onAxisEvent, void, (const char* device, const c
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool GuiInputCtrl::onInputEvent( const InputEventInfo &event )
|
bool GuiInputCtrl::onInputEvent( const InputEventInfo &event )
|
||||||
{
|
{
|
||||||
|
if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType)
|
||||||
|
return false;
|
||||||
|
|
||||||
char deviceString[32];
|
char deviceString[32];
|
||||||
if ( event.action == SI_MAKE )
|
if ( event.action == SI_MAKE )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ protected:
|
||||||
bool mSendAxisEvents;
|
bool mSendAxisEvents;
|
||||||
bool mSendBreakEvents;
|
bool mSendBreakEvents;
|
||||||
bool mSendModifierEvents;
|
bool mSendModifierEvents;
|
||||||
|
bool mIgnoreMouseEvents;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue