mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-30 17:45:21 +00:00
Imported in UI sounds
Fixed asset properties editing so it applies after saving Added fix for making sound asset preview playback properly
This commit is contained in:
parent
cd1fd1ccf4
commit
df0f8dafa6
5 changed files with 56 additions and 5 deletions
|
|
@ -0,0 +1 @@
|
|||
<SoundAsset canSave="true" canSaveDynamicFields="true" AssetName="buttonClick" soundFile="@assetFile=buttonClick.wav" PitchAdjust="1" VolumeAdjust="1" is3D="false" isLooping="false" isStreaming="false" useHardware="false" minDistance="1" maxDistance="100" coneInsideAngle="360" coneOutsideAngle="360" coneOutsideVolume="1" rolloffFactor="-1" scatterDistance="0 0 0"/>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<SoundAsset canSave="true" canSaveDynamicFields="true" AssetName="buttonHover" soundFile="@assetFile=buttonHover.wav" PitchAdjust="1" VolumeAdjust="1" is3D="false" isLooping="false" isStreaming="false" useHardware="true" minDistance="1" maxDistance="120" coneInsideAngle="360" coneOutsideAngle="360" coneOutsideVolume="1" rolloffFactor="-1" scatterDistance="0 0 0"/>
|
||||
|
|
@ -1178,7 +1178,7 @@ function AssetBrowserPreviewButton::onRightClick(%this)
|
|||
EditAssetPopup.enableItem(7, true);
|
||||
|
||||
//Is it an editable type?
|
||||
if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset" || %assetType $= "SoundAsset")
|
||||
if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset")
|
||||
{
|
||||
EditAssetPopup.enableItem(0, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,30 @@
|
|||
function AssetBrowser::editSoundAsset(%this, %assetDef)
|
||||
{
|
||||
if (isObject($PreviewSoundSource))
|
||||
sfxStop($PreviewSoundSource);
|
||||
$PreviewSoundSource = %assetDef.playSound();
|
||||
}
|
||||
|
||||
function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.soundFilePath;
|
||||
//%previewData.doubleClickCommand = "EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
|
||||
|
||||
if(%this.selectMode)
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.onSoundAssetEditorDropped( "@%assetDef@" );";
|
||||
}
|
||||
}
|
||||
|
||||
%previewData.previewImage = "ToolsModule:soundIcon_image";
|
||||
|
||||
|
|
@ -52,7 +69,26 @@ function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)
|
|||
|
||||
}
|
||||
|
||||
function AssetBrowser::editSoundAsset(%this, %assetDef)
|
||||
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
%soundSource = %assetDef.playSound();
|
||||
Canvas.popDialog(EditorDragAndDropLayer);
|
||||
|
||||
// Make sure this is a color swatch drag operation.
|
||||
if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) )
|
||||
return;
|
||||
|
||||
%assetType = %payload.assetType;
|
||||
|
||||
if(%assetType $= "SoundAsset")
|
||||
{
|
||||
%module = %payload.moduleName;
|
||||
%asset = %payload.assetName;
|
||||
|
||||
%targetComponent = %this.targetObject;
|
||||
%targetComponent.soundAsset = %module @ ":" @ %asset;
|
||||
|
||||
//Inspector.refresh();
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
|
|
@ -3,7 +3,9 @@ function AssetBrowser_editAsset::saveAsset(%this)
|
|||
%file = AssetDatabase.getAssetFilePath(%this.editedAssetId);
|
||||
%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.reloadAsset(%this.editedAssetId);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
|
||||
Canvas.popDialog(AssetBrowser_editAsset);
|
||||
}
|
||||
|
|
@ -79,6 +81,17 @@ function AssetBrowser::editAssetInfo(%this)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
function AssetBrowser::reloadAsset(%this, %assetId)
|
||||
{
|
||||
%moduleName = getToken(%assetId, ":", 0);
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName);
|
||||
|
||||
%assetName = getToken(%assetId, ":", 1);
|
||||
%assetFilePath = AssetDatabase.getAssetFilePath(%assetId);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetId);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
|
||||
}
|
||||
|
||||
function AssetBrowser::refreshAsset(%this, %assetId)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue