mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-13 17:30:51 +00:00
Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into Preview4_0
This commit is contained in:
commit
d06bc790e3
12 changed files with 147 additions and 74 deletions
|
|
@ -405,7 +405,12 @@ public: \
|
|||
else if (m##name##AssetId[index] != StringTable->EmptyString())\
|
||||
return m##name##AssetId[index];\
|
||||
else if (m##name##Name[index] != StringTable->EmptyString())\
|
||||
return StringTable->insert(Platform::makeRelativePathName(m##name##Name[index], Platform::getMainDotCsDir()));\
|
||||
{\
|
||||
if (String(m##name##Name[index]).startsWith("#") || String(m##name##Name[index]).startsWith("$"))\
|
||||
return StringTable->insert(m##name##Name[index]);\
|
||||
else\
|
||||
return StringTable->insert(Platform::makeRelativePathName(m##name##Name[index], Platform::getMainDotCsDir()));\
|
||||
}\
|
||||
else\
|
||||
return StringTable->EmptyString();\
|
||||
}\
|
||||
|
|
|
|||
|
|
@ -721,27 +721,27 @@ String AssetImporter::parseImageSuffixes(String assetName, String* suffixType)
|
|||
{
|
||||
case 0:
|
||||
suffixList = activeImportConfig->DiffuseTypeSuffixes;
|
||||
suffixType->insert(0, "Albedo", 10);
|
||||
suffixType->insert(0, "Albedo", 6);
|
||||
break;
|
||||
case 1:
|
||||
suffixList = activeImportConfig->NormalTypeSuffixes;
|
||||
suffixType->insert(0, "Normal", 10);
|
||||
suffixType->insert(0, "Normal", 6);
|
||||
break;
|
||||
case 2:
|
||||
suffixList = activeImportConfig->RoughnessTypeSuffixes;
|
||||
suffixType->insert(0, "Roughness", 10);
|
||||
suffixType->insert(0, "Roughness", 9);
|
||||
break;
|
||||
case 3:
|
||||
suffixList = activeImportConfig->AOTypeSuffixes;
|
||||
suffixType->insert(0, "AO", 10);
|
||||
suffixType->insert(0, "AO", 2);
|
||||
break;
|
||||
case 4:
|
||||
suffixList = activeImportConfig->MetalnessTypeSuffixes;
|
||||
suffixType->insert(0, "Metalness", 10);
|
||||
suffixType->insert(0, "Metalness", 9);
|
||||
break;
|
||||
case 5:
|
||||
suffixList = activeImportConfig->PBRTypeSuffixes;
|
||||
suffixType->insert(0, "ORMConfig", 10);
|
||||
suffixType->insert(0, "ORMConfig", 9);
|
||||
break;
|
||||
default:
|
||||
suffixList = "";
|
||||
|
|
|
|||
|
|
@ -731,7 +731,8 @@ void Trigger::potentialEnterObject(GameBase* enter)
|
|||
|
||||
if(evalCmD(&mEnterCommand))
|
||||
{
|
||||
String command = String("%obj = ") + enter->getIdString() + ";" + mEnterCommand;
|
||||
String command = String("%obj = ") + enter->getIdString() + ";";
|
||||
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
|
||||
Con::evaluate(command.c_str());
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +780,8 @@ void Trigger::processTick(const Move* move)
|
|||
|
||||
if (evalCmD(&mLeaveCommand))
|
||||
{
|
||||
String command = String("%obj = ") + remove->getIdString() + ";" + mLeaveCommand;
|
||||
String command = String("%obj = ") + remove->getIdString() + ";";
|
||||
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
|
||||
Con::evaluate(command.c_str());
|
||||
}
|
||||
if (testTrippable() && testCondition())
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include "materials/materialFeatureTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "T3D/accumulationVolume.h"
|
||||
#include "math/mTransform.h"
|
||||
|
||||
#include "gui/editor/inspector/group.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
|
@ -1863,3 +1864,31 @@ void TSStatic::setSelectionFlags(U8 flags)
|
|||
}
|
||||
}
|
||||
|
||||
void TSStatic::getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat)
|
||||
{
|
||||
|
||||
S32 nodeIDx = getShapeResource()->findNode(nodeName);
|
||||
|
||||
MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIDx];
|
||||
mountTransform.mul(xfm);
|
||||
const Point3F &scale = getScale();
|
||||
// The position of the mount point needs to be scaled.
|
||||
Point3F position = mountTransform.getPosition();
|
||||
position.convolve(scale);
|
||||
mountTransform.setPosition(position);
|
||||
// Also we would like the object to be scaled to the model.
|
||||
outMat->mul(mObjToWorld, mountTransform);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod(TSStatic, getNodeTransform, TransformF, (const char *nodeName), ,
|
||||
"@brief Get the world transform of the specified mount slot.\n\n"
|
||||
|
||||
"@param slot Image slot to query\n"
|
||||
"@return the mount transform\n\n")
|
||||
{
|
||||
MatrixF xf(true);
|
||||
object->getNodeTransform(nodeName, MatrixF::Identity, &xf);
|
||||
return xf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ public:
|
|||
void updateMaterials();
|
||||
|
||||
bool isAnimated() { return mPlayAmbient; }
|
||||
void getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat);
|
||||
|
||||
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
|
||||
|
||||
|
|
|
|||
|
|
@ -303,54 +303,54 @@ U32 GFXDrawUtil::drawTextN( GFont *font, const Point2F &ptDraw, const UTF16 *in_
|
|||
//-----------------------------------------------------------------------------
|
||||
// Draw Bitmaps
|
||||
//-----------------------------------------------------------------------------
|
||||
void GFXDrawUtil::drawBitmap( GFXTextureObject* texture, const Point2I &in_rAt, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmap( GFXTextureObject* texture, const Point2I &in_rAt, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
drawBitmap(texture,Point2F((F32)in_rAt.x,(F32)in_rAt.y),in_flip,filter,in_wrap);
|
||||
drawBitmap(texture,Point2F((F32)in_rAt.x,(F32)in_rAt.y),in_flip,filter,in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapStretch( GFXTextureObject* texture, const RectI &dstRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapStretch( GFXTextureObject* texture, const RectI &dstRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
drawBitmapStretch(texture,RectF((F32)dstRect.point.x,(F32)dstRect.point.y,(F32)dstRect.extent.x,(F32)dstRect.extent.y),in_flip,filter,in_wrap);
|
||||
drawBitmapStretch(texture,RectF((F32)dstRect.point.x,(F32)dstRect.point.y,(F32)dstRect.extent.x,(F32)dstRect.extent.y),in_flip,filter,in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapSR( GFXTextureObject* texture, const Point2I &in_rAt, const RectI &srcRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapSR( GFXTextureObject* texture, const Point2I &in_rAt, const RectI &srcRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
drawBitmapSR(texture,Point2F((F32)in_rAt.x,(F32)in_rAt.y),RectF((F32)srcRect.point.x,(F32)srcRect.point.y,(F32)srcRect.extent.x,(F32)srcRect.extent.y),in_flip,filter,in_wrap);
|
||||
drawBitmapSR(texture,Point2F((F32)in_rAt.x,(F32)in_rAt.y),RectF((F32)srcRect.point.x,(F32)srcRect.point.y,(F32)srcRect.extent.x,(F32)srcRect.extent.y),in_flip,filter,in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapStretchSR( GFXTextureObject *texture, const RectI &dstRect, const RectI &srcRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapStretchSR( GFXTextureObject *texture, const RectI &dstRect, const RectI &srcRect, const GFXBitmapFlip in_flip, const GFXTextureFilterType filter , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
RectF dstRectF = RectF((F32)dstRect.point.x,(F32)dstRect.point.y,(F32)dstRect.extent.x,(F32)dstRect.extent.y);
|
||||
RectF srcRectF = RectF((F32)srcRect.point.x,(F32)srcRect.point.y,(F32)srcRect.extent.x,(F32)srcRect.extent.y);
|
||||
drawBitmapStretchSR(texture,dstRectF,srcRectF,in_flip,filter,in_wrap);
|
||||
drawBitmapStretchSR(texture,dstRectF,srcRectF,in_flip,filter,in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
AssertFatal( texture != 0, "No texture specified for drawBitmap()" );
|
||||
|
||||
RectI subRegion( 0, 0, texture->mBitmapSize.x, texture->mBitmapSize.y );
|
||||
RectI stretch( in_rAt.x, in_rAt.y, texture->mBitmapSize.x, texture->mBitmapSize.y );
|
||||
drawBitmapStretchSR( texture, stretch, subRegion, in_flip, filter, in_wrap );
|
||||
drawBitmapStretchSR( texture, stretch, subRegion, in_flip, filter, in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapStretch( GFXTextureObject*texture, const RectF &dstRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapStretch( GFXTextureObject*texture, const RectF &dstRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
AssertFatal( texture != 0, "No texture specified for drawBitmapStretch()" );
|
||||
|
||||
RectF subRegion( 0.f, 0.f, (F32)texture->mBitmapSize.x, (F32)texture->mBitmapSize.y );
|
||||
drawBitmapStretchSR( texture, dstRect, subRegion, in_flip, filter, in_wrap );
|
||||
drawBitmapStretchSR( texture, dstRect, subRegion, in_flip, filter, in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
AssertFatal( texture != 0, "No texture specified for drawBitmapSR()" );
|
||||
|
||||
RectF stretch( in_rAt.x, in_rAt.y, srcRect.len_x(), srcRect.len_y() );
|
||||
drawBitmapStretchSR( texture, stretch, srcRect, in_flip, filter, in_wrap );
|
||||
drawBitmapStretchSR( texture, stretch, srcRect, in_flip, filter, in_wrap, angle);
|
||||
}
|
||||
|
||||
void GFXDrawUtil::drawBitmapStretchSR( GFXTextureObject* texture, const RectF &dstRect, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
|
||||
void GFXDrawUtil::drawBitmapStretchSR( GFXTextureObject* texture, const RectF &dstRect, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/, F32 angle)
|
||||
{
|
||||
// Sanity if no texture is specified.
|
||||
if(!texture)
|
||||
|
|
@ -395,6 +395,30 @@ void GFXDrawUtil::drawBitmapStretchSR( GFXTextureObject* texture, const RectF &d
|
|||
verts[2].texCoord.set( texLeft, texBottom );
|
||||
verts[3].texCoord.set( texRight, texBottom );
|
||||
|
||||
if (angle != 0.0f)
|
||||
{
|
||||
U32 i = 0;
|
||||
Point3F points[4];
|
||||
|
||||
points[0] = Point3F(-dstRect.extent.x / 2.0f, -dstRect.extent.y / 2.0f, 0.0);
|
||||
points[1] = Point3F(dstRect.extent.x / 2.0f, -dstRect.extent.y / 2.0f, 0.0);
|
||||
points[2] = Point3F(-dstRect.extent.x / 2.0f, dstRect.extent.y / 2.0f, 0.0);
|
||||
points[3] = Point3F(dstRect.extent.x / 2.0f, dstRect.extent.y / 2.0f, 0.0);
|
||||
|
||||
//calc center by taking position+extent/2
|
||||
Point3F offset(dstRect.point.x + dstRect.extent.x / 2.0f,
|
||||
dstRect.point.y + dstRect.extent.y / 2.0f, 0.0);
|
||||
|
||||
//rotate points by mulitplying by a rotation matrix
|
||||
MatrixF rotMatrix(EulerF(0.0, 0.0, mDegToRad(angle)));
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
rotMatrix.mulP(points[i]);
|
||||
points[i] += offset;
|
||||
verts[i].point = points[i];
|
||||
}
|
||||
}
|
||||
|
||||
verts.unlock();
|
||||
|
||||
mDevice->setVertexBuffer( verts );
|
||||
|
|
@ -1641,4 +1665,4 @@ void GFXDrawUtil::drawTransform( const GFXStateBlockDesc &desc, const MatrixF &m
|
|||
mDevice->setVertexBuffer( verts );
|
||||
mDevice->setupGenericShaders();
|
||||
mDevice->drawPrimitive( GFXLineList, 0, 3 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,15 +93,15 @@ public:
|
|||
//-----------------------------------------------------------------------------
|
||||
// Draw Bitmaps
|
||||
//-----------------------------------------------------------------------------
|
||||
void drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapStretch( GFXTextureObject*texture, const RectF &dstRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapStretchSR( GFXTextureObject*texture, const RectF &dstRect, const RectF &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapStretch( GFXTextureObject*texture, const RectF &dstRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapStretchSR( GFXTextureObject*texture, const RectF &dstRect, const RectF &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
|
||||
void drawBitmap( GFXTextureObject*texture, const Point2I &in_rAt, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapSR( GFXTextureObject*texture, const Point2I &in_rAt, const RectI &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapStretch( GFXTextureObject*texture, const RectI &dstRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmapStretchSR( GFXTextureObject*texture, const RectI &dstRect, const RectI &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true );
|
||||
void drawBitmap( GFXTextureObject*texture, const Point2I &in_rAt, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapSR( GFXTextureObject*texture, const Point2I &in_rAt, const RectI &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapStretch( GFXTextureObject*texture, const RectI &dstRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
void drawBitmapStretchSR( GFXTextureObject*texture, const RectI &dstRect, const RectI &srcRect, const GFXBitmapFlip in_flip = GFXBitmapFlip_None, const GFXTextureFilterType filter = GFXTextureFilterPoint , bool in_wrap = true, F32 angle = 0.0f);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Draw 3D Shapes
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ ConsoleDocClass( GuiBitmapCtrl,
|
|||
GuiBitmapCtrl::GuiBitmapCtrl(void)
|
||||
: mStartPoint( 0, 0 ),
|
||||
mColor(ColorI::WHITE),
|
||||
mAngle(0),
|
||||
mWrap( false )
|
||||
{
|
||||
INIT_ASSET(Bitmap);
|
||||
|
|
@ -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" );
|
||||
|
||||
|
|
@ -187,14 +190,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ class GuiBitmapCtrl : public GuiControl
|
|||
|
||||
Point2I mStartPoint;
|
||||
ColorI mColor;
|
||||
|
||||
F32 mAngle;
|
||||
|
||||
/// If true, bitmap tiles inside control. Otherwise stretches.
|
||||
bool mWrap;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1122,7 +1122,7 @@ void PostEffect::_setupConstants( const SceneRenderState *state )
|
|||
|
||||
void PostEffect::_setupTexture( U32 stage, GFXTexHandle &inputTex, const RectI *inTexViewport )
|
||||
{
|
||||
const String &texFilename = mTextureName[ stage ];
|
||||
const String &texFilename = getTexture( stage );
|
||||
|
||||
GFXTexHandle theTex;
|
||||
NamedTexTarget *namedTarget = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue