mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Updates TerrainMaterialAsset to utilize similar macros to everything else
Updates groundCover to utilize TerrainMaterialAsset macros in place of straight StringTableEntry for type layers Fixes formatting for several asset types' inspector fields so they correctly call down into prompting the AssetBrowser being shown with correct field naming, thus allowing fields that are arrays to have the right index when setting the target variable Updates several asset helper macros to handle blank values for network traffic to actually be sent to client, thus allowing setting an asset to blank on the client, rather than only falling back
This commit is contained in:
parent
9fe2eec813
commit
66f924ebd4
13 changed files with 406 additions and 52 deletions
|
|
@ -510,7 +510,12 @@ GroundCover::GroundCover()
|
|||
mMinElevation[i] = -99999.0f;
|
||||
mMaxElevation[i] = 99999.0f;
|
||||
|
||||
mLayer[i] = StringTable->EmptyString();
|
||||
mLayerAsset[i] = nullptr;
|
||||
mLayerFile[i] = StringTable->EmptyString();
|
||||
|
||||
mShapeAsset[i] = nullptr;
|
||||
mShapeFile[i] = StringTable->EmptyString();
|
||||
|
||||
mInvertLayer[i] = false;
|
||||
|
||||
mMinClumpCount[i] = 1;
|
||||
|
|
@ -565,7 +570,10 @@ void GroundCover::initPersistFields()
|
|||
|
||||
INITPERSISTFIELD_SHAPEASSET_ARRAY_REFACTOR(Shape, MAX_COVERTYPES, GroundCover, "The cover shape. [Optional]");
|
||||
|
||||
addField( "layer", TypeTerrainMaterialAssetId, Offset( mLayer, GroundCover ), MAX_COVERTYPES, "Terrain material assetId to limit coverage to, or blank to not limit." );
|
||||
INITPERSISTFIELD_TERRAINMATERIALASSET_ARRAY(Layer, MAX_COVERTYPES, GroundCover, "Terrain material assetId to limit coverage to, or blank to not limit.");
|
||||
|
||||
//Legacy field
|
||||
addProtectedField("layer", TypeTerrainMaterialAssetPtr, Offset(mLayerAsset, GroundCover), &_setLayerData, &defaultProtectedGetFn, MAX_COVERTYPES, "Terrain material assetId to limit coverage to, or blank to not limit.", AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
addField( "invertLayer", TypeBool, Offset( mInvertLayer, GroundCover ), MAX_COVERTYPES, "Indicates that the terrain material index given in 'layer' is an exclusion mask." );
|
||||
|
||||
|
|
@ -754,7 +762,6 @@ U32 GroundCover::packUpdate( NetConnection *connection, U32 mask, BitStream *str
|
|||
stream->write( mMinElevation[i] );
|
||||
stream->write( mMaxElevation[i] );
|
||||
|
||||
stream->writeString( mLayer[i] );
|
||||
stream->writeFlag( mInvertLayer[i] );
|
||||
|
||||
stream->write( mMinClumpCount[i] );
|
||||
|
|
@ -768,6 +775,7 @@ U32 GroundCover::packUpdate( NetConnection *connection, U32 mask, BitStream *str
|
|||
stream->write( mBillboardRects[i].extent.y );
|
||||
}
|
||||
|
||||
PACK_ASSET_ARRAY_REFACTOR(connection, Layer, MAX_COVERTYPES)
|
||||
PACK_ASSET_ARRAY_REFACTOR(connection, Shape, MAX_COVERTYPES)
|
||||
|
||||
stream->writeFlag( mDebugRenderCells );
|
||||
|
|
@ -825,7 +833,6 @@ void GroundCover::unpackUpdate( NetConnection *connection, BitStream *stream )
|
|||
stream->read( &mMinElevation[i] );
|
||||
stream->read( &mMaxElevation[i] );
|
||||
|
||||
mLayer[i] = stream->readSTString();
|
||||
mInvertLayer[i] = stream->readFlag();
|
||||
|
||||
stream->read( &mMinClumpCount[i] );
|
||||
|
|
@ -839,6 +846,8 @@ void GroundCover::unpackUpdate( NetConnection *connection, BitStream *stream )
|
|||
stream->read( &mBillboardRects[i].extent.y );
|
||||
}
|
||||
|
||||
UNPACK_ASSET_ARRAY_REFACTOR(connection, Layer, MAX_COVERTYPES)
|
||||
|
||||
UNPACK_ASSET_ARRAY_REFACTOR(connection, Shape, MAX_COVERTYPES)
|
||||
|
||||
mDebugRenderCells = stream->readFlag();
|
||||
|
|
@ -1181,7 +1190,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
|
|||
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F();
|
||||
const F32 typeWindScale = mWindScale[type];
|
||||
|
||||
StringTableEntry typeLayer = mLayer[type];
|
||||
StringTableEntry typeLayer = StringTable->EmptyString();
|
||||
if (mLayerAsset[type].notNull())
|
||||
typeLayer = mLayerAsset[type]->getAssetId();
|
||||
const bool typeInvertLayer = mInvertLayer[type];
|
||||
|
||||
// We can set this once here... all the placements for this are the same.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue