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 insert the .uasset names in uassetNames that you are interested to modify, and then implement the patching logic in on how you want to patch each of the .uassets in uassetName in the patch Scala method. Note that any .uasset in uassetNames will not be processed by automod and simply delegated to patch. The ast variable holds the entire JSON object of the .uasset named uassetName. The patchTrees variables hold 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.).