Fixes various reported issues with the ShapeEd update

- Updates addSequence for the TSShapeConstructor so it can properly understand if it's handed an assetId or not, and if it is, stores that as the source data for use later
- Has the added benefit of ensuring no erroneous double-ups of data causing accidental overwrites when saving the shapeConstructor because it thinks the data 'changed'
- Fixed saving of new added sequences in shape constructor to properly trip whitespace
- Adds ability to manually trigger a ShapeAsset to load the shape data
- Adjusted the logic for getting a shape/animation asset's constructor when adding a new sequence to avoid false reporting of no constructor existing(by manually loading it)
- Fixed formatting on ShapeEd Anim window to properly scale
- Added onWake calls for the ShapeEd select and properties windows to better prep them position/extents-wise so they should behave more consistently
- Fixed issue of Not closing material editor if it was opened via the Edit Selected Material button in the ShapeEd
- Fixed issue of highlighting of material not going away when ShapeEditor is closed
This commit is contained in:
JeffR 2025-10-13 00:07:46 -05:00
parent 7a0ae4c7af
commit e02981c848
9 changed files with 91 additions and 50 deletions

View file

@ -159,7 +159,7 @@ void ShapeAnimationAsset::initializeAsset(void)
mSourceShape = ResourceManager::get().load(mFilePath);
if (!mSourceShape || !mSourceShape->addSequence("ambient", "", mAnimationName, mStartFrame, mEndFrame, mPadRotation, mPadTransforms))
if (!mSourceShape || !mSourceShape->addSequence("ambient", "", "", mAnimationName, mStartFrame, mEndFrame, mPadRotation, mPadTransforms))
{
Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to do initial setup of the animation clip named %s for asset %s", mAnimationName, getAssetName());
return;

View file

@ -387,7 +387,7 @@ U32 ShapeAsset::load()
String srcPath(mAnimationAssets[i]->getAnimationFilename());
//SplitSequencePathAndName(srcPath, srcName);
if (!mShape->addSequence(srcPath, srcName, srcName,
if (!mShape->addSequence(srcPath, mAnimationAssets[i]->getAssetId(), srcName, srcName,
mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms()))
{
mLoadedState = MissingAnimatons;
@ -755,6 +755,11 @@ DefineEngineMethod(ShapeAsset, getStatusString, String, (), , "get status string
return ShapeAsset::getAssetErrstrn(object->getStatus());
}
DefineEngineMethod(ShapeAsset, load, String, (), , "get status string")\
{
U32 code = object->load();
return ShapeAsset::getAssetErrstrn(code);
}
#ifdef TORQUE_TOOLS
DefineEngineMethod(ShapeAsset, generateCachedPreviewImage, const char*, (S32 resolution, const char* overrideMaterialName), (256, ""),

View file

@ -682,7 +682,7 @@ class TSShape
bool removeDetail(S32 size);
static bool isShapeFileType(Torque::Path filePath);
bool addSequence(const Torque::Path& path, const String& fromSeq, const String& name, S32 startFrame, S32 endFrame, bool padRotKeys, bool padTransKeys);
bool addSequence(const Torque::Path& path, const String& assetId, const String& fromSeq, const String& name, S32 startFrame, S32 endFrame, bool padRotKeys, bool padTransKeys);
bool removeSequence(const String& name);
bool addTrigger(const String& seqName, S32 keyframe, S32 state);

View file

@ -2147,11 +2147,13 @@ DefineTSShapeConstructorMethod(addSequence, bool,
{
String srcName;
String srcPath(source);
StringTableEntry assetId = StringTable->EmptyString();
SplitSequencePathAndName(srcPath, srcName);
if (AssetDatabase.isDeclaredAsset(srcPath))
{
StringTableEntry assetId = StringTable->insert(srcPath.c_str());
assetId = StringTable->insert(srcPath.c_str());
StringTableEntry assetType = AssetDatabase.getAssetType(assetId);
if (assetType == StringTable->insert("ShapeAsset"))
{
@ -2167,7 +2169,7 @@ DefineTSShapeConstructorMethod(addSequence, bool,
}
}
if (!mShape->addSequence(srcPath, srcName, name, start, end, padRot, padTrans))
if (!mShape->addSequence(srcPath, assetId, srcName, name, start, end, padRot, padTrans))
return false;
ADD_TO_CHANGE_SET();

View file

@ -30,6 +30,7 @@
#include "ts/tsMaterialList.h"
#include "core/stream/fileStream.h"
#include "core/volume.h"
#include "assets/assetManager.h"
//-----------------------------------------------------------------------------
@ -1376,7 +1377,7 @@ bool TSShape::isShapeFileType(Torque::Path filePath)
}
//-----------------------------------------------------------------------------
bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq,
bool TSShape::addSequence(const Torque::Path& path, const String& assetId, const String& fromSeq,
const String& name, S32 startFrame, S32 endFrame,
bool padRotKeys, bool padTransKeys)
{
@ -1810,7 +1811,11 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq,
seq.dirtyFlags |= TSShapeInstance::MatFrameDirty;
// Store information about how this sequence was created
seq.sourceData.from = String::ToString("%s\t%s", path.getFullPath().c_str(), oldName.c_str());
String fromData = path.getFullPath();
if (assetId.isNotEmpty() && AssetDatabase.isDeclaredAsset(assetId.c_str()))
fromData = assetId;
seq.sourceData.from = String::ToString("%s\t%s", fromData.c_str(), oldName.c_str());
seq.sourceData.total = srcSeq->numKeyframes;
seq.sourceData.start = startFrame;
seq.sourceData.end = endFrame;