Advanced Script Customizations

Customizing automod to process any JSON .uasset structure

You can customize automod further by updating patchCustom.sc:

import com.fasterxml.jackson.databind.JsonNode
import scala.collection.immutable.{TreeMap, TreeSet}

lazy val uassetNames: TreeSet[String] = TreeSet(
  // insert the uasset name that you want to handle in the patch method here (without file extension)
)

// This method will be called for any uasset in the uassetNames, as well as for uasset not handled by the script code
// The passed ast's JSON schema is UAssetAPI's; see the .cache directory to understand UAssetAPI JSON schema 
def patch(uassetName: String, ast: JsonNode, patchTrees: Seq[automod.UAssetPropertyChanges]): Boolean = {

  // insert your custom patching code here

  return false // return true if you can modify the ast successfully
}

where you can list in uassetNames the .uasset names you are interested in modifying, and then implement the patching logic for each of them in the patch Scala method. Note that any .uasset in uassetNames will not be processed by automod; it is simply delegated to your patch method. The ast variable holds the entire UAssetAPI JSON object of the .uasset named uassetName (see The UAssetAPI JSON Representation). The patchTrees variable holds the TOML patch files associated with uassetName.

You can use Scala Metals to help with coding patchCustom.sc by providing a rich-featured Scala IDE in VSCode/VSCodium (e.g., debugging, etc.).