mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Merge remote-tracking branch 'devhead/Preview4_0' into cpuinfo
This commit is contained in:
commit
ca0a5d41a7
42 changed files with 668 additions and 218 deletions
|
|
@ -169,7 +169,13 @@ void MaterialAsset::initializeAsset()
|
||||||
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
|
|
||||||
if (Torque::FS::IsScriptFile(mScriptPath))
|
if (Torque::FS::IsScriptFile(mScriptPath))
|
||||||
Con::executeFile(mScriptPath, false, false);
|
{
|
||||||
|
if (!Sim::findObject(mMatDefinitionName))
|
||||||
|
if (Con::executeFile(mScriptPath, false, false))
|
||||||
|
mLoadedState = ScriptLoaded;
|
||||||
|
else
|
||||||
|
mLoadedState = Failed;
|
||||||
|
}
|
||||||
|
|
||||||
loadMaterial();
|
loadMaterial();
|
||||||
}
|
}
|
||||||
|
|
@ -179,7 +185,22 @@ void MaterialAsset::onAssetRefresh()
|
||||||
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||||
|
|
||||||
if (Torque::FS::IsScriptFile(mScriptPath))
|
if (Torque::FS::IsScriptFile(mScriptPath))
|
||||||
Con::executeFile(mScriptPath, false, false);
|
{
|
||||||
|
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
|
||||||
|
//But that definition, whatever it is, is the 'correct' one, so we enable the Replace Existing behavior
|
||||||
|
//when the engine encounters a named object conflict.
|
||||||
|
String redefineBehaviorPrev = Con::getVariable("$Con::redefineBehavior");
|
||||||
|
Con::setVariable("$Con::redefineBehavior", "replaceExisting");
|
||||||
|
|
||||||
|
if (Con::executeFile(mScriptPath, false, false))
|
||||||
|
mLoadedState = ScriptLoaded;
|
||||||
|
else
|
||||||
|
mLoadedState = Failed;
|
||||||
|
|
||||||
|
//And now that we've executed, switch back to the prior behavior
|
||||||
|
Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
loadMaterial();
|
loadMaterial();
|
||||||
}
|
}
|
||||||
|
|
@ -206,7 +227,7 @@ void MaterialAsset::loadMaterial()
|
||||||
if (mMaterialDefinition)
|
if (mMaterialDefinition)
|
||||||
SAFE_DELETE(mMaterialDefinition);
|
SAFE_DELETE(mMaterialDefinition);
|
||||||
|
|
||||||
if (mMatDefinitionName != StringTable->EmptyString())
|
if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
Material* matDef;
|
Material* matDef;
|
||||||
if (!Sim::findObject(mMatDefinitionName, matDef))
|
if (!Sim::findObject(mMatDefinitionName, matDef))
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,12 @@ class MaterialAsset : public AssetBase
|
||||||
public:
|
public:
|
||||||
static StringTableEntry smNoMaterialAssetFallback;
|
static StringTableEntry smNoMaterialAssetFallback;
|
||||||
|
|
||||||
|
enum MaterialAssetErrCode
|
||||||
|
{
|
||||||
|
ScriptLoaded = AssetErrCode::Extended,
|
||||||
|
Extended
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MaterialAsset();
|
MaterialAsset();
|
||||||
virtual ~MaterialAsset();
|
virtual ~MaterialAsset();
|
||||||
|
|
|
||||||
|
|
@ -1551,13 +1551,10 @@ void ParticleEmitter::updateBBox()
|
||||||
|
|
||||||
for (Particle* part = part_list_head.next; part != NULL; part = part->next)
|
for (Particle* part = part_list_head.next; part != NULL; part = part->next)
|
||||||
{
|
{
|
||||||
for (Particle* part = part_list_head.next; part != NULL; part = part->next)
|
Point3F particleSize(part->size * 0.5f);
|
||||||
{
|
F32 motion = getMax((part->vel.len() * part->totalLifetime / 1000.0f), 1.0f);
|
||||||
Point3F particleSize(part->size * 0.5f);
|
minPt.setMin(part->pos - particleSize - Point3F(motion));
|
||||||
F32 motion = getMax((part->vel.len() * part->totalLifetime / 1000.0f), 1.0f);
|
maxPt.setMax(part->pos + particleSize + Point3F(motion));
|
||||||
minPt.setMin(part->pos - particleSize - Point3F(motion));
|
|
||||||
maxPt.setMax(part->pos + particleSize + Point3F(motion));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mObjBox = Box3F(minPt, maxPt);
|
mObjBox = Box3F(minPt, maxPt);
|
||||||
|
|
@ -1675,8 +1672,8 @@ void ParticleEmitter::addParticle(const Point3F& pos, const Point3F& axis, const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
U32 dBlockIndex = gRandGen.randI() % mDataBlock->particleDataBlocks.size();
|
dBlockIndex = gRandGen.randI() % mDataBlock->particleDataBlocks.size();
|
||||||
mDataBlock->particleDataBlocks[dBlockIndex]->initializeParticle(pNew, vel);
|
mDataBlock->particleDataBlocks[dBlockIndex]->initializeParticle(pNew, vel);
|
||||||
}
|
}
|
||||||
updateKeyData( pNew );
|
updateKeyData( pNew );
|
||||||
|
|
||||||
|
|
@ -2220,7 +2217,7 @@ void ParticleEmitter::setupOriented( Particle *part,
|
||||||
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||||
const ColorI color = partCol.toColorI();
|
const ColorI color = partCol.toColorI();
|
||||||
// Here we deal with UVs for animated particle (oriented)
|
// Here we deal with UVs for animated particle (oriented)
|
||||||
if (part->dataBlock->animateTexture)
|
if (part->dataBlock->animateTexture && !part->dataBlock->animTexFrames.empty())
|
||||||
{
|
{
|
||||||
// Let particle compute the UV indices for current frame
|
// Let particle compute the UV indices for current frame
|
||||||
S32 fm = (S32)(part->currentAge*(1.0f/1000.0f)*part->dataBlock->framesPerSec);
|
S32 fm = (S32)(part->currentAge*(1.0f/1000.0f)*part->dataBlock->framesPerSec);
|
||||||
|
|
@ -2331,7 +2328,7 @@ void ParticleEmitter::setupAligned( const Particle *part,
|
||||||
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
LinearColorF partCol = mLerp( part->color, ( part->color * ambientColor ), ambientLerp );
|
||||||
const ColorI color = partCol.toColorI();
|
const ColorI color = partCol.toColorI();
|
||||||
// Here we deal with UVs for animated particle
|
// Here we deal with UVs for animated particle
|
||||||
if (part->dataBlock->animateTexture)
|
if (part->dataBlock->animateTexture && !part->dataBlock->animTexFrames.empty())
|
||||||
{
|
{
|
||||||
// Let particle compute the UV indices for current frame
|
// Let particle compute the UV indices for current frame
|
||||||
S32 fm = (S32)(part->currentAge*(1.0f/1000.0f)*part->dataBlock->framesPerSec);
|
S32 fm = (S32)(part->currentAge*(1.0f/1000.0f)*part->dataBlock->framesPerSec);
|
||||||
|
|
@ -2520,7 +2517,7 @@ void ParticleEmitter::setupRibbon(Particle *part,
|
||||||
ColorI pCol = partCol.toColorI();
|
ColorI pCol = partCol.toColorI();
|
||||||
|
|
||||||
// Here we deal with UVs for animated particle (oriented)
|
// Here we deal with UVs for animated particle (oriented)
|
||||||
if (part->dataBlock->animateTexture)
|
if (part->dataBlock->animateTexture && !part->dataBlock->animTexFrames.empty())
|
||||||
{
|
{
|
||||||
// Let particle compute the UV indices for current frame
|
// Let particle compute the UV indices for current frame
|
||||||
S32 fm = (S32)(part->currentAge*(1.0f / 1000.0f)*part->dataBlock->framesPerSec);
|
S32 fm = (S32)(part->currentAge*(1.0f / 1000.0f)*part->dataBlock->framesPerSec);
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ ConsoleDocClass( PrecipitationData,
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
PrecipitationData::PrecipitationData()
|
PrecipitationData::PrecipitationData()
|
||||||
{
|
{
|
||||||
soundProfile = NULL;
|
INIT_SOUNDASSET(Sound);
|
||||||
|
|
||||||
INIT_IMAGEASSET(Drop);
|
INIT_IMAGEASSET(Drop);
|
||||||
|
|
||||||
|
|
@ -143,8 +143,7 @@ PrecipitationData::PrecipitationData()
|
||||||
|
|
||||||
void PrecipitationData::initPersistFields()
|
void PrecipitationData::initPersistFields()
|
||||||
{
|
{
|
||||||
addField( "soundProfile", TYPEID< SFXTrack >(), Offset(soundProfile, PrecipitationData),
|
INITPERSISTFIELD_SOUNDASSET(Sound, PrecipitationData, "Looping SFXProfile effect to play while Precipitation is active.");
|
||||||
"Looping SFXProfile effect to play while Precipitation is active." );
|
|
||||||
|
|
||||||
addProtectedField( "dropTexture", TypeFilename, Offset(mDropName, PrecipitationData), &_setDropData, &defaultProtectedGetFn,
|
addProtectedField( "dropTexture", TypeFilename, Offset(mDropName, PrecipitationData), &_setDropData, &defaultProtectedGetFn,
|
||||||
"@brief Texture filename for drop particles.\n\n"
|
"@brief Texture filename for drop particles.\n\n"
|
||||||
|
|
@ -190,7 +189,7 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
||||||
if( Parent::preload( server, errorStr) == false)
|
if( Parent::preload( server, errorStr) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !server && !sfxResolve( &soundProfile, errorStr ) )
|
if (!server && !getSFXProfile())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -200,7 +199,7 @@ void PrecipitationData::packData(BitStream* stream)
|
||||||
{
|
{
|
||||||
Parent::packData(stream);
|
Parent::packData(stream);
|
||||||
|
|
||||||
sfxWrite( stream, soundProfile );
|
PACKDATA_SOUNDASSET(Sound);
|
||||||
|
|
||||||
PACKDATA_IMAGEASSET(Drop);
|
PACKDATA_IMAGEASSET(Drop);
|
||||||
|
|
||||||
|
|
@ -217,7 +216,7 @@ void PrecipitationData::unpackData(BitStream* stream)
|
||||||
{
|
{
|
||||||
Parent::unpackData(stream);
|
Parent::unpackData(stream);
|
||||||
|
|
||||||
sfxRead( stream, &soundProfile );
|
UNPACKDATA_SOUNDASSET(Sound);
|
||||||
|
|
||||||
UNPACKDATA_IMAGEASSET(Drop);
|
UNPACKDATA_IMAGEASSET(Drop);
|
||||||
|
|
||||||
|
|
@ -598,9 +597,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
{
|
{
|
||||||
SFX_DELETE( mAmbientSound );
|
SFX_DELETE( mAmbientSound );
|
||||||
|
|
||||||
if ( mDataBlock->soundProfile )
|
if ( mDataBlock->getSFXProfile())
|
||||||
{
|
{
|
||||||
mAmbientSound = SFX->createSource( mDataBlock->soundProfile, &getTransform() );
|
mAmbientSound = SFX->createSource(mDataBlock->getSFXProfile(), &getTransform() );
|
||||||
if ( mAmbientSound )
|
if ( mAmbientSound )
|
||||||
mAmbientSound->play();
|
mAmbientSound->play();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "T3D/assets/ImageAsset.h"
|
#include "T3D/assets/ImageAsset.h"
|
||||||
|
#include "T3D/assets/SoundAsset.h"
|
||||||
|
|
||||||
class SFXTrack;
|
//class SFXTrack;
|
||||||
class SFXSource;
|
class SFXSource;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
@ -45,30 +46,39 @@ class PrecipitationData : public GameBaseData
|
||||||
typedef GameBaseData Parent;
|
typedef GameBaseData Parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SFXTrack* soundProfile;
|
//SFXTrack* soundProfile;
|
||||||
|
DECLARE_SOUNDASSET(PrecipitationData, Sound);
|
||||||
|
DECLARE_SOUNDASSET_SETGET(PrecipitationData, Sound);
|
||||||
|
|
||||||
DECLARE_IMAGEASSET(PrecipitationData, Drop, onDropChanged, GFXStaticTextureSRGBProfile); ///< Texture for drop particles
|
DECLARE_IMAGEASSET(PrecipitationData, Drop, onDropChanged, GFXStaticTextureSRGBProfile); ///< Texture for drop particles
|
||||||
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Drop);
|
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Drop);
|
||||||
|
|
||||||
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
|
StringTableEntry mDropShaderName; ///< The name of the shader used for raindrops
|
||||||
|
|
||||||
DECLARE_IMAGEASSET(PrecipitationData, Splash, onSplashChanged, GFXStaticTextureSRGBProfile); ///< Texture for splash particles
|
DECLARE_IMAGEASSET(PrecipitationData, Splash, onSplashChanged, GFXStaticTextureSRGBProfile); ///< Texture for splash particles
|
||||||
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Splash);
|
DECLARE_IMAGEASSET_SETGET(PrecipitationData, Splash);
|
||||||
|
|
||||||
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
|
StringTableEntry mSplashShaderName; ///< The name of the shader used for raindrops
|
||||||
|
|
||||||
S32 mDropsPerSide; ///< How many drops are on a side of the raindrop texture.
|
S32 mDropsPerSide; ///< How many drops are on a side of the raindrop texture.
|
||||||
S32 mSplashesPerSide; ///< How many splash are on a side of the splash texture.
|
S32 mSplashesPerSide; ///< How many splash are on a side of the splash texture.
|
||||||
|
|
||||||
PrecipitationData();
|
PrecipitationData();
|
||||||
DECLARE_CONOBJECT(PrecipitationData);
|
DECLARE_CONOBJECT(PrecipitationData);
|
||||||
bool preload( bool server, String& errorStr );
|
bool preload( bool server, String& errorStr );
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
virtual void packData(BitStream* stream);
|
virtual void packData(BitStream* stream);
|
||||||
virtual void unpackData(BitStream* stream);
|
virtual void unpackData(BitStream* stream);
|
||||||
|
|
||||||
void onDropChanged() {}
|
void onDropChanged() {}
|
||||||
void onSplashChanged() {}
|
void onSplashChanged() {}
|
||||||
|
|
||||||
|
SFXProfile* getSFXProfile() {
|
||||||
|
if (mSoundAsset.notNull())
|
||||||
|
return mSoundAsset->getSfxProfile();
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Raindrop
|
struct Raindrop
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ bool Prefab::protectedSetFile( void *object, const char *index, const char *data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prefab::setFile( String file )
|
void Prefab::setFile( StringTableEntry file )
|
||||||
{
|
{
|
||||||
AssertFatal( isServerObject(), "Prefab-bad" );
|
AssertFatal( isServerObject(), "Prefab-bad" );
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ void Prefab::setFile( String file )
|
||||||
// be called for the client-side prefab but maybe the user did so accidentally.
|
// be called for the client-side prefab but maybe the user did so accidentally.
|
||||||
if ( isClientObject() )
|
if ( isClientObject() )
|
||||||
{
|
{
|
||||||
Con::errorf( "Prefab::setFile( %s ) - Should not be called on a client-side Prefab.", file.c_str() );
|
Con::errorf( "Prefab::setFile( %s ) - Should not be called on a client-side Prefab.", file );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
void render( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
void render( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
||||||
|
|
||||||
///
|
///
|
||||||
void setFile( String file );
|
void setFile(StringTableEntry file );
|
||||||
|
|
||||||
/// Removes all children from this Prefab and puts them into a SimGroup
|
/// Removes all children from this Prefab and puts them into a SimGroup
|
||||||
/// which is added to the Scene and returned to the caller.
|
/// which is added to the Scene and returned to the caller.
|
||||||
|
|
|
||||||
|
|
@ -786,6 +786,8 @@ bool Projectile::onAdd()
|
||||||
// If we're on the server, we need to inherit some of our parent's velocity
|
// If we're on the server, we need to inherit some of our parent's velocity
|
||||||
//
|
//
|
||||||
mCurrTick = 0;
|
mCurrTick = 0;
|
||||||
|
|
||||||
|
scriptOnAdd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1675,10 +1675,6 @@ void TSStatic::onInspect(GuiInspector* inspector)
|
||||||
{
|
{
|
||||||
dSprintf(matFieldName, 128, "MaterialSlot%d", i);
|
dSprintf(matFieldName, 128, "MaterialSlot%d", i);
|
||||||
|
|
||||||
//addComponentField(matFieldName, "A material used in the shape file", "Material", matAsset->getAssetId(), "");
|
|
||||||
//Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName);
|
|
||||||
Con::printf("Added material field for MaterialSlot %d", i);
|
|
||||||
|
|
||||||
GuiInspectorField* fieldGui = materialGroup->constructField(TypeMaterialAssetPtr);
|
GuiInspectorField* fieldGui = materialGroup->constructField(TypeMaterialAssetPtr);
|
||||||
fieldGui->init(inspector, materialGroup);
|
fieldGui->init(inspector, materialGroup);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,57 +56,7 @@ namespace Compiler
|
||||||
|
|
||||||
using namespace Compiler;
|
using namespace Compiler;
|
||||||
|
|
||||||
class FuncVars
|
FuncVars gEvalFuncVars;
|
||||||
{
|
|
||||||
struct Var
|
|
||||||
{
|
|
||||||
S32 reg;
|
|
||||||
TypeReq currentType;
|
|
||||||
StringTableEntry name;
|
|
||||||
bool isConstant;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
S32 assign(StringTableEntry var, TypeReq currentType, S32 lineNumber, bool isConstant = false)
|
|
||||||
{
|
|
||||||
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
|
||||||
if (found != vars.end())
|
|
||||||
{
|
|
||||||
AssertISV(!found->second.isConstant, avar("Reassigning variable %s when it is a constant. File: %s Line : %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
|
||||||
return found->second.reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 id = counter++;
|
|
||||||
vars[var] = { id, currentType, var, isConstant };
|
|
||||||
variableNameMap[id] = var;
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 lookup(StringTableEntry var, S32 lineNumber)
|
|
||||||
{
|
|
||||||
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
|
||||||
AssertISV(found != vars.end(), avar("Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
|
||||||
return found->second.reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
TypeReq lookupType(StringTableEntry var, S32 lineNumber)
|
|
||||||
{
|
|
||||||
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
|
||||||
|
|
||||||
AssertISV(found != vars.end(), avar("Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
|
||||||
return found->second.currentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline S32 count() { return counter; }
|
|
||||||
|
|
||||||
std::unordered_map<S32, StringTableEntry> variableNameMap;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unordered_map<StringTableEntry, Var> vars;
|
|
||||||
S32 counter = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
FuncVars* gFuncVars = NULL;
|
FuncVars* gFuncVars = NULL;
|
||||||
|
|
||||||
inline FuncVars* getFuncVars(S32 lineNumber)
|
inline FuncVars* getFuncVars(S32 lineNumber)
|
||||||
|
|
@ -1602,7 +1552,8 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream& codeStream, U32 ip)
|
||||||
tbl->add(fnName, nameSpace, varName);
|
tbl->add(fnName, nameSpace, varName);
|
||||||
}
|
}
|
||||||
|
|
||||||
gFuncVars = NULL;
|
// In eval mode, global func vars are allowed.
|
||||||
|
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : NULL;
|
||||||
|
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ CodeBlock * CodeBlock::smCodeBlockList = NULL;
|
||||||
CodeBlock * CodeBlock::smCurrentCodeBlock = NULL;
|
CodeBlock * CodeBlock::smCurrentCodeBlock = NULL;
|
||||||
ConsoleParser *CodeBlock::smCurrentParser = NULL;
|
ConsoleParser *CodeBlock::smCurrentParser = NULL;
|
||||||
|
|
||||||
|
extern FuncVars gEvalFuncVars;
|
||||||
|
extern FuncVars* gFuncVars;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
CodeBlock::CodeBlock()
|
CodeBlock::CodeBlock()
|
||||||
|
|
@ -491,6 +494,8 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
|
||||||
chompUTF8BOM(inScript, &script);
|
chompUTF8BOM(inScript, &script);
|
||||||
|
|
||||||
gSyntaxError = false;
|
gSyntaxError = false;
|
||||||
|
gIsEvalCompile = false;
|
||||||
|
gFuncVars = NULL;
|
||||||
|
|
||||||
consoleAllocReset();
|
consoleAllocReset();
|
||||||
|
|
||||||
|
|
@ -629,6 +634,11 @@ ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inStr
|
||||||
addToCodeList();
|
addToCodeList();
|
||||||
|
|
||||||
gStatementList = NULL;
|
gStatementList = NULL;
|
||||||
|
|
||||||
|
// we are an eval compile if we don't have a file name associated (no exec)
|
||||||
|
gIsEvalCompile = fileName == NULL;
|
||||||
|
// In eval mode, global func vars are allowed.
|
||||||
|
gFuncVars = gIsEvalCompile ? &gEvalFuncVars : NULL;
|
||||||
|
|
||||||
// Set up the parser.
|
// Set up the parser.
|
||||||
smCurrentParser = getParserForFile(fileName);
|
smCurrentParser = getParserForFile(fileName);
|
||||||
|
|
@ -667,6 +677,8 @@ ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inStr
|
||||||
|
|
||||||
codeStream.emit(OP_RETURN_VOID);
|
codeStream.emit(OP_RETURN_VOID);
|
||||||
codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs);
|
codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs);
|
||||||
|
|
||||||
|
S32 localRegisterCount = gIsEvalCompile ? gEvalFuncVars.count() : 0;
|
||||||
|
|
||||||
consoleAllocReset();
|
consoleAllocReset();
|
||||||
|
|
||||||
|
|
@ -683,7 +695,8 @@ ConsoleValue CodeBlock::compileExec(StringTableEntry fileName, const char *inStr
|
||||||
if (lastIp + 1 != codeSize)
|
if (lastIp + 1 != codeSize)
|
||||||
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp);
|
||||||
|
|
||||||
return std::move(exec(0, fileName, NULL, 0, 0, noCalls, NULL, setFrame));
|
// repurpose argc as local register counter for global state
|
||||||
|
return std::move(exec(0, fileName, NULL, localRegisterCount, 0, noCalls, NULL, setFrame));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,8 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
||||||
// Do we want this code to execute using a new stack frame?
|
// Do we want this code to execute using a new stack frame?
|
||||||
if (setFrame < 0)
|
if (setFrame < 0)
|
||||||
{
|
{
|
||||||
gEvalState.pushFrame(NULL, NULL, 0);
|
// argc is the local count for eval
|
||||||
|
gEvalState.pushFrame(NULL, NULL, argc);
|
||||||
gCallStack.pushFrame(0);
|
gCallStack.pushFrame(0);
|
||||||
popFrame = true;
|
popFrame = true;
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +735,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
||||||
SimObject* curObject = NULL;
|
SimObject* curObject = NULL;
|
||||||
SimObject* saveObject = NULL;
|
SimObject* saveObject = NULL;
|
||||||
Namespace::Entry* nsEntry;
|
Namespace::Entry* nsEntry;
|
||||||
Namespace* ns;
|
Namespace* ns = NULL;
|
||||||
const char* curFNDocBlock = NULL;
|
const char* curFNDocBlock = NULL;
|
||||||
const char* curNSDocBlock = NULL;
|
const char* curNSDocBlock = NULL;
|
||||||
const S32 nsDocLength = 128;
|
const S32 nsDocLength = 128;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include "console/simBase.h"
|
#include "console/simBase.h"
|
||||||
|
|
||||||
|
extern FuncVars gEvalFuncVars;
|
||||||
|
|
||||||
namespace Compiler
|
namespace Compiler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -86,6 +88,7 @@ namespace Compiler
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
bool gSyntaxError = false;
|
bool gSyntaxError = false;
|
||||||
|
bool gIsEvalCompile = false;
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -121,6 +124,7 @@ namespace Compiler
|
||||||
getFunctionStringTable().reset();
|
getFunctionStringTable().reset();
|
||||||
getIdentTable().reset();
|
getIdentTable().reset();
|
||||||
getFunctionVariableMappingTable().reset();
|
getFunctionVariableMappingTable().reset();
|
||||||
|
gEvalFuncVars.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); }
|
void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); }
|
||||||
|
|
@ -132,6 +136,44 @@ namespace Compiler
|
||||||
|
|
||||||
using namespace Compiler;
|
using namespace Compiler;
|
||||||
|
|
||||||
|
S32 FuncVars::assign(StringTableEntry var, TypeReq currentType, S32 lineNumber, bool isConstant)
|
||||||
|
{
|
||||||
|
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
||||||
|
if (found != vars.end())
|
||||||
|
{
|
||||||
|
AssertISV(!found->second.isConstant, avar("Reassigning variable %s when it is a constant. File: %s Line : %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
||||||
|
return found->second.reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 id = counter++;
|
||||||
|
vars[var] = { id, currentType, var, isConstant };
|
||||||
|
variableNameMap[id] = var;
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 FuncVars::lookup(StringTableEntry var, S32 lineNumber)
|
||||||
|
{
|
||||||
|
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
||||||
|
AssertISV(found != vars.end(), avar("Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
||||||
|
return found->second.reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
TypeReq FuncVars::lookupType(StringTableEntry var, S32 lineNumber)
|
||||||
|
{
|
||||||
|
std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
|
||||||
|
|
||||||
|
AssertISV(found != vars.end(), avar("Variable %s referenced before used when compiling script. File: %s Line: %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber));
|
||||||
|
return found->second.currentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FuncVars::clear()
|
||||||
|
{
|
||||||
|
vars.clear();
|
||||||
|
variableNameMap.clear();
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,35 @@ namespace Compiler
|
||||||
void consoleAllocReset();
|
void consoleAllocReset();
|
||||||
|
|
||||||
extern bool gSyntaxError;
|
extern bool gSyntaxError;
|
||||||
|
extern bool gIsEvalCompile;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FuncVars
|
||||||
|
{
|
||||||
|
struct Var
|
||||||
|
{
|
||||||
|
S32 reg;
|
||||||
|
TypeReq currentType;
|
||||||
|
StringTableEntry name;
|
||||||
|
bool isConstant;
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
S32 assign(StringTableEntry var, TypeReq currentType, S32 lineNumber, bool isConstant = false);
|
||||||
|
|
||||||
|
S32 lookup(StringTableEntry var, S32 lineNumber);
|
||||||
|
|
||||||
|
TypeReq lookupType(StringTableEntry var, S32 lineNumber);
|
||||||
|
|
||||||
|
inline S32 count() { return counter; }
|
||||||
|
|
||||||
|
std::unordered_map<S32, StringTableEntry> variableNameMap;
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unordered_map<StringTableEntry, Var> vars;
|
||||||
|
S32 counter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Utility class to emit and patch bytecode
|
/// Utility class to emit and patch bytecode
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ GFXAdapter *GFXInit::getBestAdapterChoice()
|
||||||
{
|
{
|
||||||
S32 adapterIdx = dAtoi(adapterDevice.c_str());
|
S32 adapterIdx = dAtoi(adapterDevice.c_str());
|
||||||
if (adapterIdx == -1)
|
if (adapterIdx == -1)
|
||||||
adapter = chooseAdapter(adapterType, outputDevice.c_str());
|
adapter = chooseAdapter(NullDevice, outputDevice.c_str());
|
||||||
else
|
else
|
||||||
adapter = chooseAdapter(adapterType, adapterIdx);
|
adapter = chooseAdapter(adapterType, adapterIdx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -933,7 +933,7 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
||||||
}
|
}
|
||||||
GFXShader* GFXGLDevice::createShader()
|
GFXShader* GFXGLDevice::createShader()
|
||||||
{
|
{
|
||||||
GFXGLShader* shader = new GFXGLShader();
|
GFXGLShader* shader = new GFXGLShader(this);
|
||||||
shader->registerResourceWithDevice( this );
|
shader->registerResourceWithDevice( this );
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -382,10 +382,11 @@ void GFXGLShaderConstBuffer::onShaderReload( GFXGLShader *shader )
|
||||||
mWasLost = true;
|
mWasLost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXGLShader::GFXGLShader() :
|
GFXGLShader::GFXGLShader(GFXGLDevice* device) :
|
||||||
mVertexShader(0),
|
mVertexShader(0),
|
||||||
mPixelShader(0),
|
mPixelShader(0),
|
||||||
mProgram(0),
|
mProgram(0),
|
||||||
|
mDevice(device),
|
||||||
mConstBufferSize(0),
|
mConstBufferSize(0),
|
||||||
mConstBuffer(NULL)
|
mConstBuffer(NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -706,7 +707,8 @@ void GFXGLShader::initHandles()
|
||||||
dMemset(mConstBuffer, 0, mConstBufferSize);
|
dMemset(mConstBuffer, 0, mConstBufferSize);
|
||||||
|
|
||||||
// Set our program so uniforms are assigned properly.
|
// Set our program so uniforms are assigned properly.
|
||||||
glUseProgram(mProgram);
|
mDevice->setShader(this, false);
|
||||||
|
|
||||||
// Iterate through uniforms to set sampler numbers.
|
// Iterate through uniforms to set sampler numbers.
|
||||||
for (HandleMap::Iterator iter = mHandles.begin(); iter != mHandles.end(); ++iter)
|
for (HandleMap::Iterator iter = mHandles.begin(); iter != mHandles.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
|
@ -723,7 +725,6 @@ void GFXGLShader::initHandles()
|
||||||
dMemcpy(mConstBuffer + handle->mOffset, &handle->mSamplerNum, handle->getSize());
|
dMemcpy(mConstBuffer + handle->mOffset, &handle->mSamplerNum, handle->getSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glUseProgram(0);
|
|
||||||
|
|
||||||
//instancing
|
//instancing
|
||||||
if (!mInstancingFormat)
|
if (!mInstancingFormat)
|
||||||
|
|
@ -830,6 +831,7 @@ void GFXGLShader::setConstantsFromBuffer(GFXGLShaderConstBuffer* buffer)
|
||||||
|
|
||||||
// Copy new value into our const buffer and set in GL.
|
// Copy new value into our const buffer and set in GL.
|
||||||
dMemcpy(mConstBuffer + handle->mOffset, buffer->mBuffer + handle->mOffset, handle->getSize());
|
dMemcpy(mConstBuffer + handle->mOffset, buffer->mBuffer + handle->mOffset, handle->getSize());
|
||||||
|
|
||||||
switch(handle->mDesc.constType)
|
switch(handle->mDesc.constType)
|
||||||
{
|
{
|
||||||
case GFXSCT_Float:
|
case GFXSCT_Float:
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,15 @@
|
||||||
class GFXGLShaderConstHandle;
|
class GFXGLShaderConstHandle;
|
||||||
class FileStream;
|
class FileStream;
|
||||||
class GFXGLShaderConstBuffer;
|
class GFXGLShaderConstBuffer;
|
||||||
|
class GFXGLDevice;
|
||||||
|
|
||||||
class GFXGLShader : public GFXShader
|
class GFXGLShader : public GFXShader
|
||||||
{
|
{
|
||||||
typedef Map<String, GFXGLShaderConstHandle*> HandleMap;
|
typedef Map<String, GFXGLShaderConstHandle*> HandleMap;
|
||||||
public:
|
public:
|
||||||
GFXGLShader();
|
GFXGLShader(GFXGLDevice* device);
|
||||||
virtual ~GFXGLShader();
|
virtual ~GFXGLShader();
|
||||||
|
|
||||||
/// @name GFXShader interface
|
/// @name GFXShader interface
|
||||||
/// @{
|
/// @{
|
||||||
virtual GFXShaderConstHandle* getShaderConstHandle(const String& name);
|
virtual GFXShaderConstHandle* getShaderConstHandle(const String& name);
|
||||||
|
|
@ -99,6 +100,7 @@ protected:
|
||||||
U32 mConstBufferSize;
|
U32 mConstBufferSize;
|
||||||
U8* mConstBuffer;
|
U8* mConstBuffer;
|
||||||
HandleMap mHandles;
|
HandleMap mHandles;
|
||||||
|
GFXGLDevice* mDevice;
|
||||||
Vector<GFXGLShaderConstHandle*> mValidHandles;
|
Vector<GFXGLShaderConstHandle*> mValidHandles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -258,17 +258,19 @@ bool GuiCanvas::onAdd()
|
||||||
// Make sure we're able to render.
|
// Make sure we're able to render.
|
||||||
newDevice->setAllowRender( true );
|
newDevice->setAllowRender( true );
|
||||||
|
|
||||||
if(mDisplayWindow)
|
// NULL device returns a nullptr for getPlatformWindow
|
||||||
|
PlatformWindow* window = getPlatformWindow();
|
||||||
|
if (mDisplayWindow && window)
|
||||||
{
|
{
|
||||||
getPlatformWindow()->show();
|
window->show();
|
||||||
WindowManager->setDisplayWindow(true);
|
WindowManager->setDisplayWindow(true);
|
||||||
getPlatformWindow()->setDisplayWindow(true);
|
window->setDisplayWindow(true);
|
||||||
}
|
}
|
||||||
else
|
else if (window)
|
||||||
{
|
{
|
||||||
getPlatformWindow()->hide();
|
window->hide();
|
||||||
WindowManager->setDisplayWindow(false);
|
WindowManager->setDisplayWindow(false);
|
||||||
getPlatformWindow()->setDisplayWindow(false);
|
window->setDisplayWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagate add to parents.
|
// Propagate add to parents.
|
||||||
|
|
|
||||||
|
|
@ -1993,12 +1993,12 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
|
||||||
if ( !mHitObject )
|
if ( !mHitObject )
|
||||||
{
|
{
|
||||||
SceneObject *hitObj = NULL;
|
SceneObject *hitObj = NULL;
|
||||||
if ( collide(event, &hitObj) && hitObj->isSelectionEnabled() && !objClassIgnored(hitObj) )
|
if ( collide(event, &hitObj) && !hitObj->isDeleted() && hitObj->isSelectionEnabled() && !objClassIgnored(hitObj) )
|
||||||
{
|
{
|
||||||
mHitObject = hitObj;
|
mHitObject = hitObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastMouseEvent = event;
|
mLastMouseEvent = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ StdConsole *stdConsole = NULL;
|
||||||
DefineEngineFunction(enableWinConsole, void, (bool _enable),, "enableWinConsole(bool);")
|
DefineEngineFunction(enableWinConsole, void, (bool _enable),, "enableWinConsole(bool);")
|
||||||
{
|
{
|
||||||
if (stdConsole)
|
if (stdConsole)
|
||||||
stdConsole->enable(_enable);
|
{
|
||||||
|
stdConsole->enable(_enable);
|
||||||
|
stdConsole->enableInput(_enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdConsole::create()
|
void StdConsole::create()
|
||||||
|
|
@ -141,6 +144,9 @@ StdConsole::StdConsole()
|
||||||
stdIn = dup(0);
|
stdIn = dup(0);
|
||||||
stdErr = dup(2);
|
stdErr = dup(2);
|
||||||
|
|
||||||
|
// Ensure in buffer is null terminated after allocation
|
||||||
|
inbuf[0] = 0x00;
|
||||||
|
|
||||||
iCmdIndex = 0;
|
iCmdIndex = 0;
|
||||||
stdConsoleEnabled = false;
|
stdConsoleEnabled = false;
|
||||||
stdConsoleInputEnabled = false;
|
stdConsoleInputEnabled = false;
|
||||||
|
|
@ -195,11 +201,14 @@ void StdConsole::processConsoleLine(const char *consoleLine)
|
||||||
{
|
{
|
||||||
if(stdConsoleEnabled)
|
if(stdConsoleEnabled)
|
||||||
{
|
{
|
||||||
inbuf[inpos] = 0;
|
|
||||||
if(lineOutput)
|
if(lineOutput)
|
||||||
printf("%s\n", consoleLine);
|
printf("%s\n", consoleLine);
|
||||||
else
|
else
|
||||||
printf("%c%s\n%s%s", '\r', consoleLine, Con::getVariable("Con::Prompt"), inbuf);
|
{
|
||||||
|
// Clear current line before outputting the console line. This prevents prompt text from overflowing onto normal output.
|
||||||
|
printf("%c[2K", 27);
|
||||||
|
printf("%c%s\n%s%s", '\r', consoleLine, Con::getVariable("Con::Prompt"), inbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,6 +332,7 @@ void StdConsole::process()
|
||||||
|
|
||||||
printf("%s", Con::getVariable("Con::Prompt"));
|
printf("%s", Con::getVariable("Con::Prompt"));
|
||||||
inpos = outpos = 0;
|
inpos = outpos = 0;
|
||||||
|
inbuf[0] = 0x00; // Ensure inbuf is NULL terminated after sending out command
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
// JMQTODO: are these magic numbers keyboard map specific?
|
// JMQTODO: are these magic numbers keyboard map specific?
|
||||||
|
|
|
||||||
|
|
@ -1613,3 +1613,15 @@ void TerrainBlock::deleteZodiacPrimitiveBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(TerrainBlock, getTerrain, String, (), , "Returns the terrain file used for this terrain block, either via the asset or the filename assigned, which ever is valid")
|
||||||
|
{
|
||||||
|
return object->getTerrain();
|
||||||
|
}
|
||||||
|
DefineEngineMethod(TerrainBlock, getTerrainAsset, String, (), , "Returns the assetId used for this terrain block")
|
||||||
|
{
|
||||||
|
return object->getTerrainAssetId();
|
||||||
|
}
|
||||||
|
DefineEngineMethod(TerrainBlock, setTerrain, bool, (const char* terrain), , "Terrain assignment.first tries asset then flat file.")
|
||||||
|
{
|
||||||
|
return object->_setTerrain(StringTable->insert(terrain));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -488,6 +488,39 @@ public:
|
||||||
void inspectPostApply();
|
void inspectPostApply();
|
||||||
|
|
||||||
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
|
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
|
||||||
|
|
||||||
|
const StringTableEntry getTerrain() const
|
||||||
|
{
|
||||||
|
if (mTerrainAsset && (mTerrainAsset->getTerrainFilePath() != StringTable->EmptyString()))
|
||||||
|
return mTerrainAsset->getTerrainFilePath();
|
||||||
|
else if (mTerrainAssetId != StringTable->EmptyString())
|
||||||
|
return mTerrainAssetId;
|
||||||
|
else if (mTerrFileName != StringTable->EmptyString())
|
||||||
|
return mTerrFileName;
|
||||||
|
else
|
||||||
|
return StringTable->EmptyString();
|
||||||
|
}
|
||||||
|
|
||||||
|
const StringTableEntry getTerrainAssetId() const
|
||||||
|
{
|
||||||
|
if (mTerrainAssetId != StringTable->EmptyString())
|
||||||
|
return mTerrainAssetId;
|
||||||
|
else
|
||||||
|
return StringTable->EmptyString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _setTerrain(StringTableEntry terrain)
|
||||||
|
{
|
||||||
|
if (terrain == StringTable->EmptyString())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (AssetDatabase.isDeclaredAsset(terrain))
|
||||||
|
setTerrainAsset(terrain);
|
||||||
|
else
|
||||||
|
mTerrFileName = terrain;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool mUpdateBasetex;
|
bool mUpdateBasetex;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
exec( "tools/gui/profiles.ed.tscript" );
|
|
||||||
|
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
|
$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
|
||||||
bitmapAsset = "UI:background_dark_image";
|
bitmapAsset = "UI:background_dark_image";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
$Core::windowIcon = "data/icon.png";
|
$Core::windowIcon = "data/icon.png";
|
||||||
$Core::splashWindowImage = "data/splash.png";
|
$Core::splashWindowImage = "data/splash.png";
|
||||||
|
|
||||||
// Display a splash window immediately to improve app responsiveness before
|
|
||||||
// engine is initialized and main window created.
|
|
||||||
displaySplashWindow($Core::splashWindowImage);
|
|
||||||
|
|
||||||
// Console does something.
|
// Console does something.
|
||||||
setLogMode(6);
|
setLogMode(6);
|
||||||
|
|
||||||
|
|
@ -20,6 +16,18 @@ ModuleDatabase.setModuleExtension("module");
|
||||||
ModuleDatabase.scanModules( "core", false );
|
ModuleDatabase.scanModules( "core", false );
|
||||||
ModuleDatabase.LoadExplicit( "CoreModule" );
|
ModuleDatabase.LoadExplicit( "CoreModule" );
|
||||||
|
|
||||||
|
// Display a splash window immediately to improve app responsiveness before
|
||||||
|
// engine is initialized and main window created.
|
||||||
|
if ($Server::Dedicated == false)
|
||||||
|
{
|
||||||
|
if ($platform $= "windows")
|
||||||
|
displaySplashWindow($Core::splashWindowImage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$Video::forceDisplayAdapter = -1;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Load any gameplay modules
|
// Load any gameplay modules
|
||||||
ModuleDatabase.scanModules( "data", false );
|
ModuleDatabase.scanModules( "data", false );
|
||||||
|
|
@ -42,6 +50,7 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeSplashWindow();
|
if ( ($Server::Dedicated == false) && ($platform $= "windows") )
|
||||||
|
closeSplashWindow();
|
||||||
|
|
||||||
echo("Engine initialized...");
|
echo("Engine initialized...");
|
||||||
|
|
@ -618,7 +618,9 @@ function AssetBrowser::loadDirectories( %this )
|
||||||
|
|
||||||
%dataItem = AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.modulesIdx, "data");
|
%dataItem = AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.modulesIdx, "data");
|
||||||
AssetBrowser-->filterTree.tagsIdx = AssetBrowser-->filterTree.insertItem(1, "Tags");
|
AssetBrowser-->filterTree.tagsIdx = AssetBrowser-->filterTree.insertItem(1, "Tags");
|
||||||
AssetBrowser-->filterTree.creatorIdx = AssetBrowser-->filterTree.insertItem(1, "Creator");
|
|
||||||
|
if(!%this.selectMode)
|
||||||
|
AssetBrowser-->filterTree.creatorIdx = AssetBrowser-->filterTree.insertItem(1, "Creator");
|
||||||
|
|
||||||
%this.dirHandler.loadFolders("data", %dataItem);
|
%this.dirHandler.loadFolders("data", %dataItem);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ function AssetBrowser::createTerrainAsset(%this)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toolsMessageBox( "Import Terrain",
|
MessageBox( "Import Terrain",
|
||||||
"Terrain import failed! Check console for error messages.",
|
"Terrain import failed! Check console for error messages.",
|
||||||
"Ok", "Error" );
|
"Ok", "Error" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ function AssetBrowser::loadCreatorClasses(%this)
|
||||||
%this.addCreatorClass("LevelInfo", "Level Info" );
|
%this.addCreatorClass("LevelInfo", "Level Info" );
|
||||||
%this.addCreatorClass("Marker", "Path Node" );
|
%this.addCreatorClass("Marker", "Path Node" );
|
||||||
%this.addCreatorClass("MissionArea", "Mission Area" );
|
%this.addCreatorClass("MissionArea", "Mission Area" );
|
||||||
%this.addCreatorClass("Note", "Note" );
|
%this.addCreatorClass("NotesObject", "Note" );
|
||||||
%this.addCreatorClass("Path" );
|
%this.addCreatorClass("Path" );
|
||||||
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere" );
|
%this.addCreatorClass("SpawnSphere", "General Spawn Sphere" );
|
||||||
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
|
%this.addCreatorClass("SpawnSphere", "Player Spawn Sphere"/*, "PlayerDropPoint"*/ );
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,6 @@ function ConvexEditorPlugin::onDeactivated( %this )
|
||||||
|
|
||||||
ConvexEditorTreeWindow.setVisible( false );
|
ConvexEditorTreeWindow.setVisible( false );
|
||||||
ConvexEditorOptionsWindow.setVisible( false );
|
ConvexEditorOptionsWindow.setVisible( false );
|
||||||
ConvexEditorToolbar.setVisible( false );
|
|
||||||
%this.map.pop();
|
%this.map.pop();
|
||||||
|
|
||||||
// Remove our menu.
|
// Remove our menu.
|
||||||
|
|
|
||||||
|
|
@ -910,7 +910,7 @@ function GuiEditorTabBook::onWake( %this )
|
||||||
item[ 1 ] = "Categorized View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Categorized\" );";
|
item[ 1 ] = "Categorized View" TAB "" TAB "GuiEditorToolbox.setViewType( \"Categorized\" );";
|
||||||
};
|
};
|
||||||
|
|
||||||
GlobalActionMap.bindCmd( keyboard, space, "", "AssetBrowser.toggleDialog();" );
|
GlobalActionMap.bindCmd( keyboard, "shift space", "", "AssetBrowser.toggleDialog();" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ function GuiEditCanvas::load( %this, %filename )
|
||||||
// group. And, it should be the only thing in the group.
|
// group. And, it should be the only thing in the group.
|
||||||
if( !isObject( $guiContent ) )
|
if( !isObject( $guiContent ) )
|
||||||
{
|
{
|
||||||
toolsMessageBox( getEngineName(),
|
MessageBox( getEngineName(),
|
||||||
"You have loaded a Gui file that was created before this version. It has been loaded but you must open it manually from the content list dropdown",
|
"You have loaded a Gui file that was created before this version. It has been loaded but you must open it manually from the content list dropdown",
|
||||||
"Ok", "Information" );
|
"Ok", "Information" );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -333,7 +333,7 @@ function GuiEditCanvas::save( %this, %selectedOnly, %noPrompt )
|
||||||
return;
|
return;
|
||||||
else if( %selected.getCount() > 1 )
|
else if( %selected.getCount() > 1 )
|
||||||
{
|
{
|
||||||
toolsMessageBox( "Invalid selection", "Only a single control hierarchy can be saved to a file. Make sure you have selected only one control in the tree view." );
|
MessageBox( "Invalid selection", "Only a single control hierarchy can be saved to a file. Make sure you have selected only one control in the tree view." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -464,7 +464,7 @@ function GuiEditCanvas::save( %this, %selectedOnly, %noPrompt )
|
||||||
GuiEditorStatusBar.print( "Saved file '" @ %currentObject.getFileName() @ "'" );
|
GuiEditorStatusBar.print( "Saved file '" @ %currentObject.getFileName() @ "'" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
toolsMessageBox( "Error writing to file", "There was an error writing to file '" @ %currentFile @ "'. The file may be read-only.", "Ok", "Error" );
|
MessageBox( "Error writing to file", "There was an error writing to file '" @ %currentFile @ "'. The file may be read-only.", "Ok", "Error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
@ -490,7 +490,7 @@ function GuiEditCanvas::append( %this )
|
||||||
|
|
||||||
if( !isObject( $guiContent ) )
|
if( !isObject( $guiContent ) )
|
||||||
{
|
{
|
||||||
toolsMessageBox( "Error loading GUI file", "The GUI content controls could not be found. This function can only be used with files saved by the GUI editor.", "Ok", "Error" );
|
MessageBox( "Error loading GUI file", "The GUI content controls could not be found. This function can only be used with files saved by the GUI editor.", "Ok", "Error" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -519,7 +519,7 @@ function GuiEditCanvas::revert( %this )
|
||||||
if( %filename $= "" )
|
if( %filename $= "" )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( toolsMessageBox( "Revert Gui", "Really revert the current Gui? This cannot be undone.", "OkCancel", "Question" ) == $MROk )
|
if( MessageBox( "Revert Gui", "Really revert the current Gui? This cannot be undone.", "OkCancel", "Question" ) == $MROk )
|
||||||
%this.load( %filename );
|
%this.load( %filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ function GuiEditorNewGuiDialog::onOK( %this )
|
||||||
|
|
||||||
if( isObject( %name ) && %name.isMemberOfClass( "GuiControl" ) )
|
if( isObject( %name ) && %name.isMemberOfClass( "GuiControl" ) )
|
||||||
{
|
{
|
||||||
if( toolsMessageBox( "Warning", "Replace the existing control '" @ %name @ "'?", "OkCancel", "Question" ) == $MROk )
|
if( MessageBox( "Warning", "Replace the existing control '" @ %name @ "'?", "OkCancel", "Question" ) == $MROk )
|
||||||
%name.delete();
|
%name.delete();
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1097,9 +1097,6 @@ function MaterialEditorGui::updateActiveMaterial(%this, %propertyField, %value,
|
||||||
{
|
{
|
||||||
MaterialEditorGui.setMaterialDirty();
|
MaterialEditorGui.setMaterialDirty();
|
||||||
|
|
||||||
if(%value $= "")
|
|
||||||
%value = "\"\"";
|
|
||||||
|
|
||||||
// Here is where we handle undo actions with slider controls. We want to be able to
|
// Here is where we handle undo actions with slider controls. We want to be able to
|
||||||
// undo every onMouseUp; so we overrite the same undo action when necessary in order
|
// undo every onMouseUp; so we overrite the same undo action when necessary in order
|
||||||
// to achieve this desired effect.
|
// to achieve this desired effect.
|
||||||
|
|
@ -1130,7 +1127,7 @@ function MaterialEditorGui::updateActiveMaterial(%this, %propertyField, %value,
|
||||||
|
|
||||||
if (MaterialEditorGui.livePreview == true)
|
if (MaterialEditorGui.livePreview == true)
|
||||||
{
|
{
|
||||||
MaterialEditorGui.setFieldValue(%propertyField, %value);
|
MaterialEditorGui.currentMaterial.setFieldValue(%propertyField, %value);
|
||||||
MaterialEditorGui.currentMaterial.flush();
|
MaterialEditorGui.currentMaterial.flush();
|
||||||
MaterialEditorGui.currentMaterial.reload();
|
MaterialEditorGui.currentMaterial.reload();
|
||||||
}
|
}
|
||||||
|
|
@ -1263,8 +1260,8 @@ function MaterialEditorGui::doUpdateTextureMap( %this, %assetId )
|
||||||
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
|
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
|
||||||
%bitmapCtrl.setBitmap(%bitmap);
|
%bitmapCtrl.setBitmap(%bitmap);
|
||||||
%textCtrl.setText(%assetId);
|
%textCtrl.setText(%assetId);
|
||||||
MaterialEditorGui.updateActiveMaterial(%type @ "Map[" @ %layer @ "]","\"\"");
|
MaterialEditorGui.updateActiveMaterial(%type @ "Map[" @ %layer @ "]","");
|
||||||
MaterialEditorGui.updateActiveMaterial(%type @ "MapAsset[" @ %layer @ "]","\"" @ %assetId @ "\"");
|
MaterialEditorGui.updateActiveMaterial(%type @ "MapAsset[" @ %layer @ "]", %assetId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1276,7 +1273,7 @@ function MaterialEditorGui::updateDetailScale(%this,%newScale)
|
||||||
{
|
{
|
||||||
%layer = MaterialEditorGui.currentLayer;
|
%layer = MaterialEditorGui.currentLayer;
|
||||||
|
|
||||||
%detailScale = "\"" @ %newScale SPC %newScale @ "\"";
|
%detailScale = %newScale SPC %newScale;
|
||||||
MaterialEditorGui.updateActiveMaterial("detailScale[" @ %layer @ "]", %detailScale);
|
MaterialEditorGui.updateActiveMaterial("detailScale[" @ %layer @ "]", %detailScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1284,7 +1281,7 @@ function MaterialEditorGui::updateDetailNormalStrength(%this,%newStrength)
|
||||||
{
|
{
|
||||||
%layer = MaterialEditorGui.currentLayer;
|
%layer = MaterialEditorGui.currentLayer;
|
||||||
|
|
||||||
%detailStrength = "\"" @ %newStrength @ "\"";
|
%detailStrength = %newStrength;
|
||||||
MaterialEditorGui.updateActiveMaterial("detailNormalMapStrength[" @ %layer @ "]", %detailStrength);
|
MaterialEditorGui.updateActiveMaterial("detailNormalMapStrength[" @ %layer @ "]", %detailStrength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1295,7 +1292,7 @@ function MaterialEditorGui::updateRotationOffset(%this, %isSlider, %onMouseUp)
|
||||||
%Y = MaterialEditorPropertiesWindow-->RotationTextEditV.getText();
|
%Y = MaterialEditorPropertiesWindow-->RotationTextEditV.getText();
|
||||||
MaterialEditorPropertiesWindow-->RotationCrosshair.setPosition(45*mAbs(%X)-2, 45*mAbs(%Y)-2);
|
MaterialEditorPropertiesWindow-->RotationCrosshair.setPosition(45*mAbs(%X)-2, 45*mAbs(%Y)-2);
|
||||||
|
|
||||||
MaterialEditorGui.updateActiveMaterial("rotPivotOffset[" @ %layer @ "]","\"" @ %X SPC %Y @ "\"",%isSlider,%onMouseUp);
|
MaterialEditorGui.updateActiveMaterial("rotPivotOffset[" @ %layer @ "]", %X SPC %Y,%isSlider,%onMouseUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MaterialEditorGui::updateRotationSpeed(%this, %isSlider, %onMouseUp)
|
function MaterialEditorGui::updateRotationSpeed(%this, %isSlider, %onMouseUp)
|
||||||
|
|
@ -1457,7 +1454,7 @@ function MaterialEditorGui::syncGuiColor(%this, %guiCtrl, %propname, %color)
|
||||||
%a = getWord(%color,3);
|
%a = getWord(%color,3);
|
||||||
|
|
||||||
%colorSwatch = (%r SPC %g SPC %b SPC %a);
|
%colorSwatch = (%r SPC %g SPC %b SPC %a);
|
||||||
%color = "\"" @ %r SPC %g SPC %b SPC %a @ "\"";
|
%color = %r SPC %g SPC %b SPC %a;
|
||||||
|
|
||||||
%guiCtrl.color = %colorSwatch;
|
%guiCtrl.color = %colorSwatch;
|
||||||
MaterialEditorGui.updateActiveMaterial(%propName, %color);
|
MaterialEditorGui.updateActiveMaterial(%propName, %color);
|
||||||
|
|
|
||||||
|
|
@ -919,7 +919,7 @@ T3Dpre4ProjectImporter::genProcessor("DebrisData", "shape shapeAsset shapeFile s
|
||||||
T3Dpre4ProjectImporter::genProcessor("DecalData", "material materialAsset");
|
T3Dpre4ProjectImporter::genProcessor("DecalData", "material materialAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("ExplosionData", "explosionShape explosionShapeAsset");
|
T3Dpre4ProjectImporter::genProcessor("ExplosionData", "explosionShape explosionShapeAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("ParticleData", "texture textureAsset textureName textureAsset textureExt textureExtAsset textureExtName textureExtAsset");
|
T3Dpre4ProjectImporter::genProcessor("ParticleData", "texture textureAsset textureName textureAsset textureExt textureExtAsset textureExtName textureExtAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset");
|
T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset soundProfile soundAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset");
|
T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
|
T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
|
||||||
T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");
|
T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");
|
||||||
|
|
|
||||||
|
|
@ -556,23 +556,49 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
|
||||||
%targetFilename = sanitizeFilename(%value);
|
%targetFilename = sanitizeFilename(%value);
|
||||||
|
|
||||||
if(isObject(%targetFilename))
|
if(isObject(%targetFilename))
|
||||||
|
{
|
||||||
|
if(%originalFieldName $= "soundProfile")
|
||||||
{
|
{
|
||||||
//likely a material name, so handle it that way
|
$ProjectImporter::assetQuery.clear();
|
||||||
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
|
%foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
|
||||||
|
if(%foundAssets != 0)
|
||||||
|
{
|
||||||
|
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//likely a material name, so handle it that way
|
||||||
|
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!isFile(%targetFilename))
|
if(!isFile(%targetFilename))
|
||||||
{
|
{
|
||||||
error("Legacy Project Importer - file described in line could not be found/is not valid");
|
if(%originalFieldName $= "soundProfile")
|
||||||
return %line;
|
{
|
||||||
}
|
$ProjectImporter::assetQuery.clear();
|
||||||
|
%foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
|
||||||
$ProjectImporter::assetQuery.clear();
|
if(%foundAssets != 0)
|
||||||
%foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
|
{
|
||||||
if(%foundAssets != 0)
|
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
||||||
{
|
}
|
||||||
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error("Legacy Project Importer - file described in line could not be found/is not valid");
|
||||||
|
return %line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ProjectImporter::assetQuery.clear();
|
||||||
|
%foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
|
||||||
|
if(%foundAssets != 0)
|
||||||
|
{
|
||||||
|
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ function RiverEditorGui::createRiver( %this )
|
||||||
|
|
||||||
baseColor = "45 108 171 255";
|
baseColor = "45 108 171 255";
|
||||||
|
|
||||||
rippleTex = "core/rendering/images/ripple.dds";
|
rippleTex = "Core_Rendering:ripple_image";
|
||||||
foamTex = "core/rendering/images/foam";
|
foamTex = "Core_Rendering:foam_image";
|
||||||
depthGradientTex = "core/rendering/images/depthcolor_ramp";
|
depthGradientTex = "Core_Rendering:depthcolor_ramp_image";
|
||||||
};
|
};
|
||||||
|
|
||||||
return %river;
|
return %river;
|
||||||
|
|
|
||||||
|
|
@ -313,30 +313,6 @@ function ObjectBuilderGui::createImageAssetType(%this, %index)
|
||||||
else
|
else
|
||||||
%name = %this.field[%index, text];
|
%name = %this.field[%index, text];
|
||||||
|
|
||||||
//
|
|
||||||
/*%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
|
||||||
profile = "ToolsGuiTextRightProfile";
|
|
||||||
internalName = "assetText";
|
|
||||||
text = %name;
|
|
||||||
extent = %this.fieldNameExtent;
|
|
||||||
position = %this.curXPos @ " " @ %this.curYPos;
|
|
||||||
modal = "1";
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
%this.controls[%this.numControls] = new GuiButtonCtrl() {
|
|
||||||
HorizSizing = "width";
|
|
||||||
profile = "ToolsGuiButtonProfile";
|
|
||||||
internalName = "assetButton";
|
|
||||||
extent = %this.fileButtonExtent;
|
|
||||||
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
|
|
||||||
modal = "1";
|
|
||||||
command = %this @ ".getImageAsset(" @ %index @ ");";
|
|
||||||
};
|
|
||||||
|
|
||||||
%val = %this.field[%index, value];
|
|
||||||
%this.controls[%this.numControls].setText(fileBase(%val) @ fileExt(%val));*/
|
|
||||||
|
|
||||||
%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
||||||
profile = "ToolsGuiTextRightProfile";
|
profile = "ToolsGuiTextRightProfile";
|
||||||
text = %name;
|
text = %name;
|
||||||
|
|
@ -375,7 +351,7 @@ function ObjectBuilderGui::createImageAssetType(%this, %index)
|
||||||
modal = "1";
|
modal = "1";
|
||||||
command = %this @ ".getImageAsset(" @ %index @ ");";
|
command = %this @ ".getImageAsset(" @ %index @ ");";
|
||||||
};
|
};
|
||||||
%button.setBitmap("ToolsModule:change_material_btn_n_image");
|
%button.setBitmap("ToolsModule:GameTSCtrl_image");
|
||||||
%this.controls[%this.numControls].addGuiControl(%button);
|
%this.controls[%this.numControls].addGuiControl(%button);
|
||||||
|
|
||||||
%this.numControls++;
|
%this.numControls++;
|
||||||
|
|
@ -412,6 +388,279 @@ function ObjectBuilderGui::gotImageAsset(%this, %name)
|
||||||
// This doesn't work for button controls as getValue returns their state!
|
// This doesn't work for button controls as getValue returns their state!
|
||||||
//%this.controls[%this.currentControl].setValue(%name);
|
//%this.controls[%this.currentControl].setValue(%name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
function ObjectBuilderGui::createMaterialAssetType(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::createMaterialAssetType: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if(%this.field[%index, text] $= "")
|
||||||
|
%name = %this.field[%index, name];
|
||||||
|
else
|
||||||
|
%name = %this.field[%index, text];
|
||||||
|
|
||||||
|
%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
||||||
|
profile = "ToolsGuiTextRightProfile";
|
||||||
|
text = %name;
|
||||||
|
extent = %this.fieldNameExtent;
|
||||||
|
position = %this.curXPos @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
%this.controls[%this.numControls] = new GuiControl() {
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiDefaultProfile";
|
||||||
|
extent = %this.textEditExtent;
|
||||||
|
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
%text = new GuiTextEditCtrl() {
|
||||||
|
class = ObjectBuilderGuiTextEditCtrl;
|
||||||
|
internalName = "assetText";
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
extent = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) - 2 @ " " @ getWord(%this.textEditExtent,1);
|
||||||
|
text = %this.field[%index, value];
|
||||||
|
position = "0 0";
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%text);
|
||||||
|
|
||||||
|
%button = new GuiBitmapButtonCtrl() {
|
||||||
|
internalName = "assetButton";
|
||||||
|
HorizSizing = "left";
|
||||||
|
profile = "ToolsGuiButtonProfile";
|
||||||
|
extent = %this.matButtonExtent;
|
||||||
|
position = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) @ " 0";
|
||||||
|
modal = "1";
|
||||||
|
command = %this @ ".getMaterialAsset(" @ %index @ ");";
|
||||||
|
};
|
||||||
|
%button.setBitmap("ToolsModule:change_material_btn_n_image");
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%button);
|
||||||
|
|
||||||
|
%this.numControls++;
|
||||||
|
%this.curYPos += %this.defaultFieldStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::getMaterialAsset(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::getMaterialAsset: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
%val = %this.field[%index, ext];
|
||||||
|
|
||||||
|
//%path = filePath(%val);
|
||||||
|
//%ext = fileExt(%val);
|
||||||
|
|
||||||
|
%this.currentControl = %index;
|
||||||
|
AssetBrowser.showDialog("MaterialAsset", %this @ ".gotMaterialAsset", "", "", "");
|
||||||
|
//getLoadFilename( %val @ "|" @ %val, %this @ ".gotFileName", %this.lastPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::gotMaterialAsset(%this, %name)
|
||||||
|
{
|
||||||
|
%index = %this.currentControl;
|
||||||
|
|
||||||
|
%this.field[%index, value] = %name;
|
||||||
|
%this.controls[%this.currentControl]-->assetText.setText(%name);
|
||||||
|
|
||||||
|
%this.lastPath = %name;
|
||||||
|
|
||||||
|
// This doesn't work for button controls as getValue returns their state!
|
||||||
|
//%this.controls[%this.currentControl].setValue(%name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
function ObjectBuilderGui::createShapeAssetType(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::createShapeAssetType: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if(%this.field[%index, text] $= "")
|
||||||
|
%name = %this.field[%index, name];
|
||||||
|
else
|
||||||
|
%name = %this.field[%index, text];
|
||||||
|
|
||||||
|
%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
||||||
|
profile = "ToolsGuiTextRightProfile";
|
||||||
|
text = %name;
|
||||||
|
extent = %this.fieldNameExtent;
|
||||||
|
position = %this.curXPos @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
%this.controls[%this.numControls] = new GuiControl() {
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiDefaultProfile";
|
||||||
|
extent = %this.textEditExtent;
|
||||||
|
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
%text = new GuiTextEditCtrl() {
|
||||||
|
class = ObjectBuilderGuiTextEditCtrl;
|
||||||
|
internalName = "assetText";
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
extent = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) - 2 @ " " @ getWord(%this.textEditExtent,1);
|
||||||
|
text = %this.field[%index, value];
|
||||||
|
position = "0 0";
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%text);
|
||||||
|
|
||||||
|
%button = new GuiBitmapButtonCtrl() {
|
||||||
|
internalName = "assetButton";
|
||||||
|
HorizSizing = "left";
|
||||||
|
profile = "ToolsGuiButtonProfile";
|
||||||
|
extent = %this.matButtonExtent;
|
||||||
|
position = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) @ " 0";
|
||||||
|
modal = "1";
|
||||||
|
command = %this @ ".getShapeAsset(" @ %index @ ");";
|
||||||
|
};
|
||||||
|
%button.setBitmap("ToolsModule:shape_editor_n_image");
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%button);
|
||||||
|
|
||||||
|
%this.numControls++;
|
||||||
|
%this.curYPos += %this.defaultFieldStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::getShapeAsset(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::getShapeAsset: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
%val = %this.field[%index, ext];
|
||||||
|
|
||||||
|
//%path = filePath(%val);
|
||||||
|
//%ext = fileExt(%val);
|
||||||
|
|
||||||
|
%this.currentControl = %index;
|
||||||
|
AssetBrowser.showDialog("ShapeAsset", %this @ ".gotShapeAsset", "", "", "");
|
||||||
|
//getLoadFilename( %val @ "|" @ %val, %this @ ".gotFileName", %this.lastPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::gotShapeAsset(%this, %name)
|
||||||
|
{
|
||||||
|
%index = %this.currentControl;
|
||||||
|
|
||||||
|
%this.field[%index, value] = %name;
|
||||||
|
%this.controls[%this.currentControl]-->assetText.setText(%name);
|
||||||
|
|
||||||
|
%this.lastPath = %name;
|
||||||
|
|
||||||
|
// This doesn't work for button controls as getValue returns their state!
|
||||||
|
//%this.controls[%this.currentControl].setValue(%name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
function ObjectBuilderGui::createSoundAssetType(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::createSoundAssetType: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if(%this.field[%index, text] $= "")
|
||||||
|
%name = %this.field[%index, name];
|
||||||
|
else
|
||||||
|
%name = %this.field[%index, text];
|
||||||
|
|
||||||
|
%this.textControls[%this.numControls] = new GuiTextCtrl() {
|
||||||
|
profile = "ToolsGuiTextRightProfile";
|
||||||
|
text = %name;
|
||||||
|
extent = %this.fieldNameExtent;
|
||||||
|
position = %this.curXPos @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
%this.controls[%this.numControls] = new GuiControl() {
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiDefaultProfile";
|
||||||
|
extent = %this.textEditExtent;
|
||||||
|
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
%text = new GuiTextEditCtrl() {
|
||||||
|
class = ObjectBuilderGuiTextEditCtrl;
|
||||||
|
internalName = "assetText";
|
||||||
|
HorizSizing = "width";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
extent = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) - 2 @ " " @ getWord(%this.textEditExtent,1);
|
||||||
|
text = %this.field[%index, value];
|
||||||
|
position = "0 0";
|
||||||
|
modal = "1";
|
||||||
|
};
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%text);
|
||||||
|
|
||||||
|
%button = new GuiBitmapButtonCtrl() {
|
||||||
|
internalName = "assetButton";
|
||||||
|
HorizSizing = "left";
|
||||||
|
profile = "ToolsGuiButtonProfile";
|
||||||
|
extent = %this.matButtonExtent;
|
||||||
|
position = getWord(%this.textEditExtent,0) - getWord(%this.matButtonExtent,0) @ " 0";
|
||||||
|
modal = "1";
|
||||||
|
command = %this @ ".getSoundAsset(" @ %index @ ");";
|
||||||
|
};
|
||||||
|
%button.setBitmap("ToolsModule:SFXEmitter_image");
|
||||||
|
%this.controls[%this.numControls].addGuiControl(%button);
|
||||||
|
|
||||||
|
%this.numControls++;
|
||||||
|
%this.curYPos += %this.defaultFieldStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::getSoundAsset(%this, %index)
|
||||||
|
{
|
||||||
|
if(%index >= %this.numFields || %this.field[%index, name] $= "")
|
||||||
|
{
|
||||||
|
error("ObjectBuilderGui::getSoundAsset: invalid field");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
%val = %this.field[%index, ext];
|
||||||
|
|
||||||
|
//%path = filePath(%val);
|
||||||
|
//%ext = fileExt(%val);
|
||||||
|
|
||||||
|
%this.currentControl = %index;
|
||||||
|
AssetBrowser.showDialog("SoundAsset", %this @ ".gotSoundAsset", "", "", "");
|
||||||
|
//getLoadFilename( %val @ "|" @ %val, %this @ ".gotFileName", %this.lastPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
function ObjectBuilderGui::gotSoundAsset(%this, %name)
|
||||||
|
{
|
||||||
|
%index = %this.currentControl;
|
||||||
|
|
||||||
|
%this.field[%index, value] = %name;
|
||||||
|
%this.controls[%this.currentControl]-->assetText.setText(%name);
|
||||||
|
|
||||||
|
%this.lastPath = %name;
|
||||||
|
|
||||||
|
// This doesn't work for button controls as getValue returns their state!
|
||||||
|
//%this.controls[%this.currentControl].setValue(%name);
|
||||||
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function ObjectBuilderGui::createMaterialNameType(%this, %index)
|
function ObjectBuilderGui::createMaterialNameType(%this, %index)
|
||||||
{
|
{
|
||||||
|
|
@ -680,6 +929,15 @@ function ObjectBuilderGui::process(%this)
|
||||||
case "TypeImageAsset":
|
case "TypeImageAsset":
|
||||||
%this.createImageAssetType(%i);
|
%this.createImageAssetType(%i);
|
||||||
|
|
||||||
|
case "TypeMaterialAsset":
|
||||||
|
%this.createMaterialAssetType(%i);
|
||||||
|
|
||||||
|
case "TypeShapeAsset":
|
||||||
|
%this.createShapeAssetType(%i);
|
||||||
|
|
||||||
|
case "TypeSoundAsset":
|
||||||
|
%this.createSoundAssetType(%i);
|
||||||
|
|
||||||
case "TypeMaterialName":
|
case "TypeMaterialName":
|
||||||
%this.createMaterialNameType(%i);
|
%this.createMaterialNameType(%i);
|
||||||
|
|
||||||
|
|
@ -753,7 +1011,10 @@ function ObjectBuilderGui::onOK(%this)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (%this.field[%i, type] $= "TypeImageAsset" ||
|
if (%this.field[%i, type] $= "TypeImageAsset" ||
|
||||||
%this.field[%i, type] $= "TypeTerrainAsset")
|
%this.field[%i, type] $= "TypeTerrainAsset" ||
|
||||||
|
%this.field[%i, type] $= "TypeMaterialAsset" ||
|
||||||
|
%this.field[%i, type] $= "TypeShapeAsset"
|
||||||
|
)
|
||||||
{
|
{
|
||||||
%this.field[%i, value] = %this.controls[%i]-->assetText.getText();
|
%this.field[%i, value] = %this.controls[%i]-->assetText.getText();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -861,7 +1122,6 @@ function ObjectBuilderGui::buildScatterSky( %this, %dontWarnAboutSun )
|
||||||
%this.addField( "moonMatAsset", "TypeMaterialAsset", "Moon Material", "Core_Rendering:moon_wglow" );
|
%this.addField( "moonMatAsset", "TypeMaterialAsset", "Moon Material", "Core_Rendering:moon_wglow" );
|
||||||
%this.addField( "nightCubemap", "TypeCubemapName", "Night Cubemap", "NightCubemap" );
|
%this.addField( "nightCubemap", "TypeCubemapName", "Night Cubemap", "NightCubemap" );
|
||||||
%this.addField( "useNightCubemap", "TypeBool", "Use Night Cubemap", "true" );
|
%this.addField( "useNightCubemap", "TypeBool", "Use Night Cubemap", "true" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjectBuilderGui::buildCloudLayer(%this)
|
function ObjectBuilderGui::buildCloudLayer(%this)
|
||||||
|
|
@ -954,7 +1214,7 @@ function ObjectBuilderGui::buildSun( %this, %dontWarnAboutScatterSky )
|
||||||
|
|
||||||
// This is a trick... any fields added after process won't show
|
// This is a trick... any fields added after process won't show
|
||||||
// up as controls, but will be applied to the created object.
|
// up as controls, but will be applied to the created object.
|
||||||
%this.addField( "coronaMaterial", "TypeMaterialName", "Corona Material", "Corona_Mat" );
|
%this.addField( "coronaMaterial", "TypeMaterialAsset", "Corona Material", "Core_Rendering:Corona_Mat" );
|
||||||
%this.addField( "flareType", "TypeLightFlareDataPtr", "Flare", "SunFlareExample" );
|
%this.addField( "flareType", "TypeLightFlareDataPtr", "Flare", "SunFlareExample" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -994,9 +1254,9 @@ function ObjectBuilderGui::addWaterObjectFields(%this)
|
||||||
%this.addField("waveSpeed[2]", "TypeFloat", "Wave Speed", "1");
|
%this.addField("waveSpeed[2]", "TypeFloat", "Wave Speed", "1");
|
||||||
%this.addField("overallWaveMagnitude", "TypeFloat", "Overall Wave Magnitude", "1.0");
|
%this.addField("overallWaveMagnitude", "TypeFloat", "Overall Wave Magnitude", "1.0");
|
||||||
|
|
||||||
%this.addField("rippleTexAsset", "TypeImageAssetId", "Ripple Texture", "Core_Rendering:ripple_image" );
|
%this.addField("rippleTex", "TypeImageAsset", "Ripple Texture", "Core_Rendering:ripple_image" );
|
||||||
%this.addField("depthGradientTexAsset", "TypeImageAssetId", "Depth Gradient Texture", "Core_Rendering:depthcolor_ramp_imag" );
|
%this.addField("depthGradientTex", "TypeImageAsset", "Depth Gradient Texture", "Core_Rendering:depthcolor_ramp_image" );
|
||||||
%this.addField("foamTexAsset", "TypeImageAssetId", "Foam Texture", "Core_Rendering:foam_image" );
|
%this.addField("foamTex", "TypeImageAsset", "Foam Texture", "Core_Rendering:foam_image" );
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjectBuilderGui::buildWaterBlock(%this)
|
function ObjectBuilderGui::buildWaterBlock(%this)
|
||||||
|
|
@ -1038,8 +1298,8 @@ function ObjectBuilderGui::buildTerrainBlock(%this)
|
||||||
function ObjectBuilderGui::buildGroundCover( %this )
|
function ObjectBuilderGui::buildGroundCover( %this )
|
||||||
{
|
{
|
||||||
%this.objectClassName = "GroundCover";
|
%this.objectClassName = "GroundCover";
|
||||||
%this.addField( "material", "TypeMaterialName", "Material Name", "" );
|
%this.addField( "materialAsset", "TypeMaterialAsset", "Material Asset", "" );
|
||||||
%this.addField( "shapeFilename[0]", "TypeFile", "Shape File [Optional]", "", "*.*");
|
%this.addField( "shapeAsset[0]", "TypeShapeAsset", "Shape Asset [Optional]", "", "");
|
||||||
%this.process();
|
%this.process();
|
||||||
|
|
||||||
// This is a trick... any fields added after process won't show
|
// This is a trick... any fields added after process won't show
|
||||||
|
|
@ -1212,6 +1472,9 @@ function ObjectBuilderGui::buildGeneralDropPoint(%this)
|
||||||
function ObjectBuilderGui::buildNotesObject(%this)
|
function ObjectBuilderGui::buildNotesObject(%this)
|
||||||
{
|
{
|
||||||
%this.objectClassName = "NotesObject";
|
%this.objectClassName = "NotesObject";
|
||||||
|
%this.addField("note", "TypeString", "Note Text", "");
|
||||||
|
%this.addField("showArrow", "TypeBool", "Show Arrow", "");
|
||||||
|
%this.addField("arrowColor", "TypeColorI", "Arrow Color", "255 0 0 255");
|
||||||
%this.process();
|
%this.process();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -1221,11 +1484,11 @@ function ObjectBuilderGui::buildVolumetricFog(%this)
|
||||||
{
|
{
|
||||||
// Change this if you want to default to another Folder
|
// Change this if you want to default to another Folder
|
||||||
// Otherwise every time you want to add a Fog you will go this.
|
// Otherwise every time you want to add a Fog you will go this.
|
||||||
%defShape = "core/rendering/shapes/Fog_Cube.DAE";
|
%defShape = "Core_Rendering:Fog_Cube";
|
||||||
%this.lastPath=getMainDotCsDir() @ %defShape;
|
%this.lastPath=getMainDotCsDir() @ %defShape;
|
||||||
OBObjectName.setValue( "" );
|
OBObjectName.setValue( "" );
|
||||||
%this.objectClassName = "VolumetricFog";
|
%this.objectClassName = "VolumetricFog";
|
||||||
%this.addField( "shapeName", "TypeFile", "Shape (Fog volume)", "", "*.dts;*.dae");
|
%this.addField( "shapeAsset", "TypeShapeAsset", "Shape (Fog volume)", "", "");
|
||||||
%this.addField("Scale", "TypePoint3", "Scale", "1 1 1");
|
%this.addField("Scale", "TypePoint3", "Scale", "1 1 1");
|
||||||
%this.addField("FogColor", "TypeColorI", "FogColor", "200 200 200 255");
|
%this.addField("FogColor", "TypeColorI", "FogColor", "200 200 200 255");
|
||||||
%this.process();
|
%this.process();
|
||||||
|
|
|
||||||
|
|
@ -1826,7 +1826,10 @@ function EditorTree::update( %this )
|
||||||
// Tooltip for TSStatic
|
// Tooltip for TSStatic
|
||||||
function EditorTree::GetTooltipTSStatic( %this, %obj )
|
function EditorTree::GetTooltipTSStatic( %this, %obj )
|
||||||
{
|
{
|
||||||
return "Shape: " @ %obj.shapeName;
|
%shapeName = %obj.shapeAsset;
|
||||||
|
if(%shapeName $= "")
|
||||||
|
%shapeName = %obj.getShape();
|
||||||
|
return "Shape: " @ %shapeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip for ShapeBase
|
// Tooltip for ShapeBase
|
||||||
|
|
@ -1862,7 +1865,10 @@ function EditorTree::GetTooltipPrefab( %this, %obj )
|
||||||
// Tooltip for GroundCover
|
// Tooltip for GroundCover
|
||||||
function EditorTree::GetTooltipGroundCover( %this, %obj )
|
function EditorTree::GetTooltipGroundCover( %this, %obj )
|
||||||
{
|
{
|
||||||
%text = "Material: " @ %obj.material;
|
%matName = %obj.materialAsset;
|
||||||
|
if(%matName $= "")
|
||||||
|
%matName = %obj.getMaterial();
|
||||||
|
%text = "Material: " @ %matName;
|
||||||
for(%i=0; %i<8; %i++)
|
for(%i=0; %i<8; %i++)
|
||||||
{
|
{
|
||||||
if(%obj.probability[%i] > 0 && %obj.shapeFilename[%i] !$= "")
|
if(%obj.probability[%i] > 0 && %obj.shapeFilename[%i] !$= "")
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,4 @@ GlobalActionMap.bind(keyboard, "tilde", toggleConsole);
|
||||||
|
|
||||||
EditorMap.bind( mouse, "alt zaxis", editorWheelFadeScroll );
|
EditorMap.bind( mouse, "alt zaxis", editorWheelFadeScroll );
|
||||||
|
|
||||||
EditorMap.bindCmd( keyboard, space, "", "AssetBrowser.toggleDialog();" );
|
EditorMap.bindCmd( keyboard, "shift space", "", "AssetBrowser.toggleDialog();" );
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ function EWCreatorWindow::createObject( %this, %cmd )
|
||||||
%this.setNewObjectGroup( getScene(0) );
|
%this.setNewObjectGroup( getScene(0) );
|
||||||
|
|
||||||
pushInstantGroup();
|
pushInstantGroup();
|
||||||
%objId = eval(%cmd);
|
%objId = eval("return " @ %cmd);
|
||||||
popInstantGroup();
|
popInstantGroup();
|
||||||
|
|
||||||
if( isObject( %objId ) )
|
if( isObject( %objId ) )
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ function EditorNewLevel( %level )
|
||||||
%saveFirst = false;
|
%saveFirst = false;
|
||||||
if ( EditorIsDirty() )
|
if ( EditorIsDirty() )
|
||||||
{
|
{
|
||||||
error(knob);
|
%saveFirst = MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
||||||
%saveFirst = toolsMessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
|
||||||
$Server::MissionFile @ "\" before creating a new mission?", "SaveDontSave", "Question") == $MROk;
|
$Server::MissionFile @ "\" before creating a new mission?", "SaveDontSave", "Question") == $MROk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,7 +299,7 @@ function EditorSaveMission()
|
||||||
// first check for dirty and read-only files:
|
// first check for dirty and read-only files:
|
||||||
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
if((EWorldEditor.isDirty || ETerrainEditor.isMissionDirty) && !isWriteableFileName($Server::MissionFile))
|
||||||
{
|
{
|
||||||
toolsMessageBox("Error", "Mission file \""@ $Server::MissionFile @ "\" is read-only. Continue?", "Ok", "Stop");
|
MessageBox("Error", "Mission file \""@ $Server::MissionFile @ "\" is read-only. Continue?", "Ok", "Stop");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(ETerrainEditor.isDirty)
|
if(ETerrainEditor.isDirty)
|
||||||
|
|
@ -310,9 +309,18 @@ function EditorSaveMission()
|
||||||
|
|
||||||
while ((%terrainObject = containerSearchNext()) != 0)
|
while ((%terrainObject = containerSearchNext()) != 0)
|
||||||
{
|
{
|
||||||
if (!isWriteableFileName(%terrainObject.terrainFile))
|
%terrFile = %terrainObject.getTerrain();
|
||||||
|
if(AssetDatabase.isDeclaredAsset(%terrFile))
|
||||||
{
|
{
|
||||||
if (toolsMessageBox("Error", "Terrain file \""@ %terrainObject.terrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
%assetDef = AssetDatabase.acquireAsset(%terrFile);
|
||||||
|
%file = %assetDef.getTerrainFilePath();
|
||||||
|
AssetDatabase.releaseAsset(%terrFile);
|
||||||
|
%terrFile = %file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isWriteableFileName(%terrFile))
|
||||||
|
{
|
||||||
|
if (MessageBox("Error", "Terrain file \""@ %terrainObject.terrainFile @ "\" is read-only. Continue?", "Ok", "Stop") == $MROk)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -497,12 +505,12 @@ function EditorOpenMission(%levelAsset)
|
||||||
if( EditorIsDirty())
|
if( EditorIsDirty())
|
||||||
{
|
{
|
||||||
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
// "EditorSaveBeforeLoad();", "getLoadFilename(\"*.mis\", \"EditorDoLoadMission\");"
|
||||||
if(toolsMessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
if(MessageBox("Mission Modified", "Would you like to save changes to the current mission \"" @
|
||||||
$Server::MissionFile @ "\" before opening a new mission?", SaveDontSave, Question) == $MROk)
|
$Server::MissionFile @ "\" before opening a new mission?", SaveDontSave, Question) == $MROk)
|
||||||
{
|
{
|
||||||
if(! EditorSaveMission())
|
if(!EditorSaveMission())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(%levelAsset $= "")
|
if(%levelAsset $= "")
|
||||||
|
|
@ -779,8 +787,20 @@ function makeSelectedAMesh(%assetId)
|
||||||
function EditorTakeControlOfEntity()
|
function EditorTakeControlOfEntity()
|
||||||
{
|
{
|
||||||
%object = EWorldEditor.getSelectedObject(0);
|
%object = EWorldEditor.getSelectedObject(0);
|
||||||
switchCamera(localClientConnection, %object);
|
if(isObject(%object) && %object.getClassName() !$= "Camera")
|
||||||
switchControlObject(localClientConnection, %object);
|
{
|
||||||
|
$Editor::previousControlObject = localClientConnection.getControlObject();
|
||||||
|
localClientConnection.setControlObject(%object);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function EditorReleaseControlOfEntity()
|
||||||
|
{
|
||||||
|
if(isObject($Editor::previousControlObject))
|
||||||
|
{
|
||||||
|
localClientConnection.setControlObject($Editor::previousControlObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditorMount()
|
function EditorMount()
|
||||||
|
|
|
||||||
|
|
@ -459,9 +459,11 @@ function EditorGui::buildMenus(%this)
|
||||||
Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();";
|
Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();";
|
||||||
Item[19] = "-";
|
Item[19] = "-";
|
||||||
Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();";
|
Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();";
|
||||||
Item[21] = "-";
|
Item[21] = "Release control of entity" TAB "" TAB "EditorReleaseControlOfEntity();";
|
||||||
Item[22] = "Mount Selection A to B" TAB "" TAB "EditorMount();";
|
|
||||||
Item[23] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();";
|
Item[22] = "-";
|
||||||
|
Item[23] = "Mount Selection A to B" TAB "" TAB "EditorMount();";
|
||||||
|
Item[24] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue