Browse Source

Merge pull request #627 from Azaezel/alpha40/soundAssetFollowup

sound asset followups
Brian Roberts 3 years ago
parent
commit
361ae7e2da

+ 4 - 7
Engine/source/T3D/player.cpp

@@ -477,9 +477,6 @@ bool PlayerData::preload(bool server, String &errorStr)
       {
          if (!getPlayerSoundProfile(i))
             Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]);
-
-         const char* enumString = castConsoleTypeToString(static_cast<Sounds>(i));
-            Con::printf("preload: %s = %s", enumString, mPlayerSoundAssetId[i]);
       }
    }
 
@@ -7045,11 +7042,11 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
          }
       }
    }
-   else if( contactMaterial && contactMaterial->mFootstepSoundCustom )
+   else if( contactMaterial && contactMaterial->getCustomFootstepSoundProfile())
    {
       // Footstep sound defined on material.
 
-      SFX->playOnce( contactMaterial->mFootstepSoundCustom, &footMat );
+      SFX->playOnce( contactMaterial->getCustomFootstepSoundProfile(), &footMat );
    }
    else
    {
@@ -7082,8 +7079,8 @@ void Player:: playImpactSound()
       {
          Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 );
 
-         if( material && material->mImpactSoundCustom )
-            SFX->playOnce( material->mImpactSoundCustom, &getTransform() );
+         if( material && material->getCustomImpactSoundProfile() )
+            SFX->playOnce( material->getCustomImpactSoundProfile(), &getTransform() );
          else
          {
             S32 sound = -1;

+ 2 - 3
Engine/source/T3D/projectile.cpp

@@ -367,10 +367,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
          if (Sim::findObject(decalId, decal) == false)
             Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
 
+      _setProjectileSound(getProjectileSound());
       if (getProjectileSound() != StringTable->EmptyString())
       {
-         _setProjectileSound(getProjectileSound());
-
          if (!getProjectileSoundProfile())
             Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash.");
       }
@@ -1101,7 +1100,7 @@ void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideT
 
 void Projectile::updateSound()
 {
-   if (!mDataBlock->getProjectileSound())
+   if (!mDataBlock->isProjectileSoundValid())
       return;
 
    if ( mSound )

+ 15 - 13
Engine/source/afx/afxMagicMissile.cpp

@@ -142,8 +142,7 @@ U32 Projectile::smProjectileWarpTicks = 5;
 afxMagicMissileData::afxMagicMissileData()
 {
    INIT_ASSET(ProjectileShape);
-
-   sound = NULL;
+   INIT_ASSET(ProjectileSound);
 
    /* From stock Projectile code...
    explosion = NULL;
@@ -248,7 +247,7 @@ afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool
 {
    CLONE_ASSET(ProjectileShape);
   projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName
-  sound = other.sound;
+  CLONE_ASSET(ProjectileSound);
   splash = other.splash;
   splashId = other.splashId; // -- for pack/unpack of splash ptr
   lightDesc = other.lightDesc;
@@ -338,7 +337,7 @@ void afxMagicMissileData::initPersistFields()
    INITPERSISTFIELD_SHAPEASSET(ProjectileShape, afxMagicMissileData, "Shape for the projectile");
    addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData));
 
-   addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData));
+   INITPERSISTFIELD_SOUNDASSET(ProjectileSound, afxMagicMissileData, "sound for the projectile");
 
    /* From stock Projectile code...
    addField("explosion", TYPEID< ExplosionData >(), Offset(explosion, ProjectileData));
@@ -533,9 +532,12 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
             Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
       */
 
-      String sfxErrorStr;
-      if( !sfxResolve( &sound, sfxErrorStr) )
-         Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
+      _setProjectileSound(getProjectileSound());
+      if (getProjectileSound() != StringTable->EmptyString())
+      {
+         if (!getProjectileSoundProfile())
+            Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Cant get an sfxProfile for afxMagicMissileData.");
+      }
 
       if (!lightDesc && lightDescId != 0)
          if (Sim::findObject(lightDescId, lightDesc) == false)
@@ -547,7 +549,7 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
       projectileShape = mProjectileShapeAsset->getShapeResource();
       if (bool(projectileShape) == false)
       {
-         errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", mProjectileShapeAssetId);
+         errorStr = String::ToString("afxMagicMissileData::preload: Couldn't load shape \"%s\"", mProjectileShapeAssetId);
          return false;
       }
       /* From stock Projectile code...
@@ -641,7 +643,7 @@ void afxMagicMissileData::packData(BitStream* stream)
                                               DataBlockObjectIdLast);
    */
 
-   sfxWrite( stream, sound );
+   PACKDATA_ASSET(ProjectileSound);
 
    if ( stream->writeFlag(lightDesc != NULL))
       stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst,
@@ -747,7 +749,7 @@ void afxMagicMissileData::unpackData(BitStream* stream)
       decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
    */
    
-   sfxRead( stream, &sound );
+   UNPACKDATA_ASSET(ProjectileSound);
 
    if (stream->readFlag())
       lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
@@ -1170,8 +1172,8 @@ bool afxMagicMissile::onNewDataBlock(GameBaseData* dptr, bool reload)
 
       SFX_DELETE( mSound );
 
-      if ( mDataBlock->sound )
-         mSound = SFX->createSource( mDataBlock->sound );
+      if (mDataBlock->getProjectileSound())
+         mSound = SFX->createSource(mDataBlock->getProjectileSoundProfile());
    }
 
    return true;
@@ -2006,7 +2008,7 @@ void afxMagicMissile::get_launch_data(Point3F& pos, Point3F& vel)
 
 void afxMagicMissile::updateSound()
 {
-  if (!mDataBlock->sound)
+  if (!mDataBlock->isProjectileSoundValid())
     return;
 
   if ( mSound )

+ 2 - 1
Engine/source/afx/afxMagicMissile.h

@@ -126,7 +126,8 @@ public:
   SplashData* splash;                 // Water Splash Datablock
   S32 splashId;                       // Water splash ID
 
-  SFXTrack* sound;                    // Projectile Sound
+  DECLARE_SOUNDASSET(afxMagicMissileData, ProjectileSound);
+  DECLARE_ASSET_SETGET(afxMagicMissileData, ProjectileSound);
 
   LightDescription *lightDesc;
   S32 lightDescId;   

+ 7 - 4
Engine/source/gui/controls/guiMLTextCtrl.cpp

@@ -268,7 +268,7 @@ GuiMLTextCtrl::GuiMLTextCtrl()
 {   
    mActive = true;
    //mInitialText = StringTable->EmptyString();
-   Sim::findObject("InputDeniedSound", mDeniedSound);
+   INIT_ASSET(DeniedSound);
 }
 
 //--------------------------------------------------------------------------
@@ -290,7 +290,7 @@ void GuiMLTextCtrl::initPersistFields()
       addField("lineSpacing",       TypeS32,    Offset(mLineSpacingPixels, GuiMLTextCtrl), "The number of blank pixels to place between each line.\n");
       addField("allowColorChars",   TypeBool,   Offset(mAllowColorChars,   GuiMLTextCtrl), "If true, the control will allow characters to have unique colors.");
       addField("maxChars",          TypeS32,    Offset(mMaxBufferSize,     GuiMLTextCtrl), "Maximum number of characters that the control will display.");
-      addField("deniedSound",       TypeSFXTrackName, Offset(mDeniedSound, GuiMLTextCtrl), "If the text will not fit in the control, the deniedSound is played.");
+      INITPERSISTFIELD_SOUNDASSET(DeniedSound, GuiMLTextCtrl, "If the text will not fit in the control, the deniedSound is played.");
       addField("text",              TypeCaseString,  Offset( mInitialText, GuiMLTextCtrl ), "Text to display in this control.");
       addField("useURLMouseCursor", TypeBool,   Offset(mUseURLMouseCursor,   GuiMLTextCtrl), "If true, the mouse cursor will turn into a hand cursor while over a link in the text.\n"
                                                                       "This is dependant on the markup language used by the GuiMLTextCtrl\n");
@@ -323,6 +323,9 @@ bool GuiMLTextCtrl::onAdd()
 
    if (!mTextBuffer.length() && mInitialText[0] != 0)
       setText(mInitialText, dStrlen(mInitialText)+1);
+
+   _setDeniedSound(getDeniedSound());
+
    return true;
 }
 
@@ -917,8 +920,8 @@ void GuiMLTextCtrl::insertChars(const char* inputChars,
    if (numCharsToInsert <= 0)
    {
       // Play the "Denied" sound:
-      if ( numInputChars > 0 && mDeniedSound )
-         SFX->playOnce(mDeniedSound);
+      if ( numInputChars > 0 && getDeniedSoundProfile())
+         SFX->playOnce(getDeniedSoundProfile());
 
       return;
    }

+ 6 - 2
Engine/source/gui/controls/guiMLTextCtrl.h

@@ -31,6 +31,10 @@
 #include "core/stringBuffer.h"
 #endif
 
+#ifndef SOUND_ASSET_H
+#include "T3D/assets/SoundAsset.h"
+#endif
+
 class GFont;
 class SFXTrack;
 
@@ -258,8 +262,8 @@ class GuiMLTextCtrl : public GuiControl
    bool mUseURLMouseCursor;
 
    // Too many chars sound:
-   SFXTrack*  mDeniedSound;
-
+   DECLARE_SOUNDASSET(GuiMLTextCtrl, DeniedSound);
+   DECLARE_ASSET_SETGET(GuiMLTextCtrl, DeniedSound);
    //-------------------------------------- Protected interface
   protected:
    // Inserting and deleting character blocks...

+ 4 - 3
Engine/source/materials/materialDefinition.cpp

@@ -231,7 +231,8 @@ Material::Material()
 
    mFootstepSoundId = -1;     mImpactSoundId = -1;
    mImpactFXIndex = -1;
-   mFootstepSoundCustom = 0;  mImpactSoundCustom = 0;
+   INIT_ASSET(CustomFootstepSound);
+   INIT_ASSET(CustomImpactSound);
    mFriction = 0.0;
 
    mDirectSoundOcclusion = 1.f;
@@ -476,7 +477,7 @@ void Material::initPersistFields()
       "- 16: PlayerData::impactWaterHard\n"
       "- 17: PlayerData::exitingWater\n");
 
-   addField("customFootstepSound", TypeSFXTrackName, Offset(mFootstepSoundCustom, Material),
+   INITPERSISTFIELD_SOUNDASSET(CustomFootstepSound, Material,
       "The sound to play when the player walks over the material.  If this is set, it overrides #footstepSoundId.  This field is "
       "useful for directly assigning custom footstep sounds to materials without having to rely on the PlayerData sound assignment.\n\n"
       "@warn Be aware that materials are client-side objects.  This means that the SFXTracks assigned to materials must be client-side, too.");
@@ -488,7 +489,7 @@ void Material::initPersistFields()
       "What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater "
       "than PlayerData::groundImpactMinSpeed.\n\n"
       "For a list of IDs, see #impactFXId");
-   addField("customImpactSound", TypeSFXTrackName, Offset(mImpactSoundCustom, Material),
+   INITPERSISTFIELD_SOUNDASSET(CustomImpactSound, Material,
       "The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.  "
       "If this is set, it overrides #impactSoundId.  This field is useful for directly assigning custom impact sounds to materials "
       "without having to rely on the PlayerData sound assignment.\n\n"

+ 7 - 2
Engine/source/materials/materialDefinition.h

@@ -47,6 +47,9 @@
 #ifndef _ASSET_PTR_H_
 #include "assets/assetPtr.h"
 #endif
+#ifndef SOUND_ASSET_H
+#include "T3D/assets/SoundAsset.h"
+#endif
 
 class CubemapData;
 class SFXTrack;
@@ -367,8 +370,10 @@ public:
    /// Sound effect to play when walking on surface with this material.
    /// If defined, overrides mFootstepSoundId.
    /// @see mFootstepSoundId
-   SFXTrack* mFootstepSoundCustom;
-   SFXTrack* mImpactSoundCustom;
+   DECLARE_SOUNDASSET(Material, CustomFootstepSound);
+   DECLARE_ASSET_SETGET(Material, CustomFootstepSound);
+   DECLARE_SOUNDASSET(Material, CustomImpactSound);
+   DECLARE_ASSET_SETGET(Material, CustomImpactSound);
 
    F32 mFriction;                   ///< Friction coefficient when moving along surface.
 

+ 12 - 7
Engine/source/sfx/sfxAmbience.cpp

@@ -85,10 +85,10 @@ SFXAmbience::ChangeSignal SFXAmbience::smChangeSignal;
 SFXAmbience::SFXAmbience()
    : mDopplerFactor( 0.5f ),
      mRolloffFactor( 1.f ),
-     mSoundTrack( NULL ),
      mEnvironment( NULL )
 {
    dMemset( mState, 0, sizeof( mState ) );
+   INIT_ASSET(SoundTrack);
 }
 
 //-----------------------------------------------------------------------------
@@ -100,7 +100,7 @@ void SFXAmbience::initPersistFields()
       addField( "environment",            TypeSFXEnvironmentName, Offset( mEnvironment, SFXAmbience ),
          "Reverb environment active in the ambience zone.\n"
          "@ref SFX_reverb" );
-      addField( "soundTrack",             TypeSFXTrackName,       Offset( mSoundTrack, SFXAmbience ),
+      INITPERSISTFIELD_SOUNDASSET(SoundTrack, SFXAmbience,
          "Sound track to play in the ambience zone." );
       addField( "rolloffFactor",          TypeF32, Offset( mRolloffFactor, SFXAmbience ),
          "The rolloff factor to apply to distance-based volume attenuation in this space.\n"
@@ -131,7 +131,8 @@ bool SFXAmbience::onAdd()
       return false;
       
    Sim::getSFXAmbienceSet()->addObject( this );
-      
+
+   _setSoundTrack(getSoundTrack());
    return true;
 }
 
@@ -150,9 +151,13 @@ bool SFXAmbience::preload( bool server, String& errorStr )
    {
       if( !sfxResolve( &mEnvironment, errorStr ) )
          return false;
-         
-      if( !sfxResolve( &mSoundTrack, errorStr ) )
+
+      _setSoundTrack(getSoundTrack());
+      if (!getSoundTrackProfile())
+      {
+         Con::errorf("SFXAmbience::Preload() - unable to find sfxProfile for asset %s", mSoundTrackAssetId);
          return false;
+      }
          
       for( U32 i = 0; i < MaxStates; ++ i )
          if( !sfxResolve( &mState[ i ], errorStr ) )
@@ -169,7 +174,7 @@ void SFXAmbience::packData( BitStream* stream )
    Parent::packData( stream );
       
    sfxWrite( stream, mEnvironment );
-   sfxWrite( stream, mSoundTrack );
+   PACKDATA_ASSET(SoundTrack);
    
    stream->write( mRolloffFactor );
    stream->write( mDopplerFactor );
@@ -185,7 +190,7 @@ void SFXAmbience::unpackData( BitStream* stream )
    Parent::unpackData( stream );
       
    sfxRead( stream, &mEnvironment );
-   sfxRead( stream, &mSoundTrack );
+   UNPACKDATA_ASSET(SoundTrack);
    
    stream->read( &mRolloffFactor );
    stream->read( &mDopplerFactor );

+ 6 - 5
Engine/source/sfx/sfxAmbience.h

@@ -33,6 +33,9 @@
    #include "core/util/tSignal.h"
 #endif
 
+#ifndef SOUND_ASSET_H
+#include "T3D/assets/SoundAsset.h"
+#endif
 
 class SFXEnvironment;
 class SFXTrack;
@@ -63,7 +66,8 @@ class SFXAmbience : public SimDataBlock
       F32 mRolloffFactor;
    
       /// Sound track to play when inside the ambient space.
-      SFXTrack* mSoundTrack;
+      DECLARE_SOUNDASSET(SFXAmbience, SoundTrack);
+      DECLARE_ASSET_SETGET(SFXAmbience, SoundTrack);
 
       /// Reverb environment to apply when inside the ambient space.
       SFXEnvironment* mEnvironment;
@@ -89,10 +93,7 @@ class SFXAmbience : public SimDataBlock
             
       /// Return the reverb environment of the ambient space.
       SFXEnvironment* getEnvironment() const { return mEnvironment; }
-      
-      /// Return the ambient soundtrack of this ambient space.
-      SFXTrack* getSoundTrack() const { return mSoundTrack; }
-      
+            
       /// Return the given state bound to this ambient space.
       SFXState* getState( U32 i ) const
       {

+ 2 - 2
Engine/source/sfx/sfxController.cpp

@@ -166,7 +166,7 @@ void SFXController::_compileList( SFXPlayList* playList )
       
       // If there's no track in this slot, ignore it.
       
-      if( !playList->getSlots().mTrack[ slotIndex ] )
+      if( !playList->getTrackProfile(slotIndex))
          continue;
          
       // If this is a looped slot and the list is not set to loop
@@ -393,7 +393,7 @@ bool SFXController::_execInsn()
       case OP_Play:
       {
          SFXPlayList* playList = getPlayList();
-         SFXTrack* track = playList->getSlots().mTrack[ insn.mSlotIndex ];
+         SFXTrack* track = playList->getTrackProfile(insn.mSlotIndex);
          
          // Handle existing sources playing on this slot and find
          // whether we need to start a new source.

+ 10 - 4
Engine/source/sfx/sfxPlayList.cpp

@@ -220,6 +220,8 @@ SFXPlayList::SFXPlayList()
      mTrace( false ),
      mNumSlotsToPlay( NUM_SLOTS )
 {
+   for (U32 i=0;i<NUM_SLOTS;i++)
+      INIT_ASSET_ARRAY(Track, i);
 }
 
 //-----------------------------------------------------------------------------
@@ -247,7 +249,7 @@ void SFXPlayList::initPersistFields()
    
       addArray( "slots", NUM_SLOTS );
       
-         addField( "track",                  TypeSFXTrackName, Offset( mSlots.mTrack, SFXPlayList ), NUM_SLOTS,
+         INITPERSISTFIELD_SOUNDASSET_ARRAY( Track, NUM_SLOTS, SFXPlayList,
             "Track to play in this slot.\n"
             "This must be set for the slot to be considered for playback.  Other settings for a slot "
             "will not take effect except this field is set." );
@@ -350,8 +352,12 @@ bool SFXPlayList::preload( bool server, String& errorStr )
    {
       for( U32 i = 0; i < NUM_SLOTS; ++ i )
       {
-         if( !sfxResolve( &mSlots.mTrack[ i ], errorStr ) )
+         _setTrack(getTrack(i),i);
+         if (!getTrackProfile(i))
+         {
+            Con::errorf("SFXPlayList::Preload() - unable to find sfxProfile for asset %s", mTrackAssetId[i]);
             return false;
+         }
             
          if( !sfxResolve( &mSlots.mState[ i ], errorStr ) )
             return false;
@@ -419,7 +425,7 @@ void SFXPlayList::packData( BitStream* stream )
       stream->write( mSlots.mRepeatCount[ i ] );
       
    FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] );
-   FOR_EACH_SLOT sfxWrite( stream, mSlots.mTrack[ i ] );
+   FOR_EACH_SLOT PACKDATA_ASSET_ARRAY(Track, i);
 }
 
 //-----------------------------------------------------------------------------
@@ -458,7 +464,7 @@ void SFXPlayList::unpackData( BitStream* stream )
    FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );}
       
    FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] );
-   FOR_EACH_SLOT sfxRead( stream, &mSlots.mTrack[ i ] );
+   FOR_EACH_SLOT UNPACKDATA_ASSET_ARRAY(Track, i);
    
    #undef FOR_EACH_SLOT
 }

+ 8 - 6
Engine/source/sfx/sfxPlayList.h

@@ -30,6 +30,10 @@
    #include "sfx/sfxTrack.h"
 #endif
 
+#ifndef SOUND_ASSET_H
+#include "T3D/assets/SoundAsset.h"
+#endif
+
 
 class SFXState;
 
@@ -256,10 +260,7 @@ class SFXPlayList : public SFXTrack
          /// Bahavior when state of this slot is deactivated and the slot's track
          /// is playing.
          EStateMode mStateMode[ NUM_SLOTS ];
-         
-         /// Track to play in this slot.
-         SFXTrack* mTrack[ NUM_SLOTS ];
-         
+
          SlotData()
          {
             dMemset( mReplayMode, 0, sizeof( mReplayMode ) );
@@ -267,7 +268,6 @@ class SFXPlayList : public SFXTrack
             dMemset( mTransitionOut, 0, sizeof( mTransitionOut ) );
             dMemset( mRepeatCount, 0, sizeof( mRepeatCount ) );
             dMemset( mState, 0, sizeof( mState ) );
-            dMemset( mTrack, 0, sizeof( mTrack ) );
             dMemset( mStateMode, 0, sizeof( mStateMode ) );
             
             for( U32 i = 0; i < NUM_SLOTS; ++ i )
@@ -282,7 +282,9 @@ class SFXPlayList : public SFXTrack
             }
          }
       };
-                        
+      DECLARE_SOUNDASSET_ARRAY(SFXPlayList, Track, NUM_SLOTS);
+      DECLARE_ASSET_ARRAY_SETGET(SFXPlayList, Track);
+
    protected:
    
       /// Trace interpreter execution.  This field is not networked.

+ 1 - 1
Engine/source/sfx/sfxSoundscape.cpp

@@ -150,7 +150,7 @@ void SFXSoundscapeManager::update()
          
          if( !soundscape->_isOverridden() )
          {
-            SFXTrack* track = ambience->getSoundTrack();
+            SFXTrack* track = ambience->getSoundTrackProfile();
             if( !soundscape->mSource || soundscape->mSource->getTrack() != track )
             {
                if( soundscape->mSource != NULL )

+ 9 - 5
Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript

@@ -95,11 +95,15 @@ function MaterialEditorGui::open(%this)
 
    %sounds = "<None>" TAB "<Soft>" TAB "<Hard>" TAB "<Metal>" TAB "<Snow>";    // Default sounds
 
-   // Get custom sound datablocks
-   foreach (%db in DataBlockSet)
+   %assetQuery = new AssetQuery();
+   AssetDatabase.findAssetType(%assetQuery, "SoundAsset");
+   
+   %count = %assetQuery.getCount();   
+   // Get custom sound assets
+   for(%i=0; %i < %count; %i++)
    {
-      if (%db.isMemberOfClass("SFXTrack"))
-         %sounds = %sounds TAB %db.getName();
+	   %assetId = %assetQuery.getAsset(%i);
+       %sounds = %sounds TAB %assetId;
    }
 
    %count = getFieldCount(%sounds);
@@ -1504,7 +1508,7 @@ function MaterialEditorGui::updateBehaviorSound(%this, %type, %sound)
    }
 
    %this.updateActiveMaterial(%type @ "SoundId", %defaultId);
-   %this.updateActiveMaterial("custom" @ %type @ "Sound", %customName);
+   %this.updateActiveMaterial("custom" @ %type @ "SoundAsset", %customName);
 }
 
 function MaterialEditorGui::updateSoundPopup(%this, %type, %defaultId, %customName)

+ 20 - 46
Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript

@@ -839,7 +839,7 @@ T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset"
 T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
 T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset");
 T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset");
-T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShapeName projectileShapeAsset sound soundAsset");
+T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
 T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset");
 T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset");
 T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset");
@@ -902,6 +902,7 @@ T3Dpre4ProjectImporter::genProcessor("GuiProgressBitmap", "bitmap bitmapAsset");
 T3Dpre4ProjectImporter::genProcessor("GuiMissionArea", "handleBitmap handleBitmapAsset");
 T3Dpre4ProjectImporter::genProcessor("WorldEditor", "selectHandle selectHandleAsset defaultHandle defaultHandleAsset lockedHandle lockedHandleAsset");
 T3Dpre4ProjectImporter::genProcessor("GuiControlProfile", "bitmap bitmapAsset");
+T3Dpre4ProjectImporter::genProcessor("GuiMLTextCtrl", "deniedSound deniedSoundAsset");
 
 function T3Dpre4ProjectImporter::processGuiBitmapButtonCtrlLine(%this, %line)
 {
@@ -925,7 +926,7 @@ T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset soundPr
 T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
 T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");
 T3Dpre4ProjectImporter::genProcessor("PhysicsShapeData", "shape shapeAsset shapeName shapeAsset");
-T3Dpre4ProjectImporter::genProcessor("ProjectileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound soundAsset");
+T3Dpre4ProjectImporter::genProcessor("ProjectileData", "projectileShape projectileShapeAsset projectileShapeName projectileShapeAsset sound projectileSoundAsset");
 T3Dpre4ProjectImporter::genProcessor("ShapeBaseData", "shapeFile shapeAsset shape shapeAsset debrisShape debrisShapeAsset debrisShapeName debrisShapeAsset");
 T3Dpre4ProjectImporter::genProcessor("ShapeBaseImageData", "shape shapeAsset[0] shapeFP shapeAsset[1] shapeFile shapeAsset[0] shapeFileFP shapeAsset[1] stateSound stateSoundAsset");
 T3Dpre4ProjectImporter::genProcessor("ProximityMineData","armingSound ArmSoundAsset TriggerSound TriggerSoundAsset");
@@ -937,13 +938,13 @@ T3Dpre4ProjectImporter::genProcessor("HoverVehicleData", "engineSound engineSoun
 //==============================================================================
 // Datablocks - Long Lists
 //==============================================================================
-
+// - RigidShapeData
 $rigidEntriesList = "softImpactSound softImpactSoundAsset hardImpactSound hardImpactSoundAsset";
 $rigidEntriesList = $rigidEntriesList SPC "exitingWater exitingWaterAsset impactWaterEasy impactWaterEasyAsset";
 $rigidEntriesList = $rigidEntriesList SPC "impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
 $rigidEntriesList = $rigidEntriesList SPC "waterWakeSound waterWakeSoundAsset";
 T3Dpre4ProjectImporter::genProcessor("RigidShapeData",$rigidEntriesList);
-
+// - PlayerData
 $PlayerEntriesList = "shapeFP shapeFPAsset shapeNameFP shapeFPAsset";
 $PlayerEntriesList = $PlayerEntriesList SPC "FootSoftSound FootSoftAsset FootHardSound FootHardAsset FootMetalSound FootMetal";
 $PlayerEntriesList = $PlayerEntriesList SPC "FootSnowSound FootSnowAsset FootShallowSound FootShallowSplashAsset";
@@ -954,50 +955,21 @@ $PlayerEntriesList = $PlayerEntriesList SPC "impactSoftSound ImpactSoftAsset imp
 $PlayerEntriesList = $PlayerEntriesList SPC "impactMetalSound ImpactMetalAsset impactSnowSound impactSnowAsset";
 $PlayerEntriesList = $PlayerEntriesList SPC "impactWaterEasy impactWaterEasyAsset impactWaterMedium impactWaterMediumAsset impactWaterHard impactWaterHardAsset";
 $PlayerEntriesList = $PlayerEntriesList SPC "exitingWater ExitWaterAsset";
-
-
 T3Dpre4ProjectImporter::genProcessor("PlayerData", $PlayerEntriesList);
+// - Material
+$MaterialEntriesList = "baseTex diffuseMapAsset diffuseMap diffuseMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "lightMap lightMapAsset toneMap toneMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "detailTex detailMapAsset detailMap detailMapAsset detailNormalMap detailNormalMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "overlayTex overlayMapAsset overlayMap overlayMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "bumpTex normalMapAsset normalMap normalMapAsset
+$MaterialEntriesList = $MaterialEntriesList SPC "ormConfigMap ormConfigMapAsset roughMap roughMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "aoMap aoMapAsset metalMap metalMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "glowMap glowMapAsset";
+$MaterialEntriesList = $MaterialEntriesList SPC "customFootstepSound customFootstepSoundAsset customImpactSound customImpactSoundAsset";
+T3Dpre4ProjectImporter::genProcessor("Material", $MaterialEntriesList);
 //==============================================================================
 // Materials
 //==============================================================================
-//long form of the result of T3Dpre4ProjectImporter::genProcessor since that would result in a rediculously long oneliner
-function T3Dpre4ProjectImporter::processMaterialLine(%this, %line)
-{
-   %outLine = processLegacyField(%line, "baseTex", "diffuseMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "diffuseMap", "diffuseMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "lightMap", "lightMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "toneMap", "toneMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "detailTex", "detailMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "detailMap", "detailMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "overlayTex", "overlayMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "overlayMap", "overlayMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "bumpTex", "normalMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "normalMap", "normalMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "ormConfigMap", "ormConfigMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "roughMap", "roughMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "aoMap", "aoMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "metalMap", "metalMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "glowMap", "glowMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   %outLine = processLegacyField(%line, "detailNormalMap", "detailNormalMapAsset");
-   if(%outLine !$= %line) return %outLine;
-   return %line;
-}
-
 function T3Dpre4ProjectImporter::processMaterialObject(%this, %file, %objectName)
 {
    %matAsset = MaterialAsset::getAssetIdByMaterialName(%objectName);
@@ -1107,6 +1079,9 @@ T3Dpre4ProjectImporter::genProcessor("PostEffect", "texture textureAsset");
 // Using existing SFXProfiles allows us to also injest the descriptions, giving us
 // our meta-properties on the sound asset itself.
 //==============================================================================
+T3Dpre4ProjectImporter::genProcessor("SFXAmbience", "soundTrack soundTrackAsset");
+T3Dpre4ProjectImporter::genProcessor("SFXPlayList", "track trackAsset");
+
 function T3Dpre4ProjectImporter::processSFXProfileLine(%this, %line)
 {
    return %line;
@@ -1342,5 +1317,4 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam
    {
       return %line;  
    }
-}
-
+}