|
@@ -113,12 +113,22 @@ ConsoleSetType(TypeShapeAssetId)
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
+const String ShapeAsset::mErrCodeStrings[] =
|
|
|
|
+{
|
|
|
|
+ "TooManyVerts",
|
|
|
|
+ "TooManyBones",
|
|
|
|
+ "MissingAnimatons",
|
|
|
|
+ "UnKnown"
|
|
|
|
+};
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+
|
|
ShapeAsset::ShapeAsset()
|
|
ShapeAsset::ShapeAsset()
|
|
{
|
|
{
|
|
mFileName = StringTable->EmptyString();
|
|
mFileName = StringTable->EmptyString();
|
|
mConstructorFileName = StringTable->EmptyString();
|
|
mConstructorFileName = StringTable->EmptyString();
|
|
mFilePath = StringTable->EmptyString();
|
|
mFilePath = StringTable->EmptyString();
|
|
mConstructorFilePath = StringTable->EmptyString();
|
|
mConstructorFilePath = StringTable->EmptyString();
|
|
|
|
+ mLoadedState = AssetErrCode::NotLoaded;
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
@@ -264,7 +274,8 @@ bool ShapeAsset::loadShape()
|
|
|
|
|
|
if (!mShape)
|
|
if (!mShape)
|
|
{
|
|
{
|
|
- Con::errorf("StaticMesh::updateShape : failed to load shape file!");
|
|
|
|
|
|
+ Con::errorf("ShapeAsset::loadShape : failed to load shape file!");
|
|
|
|
+ mLoadedState = BadFileReference;
|
|
return false; //if it failed to load, bail out
|
|
return false; //if it failed to load, bail out
|
|
}
|
|
}
|
|
|
|
|
|
@@ -280,8 +291,10 @@ bool ShapeAsset::loadShape()
|
|
|
|
|
|
if (!mShape->addSequence(srcPath, srcName, srcName,
|
|
if (!mShape->addSequence(srcPath, srcName, srcName,
|
|
mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms()))
|
|
mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms()))
|
|
|
|
+ {
|
|
|
|
+ mLoadedState = MissingAnimatons;
|
|
return false;
|
|
return false;
|
|
-
|
|
|
|
|
|
+ }
|
|
if (mAnimationAssets[i]->isBlend())
|
|
if (mAnimationAssets[i]->isBlend())
|
|
hasBlends = true;
|
|
hasBlends = true;
|
|
}
|
|
}
|
|
@@ -300,14 +313,20 @@ bool ShapeAsset::loadShape()
|
|
if (blendAnimAsset.isNull())
|
|
if (blendAnimAsset.isNull())
|
|
{
|
|
{
|
|
Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName());
|
|
Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName());
|
|
- return false;
|
|
|
|
|
|
+ {
|
|
|
|
+ mLoadedState = MissingAnimatons;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
String refAnimName = blendAnimAsset->getAnimationName();
|
|
String refAnimName = blendAnimAsset->getAnimationName();
|
|
if (!mShape->setSequenceBlend(mAnimationAssets[i]->getAnimationName(), true, blendAnimAsset->getAnimationName(), mAnimationAssets[i]->getBlendFrame()))
|
|
if (!mShape->setSequenceBlend(mAnimationAssets[i]->getAnimationName(), true, blendAnimAsset->getAnimationName(), mAnimationAssets[i]->getBlendFrame()))
|
|
{
|
|
{
|
|
Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to set animation clip %s for asset %s to blend!", mAnimationAssets[i]->getAnimationName(), mAnimationAssets[i]->getAssetName());
|
|
Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to set animation clip %s for asset %s to blend!", mAnimationAssets[i]->getAnimationName(), mAnimationAssets[i]->getAssetName());
|
|
- return false;
|
|
|
|
|
|
+ {
|
|
|
|
+ mLoadedState = MissingAnimatons;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -315,6 +334,7 @@ bool ShapeAsset::loadShape()
|
|
|
|
|
|
mChangeSignal.trigger();
|
|
mChangeSignal.trigger();
|
|
|
|
|
|
|
|
+ mLoadedState = Ok;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -410,21 +430,21 @@ StringTableEntry ShapeAsset::getAssetIdByFilename(StringTableEntry fileName)
|
|
return shapeAssetId;
|
|
return shapeAssetId;
|
|
}
|
|
}
|
|
|
|
|
|
-bool ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* shapeAsset)
|
|
|
|
|
|
+U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* shapeAsset)
|
|
{
|
|
{
|
|
(*shapeAsset) = assetId;
|
|
(*shapeAsset) = assetId;
|
|
|
|
|
|
- if (!shapeAsset->isNull())
|
|
|
|
- return true;
|
|
|
|
|
|
+ if ((*shapeAsset))
|
|
|
|
+ return (*shapeAsset)->mLoadedState;
|
|
|
|
|
|
//Didn't work, so have us fall back to a placeholder asset
|
|
//Didn't work, so have us fall back to a placeholder asset
|
|
StringTableEntry noShapeId = StringTable->insert("Core_Rendering:noshape");
|
|
StringTableEntry noShapeId = StringTable->insert("Core_Rendering:noshape");
|
|
shapeAsset->setAssetId(noShapeId);
|
|
shapeAsset->setAssetId(noShapeId);
|
|
|
|
+ (*shapeAsset)->mLoadedState = AssetErrCode::UsingFallback;
|
|
|
|
+ if (shapeAsset->notNull())
|
|
|
|
+ return AssetErrCode::UsingFallback;
|
|
|
|
|
|
- if (!shapeAsset->isNull())
|
|
|
|
- return true;
|
|
|
|
-
|
|
|
|
- return false;
|
|
|
|
|
|
+ return AssetErrCode::Failed;
|
|
}
|
|
}
|
|
//------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
@@ -503,6 +523,7 @@ DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index),
|
|
// GuiInspectorTypeAssetId
|
|
// GuiInspectorTypeAssetId
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
+#ifdef TORQUE_TOOLS
|
|
IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetPtr);
|
|
IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetPtr);
|
|
|
|
|
|
ConsoleDocClass(GuiInspectorTypeShapeAssetPtr,
|
|
ConsoleDocClass(GuiInspectorTypeShapeAssetPtr,
|
|
@@ -596,6 +617,8 @@ void GuiInspectorTypeShapeAssetId::consoleInit()
|
|
ConsoleBaseType::getType(TypeShapeAssetId)->setInspectorFieldType("GuiInspectorTypeShapeAssetId");
|
|
ConsoleBaseType::getType(TypeShapeAssetId)->setInspectorFieldType("GuiInspectorTypeShapeAssetId");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
+
|
|
DefineEngineMethod(ShapeAsset, getShapeFile, const char*, (), ,
|
|
DefineEngineMethod(ShapeAsset, getShapeFile, const char*, (), ,
|
|
"Creates a new script asset using the targetFilePath.\n"
|
|
"Creates a new script asset using the targetFilePath.\n"
|
|
"@return The bool result of calling exec")
|
|
"@return The bool result of calling exec")
|