mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-06-04 12:06:36 +00:00
Merge branch 'development' of https://github.com/marauder2k9-torque/Torque3D into development
This commit is contained in:
commit
43535cd846
23 changed files with 244 additions and 60 deletions
|
|
@ -194,7 +194,9 @@ DefineEngineMethod(AIController, getAimObject, S32, (), ,
|
|||
|
||||
"@see setAimObject()\n")
|
||||
{
|
||||
SceneObject* obj = dynamic_cast<GameBase*>(object->getAim()->mObj.getPointer());
|
||||
SceneObject* obj = NULL;
|
||||
if (object->getAim())
|
||||
obj = dynamic_cast<GameBase*>(object->getAim()->mObj.getPointer());
|
||||
return obj ? obj->getId() : -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,12 @@ bool AIController::setControllerDataProperty(void* obj, const char* index, const
|
|||
|
||||
void AIController::setGoal(AIInfo* targ)
|
||||
{
|
||||
if (mGoal) { delete(mGoal); mGoal = NULL; }
|
||||
if (mGoal)
|
||||
{
|
||||
if (mGoal->mObj.isValid() && targ->mObj.isValid() && mGoal->mObj == targ->mObj)
|
||||
return;
|
||||
delete(mGoal); mGoal = NULL;
|
||||
}
|
||||
|
||||
if (targ->mObj.isValid())
|
||||
{
|
||||
|
|
@ -86,26 +91,58 @@ void AIController::setGoal(AIInfo* targ)
|
|||
|
||||
void AIController::setGoal(Point3F loc, F32 rad)
|
||||
{
|
||||
if (mGoal) delete(mGoal);
|
||||
if (mGoal)
|
||||
{
|
||||
if (mGoal->mPosSet && mGoal->getPosition() == loc)
|
||||
{
|
||||
mGoal->mRadius = rad;
|
||||
return;
|
||||
}
|
||||
delete(mGoal);
|
||||
}
|
||||
mGoal = new AIGoal(this, loc, rad);
|
||||
}
|
||||
|
||||
void AIController::setGoal(SimObjectPtr<SceneObject> objIn, F32 rad)
|
||||
{
|
||||
if (mGoal) delete(mGoal);
|
||||
if (mGoal)
|
||||
{
|
||||
if (mGoal->mObj.isValid() && objIn.isValid() && mGoal->mObj == objIn)
|
||||
{
|
||||
mGoal->mRadius = rad;
|
||||
return;
|
||||
}
|
||||
delete(mGoal);
|
||||
}
|
||||
mGoal = new AIGoal(this, objIn, rad);
|
||||
}
|
||||
|
||||
void AIController::setAim(Point3F loc, F32 rad, Point3F offset)
|
||||
{
|
||||
if (mAimTarget) delete(mAimTarget);
|
||||
if (mAimTarget)
|
||||
{
|
||||
if (mAimTarget->mPosSet && mAimTarget->getPosition() == loc)
|
||||
{
|
||||
mAimTarget->mAimOffset = offset;
|
||||
return;
|
||||
}
|
||||
delete(mAimTarget);
|
||||
}
|
||||
mAimTarget = new AIAimTarget(this, loc, rad);
|
||||
mAimTarget->mAimOffset = offset;
|
||||
}
|
||||
|
||||
void AIController::setAim(SimObjectPtr<SceneObject> objIn, F32 rad, Point3F offset)
|
||||
{
|
||||
if (mAimTarget) delete(mAimTarget);
|
||||
if (mAimTarget)
|
||||
{
|
||||
if (mAimTarget->mObj.isValid() && objIn.isValid() && mAimTarget->mObj == objIn)
|
||||
{
|
||||
mAimTarget->mAimOffset = offset;
|
||||
return;
|
||||
}
|
||||
delete(mAimTarget);
|
||||
}
|
||||
mAimTarget = new AIAimTarget(this, objIn, rad);
|
||||
mAimTarget->mAimOffset = offset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,24 @@ public:
|
|||
private:
|
||||
AICover* mCover;
|
||||
public:
|
||||
void setCover(Point3F loc, F32 rad = 0.0f) { delete(mCover); mCover = new AICover(this, loc, rad); }
|
||||
void setCover(SimObjectPtr<SceneObject> objIn, F32 rad = 0.0f) { delete(mCover); mCover = new AICover(this, objIn, rad); }
|
||||
void setCover(Point3F loc, F32 rad = 0.0f)
|
||||
{
|
||||
if (mCover && mCover->mPosSet && mCover->getPosition() == loc)
|
||||
{
|
||||
mCover->mRadius == rad;
|
||||
return;
|
||||
}
|
||||
delete(mCover); mCover = new AICover(this, loc, rad);
|
||||
}
|
||||
void setCover(SimObjectPtr<SceneObject> objIn, F32 rad = 0.0f)
|
||||
{
|
||||
if (mCover && mCover->mObj == objIn)
|
||||
{
|
||||
mCover->mRadius == rad;
|
||||
return;
|
||||
}
|
||||
delete(mCover); mCover = new AICover(this, objIn, rad);
|
||||
}
|
||||
AICover* getCover() { return mCover; }
|
||||
bool findCover(const Point3F& from, F32 radius);
|
||||
void clearCover();
|
||||
|
|
|
|||
|
|
@ -225,7 +225,16 @@ bool SubScene::evaluateCondition()
|
|||
Con::setBoolVariable(resVar.c_str(), false);
|
||||
String command = resVar + "=" + mLoadIf + ";";
|
||||
|
||||
Con::evaluatef(command.c_str());
|
||||
StringTableEntry objectName = getName();
|
||||
if (objectName != NULL)
|
||||
objectName = getIdString();
|
||||
|
||||
StringTableEntry groupName = getGroup()->getName();
|
||||
if (groupName != NULL)
|
||||
groupName = getGroup()->getIdString();
|
||||
|
||||
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||
Con::evaluate(command.c_str(), false, context);
|
||||
return Con::getBoolVariable(resVar.c_str());
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -3003,7 +3003,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
|
|||
|
||||
if (hasRoughness)
|
||||
{
|
||||
newMat->mInvertRoughness[0] = true;
|
||||
newMat->mInvertRoughness[0] = false;
|
||||
}
|
||||
|
||||
newAsset->addObject(newMat);
|
||||
|
|
|
|||
|
|
@ -367,7 +367,17 @@ bool SpawnSphere::testCondition()
|
|||
String resVar = getIdString() + String(".result");
|
||||
Con::setBoolVariable(resVar.c_str(), false);
|
||||
String command = resVar + "=" + mSpawnIf + ";";
|
||||
Con::evaluatef(command.c_str());
|
||||
|
||||
StringTableEntry objectName = getName();
|
||||
if (objectName != NULL)
|
||||
objectName = getIdString();
|
||||
|
||||
StringTableEntry groupName = getGroup()->getName();
|
||||
if (groupName != NULL)
|
||||
groupName = getGroup()->getIdString();
|
||||
|
||||
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||
Con::evaluate(command.c_str(), false, context);
|
||||
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -975,6 +975,7 @@ ShapeBase::ShapeBase()
|
|||
mMoveMotion( false ),
|
||||
mShapeBaseMount( NULL ),
|
||||
mShapeInstance( NULL ),
|
||||
mCubeReflector(NULL),
|
||||
mConvexList( new Convex ),
|
||||
mEnergy( 0.0f ),
|
||||
mRechargeRate( 0.0f ),
|
||||
|
|
@ -1053,6 +1054,12 @@ ShapeBase::~ShapeBase()
|
|||
mShapeInstance = NULL;
|
||||
}
|
||||
|
||||
if (mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
|
||||
CollisionTimeout* ptr = mTimeoutList;
|
||||
while (ptr) {
|
||||
CollisionTimeout* cur = ptr;
|
||||
|
|
@ -1173,7 +1180,11 @@ void ShapeBase::onRemove()
|
|||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
mCubeReflector.unregisterReflector();
|
||||
if (mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1349,11 +1360,17 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
mLightPlugin->reset();
|
||||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
mCubeReflector.unregisterReflector();
|
||||
|
||||
if ( mDataBlock->reflectorDesc )
|
||||
mCubeReflector.registerReflector( this, mDataBlock->reflectorDesc );
|
||||
{
|
||||
if (mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
if (mDataBlock->reflectorDesc)
|
||||
{
|
||||
mCubeReflector = new CubeReflector();
|
||||
mCubeReflector->registerReflector(this, mDataBlock->reflectorDesc);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2681,7 +2698,7 @@ void ShapeBase::_prepRenderImage( SceneRenderState *state,
|
|||
|
||||
// If we're currently rendering our own reflection we
|
||||
// don't want to render ourselves into it.
|
||||
if ( mCubeReflector.isRendering() )
|
||||
if (mCubeReflector && mCubeReflector->isRendering())
|
||||
return;
|
||||
|
||||
// We force all the shapes to use the highest detail
|
||||
|
|
@ -2785,8 +2802,8 @@ void ShapeBase::prepBatchRender(SceneRenderState* state, S32 mountedImageIndex )
|
|||
// Set up our TS render state.
|
||||
TSRenderState rdata;
|
||||
rdata.setSceneState( state );
|
||||
if ( mCubeReflector.isEnabled() )
|
||||
rdata.setCubemap( mCubeReflector.getCubemap() );
|
||||
if (mCubeReflector && mCubeReflector->isEnabled())
|
||||
rdata.setCubemap( mCubeReflector->getCubemap() );
|
||||
rdata.setFadeOverride( (1.0f - mCloakLevel) * mFadeVal );
|
||||
|
||||
// We might have some forward lit materials
|
||||
|
|
@ -2810,14 +2827,14 @@ void ShapeBase::prepBatchRender(SceneRenderState* state, S32 mountedImageIndex )
|
|||
mat.scale( mObjScale );
|
||||
GFX->setWorldMatrix( mat );
|
||||
|
||||
if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() )
|
||||
if ( state->isDiffusePass() && mCubeReflector && mCubeReflector->isEnabled() && mCubeReflector->getOcclusionQuery() )
|
||||
{
|
||||
RenderPassManager *pass = state->getRenderPass();
|
||||
|
||||
OccluderRenderInst *ri = pass->allocInst<OccluderRenderInst>();
|
||||
|
||||
ri->type = RenderPassManager::RIT_Occluder;
|
||||
ri->query = mCubeReflector.getOcclusionQuery();
|
||||
ri->query = mCubeReflector->getOcclusionQuery();
|
||||
mObjToWorld.mulP( mObjBox.getCenter(), &ri->position );
|
||||
ri->scale.set( mObjBox.getExtents() );
|
||||
ri->orientation = pass->allocUniqueXform( mObjToWorld );
|
||||
|
|
|
|||
|
|
@ -1207,7 +1207,7 @@ public:
|
|||
static F32 sFullCorrectionDistance;
|
||||
static F32 sCloakSpeed; // Time to cloak, in seconds
|
||||
|
||||
CubeReflector mCubeReflector;
|
||||
CubeReflector* mCubeReflector;
|
||||
|
||||
/// @name Initialization
|
||||
/// @{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "console/engineAPI.h"
|
||||
#include "collision/boxConvex.h"
|
||||
#include "console/script.h"
|
||||
#include "console/consoleInternal.h"
|
||||
|
||||
#include "core/stream/bitStream.h"
|
||||
#include "math/mathIO.h"
|
||||
|
|
@ -172,8 +173,9 @@ Trigger::Trigger()
|
|||
|
||||
mPhysicsRep = NULL;
|
||||
mTripOnce = false;
|
||||
mTripped = false;
|
||||
mTrippedBy = 0xFFFFFFFF;
|
||||
mTripIf = "";
|
||||
mTripIf.clear();
|
||||
|
||||
//Default up a basic square
|
||||
Point3F vecs[3] = { Point3F(1.0, 0.0, 0.0),
|
||||
|
|
@ -704,7 +706,17 @@ bool Trigger::testCondition()
|
|||
String resVar = getIdString() + String(".result");
|
||||
Con::setBoolVariable(resVar.c_str(), false);
|
||||
String command = resVar + "=" + mTripIf + ";";
|
||||
Con::evaluatef(command.c_str());
|
||||
|
||||
StringTableEntry objectName = getName();
|
||||
if (objectName != NULL)
|
||||
objectName = getIdString();
|
||||
|
||||
StringTableEntry groupName = getGroup()->getName();
|
||||
if (groupName != NULL)
|
||||
groupName = getGroup()->getIdString();
|
||||
|
||||
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||
Con::evaluate(command.c_str(), false, context);
|
||||
if (Con::getBoolVariable(resVar.c_str()) == 1)
|
||||
{
|
||||
return true;
|
||||
|
|
@ -738,11 +750,11 @@ void Trigger::potentialEnterObject(GameBase* enter)
|
|||
mObjects.push_back(enter);
|
||||
deleteNotify(enter);
|
||||
|
||||
if(evalCmD(&mEnterCommand))
|
||||
if(isServerObject() && evalCmD(&mEnterCommand))
|
||||
{
|
||||
String command = String("%obj = ") + enter->getIdString() + ";";
|
||||
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
|
||||
Con::evaluate(command.c_str());
|
||||
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
|
||||
}
|
||||
|
||||
if( mDataBlock && testTrippable() && testCondition())
|
||||
|
|
@ -787,11 +799,11 @@ void Trigger::processTick(const Move* move)
|
|||
mObjects.erase(i);
|
||||
clearNotify(remove);
|
||||
|
||||
if (evalCmD(&mLeaveCommand))
|
||||
if (isServerObject() && evalCmD(&mLeaveCommand))
|
||||
{
|
||||
String command = String("%obj = ") + remove->getIdString() + ";";
|
||||
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
|
||||
Con::evaluate(command.c_str());
|
||||
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
|
||||
}
|
||||
if (testTrippable() && testCondition())
|
||||
mDataBlock->onLeaveTrigger_callback( this, remove );
|
||||
|
|
@ -799,8 +811,19 @@ void Trigger::processTick(const Move* move)
|
|||
}
|
||||
}
|
||||
|
||||
if (evalCmD(&mTickCommand))
|
||||
Con::evaluate(mTickCommand.c_str());
|
||||
if (isServerObject() && evalCmD(&mTickCommand))
|
||||
{
|
||||
StringTableEntry objectName = getName();
|
||||
if (objectName != NULL)
|
||||
objectName = getIdString();
|
||||
|
||||
StringTableEntry groupName = getGroup()->getName();
|
||||
if (groupName != NULL)
|
||||
groupName = getGroup()->getIdString();
|
||||
|
||||
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
|
||||
Con::evaluate(mTickCommand.c_str(), false, context);
|
||||
}
|
||||
|
||||
if (mObjects.size() != 0 && testTrippable() && testCondition())
|
||||
mDataBlock->onTickTrigger_callback( this );
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ F32 TSStatic::smStaticObjectUnfadeableSize = 75;
|
|||
TSStatic::TSStatic()
|
||||
:
|
||||
cubeDescId(0),
|
||||
reflectorDesc(NULL)
|
||||
reflectorDesc(NULL),
|
||||
mCubeReflector(NULL)
|
||||
{
|
||||
mNetFlags.set(Ghostable | ScopeAlways);
|
||||
|
||||
|
|
@ -159,6 +160,11 @@ TSStatic::~TSStatic()
|
|||
delete mConvexList;
|
||||
mConvexList = NULL;
|
||||
mShapeAsset.unregisterRefreshNotify();
|
||||
if (mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
}
|
||||
|
||||
ImplementEnumType(TSMeshType,
|
||||
|
|
@ -361,10 +367,17 @@ bool TSStatic::onAdd()
|
|||
|
||||
if (isClientObject())
|
||||
{
|
||||
mCubeReflector.unregisterReflector();
|
||||
if (mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
|
||||
if (reflectorDesc)
|
||||
mCubeReflector.registerReflector(this, reflectorDesc);
|
||||
{
|
||||
mCubeReflector = new CubeReflector();
|
||||
mCubeReflector->registerReflector(this, reflectorDesc);
|
||||
}
|
||||
}
|
||||
|
||||
_updateShouldTick();
|
||||
|
|
@ -594,8 +607,11 @@ void TSStatic::onRemove()
|
|||
mShapeInstance = NULL;
|
||||
|
||||
mAmbientThread = NULL;
|
||||
if (isClientObject())
|
||||
mCubeReflector.unregisterReflector();
|
||||
if (isClientObject() && mCubeReflector)
|
||||
{
|
||||
mCubeReflector->unregisterReflector();
|
||||
SAFE_DELETE(mCubeReflector);
|
||||
}
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
|
@ -780,7 +796,7 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
|||
|
||||
// If we're currently rendering our own reflection we
|
||||
// don't want to render ourselves into it.
|
||||
if (mCubeReflector.isRendering())
|
||||
if (mCubeReflector && mCubeReflector->isRendering())
|
||||
return;
|
||||
|
||||
|
||||
|
|
@ -800,8 +816,8 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
|||
rdata.setFadeOverride(1.0f);
|
||||
rdata.setOriginSort(mUseOriginSort);
|
||||
|
||||
if (mCubeReflector.isEnabled())
|
||||
rdata.setCubemap(mCubeReflector.getCubemap());
|
||||
if (mCubeReflector && mCubeReflector->isEnabled())
|
||||
rdata.setCubemap(mCubeReflector->getCubemap());
|
||||
|
||||
// Acculumation
|
||||
rdata.setAccuTex(mAccuTex);
|
||||
|
|
@ -830,13 +846,13 @@ void TSStatic::prepRenderImage(SceneRenderState* state)
|
|||
mat.scale(mObjScale);
|
||||
GFX->setWorldMatrix(mat);
|
||||
|
||||
if (state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery())
|
||||
if (state->isDiffusePass() && mCubeReflector && mCubeReflector->isEnabled() && mCubeReflector->getOcclusionQuery())
|
||||
{
|
||||
RenderPassManager* pass = state->getRenderPass();
|
||||
OccluderRenderInst* ri = pass->allocInst<OccluderRenderInst>();
|
||||
|
||||
ri->type = RenderPassManager::RIT_Occluder;
|
||||
ri->query = mCubeReflector.getOcclusionQuery();
|
||||
ri->query = mCubeReflector->getOcclusionQuery();
|
||||
mObjToWorld.mulP(mObjBox.getCenter(), &ri->position);
|
||||
ri->scale.set(mObjBox.getExtents());
|
||||
ri->orientation = pass->allocUniqueXform(mObjToWorld);
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ protected:
|
|||
String cubeDescName;
|
||||
U32 cubeDescId;
|
||||
ReflectorDesc* reflectorDesc;
|
||||
CubeReflector mCubeReflector;
|
||||
CubeReflector* mCubeReflector;
|
||||
|
||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2367,8 +2367,7 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou
|
|||
|
||||
DefineEngineFunction( eval, const char*, ( const char* consoleString, bool echo ), (false), "eval(consoleString)")
|
||||
{
|
||||
Con::EvalResult returnValue = Con::evaluate(consoleString, echo, NULL);
|
||||
|
||||
Con::EvalResult returnValue = Con::evaluate(consoleString, echo, Platform::makeRelativePathName(Con::getCurrentScriptModulePath(), NULL));
|
||||
return Con::getReturnBuffer(returnValue.value.getString());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ inline FuncVars* getFuncVars(S32 lineNumber)
|
|||
{
|
||||
if (gFuncVars == &gGlobalScopeFuncVars)
|
||||
{
|
||||
const char* str = avar("Attemping to use local variable in global scope. File: %s Line: %d", CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
||||
const char* lineTxt = CodeBlock::smCurrentLineText;
|
||||
const char* str = avar("Attemping to use local variable in global scope. File: %s\nLine Num: %d\nLine: \"%s\"", CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineTxt);
|
||||
scriptErrorHandler(str);
|
||||
}
|
||||
return gFuncVars;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ using namespace Compiler;
|
|||
|
||||
bool CodeBlock::smInFunction = false;
|
||||
CodeBlock * CodeBlock::smCodeBlockList = NULL;
|
||||
const char* CodeBlock::smCurrentLineText = "\0";
|
||||
TorqueScriptParser *CodeBlock::smCurrentParser = NULL;
|
||||
|
||||
extern FuncVars gEvalFuncVars;
|
||||
|
|
@ -578,6 +579,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
|||
consoleAllocReset();
|
||||
|
||||
name = fileName;
|
||||
smCurrentLineText = inString;
|
||||
|
||||
if (fileName)
|
||||
{
|
||||
|
|
@ -623,6 +625,7 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
|||
|
||||
if (!Script::gStatementList)
|
||||
{
|
||||
smCurrentLineText = "\0";
|
||||
delete this;
|
||||
return Con::EvalResult(Con::getVariable("$ScriptError"));
|
||||
}
|
||||
|
|
@ -668,7 +671,10 @@ Con::EvalResult CodeBlock::compileExec(StringTableEntry fileName, const char *in
|
|||
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
||||
|
||||
// repurpose argc as local register counter for global state
|
||||
return (exec(0, fileName, NULL, localRegisterCount, 0, noCalls, NULL, setFrame));
|
||||
Con::EvalResult execResult = (exec(0, fileName, NULL, localRegisterCount, 0, noCalls, NULL, setFrame));
|
||||
|
||||
smCurrentLineText = "\0";
|
||||
return execResult;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ private:
|
|||
public:
|
||||
static bool smInFunction;
|
||||
static TorqueScriptParser * smCurrentParser;
|
||||
static const char* smCurrentLineText;
|
||||
|
||||
static CodeBlock *getCodeBlockList()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -160,7 +160,16 @@ S32 FuncVars::assign(StringTableEntry var, TypeReq currentType, S32 lineNumber,
|
|||
|
||||
if (found->second.isConstant)
|
||||
{
|
||||
const char* str = avar("Script Warning: Reassigning variable %s when it is a constant. File: %s Line : %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
||||
const char* lineText = CodeBlock::smCurrentLineText;
|
||||
|
||||
String codeString = CodeBlock::smCurrentLineText;
|
||||
Vector<String> splitLines;
|
||||
codeString.split("\n", splitLines);
|
||||
|
||||
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||
lineText = splitLines[lineNumber - 1].c_str();
|
||||
|
||||
const char* str = avar("Script Warning: Reassigning variable %s when it is a constant. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||
scriptErrorHandler(str);
|
||||
}
|
||||
return found->second.reg;
|
||||
|
|
@ -179,7 +188,16 @@ S32 FuncVars::lookup(StringTableEntry var, S32 lineNumber)
|
|||
|
||||
if (found == vars.end())
|
||||
{
|
||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
||||
const char* lineText = CodeBlock::smCurrentLineText;
|
||||
|
||||
String codeString = CodeBlock::smCurrentLineText;
|
||||
Vector<String> splitLines;
|
||||
codeString.split("\n", splitLines);
|
||||
|
||||
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||
lineText = splitLines[lineNumber - 1].c_str();
|
||||
|
||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||
scriptErrorHandler(str);
|
||||
|
||||
return assign(var, TypeReqString, lineNumber, false);
|
||||
|
|
@ -194,7 +212,16 @@ TypeReq FuncVars::lookupType(StringTableEntry var, S32 lineNumber)
|
|||
|
||||
if (found == vars.end())
|
||||
{
|
||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
|
||||
const char* lineText = CodeBlock::smCurrentLineText;
|
||||
|
||||
String codeString = CodeBlock::smCurrentLineText;
|
||||
Vector<String> splitLines;
|
||||
codeString.split("\n", splitLines);
|
||||
|
||||
if (lineNumber > 0 && splitLines.size() > lineNumber)
|
||||
lineText = splitLines[lineNumber-1].c_str();
|
||||
|
||||
const char* str = avar("Script Warning: Variable %s referenced before used when compiling script. File: %s\nLine Num: %d\nLine: \"%s\"", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber, lineText);
|
||||
scriptErrorHandler(str);
|
||||
|
||||
assign(var, TypeReqString, lineNumber, false);
|
||||
|
|
|
|||
|
|
@ -974,7 +974,9 @@ void GuiGameListMenuCtrl::doScriptCommand(StringTableEntry command)
|
|||
if (command && command[0])
|
||||
{
|
||||
setThisControl();
|
||||
Con::evaluate(command, false, __FILE__);
|
||||
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||
Con::evaluate(command, false, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -494,7 +494,9 @@ void GuiGameSettingsCtrl::doScriptCommand(StringTableEntry command)
|
|||
if (command && command[0])
|
||||
{
|
||||
setThisControl();
|
||||
Con::evaluate(command, false, __FILE__);
|
||||
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||
Con::evaluate(command, false, context.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1539,7 +1539,9 @@ StringTableEntry GuiListBoxCtrl::_makeMirrorItemName( SimObject *inObj )
|
|||
Con::setIntVariable( "$ThisControl", getId() );
|
||||
Con::setIntVariable( "$ThisObject", inObj->getId() );
|
||||
|
||||
outName = StringTable->insert( Con::evaluate( mMakeNameCallback ).value, true );
|
||||
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||
String context = String::ToString("%s, Object: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||
outName = StringTable->insert( Con::evaluate( mMakeNameCallback, false, context).value, true );
|
||||
}
|
||||
else if ( inObj->getName() )
|
||||
outName = StringTable->insert( inObj->getName() );
|
||||
|
|
|
|||
|
|
@ -211,7 +211,9 @@ bool GuiMLTextEditCtrl::onKeyDown(const GuiEvent& event)
|
|||
case KEY_ESCAPE:
|
||||
if ( mEscapeCommand[0] )
|
||||
{
|
||||
Con::evaluate( mEscapeCommand );
|
||||
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||
String context = String::ToString("%s, Object: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||
Con::evaluate( mEscapeCommand, false, context.c_str());
|
||||
return( true );
|
||||
}
|
||||
return( Parent::onKeyDown( event ) );
|
||||
|
|
|
|||
|
|
@ -2495,7 +2495,15 @@ void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent
|
|||
const char* GuiControl::evaluate( const char* str )
|
||||
{
|
||||
smThisControl = this;
|
||||
const char* result = Con::evaluate(str, false).value;
|
||||
StringTableEntry objectName = getName();
|
||||
if (getName() == NULL)
|
||||
objectName = getInternalName();
|
||||
StringTableEntry fileName = getFilename();
|
||||
if (fileName != NULL)
|
||||
fileName = Platform::makeRelativePathName(fileName, NULL);
|
||||
|
||||
String context = String::ToString("%s\nObject: %s", fileName, objectName);
|
||||
const char* result = Con::evaluate(str, false, context).value;
|
||||
smThisControl = NULL;
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1482,8 +1482,12 @@ bool ActionMap::processAction(const InputEventInfo* pEvent)
|
|||
if(pNode->flags & Node::BindCmd)
|
||||
{
|
||||
// it's a bind command
|
||||
if(pNode->makeConsoleCommand)
|
||||
Con::evaluate(pNode->makeConsoleCommand);
|
||||
if (pNode->makeConsoleCommand)
|
||||
{
|
||||
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
|
||||
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
|
||||
Con::evaluate(pNode->makeConsoleCommand, false, context.c_str());
|
||||
}
|
||||
}
|
||||
else if (pNode->flags & Node::Held)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -206,15 +206,15 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
|
|||
if (rmName.isNotEmpty())
|
||||
{
|
||||
mat->_setRoughMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Roughness
|
||||
mat->mRoughnessChan[0] = 1.0f;
|
||||
mat->mInvertRoughness[0] = (floatVal == 1.0f);
|
||||
mat->mRoughnessChan[0] = 1;
|
||||
mat->mInvertRoughness[0] = false;
|
||||
mat->_setMetalMap(cleanTextureName(rmName, cleanFile, path, false), 0); // Metallic
|
||||
mat->mMetalChan[0] = 2.0f;
|
||||
mat->mMetalChan[0] = 2;
|
||||
}
|
||||
if (aoName.isNotEmpty())
|
||||
{
|
||||
mat->_setAOMap(cleanTextureName(aoName, cleanFile, path, false), 0); // occlusion
|
||||
mat->mAOChan[0] = 0.0f;
|
||||
mat->mAOChan[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue