|
@@ -838,6 +838,7 @@ T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset")
|
|
|
T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset");
|
|
|
T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset");
|
|
|
T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset");
|
|
|
+T3Dpre4ProjectImporter::genProcessor("sfxEmitter", "track soundAsset filename soundAsset");
|
|
|
//==============================================================================
|
|
|
// Levels
|
|
|
//==============================================================================
|
|
@@ -1064,6 +1065,173 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %obj
|
|
|
//==============================================================================
|
|
|
T3Dpre4ProjectImporter::genProcessor("PostEffect", "texture textureAsset");
|
|
|
|
|
|
+//==============================================================================
|
|
|
+// Sounds
|
|
|
+// Sounds are a little weird because there's so much data tied up in a given sound
|
|
|
+// source. So our approach is find old SFXProfiles and process those into sound assets
|
|
|
+// by cross-referencing the filename for existing asset definitions.
|
|
|
+// Using existing SFXProfiles allows us to also injest the descriptions, giving us
|
|
|
+// our meta-properties on the sound asset itself.
|
|
|
+//==============================================================================
|
|
|
+function T3Dpre4ProjectImporter::processSFXProfileLine(%this, %line)
|
|
|
+{
|
|
|
+ return %line;
|
|
|
+}
|
|
|
+
|
|
|
+function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectName)
|
|
|
+{
|
|
|
+ %soundFilename = findObjectField("filename");
|
|
|
+
|
|
|
+ %soundFilename = sanitizeFilename(%soundFilename);
|
|
|
+
|
|
|
+ %soundAsset = SoundAsset::getAssetIdByFilename(%soundFilename);
|
|
|
+
|
|
|
+ //Throw a warn that this file's already been claimed and move on
|
|
|
+ if(%soundAsset !$= "")
|
|
|
+ {
|
|
|
+ error("T3Dpre4ProjectImporter::processSFXProfileObject() - attempting to process SFXProfile " @ %objectName
|
|
|
+ @ " but its filename is already associated to another sound asset.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //Otherwise, process it into an asset
|
|
|
+ else
|
|
|
+ {
|
|
|
+ %assetName = %objectName;
|
|
|
+
|
|
|
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%soundFilename).ModuleId;
|
|
|
+
|
|
|
+ %assetPath = filePath(%soundFilename) @ "/";
|
|
|
+
|
|
|
+ %tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
|
|
+
|
|
|
+ if(isFile(%tamlpath))
|
|
|
+ {
|
|
|
+ error("T3Dpre4ProjectImporter::processSFXProfileObject() - Failed to create as taml file already exists: " @ %soundFilename);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ %asset = new SoundAsset()
|
|
|
+ {
|
|
|
+ AssetName = %assetName;
|
|
|
+ versionId = 1;
|
|
|
+ shaderData = "";
|
|
|
+ soundFile = fileBase(%soundFilename) @ fileExt(%soundFilename);
|
|
|
+ };
|
|
|
+
|
|
|
+ %descriptionName = findObjectField("description");
|
|
|
+
|
|
|
+ if(%descriptionName !$= "")
|
|
|
+ {
|
|
|
+ //Optimization, see if we already have this description by happenstance
|
|
|
+ if(isObject(%descriptionName))
|
|
|
+ {
|
|
|
+ %asset.sourceGroup = %descriptionName.sourceGroup;
|
|
|
+ %asset.volume = %descriptionName.volume;
|
|
|
+ %asset.pitch = %descriptionName.pitch;
|
|
|
+ %asset.isLooping = %descriptionName.isLooping;
|
|
|
+ %asset.priority = %descriptionName.priority;
|
|
|
+ %asset.useHardware = %descriptionName.useHardware;
|
|
|
+ %asset.is3D = %descriptionName.is3D;
|
|
|
+ %asset.minDistance = %descriptionName.minDistance;
|
|
|
+ %asset.maxDistance = %descriptionName.maxDistance;
|
|
|
+ %asset.scatterDistance = %descriptionName.scatterDistance;
|
|
|
+ %asset.coneInsideAngle = %descriptionName.coneInsideAngle;
|
|
|
+ %asset.coneOutsideAngle = %descriptionName.coneOutsideAngle;
|
|
|
+ %asset.coneOutsideVolume = %descriptionName.coneOutsideVolume;
|
|
|
+ %asset.rolloffFactor = %descriptionName.rolloffFactor;
|
|
|
+ %asset.isStreaming = %descriptionName.isStreaming;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ %objFileFinder = findObjectInFiles(%descriptionName);
|
|
|
+ if(%objFileFinder !$= "")
|
|
|
+ {
|
|
|
+ %valueArray = new ArrayObject();
|
|
|
+
|
|
|
+ %valueArray.add("sourceGroup" SPC findObjectField("sourceGroup", %objFileFinder));
|
|
|
+ %valueArray.add("volume" SPC findObjectField("volume", %objFileFinder));
|
|
|
+ %valueArray.add("pitch" SPC findObjectField("pitch", %objFileFinder));
|
|
|
+ %valueArray.add("isLooping" SPC findObjectField("isLooping", %objFileFinder));
|
|
|
+ %valueArray.add("priority" SPC findObjectField("priority", %objFileFinder));
|
|
|
+ %valueArray.add("useHardware" SPC findObjectField("useHardware", %objFileFinder));
|
|
|
+ %valueArray.add("is3D" SPC findObjectField("is3D", %objFileFinder));
|
|
|
+ %valueArray.add("minDistance" SPC findObjectField("minDistance", %objFileFinder));
|
|
|
+ %valueArray.add("maxDistance" SPC findObjectField("maxDistance", %objFileFinder));
|
|
|
+ %valueArray.add("scatterDistance" SPC findObjectField("scatterDistance", %objFileFinder));
|
|
|
+ %valueArray.add("coneInsideAngle" SPC findObjectField("coneInsideAngle", %objFileFinder));
|
|
|
+ %valueArray.add("coneOutsideAngle" SPC findObjectField("coneOutsideAngle", %objFileFinder));
|
|
|
+ %valueArray.add("coneOutsideVolume" SPC findObjectField("coneOutsideVolume", %objFileFinder));
|
|
|
+ %valueArray.add("rolloffFactor" SPC findObjectField("rolloffFactor", %objFileFinder));
|
|
|
+ %valueArray.add("isStreaming" SPC findObjectField("isStreaming", %objFileFinder));
|
|
|
+
|
|
|
+ %objFileFinder.delete();
|
|
|
+
|
|
|
+ for(%v=0; %v < %valueArray.Count(); %v++)
|
|
|
+ {
|
|
|
+ %varSet = %valueArray.getKey(%v);
|
|
|
+ %var = getWord(%varSet, 0);
|
|
|
+ %varVal = getWord(%varSet, 1);
|
|
|
+
|
|
|
+ if(%varVal !$= "")
|
|
|
+ %asset.setFieldValue(%var, %varVal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ TamlWrite(%asset, %tamlpath);
|
|
|
+
|
|
|
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
|
|
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
|
|
+
|
|
|
+ if(!%success)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //Now mark the original SFXProfile for removal from the file as it's redundant
|
|
|
+ //now that we have the asset def
|
|
|
+
|
|
|
+ /*if(%matAsset $= "" || %matAsset $= "Core_Rendering:NoMaterial")
|
|
|
+ {
|
|
|
+ %assetName = %objectName;
|
|
|
+
|
|
|
+ %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
|
|
|
+
|
|
|
+ %assetPath = filePath(%file) @ "/";
|
|
|
+
|
|
|
+ %tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
|
|
+
|
|
|
+ if(isFile(%tamlpath))
|
|
|
+ {
|
|
|
+ error("T3Dpre4ProjectImporter::processMaterialObject() - Failed to create as taml file already exists: " @ %file);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ %asset = new MaterialAsset()
|
|
|
+ {
|
|
|
+ AssetName = %assetName;
|
|
|
+ versionId = 1;
|
|
|
+ shaderData = "";
|
|
|
+ materialDefinitionName = %assetName;
|
|
|
+ scriptFile = fileBase(%file);
|
|
|
+ };
|
|
|
+
|
|
|
+ TamlWrite(%asset, %tamlpath);
|
|
|
+
|
|
|
+ %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
|
|
+ %success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
|
|
+
|
|
|
+ if(!%success)
|
|
|
+ return false;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+function T3Dpre4ProjectImporter::processAudioProfileObject(%this, %file, %objectName)
|
|
|
+{
|
|
|
+ return %this.processSFXProfileObject(%file, %objectName);
|
|
|
+}
|
|
|
|
|
|
//==============================================================================
|
|
|
// Misc Utility functions
|