Adds test shapes of Kork and SpaceOrc

Sidestep of memleak from CSF at the moment
Minor fixes and corrections with asset importing and loose files
WIP of updated options menu
This commit is contained in:
Areloch 2019-05-28 17:24:29 -05:00
parent 98c4606b3c
commit ae857faae2
40 changed files with 765 additions and 182 deletions

View file

@ -149,12 +149,12 @@ void ImageAsset::loadImage()
void ImageAsset::initializeAsset()
{
loadImage();
setImageFileName(mImageFileName);
}
void ImageAsset::onAssetRefresh()
{
loadImage();
setImageFileName(mImageFileName);
}
void ImageAsset::setImageFileName(const char* pScriptFile)
@ -162,16 +162,16 @@ void ImageAsset::setImageFileName(const char* pScriptFile)
// Sanity!
AssertFatal(pScriptFile != NULL, "Cannot use a NULL image file.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
// Ignore no change,
if (pScriptFile == mImageFileName)
return;
// Update.
mImageFileName = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
// Refresh the asset.
refreshAsset();
loadImage();
}
DefineEngineMethod(ImageAsset, getImageFilename, const char*, (), ,
"Creates an instance of the given GameObject given the asset definition.\n"
"@return The GameObject entity created from the asset.")
{
return object->getImageFileName();
}

View file

@ -71,7 +71,7 @@ public:
bool isValid() { return mIsValidImage; }
GFXTexHandle* getImage() { return &mImage; }
GFXTexHandle getImage() { return mImage; }
protected:
virtual void initializeAsset(void);

View file

@ -121,12 +121,17 @@ void MaterialAsset::initializeAsset()
compileShader();
if (!Platform::isFullPath(mScriptFile))
mScriptFile = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptFile;
if (Platform::isFile(mScriptFile))
Con::executeFile(mScriptFile, false, false);
}
void MaterialAsset::onAssetRefresh()
{
mScriptFile = expandAssetFilePath(mScriptFile);
if (Platform::isFile(mScriptFile))
Con::executeFile(mScriptFile, false, false);
@ -151,12 +156,8 @@ void MaterialAsset::setScriptFile(const char* pScriptFile)
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
// Ignore no change,
if (pScriptFile == mScriptFile)
return;
// Update.
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile);
mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();

View file

@ -944,7 +944,12 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount )
Material* mat = dynamic_cast<Material*>(mMatInst->getMaterial());
if(mat)
{
GFXTexHandle tex(mat->mDiffuseMapFilename[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check" );
GFXTexHandle tex;
if (!mat->mDiffuseMapFilename[0].isEmpty())
tex = GFXTexHandle(mat->mDiffuseMapFilename[0], &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check");
else if (!mat->mDiffuseMapAsset[0].isNull())
tex = mat->mDiffuseMapAsset[0]->getImage();
if(tex.isValid())
{
U32 w = tex.getWidth();