mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
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:
parent
7a0ae4c7af
commit
e02981c848
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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, ""),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,21 @@ function shapeEdAddSequenceGui::show(%seqSourceData)
|
|||
shapeEdAddSequenceWindow-->startFrame.setText("0");
|
||||
shapeEdAddSequenceWindow-->endFrame.setText("-1");
|
||||
|
||||
shapeEdAddSequenceWindow.constructor = "";
|
||||
|
||||
if(AssetDatabase.isDeclaredAsset(%seqSourceData))
|
||||
{
|
||||
%shapeDef = AssetDatabase.acquireAsset(%seqSourceData);
|
||||
%shapeDef.load();
|
||||
|
||||
shapeEdAddSequenceWindow.constructor = findShapeConstructorByAssetId( %seqSourceData );
|
||||
AssetDatabase.releaseAsset(%seqSourceData);
|
||||
}
|
||||
else if(isFile(%seqSourceData))
|
||||
{
|
||||
shapeEdAddSequenceWindow.constructor = findShapeConstructorByFilename( %seqSourceData );
|
||||
}
|
||||
|
||||
Canvas.pushDialog(shapeEdAddSequenceGui);
|
||||
}
|
||||
|
||||
|
|
@ -13,29 +28,16 @@ function shapeEdAddSequenceWindow::onWake(%this)
|
|||
{
|
||||
%sourceSeq = %this-->sourceSeq.getText();
|
||||
|
||||
if(AssetDatabase.isDeclaredAsset(%sourceSeq))
|
||||
{
|
||||
%sourceShapeConstructor = findShapeConstructorByAssetId( %sourceSeq );
|
||||
}
|
||||
else if(isFile(%sourceSeq))
|
||||
{
|
||||
%sourceShapeConstructor = findShapeConstructorByFilename( %sourceSeq );
|
||||
}
|
||||
else
|
||||
{
|
||||
toolsMessageBoxOK("Error!", "Source animation data appears to not be valid. Please close the window and select a different source.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isObject(%sourceShapeConstructor))
|
||||
if(!isObject(%this.constructor))
|
||||
{
|
||||
toolsMessageBoxOK("Error!", "Unable to find shape constructor for source animation data. Please close the window and select a different source, or make sure the constructor is valid.");
|
||||
return;
|
||||
}
|
||||
|
||||
for(%i=0; %i < %sourceShapeConstructor.getSequenceCount(); %i++)
|
||||
for(%i=0; %i < %this.constructor.getSequenceCount(); %i++)
|
||||
{
|
||||
%name = %sourceShapeConstructor.getSequenceName( %i );
|
||||
%name = %this.constructor.getSequenceName( %i );
|
||||
|
||||
// Ignore __backup__ sequences (only used by editor)
|
||||
if ( !startswith( %name, "__backup__" ) )
|
||||
|
|
@ -51,6 +53,8 @@ function onShapeEditorDoAddNewSequence()
|
|||
%seqSource = shapeEdAddSequenceWindow-->sourceSeq.getText() TAB shapeEdAddSequenceWindow-->fromSeqName.getText();
|
||||
%startFrame = shapeEdAddSequenceWindow-->startFrame.getText();
|
||||
%endFrame = shapeEdAddSequenceWindow-->endFrame.getText();
|
||||
|
||||
%seqSource = trim(%seqSource);
|
||||
|
||||
ShapeEditor.doAddSequence(%seqName, %seqSource, %startFrame, %endFrame);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
HorizSizing = "width";
|
||||
VertSizing = "top";
|
||||
Position = "1" SPC getWord($pref::Video::mode, 1) - EditorGuiStatusBar.extent.y - 53;
|
||||
Extent = getWord($pref::Video::mode, 1) - ShapeEdPropWindow.Extent.x SPC 53;
|
||||
Extent = 1561 SPC 53;
|
||||
MinExtent = "475 53";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
|
|
@ -36,7 +36,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
HorizSizing = "width";
|
||||
VertSizing = "top";
|
||||
Position = "5 10";
|
||||
Extent = "809 53";
|
||||
Extent = "1552 52";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
|
|
@ -51,7 +51,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
HorizSizing = "width";
|
||||
VertSizing = "top";
|
||||
Position = "0 3";
|
||||
Extent = "809 38";
|
||||
Extent = "1557 38";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
|
|
@ -62,7 +62,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
Profile = "ToolsGuiTextProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "top";
|
||||
position = "740 19";
|
||||
position = "1440 19";
|
||||
Extent = "35 16";
|
||||
text = "Frame:";
|
||||
};
|
||||
|
|
@ -70,7 +70,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
HorizSizing = "left";
|
||||
VertSizing = "top";
|
||||
Profile = "ToolsGuiTextProfile";
|
||||
position = "778 19";
|
||||
position = "1490 19";
|
||||
Extent = "26 18";
|
||||
Variable = "$ShapeEdCurrentFrame";
|
||||
};
|
||||
|
|
@ -112,7 +112,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
HorizSizing = "width";
|
||||
VertSizing = "bottom";
|
||||
Position = "35 4";
|
||||
Extent = "736 20";
|
||||
Extent = "1480 20";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
|
|
@ -131,7 +131,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
Profile = "ToolsGuiTextEditProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
Position = "778 0";
|
||||
Position = "1524 0";
|
||||
Extent = "28 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
|
|
@ -161,7 +161,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
Profile = "ToolsGuiDefaultProfile";
|
||||
HorizSizing = "center";
|
||||
VertSizing = "top";
|
||||
position = "194 17";
|
||||
position = "568 17";
|
||||
extent = "420 18";
|
||||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
|
|
@ -426,7 +426,7 @@ $guiContent = new GuiWindowCtrl(ShapeEdAnimWindow) {
|
|||
Profile = "ToolsGuiDefaultProfile";
|
||||
HorizSizing = "left";
|
||||
VertSizing = "bottom";
|
||||
position = "765 0";
|
||||
position = "1500 0";
|
||||
Extent = "8 13";
|
||||
MinExtent = "1 1";
|
||||
bitmapAsset = "ToolsModule:seq_bar_out_n_image";
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ function ShapeEditorPlugin::onDeactivated(%this)
|
|||
ShapeEdAnimWindow.setVisible(false);
|
||||
ShapeEdAdvancedWindow.setVisible(false);
|
||||
|
||||
if( EditorGui-->MatEdPropertiesWindow.visible )
|
||||
if( MaterialEditorGui.isAwake() )
|
||||
{
|
||||
ShapeEdMaterials.editSelectedMaterialEnd( true );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,17 +147,20 @@ function ShapeEditor::getSequenceSource( %this, %seqName )
|
|||
if ( %src0 $= "" )
|
||||
%source = setField( %source, 0, %seqName );
|
||||
|
||||
%aq = new AssetQuery();
|
||||
%foundAssets = AssetDatabase.findAssetLooseFile(%aq, %src0);
|
||||
if(%foundAssets != 0)
|
||||
if(!AssetDatabase.isDeclaredAsset(%src0))
|
||||
{
|
||||
//if we have an assetId associated to the file, we're gunna just pass that
|
||||
//through for the edit actions
|
||||
%assetId = %aq.getAsset(0);
|
||||
|
||||
%source = setField( %source, 0, %assetId );
|
||||
%aq = new AssetQuery();
|
||||
%foundAssets = AssetDatabase.findAssetLooseFile(%aq, %src0);
|
||||
if(%foundAssets != 0)
|
||||
{
|
||||
//if we have an assetId associated to the file, we're gunna just pass that
|
||||
//through for the edit actions
|
||||
%assetId = %aq.getAsset(0);
|
||||
|
||||
%source = setField( %source, 0, %assetId );
|
||||
}
|
||||
%aq.delete();
|
||||
}
|
||||
%aq.delete();
|
||||
|
||||
return %source;
|
||||
}
|
||||
|
|
@ -1058,9 +1061,20 @@ function ShapeEdShapeView::onEditNodeTransform( %this, %node, %txfm, %gizmoID )
|
|||
//------------------------------------------------------------------------------
|
||||
// Sequence Editing
|
||||
//------------------------------------------------------------------------------
|
||||
function ShapeEdSelectWindow::onWake( %this )
|
||||
{
|
||||
%this.setPosition(Canvas.extent.x-%this.extent.x, %this.position.y);
|
||||
}
|
||||
|
||||
function ShapeEdAdvancedWindow::onWake( %this )
|
||||
{
|
||||
%this.setPosition(Canvas.extent.x-ShapeEdSelectWindow.extent.x-%this.extent.x, %this.position.y);
|
||||
}
|
||||
|
||||
function ShapeEdPropWindow::onWake( %this )
|
||||
{
|
||||
%this.setPosition(Canvas.extent.x-%this.extent.x, %this.position.y);
|
||||
|
||||
ShapeEdTriggerList.triggerId = 1;
|
||||
|
||||
ShapeEdTriggerList.addRow( -1, "-1" TAB "Frame" TAB "Trigger" TAB "State" );
|
||||
|
|
@ -1689,11 +1703,18 @@ function ShapeEdSeqNameFromMenu::onSelect( %this, %id, %text )
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShapeEdAnimWindow::onResize(%this)
|
||||
function ShapeEdAnimWindow::onWake(%this)
|
||||
{
|
||||
%this.doResize();
|
||||
}
|
||||
|
||||
function ShapeEdAnimWindow::doResize(%this)
|
||||
{
|
||||
if(GuiEditorGui.isAwake())
|
||||
return;
|
||||
|
||||
%animWindow = ShapeEdAnimWindow;
|
||||
%position = "1" SPC Canvas.extent.y - EditorGuiStatusBar.extent.y - %this.Extent.y;
|
||||
%position = "1" SPC Canvas.extent.y - EditorGuiStatusBar.extent.y - %this.Extent.y - 20;
|
||||
|
||||
if(isObject(ShapeEdPropWindow))
|
||||
{
|
||||
|
|
@ -1706,11 +1727,15 @@ function ShapeEdAnimWindow::onResize(%this)
|
|||
// (when the order of GUI loading has changed for example)
|
||||
%extent = Canvas.extent.x - 360 - 2 SPC %animWindow.extent.y;
|
||||
}
|
||||
|
||||
//echo("ShapeEdAnimWIndow::onWake() - " @ %position.x @ ", " @ %position.y @ ", " @ %extent.x @ ", " @ %extent.y);
|
||||
|
||||
|
||||
// resize and position accordingly
|
||||
%animWindow.resize(%position.x, %position.y, %extent.x, %extent.y);
|
||||
|
||||
}
|
||||
|
||||
function ShapeEdAnimWindow::onResize(%this)
|
||||
{
|
||||
%this.doResize();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -2259,14 +2284,14 @@ function ShapeEdMaterials::updateSelectedMaterial( %this, %highlight )
|
|||
// Remove the highlight effect from the old selection
|
||||
if ( isObject( %this.selectedMaterial ) )
|
||||
{
|
||||
%this.selectedMaterial.diffuseMap[1] = %this.savedMap;
|
||||
%this.selectedMaterial.diffuseMapAsset[1] = %this.savedMap;
|
||||
%this.selectedMaterial.reload();
|
||||
}
|
||||
|
||||
// Apply the highlight effect to the new selected material
|
||||
%this.selectedMapTo = getField( ShapeEdMaterialList.getRowText( ShapeEdMaterialList.getSelectedRow() ), 0 );
|
||||
%this.selectedMaterial = ShapeEdMaterialList.getSelectedId();
|
||||
%this.savedMap = %this.selectedMaterial.diffuseMap[1];
|
||||
%this.savedMap = %this.selectedMaterial.diffuseMapAsset[1];
|
||||
if ( %highlight && isObject( %this.selectedMaterial ) )
|
||||
{
|
||||
%this.selectedMaterial.setDiffuseMap("ToolsModule:highlight_material_image", 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue