Is it possible to use python scripts to batch-edit nodes inside of Metasounds or Blueprints?
I’ve been creating scripts to batch-process a bunch of different things in Unreal but the one thing I haven’t figured out whether it’s possible is batch changing node values in Metaounds (or Blueprints).
Some examples of what I’m trying to do::
- Searching a bunch of metasounds/blueprints for an input/variable with a certain name and changing those values to x or adding an amount to all those values
- Searching a bunch of metasounds/blueprints for the names of a node input and changing those values
Hey Yoni,
I tried looking into if this would be possible, but at the moment there is no out of the box functionality available in the engine. Digging a bit further into this to look if there are any other options, I found the class UBlueprint holds these public properties, if you could consume these graphs and iterate over the nodes as per your requirements, you might be able to batch process the nodes, as each of the UEdGraph holds an array of nodes and also has helpers to get all nodes of specific class from which you can take inspiration and write your own helpers.
#if WITH_EDITORONLY_DATA
/** Set of pages that combine into a single uber-graph */
UPROPERTY()
TArray<TObjectPtr<UEdGraph>> UbergraphPages;
/** Set of functions implemented for this class graphically */
UPROPERTY()
TArray<TObjectPtr<UEdGraph>> FunctionGraphs;
/** Graphs of signatures for delegates */
UPROPERTY()
TArray<TObjectPtr<UEdGraph>> DelegateSignatureGraphs;
/** Set of macros implemented for this class */
UPROPERTY()
TArray<TObjectPtr<UEdGraph>> MacroGraphs;
/** Set of functions actually compiled for this class */
UPROPERTY(transient, duplicatetransient)
TArray<TObjectPtr<UEdGraph>> IntermediateGeneratedGraphs;
/** Set of functions actually compiled for this class */
UPROPERTY(transient, duplicatetransient)
TArray<TObjectPtr<UEdGraph>> EventGraphs;
/** Cached cosmetic information about macro graphs, use GetCosmeticInfoForMacro() to access */
UPROPERTY(Transient)
TMap<TObjectPtr<UEdGraph>, FBlueprintMacroCosmeticInfo> PRIVATE_CachedMacroInfo;
#endif // WITH_EDITORONLY_DATA
So the best way to go about this would be to write your own Blueprint Function Library that will hold all the core functionality of the batch processing in c++, and the functions would be exposed to python and blueprints for your rest of the tools.
I hope it helps.
Best
Vedang