Merge branch 'Preview4_0' into SoundAssetImplements

# Conflicts:
#	Engine/source/T3D/assets/assetImporter.cpp
#	Engine/source/forest/forestItem.cpp
This commit is contained in:
AzaezelX 2021-10-11 20:11:27 -05:00
commit f5600826d7
122 changed files with 686 additions and 577 deletions

View file

@ -275,8 +275,6 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset)
Point2I arrowOffset;
S32 columnSplit = profile->mColumnSplit * xScale;
S32 iconIndex;
bool isRowSelected = (getSelected() != NO_ROW) && (row == mRows[getSelected()]);
bool isRowHighlighted = (getHighlighted() != NO_ROW) ? ((row == mRows[getHighlighted()]) && (row->mEnabled)) : false;
/*if (profileHasArrows)
@ -384,8 +382,6 @@ void GuiGameListMenuCtrl::onRenderKeybindOption(Row* row, Point2I currentOffset)
S32 rowHeight = profile->getRowHeight();
S32 optionWidth = xScale - columnSplit;
GFXDrawUtil* drawer = GFX->getDrawUtil();
//drawer->drawBitmap(row->mBitmap, )
@ -1048,7 +1044,6 @@ RectI GuiGameListMenuCtrl::getRowBounds(S32 rowIndex)
{
GuiGameListMenuProfile* profile = (GuiGameListMenuProfile*)mProfile;
F32 xScale = (float)getWidth() / profile->getRowWidth();
S32 rowHeight = profile->getRowHeight();
Point2I currentOffset = Point2I::Zero;
@ -1375,9 +1370,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos)
S32 rowHeight = profile->getRowHeight();
S32 optionWidth = xScale - columnSplit;
GFXDrawUtil* drawer = GFX->getDrawUtil();
//drawer->drawBitmap(row->mBitmap, )
Point2I button;
@ -1388,7 +1380,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos)
buttonSize.x = rowHeight / 2;
buttonSize.y = rowHeight / 2;
GFXTextureObject* texture = row->mBitmapTex;
RectI rect(button, buttonSize);
if (rect.pointInRect(Point2I(xPos, rowHeight / 2)))

View file

@ -311,7 +311,6 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
bool GuiPopUpMenuCtrl::_setBitmaps(void* obj, const char* index, const char* data)
{
bool ret = false;
GuiPopUpMenuCtrl* object = static_cast<GuiPopUpMenuCtrl*>(obj);
object->setBitmap(data);

View file

@ -365,7 +365,6 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
bool GuiPopUpMenuCtrlEx::_setBitmaps(void* obj, const char* index, const char* data)
{
bool ret = false;
GuiPopUpMenuCtrlEx* object = static_cast<GuiPopUpMenuCtrlEx*>(obj);
object->setBitmap(data);

View file

@ -94,6 +94,33 @@ ConsoleDocClass( GuiCanvas,
"@ingroup GuiCore\n");
ImplementEnumType(KeyboardTranslationMode,
"Modes for handling keyboard translation or native accelerator requests.\n\n")
{ GuiCanvas::TranslationMode_Platform, "Platform",
"Requests will be passed to the platform window for handling." },
{ GuiCanvas::TranslationMode_Callback, "Callback",
"Script callbacks will be issued to notify and allow override of these events." },
{ GuiCanvas::TranslationMode_Ignore, "Ignore",
"Requsts to enable/disable keyboard translations or native accelerators will be ignored "
"with no callback triggered." },
EndImplementEnumType;
IMPLEMENT_CALLBACK(GuiCanvas, onSetKeyboardTranslationEnabled, bool, (bool enable), (enable),
"Called when the canvas receives an enableKeyboardTranslation request. This is usually the "
"result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request "
"to be passed to the platform window. Return false to override the request and handle it in script.\n\n"
"@note This callback is only issued if keyTranslationMode is set to \"Callback\" for this canvas.\n"
"@param enable Requested keyboard translation state.\n"
"@see KeyboardTranslationMode\n");
IMPLEMENT_CALLBACK(GuiCanvas, onSetNativeAcceleratorsEnabled, bool, (bool enable), (enable),
"Called when the canvas receives a setNativeAcceleratorsEnabled request. This is usually the "
"result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request to "
"be passed to the platform window. Return false to override the request and handle it in script.\n\n"
"@note This callback is only issued if nativeAcceleratorMode is set to \"Callback\" for this canvas.\n"
"@param enable Requested accelerator state.\n"
"@see KeyboardTranslationMode\n");
ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear
extern InputModifiers convertModifierBits(const U32 in);
@ -127,6 +154,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
mHoverPositionSet(false),
mLeftMouseLast(false),
mHoverLeftControlTime(0),
mKeyTranslationMode(TranslationMode_Platform),
mNativeAcceleratorMode(TranslationMode_Platform),
mMiddleMouseLast(false),
mRightMouseLast(false),
mMouseDownPoint(0.0f,0.0f),
@ -183,6 +212,13 @@ void GuiCanvas::initPersistFields()
addField("displayWindow", TypeBool, Offset(mDisplayWindow, GuiCanvas), "Controls if the canvas window is rendered or not." );
endGroup("Canvas Rendering");
addGroup("KeyboardMode Callbacks");
addField("keyTranslationMode", TYPEID< KeyTranslationMode >(), Offset(mKeyTranslationMode, GuiCanvas),
"How to handle enable/disable keyboard translation requests. \"Platform\", \"Callback\" or \"Ignore\".\n");
addField("nativeAcceleratorMode", TYPEID< KeyTranslationMode >(), Offset(mNativeAcceleratorMode, GuiCanvas),
"How to handle enable/disable native accelerator requests. \"Platform\", \"Callback\" or \"Ignore\".\n");
endGroup("KeyboardMode Callbacks");
Parent::initPersistFields();
}
@ -442,20 +478,32 @@ Point2I GuiCanvas::getWindowSize()
void GuiCanvas::enableKeyboardTranslation()
{
AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!");
mPlatformWindow->setKeyboardTranslation(true);
if ((mKeyTranslationMode == TranslationMode_Platform) ||
((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(true)))
{
AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!");
mPlatformWindow->setKeyboardTranslation(true);
}
}
void GuiCanvas::disableKeyboardTranslation()
{
AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!");
mPlatformWindow->setKeyboardTranslation(false);
if ((mKeyTranslationMode == TranslationMode_Platform) ||
((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(false)))
{
AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!");
mPlatformWindow->setKeyboardTranslation(false);
}
}
void GuiCanvas::setNativeAcceleratorsEnabled( bool enabled )
{
AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!");
mPlatformWindow->setAcceleratorsEnabled( enabled );
if ((mNativeAcceleratorMode == TranslationMode_Platform) ||
((mNativeAcceleratorMode == TranslationMode_Callback) && onSetNativeAcceleratorsEnabled_callback(enabled)))
{
AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!");
mPlatformWindow->setAcceleratorsEnabled(enabled);
}
}
void GuiCanvas::setForceMouseToGUI(bool onOff)
@ -2390,7 +2438,7 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
if (control)
return control->getId();
return NULL;
return 0;
}
DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,

View file

@ -178,6 +178,19 @@ protected:
bool mHoverPositionSet;
U32 mHoverLeftControlTime;
public:
/// Setting for how to handle 'enableKeyboardTranslation' and 'setNativeAcceleratorsEnabled' requests.
enum KeyTranslationMode
{
TranslationMode_Platform,
TranslationMode_Callback,
TranslationMode_Ignore,
};
protected:
KeyTranslationMode mKeyTranslationMode;
KeyTranslationMode mNativeAcceleratorMode;
/// @}
// Internal event handling callbacks for use with PlatformWindow.
@ -454,6 +467,10 @@ public:
virtual void setWindowTitle(const char *newTitle);
DECLARE_CALLBACK(bool, onSetKeyboardTranslationEnabled, (bool enable));
DECLARE_CALLBACK(bool, onSetNativeAcceleratorsEnabled, (bool enable));
private:
static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads
protected:
@ -464,5 +481,7 @@ private:
void setConsumeLastInputEvent(bool flag) { mConsumeLastInputEvent = flag; }
bool getLastCursorPoint(Point2I& pt) const { pt = mLastCursorPt; return mLastCursorEnabled; }
};
typedef GuiCanvas::KeyTranslationMode KeyboardTranslationMode;
DefineEnumType(KeyboardTranslationMode);
#endif

View file

@ -908,12 +908,12 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), ,
"@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
{
if ( !obj)
return NULL;
return 0;
SimObject *inspector = GuiInspector::findByObject(obj);
if ( !inspector )
return NULL;
return 0;
return inspector->getId();
}

View file

@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields()
addGroup( "Animation" );
addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ),
"Index of the active thread, or -1 if none" );
addProtectedField( "threadPos", TypeF32, NULL, &setFieldThreadPos, &getFieldThreadPos,
addProtectedField( "threadPos", TypeF32, 0, &setFieldThreadPos, &getFieldThreadPos,
"Current position of the active thread (0-1)" );
addProtectedField( "threadDirection", TypeS32, NULL, &setFieldThreadDir, &getFieldThreadDir,
addProtectedField( "threadDirection", TypeS32, 0, &setFieldThreadDir, &getFieldThreadDir,
"Playback direction of the active thread" );
addProtectedField( "threadPingPong", TypeBool, NULL, &setFieldThreadPingPong, &getFieldThreadPingPong,
addProtectedField( "threadPingPong", TypeBool, 0, &setFieldThreadPingPong, &getFieldThreadPingPong,
"'PingPong' mode of the active thread" );
endGroup( "Animation" );

View file

@ -102,8 +102,6 @@ void GuiRenderTargetVizCtrl::onRender(Point2I offset,
camObject = dynamic_cast<Camera*>(camObject->getClientObject());
bool servObj = camObject->isServerObject();
if (camObject)
{
GFXTexHandle targ = camObject->getCameraRenderTarget();

View file

@ -248,7 +248,7 @@ class GuiConvexEditorUndoAction : public UndoAction
friend class GuiConvexEditorCtrl;
public:
GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(NULL)
GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(0)
{
}

View file

@ -145,7 +145,7 @@ class GuiMissionAreaUndoAction : public UndoAction
{
public:
GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(NULL)
GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(0)
{
}

View file

@ -773,7 +773,7 @@ ConsoleDocClass( TerrainSmoothAction,
);
TerrainSmoothAction::TerrainSmoothAction()
: UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(NULL)
: UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(0)
{
}