mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Updates the shape editor to support editing a shape via assetID, as well as adding support for shape animation assets being selected when adding a new animation sequence to a shape.
This commit is contained in:
parent
06e02c5582
commit
5f5b90794e
3 changed files with 63 additions and 15 deletions
|
|
@ -145,6 +145,13 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ShapeEditorPlugin::openShapeAsset(%this, %assetId)
|
||||||
|
{
|
||||||
|
%this.selectedAssetId = %assetId;
|
||||||
|
%this.selectedAssetDef = AssetDatabase.acquireAsset(%assetId);
|
||||||
|
%this.open(%this.selectedAssetDef.fileName);
|
||||||
|
}
|
||||||
|
|
||||||
function ShapeEditorPlugin::open(%this, %filename)
|
function ShapeEditorPlugin::open(%this, %filename)
|
||||||
{
|
{
|
||||||
if ( !%this.isActivated )
|
if ( !%this.isActivated )
|
||||||
|
|
|
||||||
|
|
@ -612,6 +612,19 @@ function ShapeEdPropWindow::update_onShapeSelectionChanged( %this )
|
||||||
}
|
}
|
||||||
ShapeEdThreadWindow.onAddThread(); // add thread 0
|
ShapeEdThreadWindow.onAddThread(); // add thread 0
|
||||||
|
|
||||||
|
//Now, fetch any animation assets if we're utilizing a shape asset
|
||||||
|
if(ShapeEditorPlugin.selectedAssetId !$= "")
|
||||||
|
{
|
||||||
|
%animationAssetCount = ShapeEditorPlugin.selectedAssetDef.getAnimationCount();
|
||||||
|
|
||||||
|
for(%animIdx = 0; %animIdx < %animationAssetCount; %animIdx++)
|
||||||
|
{
|
||||||
|
%animAsset = ShapeEditorPlugin.selectedAssetDef.getAnimation(%animIdx);
|
||||||
|
|
||||||
|
//ShapeEdSequenceList.addItem( %animAsset.assetName );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- DETAILS TAB ---
|
// --- DETAILS TAB ---
|
||||||
// Add detail levels and meshes to tree
|
// Add detail levels and meshes to tree
|
||||||
ShapeEdDetailTree.clearSelection();
|
ShapeEdDetailTree.clearSelection();
|
||||||
|
|
@ -789,7 +802,8 @@ function ShapeEdSeqNodeTabBook::onTabSelected( %this, %name, %index )
|
||||||
{
|
{
|
||||||
case "Seq":
|
case "Seq":
|
||||||
ShapeEdPropWindow-->newBtn.ToolTip = "Add new sequence";
|
ShapeEdPropWindow-->newBtn.ToolTip = "Add new sequence";
|
||||||
ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();";
|
//ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();";
|
||||||
|
ShapeEdPropWindow-->newBtn.Command = "AssetBrowser.showDialog(\"ShapeAnimationAsset\", \"onAddAnimationAssetShapeEditor\", \"\", \"\", \"\");";
|
||||||
ShapeEdPropWindow-->newBtn.setActive( true );
|
ShapeEdPropWindow-->newBtn.setActive( true );
|
||||||
ShapeEdPropWindow-->deleteBtn.ToolTip = "Delete selected sequence (cannot be undone)";
|
ShapeEdPropWindow-->deleteBtn.ToolTip = "Delete selected sequence (cannot be undone)";
|
||||||
ShapeEdPropWindow-->deleteBtn.Command = "ShapeEdSequences.onDeleteSequence();";
|
ShapeEdPropWindow-->deleteBtn.Command = "ShapeEdSequences.onDeleteSequence();";
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,12 @@ function ActionEditNodeTransform::undo( %this )
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Add sequence
|
// Add sequence
|
||||||
|
function onAddAnimationAssetShapeEditor(%selectedAnimation)
|
||||||
|
{
|
||||||
|
echo("SELECTED MUH ASSET");
|
||||||
|
ShapeEditor.doAddSequence(%selectedAnimation, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end )
|
function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end )
|
||||||
{
|
{
|
||||||
%action = %this.createAction( ActionAddSequence, "Add sequence" );
|
%action = %this.createAction( ActionAddSequence, "Add sequence" );
|
||||||
|
|
@ -313,23 +319,44 @@ function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end )
|
||||||
|
|
||||||
function ActionAddSequence::doit( %this )
|
function ActionAddSequence::doit( %this )
|
||||||
{
|
{
|
||||||
// If adding this sequence from an existing sequence, make a backup copy of
|
if(ShapeEditorPlugin.selectedAssetId $= "")
|
||||||
// the existing sequence first, so we can edit the start/end frames later
|
|
||||||
// without having to worry if the original source sequence has changed.
|
|
||||||
if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 )
|
|
||||||
{
|
{
|
||||||
%this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" );
|
// If adding this sequence from an existing sequence, make a backup copy of
|
||||||
ShapeEditor.shape.addSequence( %this.origFrom, %this.from );
|
// the existing sequence first, so we can edit the start/end frames later
|
||||||
|
// without having to worry if the original source sequence has changed.
|
||||||
|
if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 )
|
||||||
|
{
|
||||||
|
%this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" );
|
||||||
|
ShapeEditor.shape.addSequence( %this.origFrom, %this.from );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the sequence
|
||||||
|
$collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" );
|
||||||
|
%success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end );
|
||||||
|
$collada::forceLoadDAE = false;
|
||||||
|
|
||||||
|
if ( %success )
|
||||||
|
{
|
||||||
|
ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Add the sequence
|
|
||||||
$collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" );
|
|
||||||
%success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end );
|
|
||||||
$collada::forceLoadDAE = false;
|
|
||||||
|
|
||||||
if ( %success )
|
|
||||||
{
|
{
|
||||||
ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 );
|
%assetDef = AssetDatabase.acquireAsset(%this.seqName);
|
||||||
|
%moduleName = getWord(getToken(%this.seqName, ":", 0),0);
|
||||||
|
|
||||||
|
%idx = ShapeEdSequenceList.rowCount();
|
||||||
|
|
||||||
|
%matSet = "ShapeEditorPlugin.selectedAssetDef.animationSequence"@%idx@"=\"@Asset="@%moduleName@":"@%this.seqName.assetName@"\";";
|
||||||
|
eval(%matSet);
|
||||||
|
|
||||||
|
%assetPath = AssetDatabase.getAssetFilePath(ShapeEditorPlugin.selectedAssetId);
|
||||||
|
|
||||||
|
%assetImportSuccessful = TAMLWrite(ShapeEditorPlugin.selectedAssetDef, %assetPath);
|
||||||
|
|
||||||
|
AssetDatabase.refreshAsset(ShapeEditorPlugin.selectedAssetId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue