Merge branch 'BaseUIUpdateWipwork_20231219' of https://github.com/Areloch/Torque3D into development

This commit is contained in:
Areloch 2023-12-26 21:29:24 -06:00
commit 6e101595d6
76 changed files with 4162 additions and 6304 deletions

View file

@ -210,7 +210,7 @@ bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition
dSprintf(extensionBuffer, sizeof(extensionBuffer), "*.%s", pDeclaredAssets->getExtension());
// Scan declared assets at location.
if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) )
if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) && mEchoInfo)
{
// Warn.
Con::warnf( "AssetManager::addModuleDeclaredAssets() - No assets found at location '%s' with extension '%s'.", filePathBuffer, pDeclaredAssets->getExtension() );

View file

@ -83,6 +83,8 @@ IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseDragged, void, (), (),
"pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with "
"the mouse button still pressed." );
IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onHighlighted, void, (bool highlighted), (highlighted),
"Called when the status of the button being highlighted changes.");
ImplementEnumType( GuiButtonType,
"Type of button control.\n\n"
@ -290,6 +292,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
{
mDepressed = true;
mHighlighted = true;
onHighlighted_callback(true);
}
else
{
@ -297,6 +300,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
SFX->playOnce(mProfile->getSoundButtonOverProfile());
mHighlighted = true;
onHighlighted_callback(true);
}
}
@ -311,6 +315,7 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)
if( isMouseLocked() )
mDepressed = false;
mHighlighted = false;
onHighlighted_callback(false);
}
//-----------------------------------------------------------------------------

View file

@ -73,6 +73,7 @@ class GuiButtonBaseCtrl : public GuiControl
DECLARE_CALLBACK( void, onMouseEnter, () );
DECLARE_CALLBACK( void, onMouseLeave, () );
DECLARE_CALLBACK( void, onMouseDragged, () );
DECLARE_CALLBACK( void, onHighlighted, (bool));
/// @}
@ -95,9 +96,18 @@ class GuiButtonBaseCtrl : public GuiControl
bool getStateOn() const { return mStateOn; }
void setDepressed( bool depressed ) { mDepressed = depressed; }
void resetState() {mDepressed = false; mHighlighted = false;}
void resetState()
{
mDepressed = false;
mHighlighted = false;
onHighlighted_callback(false);
}
void setHighlighted(bool highlighted) { mHighlighted = highlighted; }
void setHighlighted(bool highlighted)
{
mHighlighted = highlighted;
onHighlighted_callback(highlighted);
}
bool isHighlighted() { return mHighlighted; }
void acceleratorKeyPress(U32 index);

View file

@ -253,7 +253,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if (mProfile->mBorder != 0)
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
else
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
}
}
else if(mHighlighted && mActive)
@ -269,7 +269,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if (mProfile->mBorder != 0)
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
else
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
}
}
else
@ -388,6 +388,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
}
drawer->setBitmapModulation(fontColor);
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}
@ -395,6 +396,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
{
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
drawer->setBitmapModulation(fontColor);
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}
@ -408,6 +410,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
}
else
start.set( ( getWidth() - textWidth ) / 2, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
drawer->setBitmapModulation( fontColor );
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}

View file

@ -218,7 +218,8 @@ GuiControl::GuiControl() : mAddGroup( NULL ),
mLangTable(NULL),
mFirstResponder(NULL),
mHorizSizing(horizResizeRight),
mVertSizing(vertResizeBottom)
mVertSizing(vertResizeBottom),
mCategory(StringTable->EmptyString())
{
mConsoleVariable = StringTable->EmptyString();
mAcceleratorKey = StringTable->EmptyString();
@ -294,6 +295,10 @@ void GuiControl::initPersistFields()
addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl),
"Key combination that triggers the control's primary action when the control is on the canvas." );
addField("category", TypeString, Offset(mCategory, GuiControl),
"Name of the category this gui control should be grouped into for organizational purposes. Primarily for tooling.");
endGroup( "Control" );
addGroup( "ToolTip" );

View file

@ -218,6 +218,8 @@ class GuiControl : public SimGroup
String mAltConsoleCommand;
String mTooltip;
StringTableEntry mCategory;
/// @}

View file

@ -40,6 +40,7 @@
#include "gui/editor/editorFunctions.h"
#include "math/mEase.h"
#include "math/mathTypes.h"
#include "sim/actionMap.h"
//-----------------------------------------------------------------------------
@ -60,7 +61,7 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl()
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" );
retCtrl->setDataField( StringTable->insert("profile"), NULL, "ToolsGuiPopupMenuProfile" );
_registerEditControl( retCtrl );
// Configure it to update our value when the popup is closed
@ -387,6 +388,44 @@ void GuiInspectorTypeGuiProfile::consoleInit()
ConsoleBaseType::getType( TYPEID< GuiControlProfile >() )->setInspectorFieldType("GuiInspectorTypeGuiProfile");
}
//-----------------------------------------------------------------------------
// GuiInspectorTypeActionMap
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(GuiInspectorTypeActionMap);
ConsoleDocClass(GuiInspectorTypeActionMap,
"@brief Inspector field type for ActionMap\n\n"
"Editor use only.\n\n"
"@internal"
);
void GuiInspectorTypeActionMap::_populateMenu(GuiPopUpMenuCtrl* menu)
{
// Add the action maps to the menu.
//First add a blank entry so you can clear the action map
menu->addEntry("", 0);
SimGroup* grp = Sim::getRootGroup();
SimSetIterator iter(grp);
for (; *iter; ++iter)
{
ActionMap* actionMap = dynamic_cast<ActionMap*>(*iter);
if (!actionMap)
continue;
menu->addEntry(actionMap->getName(), actionMap->getId());
}
menu->sort();
}
void GuiInspectorTypeActionMap::consoleInit()
{
Parent::consoleInit();
ConsoleBaseType::getType(TYPEID< ActionMap >())->setInspectorFieldType("GuiInspectorTypeActionMap");
}
//-----------------------------------------------------------------------------
// GuiInspectorTypeCheckBox
//-----------------------------------------------------------------------------

View file

@ -186,6 +186,20 @@ public:
virtual void _populateMenu( GuiPopUpMenuCtrl *menu );
};
//-----------------------------------------------------------------------------
// GuiInspectorTypeActionMap Class
//-----------------------------------------------------------------------------
class GuiInspectorTypeActionMap : public GuiInspectorTypeMenuBase
{
private:
typedef GuiInspectorTypeMenuBase Parent;
public:
DECLARE_CONOBJECT(GuiInspectorTypeActionMap);
static void consoleInit();
virtual void _populateMenu(GuiPopUpMenuCtrl* menu);
};
//-----------------------------------------------------------------------------
// GuiInspectorTypeCheckBox Class
//-----------------------------------------------------------------------------

View file

@ -64,6 +64,7 @@ GuiInputCtrl::GuiInputCtrl()
mSendModifierEvents(false),
mIgnoreMouseEvents(false)
{
mActionmap = nullptr;
}
//------------------------------------------------------------------------------
@ -80,6 +81,7 @@ void GuiInputCtrl::initPersistFields()
"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.");
addField("actionMap", TYPEID<ActionMap>(), Offset(mActionmap, GuiInputCtrl), "The name of an action map to push/pop on the input stack alongside the wake/sleep of this control.");
endGroup("GuiInputCtrl");
Parent::initPersistFields();
@ -103,6 +105,12 @@ bool GuiInputCtrl::onWake()
if( !smDesignTime && !mIgnoreMouseEvents)
mouseLock();
if(mActionmap != nullptr)
{
SimSet* actionMapSet = Sim::getActiveActionMapSet();
actionMapSet->pushObject(mActionmap);
}
setFirstResponder();
@ -115,6 +123,13 @@ void GuiInputCtrl::onSleep()
{
Parent::onSleep();
mouseUnlock();
if (mActionmap != nullptr)
{
SimSet* actionMapSet = Sim::getActiveActionMapSet();
actionMapSet->removeObject(mActionmap);
}
clearFirstResponder();
}
@ -158,6 +173,9 @@ bool GuiInputCtrl::onInputEvent( const InputEventInfo &event )
if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType)
return false;
if (mActionmap != nullptr)
return false;
char deviceString[32];
if ( event.action == SI_MAKE )
{

View file

@ -26,6 +26,7 @@
#ifndef _GUIMOUSEEVENTCTRL_H_
#include "gui/utility/guiMouseEventCtrl.h"
#endif
#include "sim/actionMap.h"
/// A control that locks the mouse and reports all keyboard input events
@ -38,6 +39,8 @@ protected:
bool mSendModifierEvents;
bool mIgnoreMouseEvents;
ActionMap* mActionmap;
public:
typedef GuiMouseEventCtrl Parent;

View file

@ -729,7 +729,8 @@ bool ActionMap::nextBoundNode( const char* function, U32 &devMapIndex, U32 &node
for ( U32 j = nodeIndex; j < dvcMap->nodeMap.size(); j++ )
{
const Node* node = &dvcMap->nodeMap[j];
if ( !( node->flags & Node::BindCmd ) && ( dStricmp( function, node->consoleFunction ) == 0 ) )
if ( ( (node->flags & Node::BindCmd) && (dStricmp(function, node->makeConsoleCommand) == 0 || dStricmp(function, node->breakConsoleCommand) == 0) )
|| (!(node->flags & Node::BindCmd) && dStricmp( function, node->consoleFunction ) == 0 ) )
{
devMapIndex = i;
nodeIndex = j;
@ -1805,6 +1806,7 @@ bool ActionMap::handleEvent(const InputEventInfo* pEvent)
for (SimSet::iterator itr = pActionMapSet->end() - 1;
itr > pActionMapSet->begin(); itr--) {
ActionMap* pMap = static_cast<ActionMap*>(*itr);
if (pMap->processAction(pEvent) == true)
return true;
}