diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index b81e2f555..114fe1972 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -171,10 +171,8 @@ void TSStatic::initPersistFields() &TSStatic::_setShapeAsset, &defaultProtectedGetFn, "The source shape asset."); -#ifdef TORQUE_ALLOW_DIRECT_FILENAMES addField("shapeName", TypeShapeFilename, Offset( mShapeName, TSStatic ), - "%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic." ); -#endif + "%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic.", AbstractClassRep::FieldFlags::FIELD_HideInInspectors ); addProtectedField( "skin", TypeRealString, Offset( mAppliedSkinName, TSStatic ), &_setFieldSkin, &_getFieldSkin, "@brief The skin applied to the shape.\n\n" diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 3fc6389a0..2d1a0623a 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -171,10 +171,8 @@ void VolumetricFog::initPersistFields() addProtectedField("shapeAsset", TypeShapeAssetPtr, Offset(mShapeAsset, VolumetricFog), &VolumetricFog::_setShapeAsset, &defaultProtectedGetFn, "The source shape asset."); -#ifdef TORQUE_ALLOW_DIRECT_FILENAMES addField("shapeName", TypeShapeFilename, Offset(mShapeName, VolumetricFog), - "Path and filename of the model file (.DTS, .DAE) to use for this Volume."); -#endif + "Path and filename of the model file (.DTS, .DAE) to use for this Volume.", AbstractClassRep::FieldFlags::FIELD_HideInInspectors ); addField("FogColor", TypeColorI, Offset(mFogColor, VolumetricFog), "Fog color RGBA (Alpha is ignored)"); @@ -1374,4 +1372,4 @@ DefineEngineMethod(VolumetricFog, isInsideFog, bool, (), , "@brief returns true if control object is inside the fog\n\n.") { return object->isInsideFog(); -} \ No newline at end of file +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs index 124384545..209c56b0c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs @@ -135,4 +135,22 @@ function AssetBrowser::moveFolder(%this, %folderPath, %newFolderPath) %this.deleteFolder(%fullPath); //thrash the modules and reload them + %oldModule = %this.dirHandler.getModuleFromAddress(%folderPath); + %newModule = %this.dirHandler.getModuleFromAddress(%newFolderPath); + + //if we didn't move modules, then we don't need to do anything other than refresh the assets within it + if(%oldModule == %newModule) + { + //only do a refresh to update asset loose file paths + AssetDatabase.refreshAllAssets(); + } + else + { + //they're different moduels now, so we gotta unload/reload both + ModuleDatabase.unloadExplicit(%oldModule.getModuleId()); + ModuleDatabase.loadExplicit(%oldModule.getModuleId()); + + ModuleDatabase.unloadExplicit(%newModule.getModuleId()); + ModuleDatabase.loadExplicit(%newModule.getModuleId()); + } } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs index e6d8a6fb1..2bea81bc6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs @@ -46,7 +46,7 @@ function directoryHandler::loadFolders(%this, %path, %parentId) { %folderID = %this.treeCtrl.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx+1); - %this.loadFolders(%path @ "/" @ %folderName, %folderID); + %this.loadFolders(%path @ "/" @ %folderName, %folderID); } } else diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs index 1203696d1..2061e2cc0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs @@ -241,3 +241,55 @@ function AssetBrowser::confirmDeleteAsset(%this) %this.refresh(); } + +//------------------------------------------------------------ +function AssetBrowser::updateAssetReference(%this, %targetPath, %oldAssetId, %newAssetId) +{ + //assetbrowser.updateAssetReference("data/pbr/levels", "pbr:material_ball", "TreeTest:TestTree"); + //this will go through every file in the game directory and swap the assetIDs to update the reference in the event something was renamed, or something was moved + //This is potentially disastrous and break a lot of things if done hapazardly, so be careful + %fullPath = makeFullPath(%targetPath); + + //First, wipe out any files inside the folder first + %file = findFirstFileMultiExpr( %fullPath @ "/*.*", true); + %fileObj = new FileObject(); + + new ArrayObject(lineCache); + + while( %file !$= "" ) + { + lineCache.empty(); + + %fileModified = false; + if(%fileObj.openForRead(%file)) + { + while( !%fileObj.isEOF() ) + { + %unModLine = %fileObj.readLine(); + %line = strreplace( %unModLine, %oldAssetId, %newAssetId ); + + if(%unModLine !$= %line) + %fileModified = true; + + lineCache.add(%line); + } + } + + if(%fileModified && %fileObj.openForWrite(%file)) + { + for(%i=0; %i