Merge branch 'Preview4_0' into SoundAssetImplements

# Conflicts:
#	Engine/source/T3D/assets/assetImporter.cpp
#	Engine/source/forest/forestItem.cpp
This commit is contained in:
AzaezelX 2021-10-11 20:11:27 -05:00
commit f5600826d7
122 changed files with 686 additions and 577 deletions

View file

@ -65,8 +65,6 @@ ConsoleSetType(TypeGUIAssetPtr)
if (argc == 1)
{
// Yes, so fetch field value.
const char* pFieldValue = argv[0];
*((const char**)dptr) = StringTable->insert(argv[0]);
return;

View file

@ -147,7 +147,7 @@ void ImageAsset::consoleInit()
Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback,
"The assetId of the texture to display when the requested image asset is missing.\n"
"@ingroup GFX\n");
smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback"));
}
@ -274,22 +274,8 @@ void ImageAsset::loadImage()
mLoadedState = Ok;
mIsValidImage = true;
return;
//GFXTexHandle texture = getTexture(&GFXStaticTextureSRGBProfile);
//mTexture.set(mImagePath, &GFXStaticTextureSRGBProfile, avar("%s() - mImage (line %d)", __FUNCTION__, __LINE__));
/*if (texture.isValid())
{
mIsValidImage = true;
//mBitmap = texture.getBitmap();
return;
}*/
mChangeSignal.trigger();
return;
}
mLoadedState = BadFileReference;
@ -497,8 +483,6 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
mInspector->getInspectObject()->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
const char* id = mInspector->getInspectObject()->getIdString();
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
// Create "Open in ShapeEditor" button
@ -569,7 +553,7 @@ bool GuiInspectorTypeImageAssetPtr::renderTooltip(const Point2I& hoverPos, const
if (texture.isNull())
return false;
// Render image at a reasonable screen size while
// Render image at a reasonable screen size while
// keeping its aspect ratio...
Point2I screensize = getRoot()->getWindowSize();
Point2I offset = hoverPos;

View file

@ -19,7 +19,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#pragma once
#ifndef MATERIALASSET_H
#include "MaterialAsset.h"
@ -168,13 +167,29 @@ void MaterialAsset::initializeAsset()
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (mMatDefinitionName == StringTable->EmptyString())
{
mLoadedState = Failed;
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
{
if (!Sim::findObject(mMatDefinitionName))
if (Con::executeFile(mScriptPath, false, false))
mLoadedState = ScriptLoaded;
else
mLoadedState = Failed;
{
if (Con::executeFile(mScriptPath, false, false))
{
mLoadedState = ScriptLoaded;
}
else
{
mLoadedState = Failed;
}
}
else
{
mLoadedState = DefinitionAlreadyExists;
}
}
loadMaterial();
@ -184,6 +199,12 @@ void MaterialAsset::onAssetRefresh()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (mMatDefinitionName == StringTable->EmptyString())
{
mLoadedState = Failed;
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
{
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
@ -199,7 +220,6 @@ void MaterialAsset::onAssetRefresh()
//And now that we've executed, switch back to the prior behavior
Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str());
}
loadMaterial();
@ -227,7 +247,7 @@ void MaterialAsset::loadMaterial()
if (mMaterialDefinition)
SAFE_DELETE(mMaterialDefinition);
if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString())
if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString())
{
Material* matDef;
if (!Sim::findObject(mMatDefinitionName, matDef))

View file

@ -74,6 +74,7 @@ public:
enum MaterialAssetErrCode
{
ScriptLoaded = AssetErrCode::Extended,
DefinitionAlreadyExists,
Extended
};

View file

@ -190,17 +190,12 @@ bool ScriptAsset::execScript()
if (handle)
return true;
return false;
if (Torque::FS::IsScriptFile(mScriptPath))
{
return Con::executeFile(mScriptPath, false, false);
}
else
{
Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec");
return false;
}
Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec");
return false;
}
DefineEngineMethod(ScriptAsset, execScript, bool, (), ,

View file

@ -603,8 +603,6 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
mInspector->getInspectObject()->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
const char* id = mInspector->getInspectObject()->getIdString();
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
// Create "Open in ShapeEditor" button

View file

@ -468,8 +468,6 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl()
mInspector->getInspectObject()->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
const char* id = mInspector->getInspectObject()->getIdString();
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
// Create "Open in ShapeEditor" button

View file

@ -1821,10 +1821,8 @@ void AssetImporter::processShapeAsset(AssetImportObject* assetItem)
}
S32 meshCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_meshCount"), nullptr));
S32 shapeItem = assetItem->shapeInfo->findItemByName("Meshes");
S32 animCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_animCount"), nullptr));
S32 animItem = assetItem->shapeInfo->findItemByName("Animations");
S32 materialCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_materialCount"), nullptr));
S32 matItem = assetItem->shapeInfo->findItemByName("Materials");
@ -2005,9 +2003,7 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem)
if (assetItem->importStatus == AssetImportObject::Skipped || assetItem->importStatus == AssetImportObject::NotProcessed)
return;
bool hasCollision = checkAssetForCollision(assetItem);
if (hasCollision)
if (checkAssetForCollision(assetItem))
{
importIssues = true;
return;
@ -2018,7 +2014,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem)
AssetQuery aQuery;
U32 numAssetsFound = AssetDatabase.findAllAssets(&aQuery);
hasCollision = false;
for (U32 i = 0; i < numAssetsFound; i++)
{
StringTableEntry assetId = aQuery.mAssetList[i];
@ -2032,7 +2027,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem)
if (assetName == StringTable->insert(assetItem->assetName.c_str()))
{
hasCollision = true;
assetItem->status = "Error";
assetItem->statusType = "DuplicateAsset";
assetItem->statusInfo = "Duplicate asset names found within the target module!\nAsset \"" + assetItem->assetName + "\" of type \"" + assetItem->assetType + "\" has a matching name.\nPlease rename it and try again!";
@ -2241,7 +2235,6 @@ void AssetImporter::resetImportConfig()
activeImportConfig->registerObject();
}
bool foundConfig = false;
Settings* editorSettings;
//See if we can get our editor settings
if (Sim::findObject("EditorSettings", editorSettings))

View file

@ -931,15 +931,6 @@ public:
return imagePath;
}
static inline const char* makeFullPath(const String& path)
{
char qualifiedFilePath[2048];
Platform::makeFullPathName(path.c_str(), qualifiedFilePath, sizeof(qualifiedFilePath));
return qualifiedFilePath;
}
//
void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
const String& getTargetModuleId() { return targetModuleId; }

View file

@ -222,7 +222,6 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch
*/
String t = data;
S32 len = t.length();
dSscanf( data, "%g %g %g %g %g %g %g %i %g %g %g %g %f", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z,
&matID, &offset.x, &offset.y, &scale.x, &scale.y, &rot);
@ -318,10 +317,10 @@ void ConvexShape::initPersistFields()
addGroup( "Internal" );
addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn,
addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
addProtectedField( "surfaceTexture", TypeRealString, NULL, &protectedSetSurfaceTexture, &defaultProtectedGetFn,
addProtectedField( "surfaceTexture", TypeRealString, 0, &protectedSetSurfaceTexture, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
endGroup( "Internal" );
@ -961,17 +960,6 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in
VectorF rayDir( end - start );
rayDir.normalizeSafe();
if ( false )
{
PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) );
Point3F sp( 0,0,-1 );
Point3F ep( 0,0,1 );
F32 t = plane.intersect( sp, ep );
Point3F hitPnt;
hitPnt.interpolate( sp, ep, t );
}
for ( S32 i = 0; i < planeCount; i++ )
{
// Don't hit the back-side of planes.
@ -1376,8 +1364,6 @@ void ConvexShape::_updateGeometry( bool updateCollision )
{
U32 count = faceList[i].triangles.size();
S32 matID = mSurfaceUVs[i].matID;
mSurfaceBuffers[mSurfaceUVs[i].matID].mPrimCount += count;
mSurfaceBuffers[mSurfaceUVs[i].matID].mVertCount += count * 3;
}
@ -1429,9 +1415,6 @@ void ConvexShape::_updateGeometry( bool updateCollision )
{
if (mSurfaceBuffers[i].mVertCount > 0)
{
U32 primCount = mSurfaceBuffers[i].mPrimCount;
U32 vertCount = mSurfaceBuffers[i].mVertCount;
mSurfaceBuffers[i].mVertexBuffer.set(GFX, mSurfaceBuffers[i].mVertCount, GFXBufferTypeStatic);
VertexType *pVert = mSurfaceBuffers[i].mVertexBuffer.lock();

View file

@ -1908,42 +1908,21 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie
if (mDataBlock->reverseOrder)
{
buffPtr += 4 * (n_parts - 1);
// do sorted-oriented particles
if (mDataBlock->sortParticles)
{
SortParticle* partPtr = orderedVector.address();
for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4)
setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
}
// do unsorted-oriented particles
else
{
Particle* oldPtr = NULL;
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) {
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4)
{
setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr);
oldPtr = partPtr;
}
}
}
else
{
// do sorted-oriented particles
if (mDataBlock->sortParticles)
{
SortParticle* partPtr = orderedVector.address();
for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4)
setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
}
// do unsorted-oriented particles
else
{
Particle* oldPtr = NULL;
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) {
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4)
{
setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr);
oldPtr = partPtr;
}
}
}
PROFILE_END();
}

View file

@ -1003,7 +1003,7 @@ void Precipitation::initRenderObjects()
// entire or a partially filled vb.
mRainIB.set(GFX, mMaxVBDrops * 6, 0, GFXBufferTypeStatic);
U16 *idxBuff;
mRainIB.lock(&idxBuff, NULL, NULL, NULL);
mRainIB.lock(&idxBuff, NULL, 0, 0);
for( U32 i=0; i < mMaxVBDrops; i++ )
{
//

View file

@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
return cObj->isValidCameraFov(fov);
}
return NULL;
return false;
}
bool GameConnection::setControlCameraFov(F32 fov)

View file

@ -46,7 +46,6 @@ namespace IBLUtilities
}
GFXShaderConstBufferRef irrConsts = irrShader->allocConstBuffer();
GFXShaderConstHandle* irrEnvMapSC = irrShader->getShaderConstHandle("$environmentMap");
GFXShaderConstHandle* irrFaceSC = irrShader->getShaderConstHandle("$face");
GFXStateBlockDesc desc;
@ -132,7 +131,6 @@ namespace IBLUtilities
}
GFXShaderConstBufferRef prefilterConsts = prefilterShader->allocConstBuffer();
GFXShaderConstHandle* prefilterEnvMapSC = prefilterShader->getShaderConstHandle("$environmentMap");
GFXShaderConstHandle* prefilterFaceSC = prefilterShader->getShaderConstHandle("$face");
GFXShaderConstHandle* prefilterRoughnessSC = prefilterShader->getShaderConstHandle("$roughness");
GFXShaderConstHandle* prefilterMipSizeSC = prefilterShader->getShaderConstHandle("$mipSize");

View file

@ -117,7 +117,7 @@ class ShapeBaseConvex : public Convex
Box3F box;
public:
ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; }
ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(0), nodeTransform(0) { mType = ShapeBaseConvexType; }
ShapeBaseConvex(const ShapeBaseConvex& cv) {
mObject = cv.mObject;
pShapeBase = cv.pShapeBase;

View file

@ -410,7 +410,6 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
{
if (!Parent::preload(server, errorStr))
return false;
bool shapeError = false;
// Resolve objects transmitted from server
if (!server) {