Updates ImageAsset usage to utilize AssetRef, and standardizes the setter/getter functions and naming conventions, as well as the ability to use and bind named targets.

This commit is contained in:
JeffR 2026-06-16 17:39:30 -05:00
parent a858d8624e
commit 34e3f78a22
82 changed files with 1451 additions and 951 deletions

View file

@ -128,7 +128,9 @@ void SplashData::initPersistFields()
addFieldV("times", TypeRangedF32, Offset(times, SplashData), &CommonValidators::NormalizedFloat, NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" );
addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" );
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
ADD_FIELD("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, SplashData))
.elements(NUM_TEX)
.doc("Image asset to use as the texture for the splash effect.\n");
addFieldV("texWrap", TypeRangedF32, Offset(texWrap, SplashData), &CommonValidators::NormalizedFloat, "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n");
addFieldV("texFactor", TypeRangedF32, Offset(texFactor, SplashData), &CommonValidators::NormalizedFloat, "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n");
@ -195,7 +197,8 @@ void SplashData::packData(BitStream* stream)
stream->writeRangedU32(explosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
}
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
for (U32 i = 0; i < NUM_TEX; i++)
AssetDatabase.packDataAsset(stream, mTextureAssetRef[i].assetId);
S32 i;
for( i=0; i<NUM_EMITTERS; i++ )
@ -248,7 +251,8 @@ void SplashData::unpackData(BitStream* stream)
explosionId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
for (U32 i = 0; i < NUM_TEX; i++)
mTextureAssetRef[i] = AssetDatabase.unpackDataAsset(stream);
U32 i;
for( i=0; i<NUM_EMITTERS; i++ )
@ -301,9 +305,9 @@ bool SplashData::preload(bool server, String &errorStr)
for( i=0; i<NUM_TEX; i++ )
{
if (mTextureAsset[i].isNull())
if (!mTextureAssetRef[i].isNull())
{
_setTexture(_getTexture(i), i);
mTextureAssetRef[i].assetPtr->load();
}
}
}