Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into SubScenes_Gamemode_PR

This commit is contained in:
JeffR 2024-09-28 22:11:39 -05:00
commit 20a01d9f02
71 changed files with 353 additions and 509 deletions

View file

@ -797,6 +797,13 @@ void WheeledVehicle::updateMove(const Move* move)
// Set the tail brake light thread direction based on the brake state.
if (mTailLightThread)
mShapeInstance->setTimeScale(mTailLightThread, mBraking? 1.0f : -1.0f);
// Update the steering animation: sequence time 0 is full right,
// and time 0.5 is straight ahead.
if (mSteeringThread) {
F32 t = (mSteering.x * mFabs(mSteering.x)) / mDataBlock->maxSteeringAngle;
mShapeInstance->setPos(mSteeringThread, 0.5 - t * 0.5);
}
}

View file

@ -2803,7 +2803,7 @@ DefineEngineFunction(getTimestamp, const char*, (), ,
return returnBuffer;
}
#ifdef TORQUE_TOOLS
#ifdef TORQUE_TOOLS_EXT_COMMANDS
DefineEngineFunction(systemCommand, S32, (const char* commandLineAction, const char* callBackFunction), (""), "")
{
if (commandLineAction && commandLineAction[0] != '\0')
@ -2819,7 +2819,9 @@ DefineEngineFunction(systemCommand, S32, (const char* commandLineAction, const c
return -1;
}
#endif
#ifdef TORQUE_TOOLS
const char* getDocsLink(const char* filename, U32 lineNumber)
{
Vector<String> fileStringSplit;

View file

@ -656,7 +656,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
}
yyerror(output.c_str());
yyerror("%s", output.c_str());
return ret;
}

View file

@ -3363,7 +3363,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
}
yyerror(output.c_str());
yyerror("%s",output.c_str());
return ret;
}

View file

@ -779,6 +779,7 @@ bool GBitmap::getColor(const U32 x, const U32 y, ColorI& rColor) const
break;
case GFXFormatL16:
rColor.set(U8(U16((pLoc[0] << 8) + pLoc[1])), 0, 0, 0);
break;
case GFXFormatR8G8B8:
case GFXFormatR8G8B8X8:
rColor.set( pLoc[0], pLoc[1], pLoc[2], 255 );

View file

@ -272,18 +272,18 @@ void GuiColorPickerCtrl::drawSelector(RectI &bounds, Point2I &selectorPos, Selec
{
case sVertical:
// Now draw the vertical selector Up -> Pos
if (selectorPos.y != bounds.point.y+1)
if (selectorPos.y > bounds.point.y)
GFX->getDrawUtil()->drawLine(selectorPos.x, bounds.point.y, selectorPos.x, selectorPos.y-sMax-1, color);
// Down -> Pos
if (selectorPos.y != bounds.point.y+bounds.extent.y)
if (selectorPos.y < bounds.point.y + bounds.extent.y)
GFX->getDrawUtil()->drawLine(selectorPos.x, selectorPos.y + sMax, selectorPos.x, bounds.point.y + bounds.extent.y, color);
break;
case sHorizontal:
// Now draw the horizontal selector Left -> Pos
if (selectorPos.x != bounds.point.x)
if (selectorPos.x > bounds.point.x)
GFX->getDrawUtil()->drawLine(bounds.point.x, selectorPos.y-1, selectorPos.x-sMax, selectorPos.y-1, color);
// Right -> Pos
if (selectorPos.x != bounds.point.x)
if (selectorPos.x < bounds.point.x + bounds.extent.x)
GFX->getDrawUtil()->drawLine(bounds.point.x+mSelectorPos.x+sMax, selectorPos.y-1, bounds.point.x + bounds.extent.x, selectorPos.y-1, color);
break;
}
@ -388,13 +388,11 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
Point2I resolution = getRoot()->getExtent();
U32 buf_x = offset.x + mSelectorPos.x + 1;
U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y + 1));
U32 buf_x = offset.x + mSelectorPos.x;
U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y));
GFXTexHandle bb(resolution.x, resolution.y, GFXFormatR8G8B8A8_SRGB, &GFXRenderTargetSRGBProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__));
Point2I tmpPt(buf_x, buf_y);
GFXTarget *targ = GFX->getActiveRenderTarget();
targ->resolveTo(bb);
@ -458,19 +456,7 @@ void GuiColorPickerCtrl::setSelectorPos(const LinearColorF & color)
Point2I GuiColorPickerCtrl::findColor(const LinearColorF & color, const Point2I& offset, const Point2I& resolution, GBitmap& bmp)
{
RectI rect;
Point2I ext = getExtent();
if (mDisplayMode != pDropperBackground)
{
ext.x -= 3;
ext.y -= 2;
rect = RectI(Point2I(1, 1), ext);
}
else
{
rect = RectI(Point2I(0, 0), ext);
}
Point2I closestPos(-1, -1);
/* Debugging
@ -498,12 +484,12 @@ Point2I GuiColorPickerCtrl::findColor(const LinearColorF & color, const Point2I&
F32 closestVal(10000.0f);
bool closestSet = false;
for (S32 x = rect.point.x; x <= rect.extent.x; x++)
for (S32 x = 0; x < ext.x; x++)
{
for (S32 y = rect.point.y; y <= rect.extent.y; y++)
for (S32 y = 0; y < ext.y; y++)
{
buf_x = offset.x + x + 1;
buf_y = (resolution.y - (offset.y + y + 1));
buf_x = offset.x + x;
buf_y = (resolution.y - (offset.y + y));
buf_y = resolution.y - buf_y;
//Get the color at that position
@ -532,46 +518,11 @@ Point2I GuiColorPickerCtrl::findColor(const LinearColorF & color, const Point2I&
void GuiColorPickerCtrl::setSelectorPos(const Point2I &pos)
{
Point2I extent = getExtent();
RectI rect;
if (mDisplayMode != pDropperBackground)
{
extent.x -= 3;
extent.y -= 2;
rect = RectI(Point2I(1,1), extent);
}
else
{
rect = RectI(Point2I(0,0), extent);
}
if (rect.pointInRect(pos))
{
mSelectorPos = pos;
mPositionChanged = true;
// We now need to update
setUpdate();
}
else
{
if ((pos.x > rect.point.x) && (pos.x < (rect.point.x + rect.extent.x)))
mSelectorPos.x = pos.x;
else if (pos.x <= rect.point.x)
mSelectorPos.x = rect.point.x;
else if (pos.x >= (rect.point.x + rect.extent.x))
mSelectorPos.x = rect.point.x + rect.extent.x - 1;
if ((pos.y > rect.point.y) && (pos.y < (rect.point.y + rect.extent.y)))
mSelectorPos.y = pos.y;
else if (pos.y <= rect.point.y)
mSelectorPos.y = rect.point.y;
else if (pos.y >= (rect.point.y + rect.extent.y))
mSelectorPos.y = rect.point.y + rect.extent.y - 1;
mPositionChanged = true;
setUpdate();
}
Point2I ext = getExtent();
mSelectorPos.x = mClamp(pos.x, 1, ext.x - 1);
mSelectorPos.y = mClamp(pos.y, 1, ext.y - 1);
mPositionChanged = true;
setUpdate();
}
void GuiColorPickerCtrl::onMouseDown(const GuiEvent &event)

View file

@ -3043,16 +3043,23 @@ DefineEngineMethod(GuiConvexEditorCtrl, getSelectedFaceZRot, float, (), ,
}
DefineEngineMethod(GuiConvexEditorCtrl, toggleGridSnapping, void, (),,
"@brief Mount objB to this object at the desired slot with optional transform.\n\n"
"@param objB Object to mount onto us\n"
"@param slot Mount slot ID\n"
"@param txfm (optional) mount offset transform\n"
"@return true if successful, false if failed (objB is not valid)")
"@brief toggle grid snapping state.\n\n")
{
object->toggleGridSnapping();
}
DefineEngineMethod(GuiConvexEditorCtrl, setGridSnap, void, (bool snap), ,
"@brief set grid snapping state.\n\n")
{
object->setGridSnap(snap);
}
DefineEngineMethod(GuiConvexEditorCtrl, getGridSnap, bool, (), ,
"@brief set grid snapping state.\n\n")
{
return object->getGridSnap();
}
DefineEngineMethod(GuiConvexEditorCtrl, setGridSnapSize, void, (float gridSize), (1.0),
"@brief Mount objB to this object at the desired slot with optional transform.\n\n"

View file

@ -130,6 +130,8 @@ public:
void setSelectedFaceVertFlip(bool flipped);
void setSelectedFaceZRot(float degrees);
void toggleGridSnapping();
bool getGridSnap() { return mGridSnap; };
void setGridSnap(bool snap) { mGridSnap = snap; };
void setGridSnapSize(float gridSize);
void updateShape();