build_material_graph
Construct a material node graph by defining nodes and connections in a single call, safely replacing the existing expressions.
Instructions
Build a complete material node graph in one atomic operation.
Creates expression nodes and wires them together in a single call. By default clears existing expressions first (safe rebuild — all external references stay intact).
Args: material_path: Full path to existing material (e.g. "/Game/Materials/M_Portal") nodes: JSON array of node definitions. Each node has: - type: Short class name (e.g. "TextureCoordinate", "Custom", "ScalarParameter", "Constant3Vector", "TextureSample", "Multiply", "Add", "Panner", "Time", "VectorParameter", "LinearInterpolate", "ComponentMask") Auto-prefixed with "MaterialExpression" if needed. - pos_x, pos_y: Graph position (default -300, 0) - properties: Dict of editor properties to set. Common ones: - parameter_name: str — name shown in material instances - default_value: number or [r,g,b,a] - slider_min, slider_max: float — slider range - group: str — parameter group name - Values starting with "/" are loaded as assets - Lists of 3-4 become LinearColor, lists of 2 become Vector2D For Custom HLSL nodes (type="Custom"), also supports: - code: HLSL source code string - description: Node title in the graph - output_type: "float" | "float2" | "float3" | "float4" - inputs: List of input pin names (e.g. ["UV", "Speed"]) - outputs: List of {"name": str, "type": str} for additional outputs connections: JSON array of connections. Each connection has: - from_node: Source node index (int, 0-based into nodes array) - from_pin: Output pin name ("" for default output) - to_node: Target node index (int) or "material" for material output - to_pin: Input pin name, or material property when to_node="material": BaseColor, Metallic, Specular, Roughness, Anisotropy, EmissiveColor, Opacity, OpacityMask, Normal, Tangent, WorldPositionOffset, Displacement, SubsurfaceColor, CustomData0, CustomData1, AmbientOcclusion, Refraction, PixelDepthOffset, ShadingModel, SurfaceThickness, FrontMaterial (FrontMaterial is for Substrate BSDF nodes — use get_available_material_pins to see which pins are active for a specific material) clear_existing: Remove existing expressions before building (default True)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | Yes | ||
| connections | Yes | ||
| material_path | Yes | ||
| clear_existing | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |