├── BL_ColorRamp2_MF.py ├── BL_ColorRamp3_MF.py ├── BL_ColorRamp4_MF.py ├── BL_ColorRamp5_MF.py ├── BL_ColorRamp6_MF.py ├── BL_ColorRamp7_MF.py ├── BL_ColorRamp8_MF.py ├── BL_ColorRamp9_MF.py ├── BL_Mapping_MF.py ├── LICENSE ├── README.md ├── TransMat.py └── TransMat_SetupScript.py /BL_ColorRamp2_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp2 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp2', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp2.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp2.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp2,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math12 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 19 | Math15 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionDivide,-920.0, 3460.0) 20 | Math16 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 21 | Math17 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionAdd,-600.0, 3540.0) 22 | Math14 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionDivide,-900.0, 3640.0) 23 | Math13 = create_expression(BL_ColorRamp2, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 24 | 25 | Position0 = create_expression(BL_ColorRamp2, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 26 | Color0 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionFunctionInput,-1580.0, 3620.0) 27 | Position1 = create_expression(BL_ColorRamp2, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 28 | Color1 = create_expression(BL_ColorRamp2,unreal.MaterialExpressionFunctionInput,-1580.0, 3880.0) 29 | 30 | Factor = create_expression(BL_ColorRamp2, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 31 | 32 | OutputResult = create_expression(BL_ColorRamp2, unreal.MaterialExpressionFunctionOutput,400, 3620) 33 | 34 | ### Loading Material Functions and Textures 35 | 36 | ### Setting Values 37 | Color0.input_name = 'Color0' 38 | Color0.sort_priority = 0 39 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 40 | Color0.use_preview_value_as_default = True 41 | Position0.input_name = 'Position0' 42 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 43 | Position0.sort_priority = 1 44 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 45 | Position0.use_preview_value_as_default = True 46 | 47 | Color1.input_name = 'Color1' 48 | Color1.sort_priority = 2 49 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 50 | Color1.use_preview_value_as_default = True 51 | Position1.input_name = "Position1" 52 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 53 | Position1.sort_priority = 3 54 | Position1.preview_value = (0.125, 0, 0, 1) 55 | Position1.use_preview_value_as_default = True 56 | 57 | 58 | Factor.input_name = 'Factor' 59 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 60 | Factor.sort_priority = 4 61 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 62 | Factor.use_preview_value_as_default = True 63 | 64 | 65 | ### Creating Connections 66 | Color1_connection = create_connection(Color1, '', Mix, 'B') 67 | Position1_connection = create_connection(Position1, '', Math12, 'A') 68 | Position1_connection = create_connection(Position1, '', Math13, 'B') 69 | Position0_connection = create_connection(Position0, '', Math12, 'B') 70 | Position0_connection = create_connection(Position0, '', Math14, 'A') 71 | Position0_connection = create_connection(Position0, '', Math13, 'A') 72 | Color0_connection = create_connection(Color0, '', Mix, 'A') 73 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 74 | Factor_connection = create_connection(Factor, '', Reroute01, '') 75 | Math12_connection = create_connection(Math12, '', Math15, 'B') 76 | Math15_connection = create_connection(Math15, '', Math16, 'A') 77 | Math16_connection = create_connection(Math16, '', Math17, 'A') 78 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 79 | Math14_connection = create_connection(Math14, '', Math17, 'B') 80 | Math13_connection = create_connection(Math13, '', Math14, 'B') 81 | 82 | Mix_connection = create_connection(Mix, '', OutputResult, '') 83 | 84 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp3_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp3 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp3', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp3.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp3.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp3,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math20 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 19 | Math19 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 20 | Math18 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 21 | Math21 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 22 | Mix01 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 23 | Math22 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 24 | Reroute10 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 25 | Reroute09 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 26 | Reroute08 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Math23 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionAdd,-320.0, 4320.0) 28 | Reroute06 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 29 | Reroute07 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 30 | Math12 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 31 | Math15 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionDivide,-920.0, 3460.0) 32 | Math16 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 33 | Math17 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionAdd,-600.0, 3540.0) 34 | Math14 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionDivide,-900.0, 3640.0) 35 | Math13 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 36 | 37 | Position0 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 38 | Color0 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 39 | 40 | Position1 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 41 | Color1 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 42 | 43 | Position2 = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 44 | Color2 = create_expression(BL_ColorRamp3,unreal.MaterialExpressionFunctionInput,-1560.0, 4620.0) 45 | 46 | Factor = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 47 | 48 | OutputResult = create_expression(BL_ColorRamp3, unreal.MaterialExpressionFunctionOutput,400, 4480) 49 | 50 | ### Loading Material Functions and Textures 51 | 52 | ### Setting Values 53 | Color0.input_name = 'Color0' 54 | Color0.sort_priority = 0 55 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 56 | Color0.use_preview_value_as_default = True 57 | Position0.input_name = 'Position0' 58 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 59 | Position0.sort_priority = 1 60 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 61 | Position0.use_preview_value_as_default = True 62 | 63 | Color1.input_name = 'Color1' 64 | Color1.sort_priority = 2 65 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 66 | Color1.use_preview_value_as_default = True 67 | Position1.input_name = "Position1" 68 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 69 | Position1.sort_priority = 3 70 | Position1.preview_value = (0.125, 0, 0, 1) 71 | Position1.use_preview_value_as_default = True 72 | 73 | Color2.input_name = 'Color2' 74 | Color2.sort_priority = 4 75 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 76 | Color2.use_preview_value_as_default = True 77 | Position2.input_name = "Position2" 78 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 79 | Position2.sort_priority = 5 80 | Position2.preview_value = (0.250, 0, 0, 1) 81 | Position2.use_preview_value_as_default = True 82 | 83 | Factor.input_name = 'Factor' 84 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 85 | Factor.sort_priority = 6 86 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 87 | Factor.use_preview_value_as_default = True 88 | 89 | ### Creating Connections 90 | Color1_connection = create_connection(Color1, '', Mix, 'B') 91 | Position1_connection = create_connection(Position1, '', Math12, 'A') 92 | Position1_connection = create_connection(Position1, '', Math13, 'B') 93 | Position1_connection = create_connection(Position1, '', Reroute09, '') 94 | Position1_connection = create_connection(Position1, '', Reroute10, '') 95 | Position1_connection = create_connection(Position1, '', Reroute08, '') 96 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 97 | Position0_connection = create_connection(Position0, '', Math12, 'B') 98 | Position0_connection = create_connection(Position0, '', Math14, 'A') 99 | Position0_connection = create_connection(Position0, '', Math13, 'A') 100 | Color0_connection = create_connection(Color0, '', Mix, 'A') 101 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 102 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 103 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 104 | Math20_connection = create_connection(Math20, '', Math23, 'B') 105 | Math19_connection = create_connection(Math19, '', Math20, 'B') 106 | Math18_connection = create_connection(Math18, '', Math21, 'B') 107 | Math21_connection = create_connection(Math21, '', Math22, 'A') 108 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 109 | Position2_connection = create_connection(Position2, '', Math18, 'A') 110 | Position2_connection = create_connection(Position2, '', Math19, 'B') 111 | Math22_connection = create_connection(Math22, '', Math23, 'A') 112 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 113 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 114 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 115 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 116 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 117 | Factor_connection = create_connection(Factor, '', Reroute01, '') 118 | Math12_connection = create_connection(Math12, '', Math15, 'B') 119 | Math15_connection = create_connection(Math15, '', Math16, 'A') 120 | Math16_connection = create_connection(Math16, '', Math17, 'A') 121 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 122 | Math14_connection = create_connection(Math14, '', Math17, 'B') 123 | Math13_connection = create_connection(Math13, '', Math14, 'B') 124 | 125 | Mix01_connection = create_connection(Mix01, '', OutputResult, '') 126 | 127 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp4_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp4 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp4', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp4.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp4.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp4,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math20 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 19 | Math19 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 20 | Math18 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 21 | Math21 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 22 | Mix01 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 23 | Math22 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 24 | Reroute10 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 25 | Reroute09 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 26 | Reroute08 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Math23 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionAdd,-320.0, 4320.0) 28 | Reroute06 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 29 | Reroute07 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 30 | Reroute05 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 31 | Reroute02 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-960.0, 5080.0) 32 | Reroute03 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-960.0, 5080.0) 33 | Reroute04 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionReroute,-960.0, 5080.0) 34 | Math24 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionAdd,-120.0, 5080.0) 35 | Math25 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 36 | Math27 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 37 | Math28 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 38 | Math29 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 39 | Math26 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 40 | Mix02 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 41 | Math12 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 42 | Math15 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-920.0, 3460.0) 43 | Math16 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 44 | Math17 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionAdd,-600.0, 3540.0) 45 | Math14 = create_expression(BL_ColorRamp4,unreal.MaterialExpressionDivide,-900.0, 3640.0) 46 | Math13 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 47 | 48 | Position0 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 49 | Color0 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 50 | 51 | Position1 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 52 | Color1 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 53 | 54 | Position2 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 55 | Color2 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 56 | 57 | Position3 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 58 | Color3 = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput,-1360.0, 5400.0) 59 | 60 | Factor = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 61 | 62 | OutputResult = create_expression(BL_ColorRamp4, unreal.MaterialExpressionFunctionOutput,400, 5280) 63 | 64 | ### Loading Material Functions and Textures 65 | 66 | ### Setting Values 67 | Color0.input_name = 'Color0' 68 | Color0.sort_priority = 0 69 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 70 | Color0.use_preview_value_as_default = True 71 | Position0.input_name = 'Position0' 72 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 73 | Position0.sort_priority = 1 74 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 75 | Position0.use_preview_value_as_default = True 76 | 77 | Color1.input_name = 'Color1' 78 | Color1.sort_priority = 2 79 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 80 | Color1.use_preview_value_as_default = True 81 | Position1.input_name = "Position1" 82 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 83 | Position1.sort_priority = 3 84 | Position1.preview_value = (0.125, 0, 0, 1) 85 | Position1.use_preview_value_as_default = True 86 | 87 | Color2.input_name = 'Color2' 88 | Color2.sort_priority = 4 89 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 90 | Color2.use_preview_value_as_default = True 91 | Position2.input_name = "Position2" 92 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 93 | Position2.sort_priority = 5 94 | Position2.preview_value = (0.250, 0, 0, 1) 95 | Position2.use_preview_value_as_default = True 96 | 97 | Color3.input_name = 'Color3' 98 | Color3.sort_priority = 6 99 | Color3.preview_value = (1.0, 1, 0.0, 1) 100 | Color3.use_preview_value_as_default = True 101 | Position3.input_name = "Position3" 102 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 103 | Position3.sort_priority = 7 104 | Position3.preview_value = (1, 0, 0, 1) 105 | Position3.use_preview_value_as_default = True 106 | 107 | Factor.input_name = 'Factor' 108 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 109 | Factor.sort_priority = 8 110 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 111 | Factor.use_preview_value_as_default = True 112 | 113 | ### Creating Connections 114 | Color1_connection = create_connection(Color1, '', Mix, 'B') 115 | Position1_connection = create_connection(Position1, '', Math12, 'A') 116 | Position1_connection = create_connection(Position1, '', Math13, 'B') 117 | Position1_connection = create_connection(Position1, '', Reroute09, '') 118 | Position1_connection = create_connection(Position1, '', Reroute10, '') 119 | Position1_connection = create_connection(Position1, '', Reroute08, '') 120 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 121 | Position0_connection = create_connection(Position0, '', Math12, 'B') 122 | Position0_connection = create_connection(Position0, '', Math14, 'A') 123 | Position0_connection = create_connection(Position0, '', Math13, 'A') 124 | Color0_connection = create_connection(Color0, '', Mix, 'A') 125 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 126 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 127 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 128 | Math20_connection = create_connection(Math20, '', Math23, 'B') 129 | Math19_connection = create_connection(Math19, '', Math20, 'B') 130 | Math18_connection = create_connection(Math18, '', Math21, 'B') 131 | Math21_connection = create_connection(Math21, '', Math22, 'A') 132 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 133 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 134 | Position2_connection = create_connection(Position2, '', Math18, 'A') 135 | Position2_connection = create_connection(Position2, '', Math19, 'B') 136 | Position2_connection = create_connection(Position2, '', Reroute03, '') 137 | Position2_connection = create_connection(Position2, '', Reroute04, '') 138 | Position2_connection = create_connection(Position2, '', Reroute02, '') 139 | Math22_connection = create_connection(Math22, '', Math23, 'A') 140 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 141 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 142 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 143 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 144 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 145 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 146 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 147 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 148 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 149 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 150 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 151 | Math25_connection = create_connection(Math25, '', Math24, 'A') 152 | Math27_connection = create_connection(Math27, '', Math26, 'B') 153 | Math28_connection = create_connection(Math28, '', Math29, 'B') 154 | Math29_connection = create_connection(Math29, '', Math25, 'A') 155 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 156 | Math26_connection = create_connection(Math26, '', Math24, 'B') 157 | Position3_connection = create_connection(Position3, '', Math28, 'A') 158 | Position3_connection = create_connection(Position3, '', Math27, 'B') 159 | Factor_connection = create_connection(Factor, '', Reroute01, '') 160 | Math12_connection = create_connection(Math12, '', Math15, 'B') 161 | Math15_connection = create_connection(Math15, '', Math16, 'A') 162 | Math16_connection = create_connection(Math16, '', Math17, 'A') 163 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 164 | Math14_connection = create_connection(Math14, '', Math17, 'B') 165 | Math13_connection = create_connection(Math13, '', Math14, 'B') 166 | 167 | Mix02_connection = create_connection(Mix02, '', OutputResult, '') 168 | 169 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp5_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp5 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp5', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp5.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp5.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp5,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math20 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 19 | Math19 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 20 | Math18 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 21 | Math21 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 22 | Mix01 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 23 | Math22 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 24 | Reroute10 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 25 | Reroute09 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 26 | Reroute08 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Math23 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionAdd,-320.0, 4320.0) 28 | Reroute06 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 29 | Reroute07 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 30 | Reroute05 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 31 | Reroute02 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-960.0, 5080.0) 32 | Reroute03 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-960.0, 5080.0) 33 | Reroute04 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-960.0, 5080.0) 34 | Math24 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionAdd,-120.0, 5080.0) 35 | Math25 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 36 | Math27 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 37 | Math28 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 38 | Math29 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 39 | Math26 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 40 | Mix02 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 41 | Mix03 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionLinearInterpolate,180.0, 6020.0) 42 | Math30 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionAdd,-120.0, 5840.0) 43 | Math31 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionMultiply,-280.0, 5800.0) 44 | Math32 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-600.0, 5955.6484375) 45 | Math33 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-600.0, 5775.6484375) 46 | Math34 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-440.0, 5775.6484375) 47 | Math35 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-440.0, 5955.6484375) 48 | Reroute11 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1849.2108154296875, 5920.0) 49 | Reroute14 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 50 | Reroute13 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 51 | Reroute12 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 52 | Math12 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 53 | Math15 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-920.0, 3460.0) 54 | Math16 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 55 | Math17 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionAdd,-600.0, 3540.0) 56 | Math14 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionDivide,-900.0, 3640.0) 57 | Math13 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 58 | 59 | Position0 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 60 | Color0 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 61 | 62 | Position1 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 63 | Color1 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 64 | 65 | Position2 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 66 | Color2 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 67 | 68 | Position3 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 69 | Color3 = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -1360.0, 5400.0) 70 | 71 | Color4 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionFunctionInput,-1360.0, 6160.0) 72 | Position4 = create_expression(BL_ColorRamp5,unreal.MaterialExpressionFunctionInput,-1360.0, 6080.0) 73 | 74 | Factor = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 75 | 76 | OutputResult = create_expression(BL_ColorRamp5, unreal.MaterialExpressionFunctionOutput,400, 6020) 77 | 78 | ### Loading Material Functions and Textures 79 | 80 | ### Setting Values 81 | Color0.input_name = 'Color0' 82 | Color0.sort_priority = 0 83 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 84 | Color0.use_preview_value_as_default = True 85 | Position0.input_name = 'Position0' 86 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 87 | Position0.sort_priority = 1 88 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 89 | Position0.use_preview_value_as_default = True 90 | 91 | Color1.input_name = 'Color1' 92 | Color1.sort_priority = 2 93 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 94 | Color1.use_preview_value_as_default = True 95 | Position1.input_name = "Position1" 96 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 97 | Position1.sort_priority = 3 98 | Position1.preview_value = (0.125, 0, 0, 1) 99 | Position1.use_preview_value_as_default = True 100 | 101 | Color2.input_name = 'Color2' 102 | Color2.sort_priority = 4 103 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 104 | Color2.use_preview_value_as_default = True 105 | Position2.input_name = "Position2" 106 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 107 | Position2.sort_priority = 5 108 | Position2.preview_value = (0.250, 0, 0, 1) 109 | Position2.use_preview_value_as_default = True 110 | 111 | Color3.input_name = 'Color3' 112 | Color3.sort_priority = 6 113 | Color3.preview_value = (1.0, 1, 0.0, 1) 114 | Color3.use_preview_value_as_default = True 115 | Position3.input_name = "Position3" 116 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 117 | Position3.sort_priority = 7 118 | Position3.preview_value = (0.375, 0, 0, 1) 119 | Position3.use_preview_value_as_default = True 120 | 121 | Color4.input_name = 'Color4' 122 | Color4.sort_priority = 8 123 | Color4.preview_value = (0, 1, 0.0, 1) 124 | Color4.use_preview_value_as_default = True 125 | Position4.input_name = "Position4" 126 | Position4.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 127 | Position4.sort_priority = 9 128 | Position4.preview_value = (0.5, 0, 0, 1) 129 | Position4.use_preview_value_as_default = True 130 | 131 | Factor.input_name = 'Factor' 132 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 133 | Factor.sort_priority = 10 134 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 135 | Factor.use_preview_value_as_default = True 136 | 137 | ### Creating Connections 138 | Color1_connection = create_connection(Color1, '', Mix, 'B') 139 | Position1_connection = create_connection(Position1, '', Math12, 'A') 140 | Position1_connection = create_connection(Position1, '', Math13, 'B') 141 | Position1_connection = create_connection(Position1, '', Reroute09, '') 142 | Position1_connection = create_connection(Position1, '', Reroute10, '') 143 | Position1_connection = create_connection(Position1, '', Reroute08, '') 144 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 145 | Position0_connection = create_connection(Position0, '', Math12, 'B') 146 | Position0_connection = create_connection(Position0, '', Math14, 'A') 147 | Position0_connection = create_connection(Position0, '', Math13, 'A') 148 | Color0_connection = create_connection(Color0, '', Mix, 'A') 149 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 150 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 151 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 152 | Math20_connection = create_connection(Math20, '', Math23, 'B') 153 | Math19_connection = create_connection(Math19, '', Math20, 'B') 154 | Math18_connection = create_connection(Math18, '', Math21, 'B') 155 | Math21_connection = create_connection(Math21, '', Math22, 'A') 156 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 157 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 158 | Position2_connection = create_connection(Position2, '', Math18, 'A') 159 | Position2_connection = create_connection(Position2, '', Math19, 'B') 160 | Position2_connection = create_connection(Position2, '', Reroute03, '') 161 | Position2_connection = create_connection(Position2, '', Reroute04, '') 162 | Position2_connection = create_connection(Position2, '', Reroute02, '') 163 | Math22_connection = create_connection(Math22, '', Math23, 'A') 164 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 165 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 166 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 167 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 168 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 169 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 170 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 171 | Reroute05_connection = create_connection(Reroute05, '', Reroute11, '') 172 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 173 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 174 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 175 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 176 | Math25_connection = create_connection(Math25, '', Math24, 'A') 177 | Math27_connection = create_connection(Math27, '', Math26, 'B') 178 | Math28_connection = create_connection(Math28, '', Math29, 'B') 179 | Math29_connection = create_connection(Math29, '', Math25, 'A') 180 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 181 | Math26_connection = create_connection(Math26, '', Math24, 'B') 182 | Mix02_connection = create_connection(Mix02, '', Mix03, 'A') 183 | Position3_connection = create_connection(Position3, '', Math28, 'A') 184 | Position3_connection = create_connection(Position3, '', Math27, 'B') 185 | Position3_connection = create_connection(Position3, '', Reroute14, '') 186 | Position3_connection = create_connection(Position3, '', Reroute13, '') 187 | Position3_connection = create_connection(Position3, '', Reroute12, '') 188 | Math30_connection = create_connection(Math30, '', Mix03, 'Alpha') 189 | Math31_connection = create_connection(Math31, '', Math30, 'A') 190 | Math32_connection = create_connection(Math32, '', Math35, 'B') 191 | Math33_connection = create_connection(Math33, '', Math34, 'B') 192 | Math34_connection = create_connection(Math34, '', Math31, 'A') 193 | Math35_connection = create_connection(Math35, '', Math30, 'B') 194 | Reroute11_connection = create_connection(Reroute11, '', Math31, 'B') 195 | Reroute14_connection = create_connection(Reroute14, '', Math32, 'A') 196 | Reroute13_connection = create_connection(Reroute13, '', Math33, 'B') 197 | Reroute12_connection = create_connection(Reroute12, '', Math35, 'A') 198 | Color4_connection = create_connection(Color4, '', Mix03, 'B') 199 | Position4_connection = create_connection(Position4, '', Math33, 'A') 200 | Position4_connection = create_connection(Position4, '', Math32, 'B') 201 | Factor_connection = create_connection(Factor, '', Reroute01, '') 202 | Math12_connection = create_connection(Math12, '', Math15, 'B') 203 | Math15_connection = create_connection(Math15, '', Math16, 'A') 204 | Math16_connection = create_connection(Math16, '', Math17, 'A') 205 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 206 | Math14_connection = create_connection(Math14, '', Math17, 'B') 207 | Math13_connection = create_connection(Math13, '', Math14, 'B') 208 | 209 | Mix03_connection = create_connection(Mix03, '', OutputResult, '') 210 | 211 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp6_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp6 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp6', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp6.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp6.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | 17 | Mix = create_expression(BL_ColorRamp6,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 18 | 19 | Reroute01 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 20 | Math20 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 21 | Math19 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 22 | Math18 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 23 | Math21 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 24 | Mix01 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 25 | Math22 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 26 | Reroute10 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Reroute09 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 28 | Reroute08 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 29 | Math23 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionAdd,-320.0, 4320.0) 30 | Reroute06 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 31 | Reroute07 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 32 | Reroute05 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 33 | Reroute02 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-960.0, 5080.0) 34 | Reroute03 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-960.0, 5080.0) 35 | Reroute04 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-960.0, 5080.0) 36 | Math24 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionAdd,-120.0, 5080.0) 37 | Math25 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 38 | Math27 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 39 | Math28 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 40 | Math29 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 41 | Math26 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 42 | Mix02 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 43 | Mix03 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionLinearInterpolate,180.0, 6020.0) 44 | Math30 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionAdd,-120.0, 5840.0) 45 | Math31 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionMultiply,-280.0, 5800.0) 46 | Math32 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 5955.6484375) 47 | Math33 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 5775.6484375) 48 | Math34 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 5775.6484375) 49 | Math35 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 5955.6484375) 50 | Reroute11 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1849.2108154296875, 5920.0) 51 | Reroute14 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 52 | Reroute13 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 53 | Reroute12 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 54 | Math36 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionAdd,-120.0, 6600.0) 55 | Math37 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionMultiply,-280.0, 6560.0) 56 | Math38 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 6715.6484375) 57 | Math39 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-600.0, 6535.6484375) 58 | Math40 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 6535.6484375) 59 | Math41 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-440.0, 6715.6484375) 60 | Reroute15 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1849.2108154296875, 6680.0) 61 | Reroute18 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 62 | Reroute17 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 63 | Reroute16 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 64 | Mix04 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionLinearInterpolate,160.0, 6780.0) 65 | Math12 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 66 | Math15 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-920.0, 3460.0) 67 | Math16 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 68 | Math17 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionAdd,-600.0, 3540.0) 69 | Math14 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionDivide,-900.0, 3640.0) 70 | Math13 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 71 | 72 | Position0 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 73 | Color0 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 74 | 75 | Position1 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 76 | Color1 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 77 | 78 | Position2 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 79 | Color2 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 80 | 81 | Position3 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 82 | Color3 = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -1360.0, 5400.0) 83 | 84 | Color4 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionFunctionInput,-1360.0, 6160.0) 85 | Position4 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionFunctionInput,-1360.0, 6080.0) 86 | 87 | Color5 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionFunctionInput,-1360.0, 6920.0) 88 | Position5 = create_expression(BL_ColorRamp6,unreal.MaterialExpressionFunctionInput,-1360.0, 6840.0) 89 | 90 | Factor = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 91 | 92 | OutputResult = create_expression(BL_ColorRamp6, unreal.MaterialExpressionFunctionOutput,400, 6020) 93 | 94 | ### Loading Material Functions and Textures 95 | 96 | ### Setting Values 97 | Color0.input_name = 'Color0' 98 | Color0.sort_priority = 0 99 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 100 | Color0.use_preview_value_as_default = True 101 | Position0.input_name = 'Position0' 102 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 103 | Position0.sort_priority = 1 104 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 105 | Position0.use_preview_value_as_default = True 106 | 107 | Color1.input_name = 'Color1' 108 | Color1.sort_priority = 2 109 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 110 | Color1.use_preview_value_as_default = True 111 | Position1.input_name = "Position1" 112 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 113 | Position1.sort_priority = 3 114 | Position1.preview_value = (0.125, 0, 0, 1) 115 | Position1.use_preview_value_as_default = True 116 | 117 | Color2.input_name = 'Color2' 118 | Color2.sort_priority = 4 119 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 120 | Color2.use_preview_value_as_default = True 121 | Position2.input_name = "Position2" 122 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 123 | Position2.sort_priority = 5 124 | Position2.preview_value = (0.250, 0, 0, 1) 125 | Position2.use_preview_value_as_default = True 126 | 127 | Color3.input_name = 'Color3' 128 | Color3.sort_priority = 6 129 | Color3.preview_value = (1.0, 1, 0.0, 1) 130 | Color3.use_preview_value_as_default = True 131 | Position3.input_name = "Position3" 132 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 133 | Position3.sort_priority = 7 134 | Position3.preview_value = (0.375, 0, 0, 1) 135 | Position3.use_preview_value_as_default = True 136 | 137 | Color4.input_name = 'Color4' 138 | Color4.sort_priority = 8 139 | Color4.preview_value = (0, 1, 0.0, 1) 140 | Color4.use_preview_value_as_default = True 141 | Position4.input_name = "Position4" 142 | Position4.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 143 | Position4.sort_priority = 9 144 | Position4.preview_value = (0.5, 0, 0, 1) 145 | Position4.use_preview_value_as_default = True 146 | 147 | Color5.input_name = 'Color5' 148 | Color5.sort_priority = 10 149 | Color5.preview_value = (0, 1, 1, 1) 150 | Color5.use_preview_value_as_default = True 151 | Position5.input_name = "Position5" 152 | Position5.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 153 | Position5.sort_priority = 11 154 | Position5.preview_value = (0.625, 0, 0, 1) 155 | Position5.use_preview_value_as_default = True 156 | 157 | Factor.input_name = 'Factor' 158 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 159 | Factor.sort_priority = 12 160 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 161 | Factor.use_preview_value_as_default = True 162 | 163 | ### Creating Connections 164 | Color1_connection = create_connection(Color1, '', Mix, 'B') 165 | Position1_connection = create_connection(Position1, '', Math12, 'A') 166 | Position1_connection = create_connection(Position1, '', Math13, 'B') 167 | Position1_connection = create_connection(Position1, '', Reroute09, '') 168 | Position1_connection = create_connection(Position1, '', Reroute10, '') 169 | Position1_connection = create_connection(Position1, '', Reroute08, '') 170 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 171 | Position0_connection = create_connection(Position0, '', Math12, 'B') 172 | Position0_connection = create_connection(Position0, '', Math14, 'A') 173 | Position0_connection = create_connection(Position0, '', Math13, 'A') 174 | Color0_connection = create_connection(Color0, '', Mix, 'A') 175 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 176 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 177 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 178 | Math20_connection = create_connection(Math20, '', Math23, 'B') 179 | Math19_connection = create_connection(Math19, '', Math20, 'B') 180 | Math18_connection = create_connection(Math18, '', Math21, 'B') 181 | Math21_connection = create_connection(Math21, '', Math22, 'A') 182 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 183 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 184 | Position2_connection = create_connection(Position2, '', Math18, 'A') 185 | Position2_connection = create_connection(Position2, '', Math19, 'B') 186 | Position2_connection = create_connection(Position2, '', Reroute03, '') 187 | Position2_connection = create_connection(Position2, '', Reroute04, '') 188 | Position2_connection = create_connection(Position2, '', Reroute02, '') 189 | Math22_connection = create_connection(Math22, '', Math23, 'A') 190 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 191 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 192 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 193 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 194 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 195 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 196 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 197 | Reroute05_connection = create_connection(Reroute05, '', Reroute11, '') 198 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 199 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 200 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 201 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 202 | Math25_connection = create_connection(Math25, '', Math24, 'A') 203 | Math27_connection = create_connection(Math27, '', Math26, 'B') 204 | Math28_connection = create_connection(Math28, '', Math29, 'B') 205 | Math29_connection = create_connection(Math29, '', Math25, 'A') 206 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 207 | Math26_connection = create_connection(Math26, '', Math24, 'B') 208 | Mix02_connection = create_connection(Mix02, '', Mix03, 'A') 209 | Position3_connection = create_connection(Position3, '', Math28, 'A') 210 | Position3_connection = create_connection(Position3, '', Math27, 'B') 211 | Position3_connection = create_connection(Position3, '', Reroute14, '') 212 | Position3_connection = create_connection(Position3, '', Reroute13, '') 213 | Position3_connection = create_connection(Position3, '', Reroute12, '') 214 | Mix03_connection = create_connection(Mix03, '', Mix04, 'A') 215 | Math30_connection = create_connection(Math30, '', Mix03, 'Alpha') 216 | Math31_connection = create_connection(Math31, '', Math30, 'A') 217 | Math32_connection = create_connection(Math32, '', Math35, 'B') 218 | Math33_connection = create_connection(Math33, '', Math34, 'B') 219 | Math34_connection = create_connection(Math34, '', Math31, 'A') 220 | Math35_connection = create_connection(Math35, '', Math30, 'B') 221 | Reroute11_connection = create_connection(Reroute11, '', Math31, 'B') 222 | Reroute11_connection = create_connection(Reroute11, '', Reroute15, '') 223 | Reroute14_connection = create_connection(Reroute14, '', Math32, 'A') 224 | Reroute13_connection = create_connection(Reroute13, '', Math33, 'B') 225 | Reroute12_connection = create_connection(Reroute12, '', Math35, 'A') 226 | Color4_connection = create_connection(Color4, '', Mix03, 'B') 227 | Position4_connection = create_connection(Position4, '', Math33, 'A') 228 | Position4_connection = create_connection(Position4, '', Math32, 'B') 229 | Position4_connection = create_connection(Position4, '', Reroute18, '') 230 | Position4_connection = create_connection(Position4, '', Reroute17, '') 231 | Position4_connection = create_connection(Position4, '', Reroute16, '') 232 | Math36_connection = create_connection(Math36, '', Mix04, 'Alpha') 233 | Math37_connection = create_connection(Math37, '', Math36, 'A') 234 | Math38_connection = create_connection(Math38, '', Math41, 'B') 235 | Math39_connection = create_connection(Math39, '', Math40, 'B') 236 | Math40_connection = create_connection(Math40, '', Math37, 'A') 237 | Math41_connection = create_connection(Math41, '', Math36, 'B') 238 | Reroute15_connection = create_connection(Reroute15, '', Math37, 'B') 239 | Reroute18_connection = create_connection(Reroute18, '', Math38, 'A') 240 | Reroute17_connection = create_connection(Reroute17, '', Math39, 'B') 241 | Reroute16_connection = create_connection(Reroute16, '', Math41, 'A') 242 | Color5_connection = create_connection(Color5, '', Mix04, 'B') 243 | Position5_connection = create_connection(Position5, '', Math39, 'A') 244 | Position5_connection = create_connection(Position5, '', Math38, 'B') 245 | Factor_connection = create_connection(Factor, '', Reroute01, '') 246 | Math12_connection = create_connection(Math12, '', Math15, 'B') 247 | Math15_connection = create_connection(Math15, '', Math16, 'A') 248 | Math16_connection = create_connection(Math16, '', Math17, 'A') 249 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 250 | Math14_connection = create_connection(Math14, '', Math17, 'B') 251 | Math13_connection = create_connection(Math13, '', Math14, 'B') 252 | 253 | Mix04_connection = create_connection(Mix04, '', OutputResult, '') 254 | 255 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp7_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp7 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp7', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp7.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp7.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math20 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 19 | Math19 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 20 | Math18 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 21 | Math21 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 22 | Mix01 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 23 | Math22 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 24 | Reroute10 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 25 | Reroute09 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 26 | Reroute08 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Math23 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-320.0, 4320.0) 28 | Reroute06 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 29 | Reroute07 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 30 | Reroute05 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 31 | Reroute02 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-960.0, 5080.0) 32 | Reroute03 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-960.0, 5080.0) 33 | Reroute04 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-960.0, 5080.0) 34 | Math24 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-120.0, 5080.0) 35 | Math25 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 36 | Math27 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 37 | Math28 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 38 | Math29 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 39 | Math26 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 40 | Mix02 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 41 | Mix03 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,180.0, 6020.0) 42 | Math30 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-120.0, 5840.0) 43 | Math31 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-280.0, 5800.0) 44 | Math32 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 5955.6484375) 45 | Math33 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 5775.6484375) 46 | Math34 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 5775.6484375) 47 | Math35 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 5955.6484375) 48 | Reroute11 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1849.2108154296875, 5920.0) 49 | Reroute14 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 50 | Reroute13 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 51 | Reroute12 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 52 | Math36 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-120.0, 6600.0) 53 | Math37 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-280.0, 6560.0) 54 | Math38 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 6715.6484375) 55 | Math39 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 6535.6484375) 56 | Math40 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 6535.6484375) 57 | Math41 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 6715.6484375) 58 | Reroute15 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1849.2108154296875, 6680.0) 59 | Reroute18 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 60 | Reroute17 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 61 | Reroute16 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 62 | Mix04 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,160.0, 6780.0) 63 | Math42 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-120.0, 7340.0) 64 | Math43 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-280.0, 7300.0) 65 | Math44 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 7455.6484375) 66 | Math45 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-600.0, 7275.6484375) 67 | Math46 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 7275.6484375) 68 | Math47 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-440.0, 7455.6484375) 69 | Mix05 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionLinearInterpolate,180.0, 7520.0) 70 | Reroute19 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1849.2108154296875, 7420.0) 71 | Reroute22 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 72 | Reroute21 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 73 | Reroute20 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 74 | Math12 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 75 | Math15 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-920.0, 3460.0) 76 | Math16 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 77 | Math17 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionAdd,-600.0, 3540.0) 78 | Math14 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionDivide,-900.0, 3640.0) 79 | Math13 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 80 | 81 | Position0 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 82 | Color0 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 83 | 84 | Position1 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 85 | Color1 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 86 | 87 | Position2 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 88 | Color2 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 89 | 90 | Position3 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 91 | Color3 = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -1360.0, 5400.0) 92 | 93 | Color4 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 6160.0) 94 | Position4 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 6080.0) 95 | 96 | Color5 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 6920.0) 97 | Position5 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 6840.0) 98 | 99 | Color6 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 7660.0) 100 | Position6 = create_expression(BL_ColorRamp7,unreal.MaterialExpressionFunctionInput,-1360.0, 7580.0) 101 | 102 | Factor = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 103 | 104 | OutputResult = create_expression(BL_ColorRamp7, unreal.MaterialExpressionFunctionOutput,400, 6020) 105 | 106 | ### Loading Material Functions and Textures 107 | 108 | ### Setting Values 109 | Color0.input_name = 'Color0' 110 | Color0.sort_priority = 0 111 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 112 | Color0.use_preview_value_as_default = True 113 | Position0.input_name = 'Position0' 114 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 115 | Position0.sort_priority = 1 116 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 117 | Position0.use_preview_value_as_default = True 118 | 119 | Color1.input_name = 'Color1' 120 | Color1.sort_priority = 2 121 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 122 | Color1.use_preview_value_as_default = True 123 | Position1.input_name = "Position1" 124 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 125 | Position1.sort_priority = 3 126 | Position1.preview_value = (0.125, 0, 0, 1) 127 | Position1.use_preview_value_as_default = True 128 | 129 | Color2.input_name = 'Color2' 130 | Color2.sort_priority = 4 131 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 132 | Color2.use_preview_value_as_default = True 133 | Position2.input_name = "Position2" 134 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 135 | Position2.sort_priority = 5 136 | Position2.preview_value = (0.250, 0, 0, 1) 137 | Position2.use_preview_value_as_default = True 138 | 139 | Color3.input_name = 'Color3' 140 | Color3.sort_priority = 6 141 | Color3.preview_value = (1.0, 1, 0.0, 1) 142 | Color3.use_preview_value_as_default = True 143 | Position3.input_name = "Position3" 144 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 145 | Position3.sort_priority = 7 146 | Position3.preview_value = (0.375, 0, 0, 1) 147 | Position3.use_preview_value_as_default = True 148 | 149 | Color4.input_name = 'Color4' 150 | Color4.sort_priority = 8 151 | Color4.preview_value = (0, 1, 0.0, 1) 152 | Color4.use_preview_value_as_default = True 153 | Position4.input_name = "Position4" 154 | Position4.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 155 | Position4.sort_priority = 9 156 | Position4.preview_value = (0.5, 0, 0, 1) 157 | Position4.use_preview_value_as_default = True 158 | 159 | Color5.input_name = 'Color5' 160 | Color5.sort_priority = 10 161 | Color5.preview_value = (0, 1, 1, 1) 162 | Color5.use_preview_value_as_default = True 163 | Position5.input_name = "Position5" 164 | Position5.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 165 | Position5.sort_priority = 11 166 | Position5.preview_value = (0.625, 0, 0, 1) 167 | Position5.use_preview_value_as_default = True 168 | 169 | Color6.input_name = 'Color6' 170 | Color6.sort_priority = 12 171 | Color6.preview_value = (0, 0, 1, 1) 172 | Color6.use_preview_value_as_default = True 173 | Position6.input_name = "Position6" 174 | Position6.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 175 | Position6.sort_priority = 13 176 | Position6.preview_value = (0.75, 0, 0, 1) 177 | Position6.use_preview_value_as_default = True 178 | 179 | Factor.input_name = 'Factor' 180 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 181 | Factor.sort_priority = 14 182 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 183 | Factor.use_preview_value_as_default = True 184 | 185 | ### Creating Connections 186 | Color1_connection = create_connection(Color1, '', Mix, 'B') 187 | Position1_connection = create_connection(Position1, '', Math12, 'A') 188 | Position1_connection = create_connection(Position1, '', Math13, 'B') 189 | Position1_connection = create_connection(Position1, '', Reroute09, '') 190 | Position1_connection = create_connection(Position1, '', Reroute10, '') 191 | Position1_connection = create_connection(Position1, '', Reroute08, '') 192 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 193 | Position0_connection = create_connection(Position0, '', Math12, 'B') 194 | Position0_connection = create_connection(Position0, '', Math14, 'A') 195 | Position0_connection = create_connection(Position0, '', Math13, 'A') 196 | Color0_connection = create_connection(Color0, '', Mix, 'A') 197 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 198 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 199 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 200 | Math20_connection = create_connection(Math20, '', Math23, 'B') 201 | Math19_connection = create_connection(Math19, '', Math20, 'B') 202 | Math18_connection = create_connection(Math18, '', Math21, 'B') 203 | Math21_connection = create_connection(Math21, '', Math22, 'A') 204 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 205 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 206 | Position2_connection = create_connection(Position2, '', Math18, 'A') 207 | Position2_connection = create_connection(Position2, '', Math19, 'B') 208 | Position2_connection = create_connection(Position2, '', Reroute03, '') 209 | Position2_connection = create_connection(Position2, '', Reroute04, '') 210 | Position2_connection = create_connection(Position2, '', Reroute02, '') 211 | Math22_connection = create_connection(Math22, '', Math23, 'A') 212 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 213 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 214 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 215 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 216 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 217 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 218 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 219 | Reroute05_connection = create_connection(Reroute05, '', Reroute11, '') 220 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 221 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 222 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 223 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 224 | Math25_connection = create_connection(Math25, '', Math24, 'A') 225 | Math27_connection = create_connection(Math27, '', Math26, 'B') 226 | Math28_connection = create_connection(Math28, '', Math29, 'B') 227 | Math29_connection = create_connection(Math29, '', Math25, 'A') 228 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 229 | Math26_connection = create_connection(Math26, '', Math24, 'B') 230 | Mix02_connection = create_connection(Mix02, '', Mix03, 'A') 231 | Position3_connection = create_connection(Position3, '', Math28, 'A') 232 | Position3_connection = create_connection(Position3, '', Math27, 'B') 233 | Position3_connection = create_connection(Position3, '', Reroute14, '') 234 | Position3_connection = create_connection(Position3, '', Reroute13, '') 235 | Position3_connection = create_connection(Position3, '', Reroute12, '') 236 | Mix03_connection = create_connection(Mix03, '', Mix04, 'A') 237 | Math30_connection = create_connection(Math30, '', Mix03, 'Alpha') 238 | Math31_connection = create_connection(Math31, '', Math30, 'A') 239 | Math32_connection = create_connection(Math32, '', Math35, 'B') 240 | Math33_connection = create_connection(Math33, '', Math34, 'B') 241 | Math34_connection = create_connection(Math34, '', Math31, 'A') 242 | Math35_connection = create_connection(Math35, '', Math30, 'B') 243 | Reroute11_connection = create_connection(Reroute11, '', Math31, 'B') 244 | Reroute11_connection = create_connection(Reroute11, '', Reroute15, '') 245 | Reroute14_connection = create_connection(Reroute14, '', Math32, 'A') 246 | Reroute13_connection = create_connection(Reroute13, '', Math33, 'B') 247 | Reroute12_connection = create_connection(Reroute12, '', Math35, 'A') 248 | Color4_connection = create_connection(Color4, '', Mix03, 'B') 249 | Position4_connection = create_connection(Position4, '', Math33, 'A') 250 | Position4_connection = create_connection(Position4, '', Math32, 'B') 251 | Position4_connection = create_connection(Position4, '', Reroute18, '') 252 | Position4_connection = create_connection(Position4, '', Reroute17, '') 253 | Position4_connection = create_connection(Position4, '', Reroute16, '') 254 | Math36_connection = create_connection(Math36, '', Mix04, 'Alpha') 255 | Math37_connection = create_connection(Math37, '', Math36, 'A') 256 | Math38_connection = create_connection(Math38, '', Math41, 'B') 257 | Math39_connection = create_connection(Math39, '', Math40, 'B') 258 | Math40_connection = create_connection(Math40, '', Math37, 'A') 259 | Math41_connection = create_connection(Math41, '', Math36, 'B') 260 | Reroute15_connection = create_connection(Reroute15, '', Math37, 'B') 261 | Reroute15_connection = create_connection(Reroute15, '', Reroute19, '') 262 | Reroute18_connection = create_connection(Reroute18, '', Math38, 'A') 263 | Reroute17_connection = create_connection(Reroute17, '', Math39, 'B') 264 | Reroute16_connection = create_connection(Reroute16, '', Math41, 'A') 265 | Mix04_connection = create_connection(Mix04, '', Mix05, 'A') 266 | Color5_connection = create_connection(Color5, '', Mix04, 'B') 267 | Position5_connection = create_connection(Position5, '', Math39, 'A') 268 | Position5_connection = create_connection(Position5, '', Math38, 'B') 269 | Position5_connection = create_connection(Position5, '', Reroute22, '') 270 | Position5_connection = create_connection(Position5, '', Reroute21, '') 271 | Position5_connection = create_connection(Position5, '', Reroute20, '') 272 | Math42_connection = create_connection(Math42, '', Mix05, 'Alpha') 273 | Math43_connection = create_connection(Math43, '', Math42, 'A') 274 | Math44_connection = create_connection(Math44, '', Math47, 'B') 275 | Math45_connection = create_connection(Math45, '', Math46, 'B') 276 | Math46_connection = create_connection(Math46, '', Math43, 'A') 277 | Math47_connection = create_connection(Math47, '', Math42, 'B') 278 | Reroute19_connection = create_connection(Reroute19, '', Math43, 'B') 279 | Reroute22_connection = create_connection(Reroute22, '', Math44, 'A') 280 | Reroute21_connection = create_connection(Reroute21, '', Math45, 'B') 281 | Reroute20_connection = create_connection(Reroute20, '', Math47, 'A') 282 | Color6_connection = create_connection(Color6, '', Mix05, 'B') 283 | Position6_connection = create_connection(Position6, '', Math45, 'A') 284 | Position6_connection = create_connection(Position6, '', Math44, 'B') 285 | Factor_connection = create_connection(Factor, '', Reroute01, '') 286 | Math12_connection = create_connection(Math12, '', Math15, 'B') 287 | Math15_connection = create_connection(Math15, '', Math16, 'A') 288 | Math16_connection = create_connection(Math16, '', Math17, 'A') 289 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 290 | Math14_connection = create_connection(Math14, '', Math17, 'B') 291 | Math13_connection = create_connection(Math13, '', Math14, 'B') 292 | 293 | Mix05_connection = create_connection(Mix05, '', OutputResult, '') 294 | 295 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp8_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp8 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp8', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp8.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp8.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Mix = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 17 | Reroute01 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 18 | Math20 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 19 | Math19 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 20 | Math18 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 21 | Math21 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 22 | Mix01 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 23 | Math22 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 24 | Reroute10 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 25 | Reroute09 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 26 | Reroute08 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 27 | Math23 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-320.0, 4320.0) 28 | Reroute06 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 29 | Reroute07 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 30 | Reroute05 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 31 | Reroute02 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-960.0, 5080.0) 32 | Reroute03 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-960.0, 5080.0) 33 | Reroute04 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-960.0, 5080.0) 34 | Math24 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-120.0, 5080.0) 35 | Math25 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 36 | Math27 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 37 | Math28 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 38 | Math29 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 39 | Math26 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 40 | Mix02 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 41 | Mix03 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,180.0, 6020.0) 42 | Math30 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-120.0, 5840.0) 43 | Math31 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-280.0, 5800.0) 44 | Math32 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 5955.6484375) 45 | Math33 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 5775.6484375) 46 | Math34 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 5775.6484375) 47 | Math35 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 5955.6484375) 48 | Reroute11 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1849.2108154296875, 5920.0) 49 | Reroute14 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 50 | Reroute13 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 51 | Reroute12 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 52 | Math36 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-120.0, 6600.0) 53 | Math37 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-280.0, 6560.0) 54 | Math38 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 6715.6484375) 55 | Math39 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 6535.6484375) 56 | Math40 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 6535.6484375) 57 | Math41 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 6715.6484375) 58 | Reroute15 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1849.2108154296875, 6680.0) 59 | Reroute18 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 60 | Reroute17 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 61 | Reroute16 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 62 | Mix04 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,160.0, 6780.0) 63 | Math42 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-120.0, 7340.0) 64 | Math43 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-280.0, 7300.0) 65 | Math44 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 7455.6484375) 66 | Math45 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 7275.6484375) 67 | Math46 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 7275.6484375) 68 | Math47 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 7455.6484375) 69 | Mix05 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,180.0, 7520.0) 70 | Reroute19 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1849.2108154296875, 7420.0) 71 | Reroute22 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 72 | Reroute21 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 73 | Reroute20 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 74 | Math48 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-120.0, 8060.0) 75 | Math49 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-280.0, 8020.0) 76 | Math50 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 8175.6484375) 77 | Math51 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-600.0, 7995.6484375) 78 | Math52 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 7995.6484375) 79 | Math53 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-440.0, 8175.6484375) 80 | Reroute26 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 81 | Reroute25 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 82 | Reroute24 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 83 | Reroute23 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionReroute,-1849.2108154296875, 8140.0) 84 | Mix06 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionLinearInterpolate,180.0, 8240.0) 85 | Math12 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionSubtract,-1080.0, 3460.0) 86 | Math15 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-920.0, 3460.0) 87 | Math16 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionMultiply,-760.0, 3480.0) 88 | Math17 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionAdd,-600.0, 3540.0) 89 | Math14 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionDivide,-900.0, 3640.0) 90 | Math13 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionSubtract, -1080.0, 3640.0) 91 | 92 | Position0 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 93 | Color0 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 94 | 95 | Position1 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 96 | Color1 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 97 | 98 | Position2 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 99 | Color2 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 100 | 101 | Position3 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 102 | Color3 = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -1360.0, 5400.0) 103 | 104 | Color4 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 6160.0) 105 | Position4 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 6080.0) 106 | 107 | Color5 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 6920.0) 108 | Position5 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 6840.0) 109 | 110 | Color6 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 7660.0) 111 | Position6 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 7580.0) 112 | 113 | Color7 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 8380.0) 114 | Position7 = create_expression(BL_ColorRamp8,unreal.MaterialExpressionFunctionInput,-1360.0, 8300.0) 115 | 116 | Factor = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 117 | 118 | OutputResult = create_expression(BL_ColorRamp8, unreal.MaterialExpressionFunctionOutput,400, 6020) 119 | 120 | ### Loading Material Functions and Textures 121 | 122 | ### Setting Values 123 | Color0.input_name = 'Color0' 124 | Color0.sort_priority = 0 125 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 126 | Color0.use_preview_value_as_default = True 127 | Position0.input_name = 'Position0' 128 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 129 | Position0.sort_priority = 1 130 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 131 | Position0.use_preview_value_as_default = True 132 | 133 | Color1.input_name = 'Color1' 134 | Color1.sort_priority = 2 135 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 136 | Color1.use_preview_value_as_default = True 137 | Position1.input_name = "Position1" 138 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 139 | Position1.sort_priority = 3 140 | Position1.preview_value = (0.125, 0, 0, 1) 141 | Position1.use_preview_value_as_default = True 142 | 143 | Color2.input_name = 'Color2' 144 | Color2.sort_priority = 4 145 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 146 | Color2.use_preview_value_as_default = True 147 | Position2.input_name = "Position2" 148 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 149 | Position2.sort_priority = 5 150 | Position2.preview_value = (0.250, 0, 0, 1) 151 | Position2.use_preview_value_as_default = True 152 | 153 | Color3.input_name = 'Color3' 154 | Color3.sort_priority = 6 155 | Color3.preview_value = (1.0, 1, 0.0, 1) 156 | Color3.use_preview_value_as_default = True 157 | Position3.input_name = "Position3" 158 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 159 | Position3.sort_priority = 7 160 | Position3.preview_value = (0.375, 0, 0, 1) 161 | Position3.use_preview_value_as_default = True 162 | 163 | Color4.input_name = 'Color4' 164 | Color4.sort_priority = 8 165 | Color4.preview_value = (0, 1, 0.0, 1) 166 | Color4.use_preview_value_as_default = True 167 | Position4.input_name = "Position4" 168 | Position4.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 169 | Position4.sort_priority = 9 170 | Position4.preview_value = (0.5, 0, 0, 1) 171 | Position4.use_preview_value_as_default = True 172 | 173 | Color5.input_name = 'Color5' 174 | Color5.sort_priority = 10 175 | Color5.preview_value = (0, 1, 1, 1) 176 | Color5.use_preview_value_as_default = True 177 | Position5.input_name = "Position5" 178 | Position5.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 179 | Position5.sort_priority = 11 180 | Position5.preview_value = (0.625, 0, 0, 1) 181 | Position5.use_preview_value_as_default = True 182 | 183 | Color6.input_name = 'Color6' 184 | Color6.sort_priority = 12 185 | Color6.preview_value = (0, 0, 1, 1) 186 | Color6.use_preview_value_as_default = True 187 | Position6.input_name = "Position6" 188 | Position6.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 189 | Position6.sort_priority = 13 190 | Position6.preview_value = (0.75, 0, 0, 1) 191 | Position6.use_preview_value_as_default = True 192 | 193 | Color7.input_name = 'Color7' 194 | Color7.sort_priority = 14 195 | Color7.preview_value = (1, 0, 1, 1) 196 | Color7.use_preview_value_as_default = True 197 | Position7.input_name = "Position7" 198 | Position7.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 199 | Position7.sort_priority = 15 200 | Position7.preview_value = (0.875, 0, 0, 1) 201 | Position7.use_preview_value_as_default = True 202 | 203 | Factor.input_name = 'Factor' 204 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 205 | Factor.sort_priority = 16 206 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 207 | Factor.use_preview_value_as_default = True 208 | 209 | ### Creating Connections 210 | Color1_connection = create_connection(Color1, '', Mix, 'B') 211 | Position1_connection = create_connection(Position1, '', Math12, 'A') 212 | Position1_connection = create_connection(Position1, '', Math13, 'B') 213 | Position1_connection = create_connection(Position1, '', Reroute09, '') 214 | Position1_connection = create_connection(Position1, '', Reroute10, '') 215 | Position1_connection = create_connection(Position1, '', Reroute08, '') 216 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 217 | Position0_connection = create_connection(Position0, '', Math12, 'B') 218 | Position0_connection = create_connection(Position0, '', Math14, 'A') 219 | Position0_connection = create_connection(Position0, '', Math13, 'A') 220 | Color0_connection = create_connection(Color0, '', Mix, 'A') 221 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 222 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 223 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 224 | Math20_connection = create_connection(Math20, '', Math23, 'B') 225 | Math19_connection = create_connection(Math19, '', Math20, 'B') 226 | Math18_connection = create_connection(Math18, '', Math21, 'B') 227 | Math21_connection = create_connection(Math21, '', Math22, 'A') 228 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 229 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 230 | Position2_connection = create_connection(Position2, '', Math18, 'A') 231 | Position2_connection = create_connection(Position2, '', Math19, 'B') 232 | Position2_connection = create_connection(Position2, '', Reroute03, '') 233 | Position2_connection = create_connection(Position2, '', Reroute04, '') 234 | Position2_connection = create_connection(Position2, '', Reroute02, '') 235 | Math22_connection = create_connection(Math22, '', Math23, 'A') 236 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 237 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 238 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 239 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 240 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 241 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 242 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 243 | Reroute05_connection = create_connection(Reroute05, '', Reroute11, '') 244 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 245 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 246 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 247 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 248 | Math25_connection = create_connection(Math25, '', Math24, 'A') 249 | Math27_connection = create_connection(Math27, '', Math26, 'B') 250 | Math28_connection = create_connection(Math28, '', Math29, 'B') 251 | Math29_connection = create_connection(Math29, '', Math25, 'A') 252 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 253 | Math26_connection = create_connection(Math26, '', Math24, 'B') 254 | Mix02_connection = create_connection(Mix02, '', Mix03, 'A') 255 | Position3_connection = create_connection(Position3, '', Math28, 'A') 256 | Position3_connection = create_connection(Position3, '', Math27, 'B') 257 | Position3_connection = create_connection(Position3, '', Reroute14, '') 258 | Position3_connection = create_connection(Position3, '', Reroute13, '') 259 | Position3_connection = create_connection(Position3, '', Reroute12, '') 260 | Mix03_connection = create_connection(Mix03, '', Mix04, 'A') 261 | Math30_connection = create_connection(Math30, '', Mix03, 'Alpha') 262 | Math31_connection = create_connection(Math31, '', Math30, 'A') 263 | Math32_connection = create_connection(Math32, '', Math35, 'B') 264 | Math33_connection = create_connection(Math33, '', Math34, 'B') 265 | Math34_connection = create_connection(Math34, '', Math31, 'A') 266 | Math35_connection = create_connection(Math35, '', Math30, 'B') 267 | Reroute11_connection = create_connection(Reroute11, '', Math31, 'B') 268 | Reroute11_connection = create_connection(Reroute11, '', Reroute15, '') 269 | Reroute14_connection = create_connection(Reroute14, '', Math32, 'A') 270 | Reroute13_connection = create_connection(Reroute13, '', Math33, 'B') 271 | Reroute12_connection = create_connection(Reroute12, '', Math35, 'A') 272 | Color4_connection = create_connection(Color4, '', Mix03, 'B') 273 | Position4_connection = create_connection(Position4, '', Math33, 'A') 274 | Position4_connection = create_connection(Position4, '', Math32, 'B') 275 | Position4_connection = create_connection(Position4, '', Reroute18, '') 276 | Position4_connection = create_connection(Position4, '', Reroute17, '') 277 | Position4_connection = create_connection(Position4, '', Reroute16, '') 278 | Math36_connection = create_connection(Math36, '', Mix04, 'Alpha') 279 | Math37_connection = create_connection(Math37, '', Math36, 'A') 280 | Math38_connection = create_connection(Math38, '', Math41, 'B') 281 | Math39_connection = create_connection(Math39, '', Math40, 'B') 282 | Math40_connection = create_connection(Math40, '', Math37, 'A') 283 | Math41_connection = create_connection(Math41, '', Math36, 'B') 284 | Reroute15_connection = create_connection(Reroute15, '', Math37, 'B') 285 | Reroute15_connection = create_connection(Reroute15, '', Reroute19, '') 286 | Reroute18_connection = create_connection(Reroute18, '', Math38, 'A') 287 | Reroute17_connection = create_connection(Reroute17, '', Math39, 'B') 288 | Reroute16_connection = create_connection(Reroute16, '', Math41, 'A') 289 | Mix04_connection = create_connection(Mix04, '', Mix05, 'A') 290 | Color5_connection = create_connection(Color5, '', Mix04, 'B') 291 | Position5_connection = create_connection(Position5, '', Math39, 'A') 292 | Position5_connection = create_connection(Position5, '', Math38, 'B') 293 | Position5_connection = create_connection(Position5, '', Reroute22, '') 294 | Position5_connection = create_connection(Position5, '', Reroute21, '') 295 | Position5_connection = create_connection(Position5, '', Reroute20, '') 296 | Math42_connection = create_connection(Math42, '', Mix05, 'Alpha') 297 | Math43_connection = create_connection(Math43, '', Math42, 'A') 298 | Math44_connection = create_connection(Math44, '', Math47, 'B') 299 | Math45_connection = create_connection(Math45, '', Math46, 'B') 300 | Math46_connection = create_connection(Math46, '', Math43, 'A') 301 | Math47_connection = create_connection(Math47, '', Math42, 'B') 302 | Mix05_connection = create_connection(Mix05, '', Mix06, 'A') 303 | Reroute19_connection = create_connection(Reroute19, '', Math43, 'B') 304 | Reroute19_connection = create_connection(Reroute19, '', Reroute23, '') 305 | Reroute22_connection = create_connection(Reroute22, '', Math44, 'A') 306 | Reroute21_connection = create_connection(Reroute21, '', Math45, 'B') 307 | Reroute20_connection = create_connection(Reroute20, '', Math47, 'A') 308 | Color6_connection = create_connection(Color6, '', Mix05, 'B') 309 | Position6_connection = create_connection(Position6, '', Math45, 'A') 310 | Position6_connection = create_connection(Position6, '', Math44, 'B') 311 | Position6_connection = create_connection(Position6, '', Reroute26, '') 312 | Position6_connection = create_connection(Position6, '', Reroute25, '') 313 | Position6_connection = create_connection(Position6, '', Reroute24, '') 314 | Math48_connection = create_connection(Math48, '', Mix06, 'Alpha') 315 | Math49_connection = create_connection(Math49, '', Math48, 'A') 316 | Math50_connection = create_connection(Math50, '', Math53, 'B') 317 | Math51_connection = create_connection(Math51, '', Math52, 'B') 318 | Math52_connection = create_connection(Math52, '', Math49, 'A') 319 | Math53_connection = create_connection(Math53, '', Math48, 'B') 320 | Reroute26_connection = create_connection(Reroute26, '', Math50, 'A') 321 | Reroute25_connection = create_connection(Reroute25, '', Math51, 'B') 322 | Reroute24_connection = create_connection(Reroute24, '', Math53, 'A') 323 | Reroute23_connection = create_connection(Reroute23, '', Math49, 'B') 324 | Color7_connection = create_connection(Color7, '', Mix06, 'B') 325 | Position7_connection = create_connection(Position7, '', Math51, 'A') 326 | Position7_connection = create_connection(Position7, '', Math50, 'B') 327 | Factor_connection = create_connection(Factor, '', Reroute01, '') 328 | Math12_connection = create_connection(Math12, '', Math15, 'B') 329 | Math15_connection = create_connection(Math15, '', Math16, 'A') 330 | Math16_connection = create_connection(Math16, '', Math17, 'A') 331 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 332 | Math14_connection = create_connection(Math14, '', Math17, 'B') 333 | Math13_connection = create_connection(Math13, '', Math14, 'B') 334 | 335 | Mix06_connection = create_connection(Mix06, '', OutputResult, '') 336 | 337 | update_function() -------------------------------------------------------------------------------- /BL_ColorRamp9_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_ColorRamp9 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp9', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_ColorRamp9.set_editor_property("expose_to_library", True) 5 | BL_ColorRamp9.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 14 | 15 | ### Creating Nodes 16 | Math12 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-1060.0, 3200.0) 17 | Math15 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-900.0, 3200.0) 18 | Mix = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,-340.0, 3620.0) 19 | Math16 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-740.0, 3220.0) 20 | Math17 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-580.0, 3280.0) 21 | Math14 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-880.0, 3380.0) 22 | Math13 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-1040.0, 3520.0) 23 | Reroute01 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1840.0, 3360.0) 24 | Math20 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-640.0, 4415.648193359375) 25 | Math19 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-800.0, 4415.648193359375) 26 | Math18 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-800.0, 4235.648193359375) 27 | Math21 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-640.0, 4235.648193359375) 28 | Mix01 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,-20.0, 4480.0) 29 | Math22 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-480.0, 4260.0) 30 | Reroute10 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 31 | Reroute09 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 32 | Reroute08 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1120.0, 4360.0) 33 | Math23 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-320.0, 4320.0) 34 | Reroute06 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 35 | Reroute07 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1840.0, 4400.0) 36 | Reroute05 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 5160.0) 37 | Reroute02 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-960.0, 5080.0) 38 | Reroute03 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-960.0, 5080.0) 39 | Reroute04 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-960.0, 5080.0) 40 | Math24 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 5080.0) 41 | Math25 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 5040.0) 42 | Math27 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 5195.648193359375) 43 | Math28 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 5015.648193359375) 44 | Math29 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 5015.648193359375) 45 | Math26 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 5195.648193359375) 46 | Mix02 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,100.0, 5180.0) 47 | Mix03 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,180.0, 6020.0) 48 | Math30 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 5840.0) 49 | Math31 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 5800.0) 50 | Math32 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 5955.6484375) 51 | Math33 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 5775.6484375) 52 | Math34 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 5775.6484375) 53 | Math35 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 5955.6484375) 54 | Reroute11 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 5920.0) 55 | Reroute14 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 56 | Reroute13 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 57 | Reroute12 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 5880.0) 58 | Math36 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 6600.0) 59 | Math37 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 6560.0) 60 | Math38 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 6715.6484375) 61 | Math39 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 6535.6484375) 62 | Math40 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 6535.6484375) 63 | Math41 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 6715.6484375) 64 | Reroute15 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 6680.0) 65 | Reroute18 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 66 | Reroute17 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 67 | Reroute16 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1040.0, 6640.0) 68 | Mix04 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,160.0, 6780.0) 69 | Math42 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 7340.0) 70 | Math43 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 7300.0) 71 | Math44 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 7455.6484375) 72 | Math45 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 7275.6484375) 73 | Math46 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 7275.6484375) 74 | Math47 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 7455.6484375) 75 | Mix05 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,180.0, 7520.0) 76 | Reroute19 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 7420.0) 77 | Reroute22 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 78 | Reroute21 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 79 | Reroute20 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1020.0, 7380.0) 80 | Math48 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 8060.0) 81 | Math49 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 8020.0) 82 | Math50 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 8175.6484375) 83 | Math51 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 7995.6484375) 84 | Math52 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 7995.6484375) 85 | Math53 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 8175.6484375) 86 | Reroute26 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 87 | Reroute25 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 88 | Reroute24 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1080.0, 8080.0) 89 | Reroute23 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 8140.0) 90 | Mix06 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionLinearInterpolate,180.0, 8240.0) 91 | Math54 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionAdd,-120.0, 8780.0) 92 | Math55 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionMultiply,-280.0, 8740.0) 93 | Math56 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 8895.6484375) 94 | Math57 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionSubtract,-600.0, 8715.6484375) 95 | Math58 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 8715.6484375) 96 | Math59 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionDivide,-440.0, 8895.6484375) 97 | Reroute27 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1849.2108154296875, 8860.0) 98 | Reroute30 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1140.0, 8820.0) 99 | Reroute29 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1140.0, 8820.0) 100 | Reroute28 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionReroute,-1140.0, 8820.0) 101 | Mix07 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionLinearInterpolate, 180.0, 8960.0) 102 | 103 | Position0 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1580.0, 3540.0) 104 | Color0 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1580.0, 3620.0) 105 | 106 | Position1 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1580.0, 3800.0) 107 | Color1 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1580.0, 3880.0) 108 | 109 | Position2 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1560.0, 4540.0) 110 | Color2 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1560.0, 4620.0) 111 | 112 | Position3 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1360.0, 5320.0) 113 | Color3 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1360.0, 5400.0) 114 | 115 | Color4 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 6160.0) 116 | Position4 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 6080.0) 117 | 118 | Color5 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 6920.0) 119 | Position5 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 6840.0) 120 | 121 | Color6 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 7660.0) 122 | Position6 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 7580.0) 123 | 124 | Color7 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 8380.0) 125 | Position7 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 8300.0) 126 | 127 | Color8 = create_expression(BL_ColorRamp9,unreal.MaterialExpressionFunctionInput,-1360.0, 9100.0) 128 | Position8 = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -1360.0, 9020.0) 129 | 130 | Factor = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionInput, -2200.0, 3320.0) 131 | 132 | OutputResult = create_expression(BL_ColorRamp9, unreal.MaterialExpressionFunctionOutput,400, 6020) 133 | 134 | ### Loading Material Functions and Textures 135 | 136 | ### Setting Values 137 | Color0.input_name = 'Color0' 138 | Color0.sort_priority = 0 139 | Color0.preview_value = (0.0, 0.0, 0.0, 1.0) 140 | Color0.use_preview_value_as_default = True 141 | Position0.input_name = 'Position0' 142 | Position0.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 143 | Position0.sort_priority = 1 144 | Position0.preview_value = (0.0, 0.0, 0.0, 1.0) 145 | Position0.use_preview_value_as_default = True 146 | 147 | Color1.input_name = 'Color1' 148 | Color1.sort_priority = 2 149 | Color1.preview_value = (1.0, 0.0, 0.0, 1.0) 150 | Color1.use_preview_value_as_default = True 151 | Position1.input_name = "Position1" 152 | Position1.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 153 | Position1.sort_priority = 3 154 | Position1.preview_value = (0.125, 0, 0, 1) 155 | Position1.use_preview_value_as_default = True 156 | 157 | Color2.input_name = 'Color2' 158 | Color2.sort_priority = 4 159 | Color2.preview_value = (1.0, 0.5, 0.0, 1) 160 | Color2.use_preview_value_as_default = True 161 | Position2.input_name = "Position2" 162 | Position2.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 163 | Position2.sort_priority = 5 164 | Position2.preview_value = (0.250, 0, 0, 1) 165 | Position2.use_preview_value_as_default = True 166 | 167 | Color3.input_name = 'Color3' 168 | Color3.sort_priority = 6 169 | Color3.preview_value = (1.0, 1, 0.0, 1) 170 | Color3.use_preview_value_as_default = True 171 | Position3.input_name = "Position3" 172 | Position3.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 173 | Position3.sort_priority = 7 174 | Position3.preview_value = (0.375, 0, 0, 1) 175 | Position3.use_preview_value_as_default = True 176 | 177 | Color4.input_name = 'Color4' 178 | Color4.sort_priority = 8 179 | Color4.preview_value = (0, 1, 0.0, 1) 180 | Color4.use_preview_value_as_default = True 181 | Position4.input_name = "Position4" 182 | Position4.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 183 | Position4.sort_priority = 9 184 | Position4.preview_value = (0.5, 0, 0, 1) 185 | Position4.use_preview_value_as_default = True 186 | 187 | Color5.input_name = 'Color5' 188 | Color5.sort_priority = 10 189 | Color5.preview_value = (0, 1, 1, 1) 190 | Color5.use_preview_value_as_default = True 191 | Position5.input_name = "Position5" 192 | Position5.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 193 | Position5.sort_priority = 11 194 | Position5.preview_value = (0.625, 0, 0, 1) 195 | Position5.use_preview_value_as_default = True 196 | 197 | Color6.input_name = 'Color6' 198 | Color6.sort_priority = 12 199 | Color6.preview_value = (0, 0, 1, 1) 200 | Color6.use_preview_value_as_default = True 201 | Position6.input_name = "Position6" 202 | Position6.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 203 | Position6.sort_priority = 13 204 | Position6.preview_value = (0.75, 0, 0, 1) 205 | Position6.use_preview_value_as_default = True 206 | 207 | Color7.input_name = 'Color7' 208 | Color7.sort_priority = 14 209 | Color7.preview_value = (1, 0, 1, 1) 210 | Color7.use_preview_value_as_default = True 211 | Position7.input_name = "Position7" 212 | Position7.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 213 | Position7.sort_priority = 15 214 | Position7.preview_value = (0.875, 0, 0, 1) 215 | Position7.use_preview_value_as_default = True 216 | 217 | Color8.input_name = 'Color8' 218 | Color8.sort_priority = 16 219 | Color8.preview_value = (1, 1, 1, 1) 220 | Color8.use_preview_value_as_default = True 221 | Position8.input_name = "Position8" 222 | Position8.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 223 | Position8.sort_priority = 17 224 | Position8.preview_value = (1, 0, 0, 1) 225 | Position8.use_preview_value_as_default = True 226 | 227 | Factor.input_name = 'Factor' 228 | Factor.input_type = unreal.FunctionInputType.FUNCTION_INPUT_SCALAR 229 | Factor.sort_priority = 18 230 | Factor.preview_value = (0.0, 0.0, 0.0, 1.0) 231 | Factor.use_preview_value_as_default = True 232 | 233 | ### Creating Connections 234 | Math12_connection = create_connection(Math12, '', Math15, 'B') 235 | Math15_connection = create_connection(Math15, '', Math16, 'A') 236 | Color1_connection = create_connection(Color1, '', Mix, 'B') 237 | Position1_connection = create_connection(Position1, '', Math12, 'A') 238 | Position1_connection = create_connection(Position1, '', Math13, 'B') 239 | Position1_connection = create_connection(Position1, '', Reroute09, '') 240 | Position1_connection = create_connection(Position1, '', Reroute10, '') 241 | Position1_connection = create_connection(Position1, '', Reroute08, '') 242 | Mix_connection = create_connection(Mix, '', Mix01, 'A') 243 | Math16_connection = create_connection(Math16, '', Math17, 'A') 244 | Math17_connection = create_connection(Math17, '', Mix, 'Alpha') 245 | Position0_connection = create_connection(Position0, '', Math12, 'B') 246 | Position0_connection = create_connection(Position0, '', Math14, 'A') 247 | Position0_connection = create_connection(Position0, '', Math13, 'A') 248 | Color0_connection = create_connection(Color0, '', Mix, 'A') 249 | Math14_connection = create_connection(Math14, '', Math17, 'B') 250 | Math13_connection = create_connection(Math13, '', Math14, 'B') 251 | Reroute01_connection = create_connection(Reroute01, '', Reroute06, '') 252 | Reroute01_connection = create_connection(Reroute01, '', Math16, 'B') 253 | Reroute01_connection = create_connection(Reroute01, '', Reroute07, '') 254 | Math20_connection = create_connection(Math20, '', Math23, 'B') 255 | Math19_connection = create_connection(Math19, '', Math20, 'B') 256 | Math18_connection = create_connection(Math18, '', Math21, 'B') 257 | Math21_connection = create_connection(Math21, '', Math22, 'A') 258 | Color2_connection = create_connection(Color2, '', Mix01, 'B') 259 | Mix01_connection = create_connection(Mix01, '', Mix02, 'A') 260 | Position2_connection = create_connection(Position2, '', Math18, 'A') 261 | Position2_connection = create_connection(Position2, '', Math19, 'B') 262 | Position2_connection = create_connection(Position2, '', Reroute03, '') 263 | Position2_connection = create_connection(Position2, '', Reroute04, '') 264 | Position2_connection = create_connection(Position2, '', Reroute02, '') 265 | Math22_connection = create_connection(Math22, '', Math23, 'A') 266 | Reroute10_connection = create_connection(Reroute10, '', Math20, 'A') 267 | Reroute09_connection = create_connection(Reroute09, '', Math18, 'B') 268 | Reroute08_connection = create_connection(Reroute08, '', Math19, 'A') 269 | Math23_connection = create_connection(Math23, '', Mix01, 'Alpha') 270 | Reroute06_connection = create_connection(Reroute06, '', Math22, 'B') 271 | Reroute07_connection = create_connection(Reroute07, '', Reroute05, '') 272 | Reroute05_connection = create_connection(Reroute05, '', Math25, 'B') 273 | Reroute05_connection = create_connection(Reroute05, '', Reroute11, '') 274 | Reroute02_connection = create_connection(Reroute02, '', Math26, 'A') 275 | Reroute03_connection = create_connection(Reroute03, '', Math28, 'B') 276 | Reroute04_connection = create_connection(Reroute04, '', Math27, 'A') 277 | Math24_connection = create_connection(Math24, '', Mix02, 'Alpha') 278 | Math25_connection = create_connection(Math25, '', Math24, 'A') 279 | Math27_connection = create_connection(Math27, '', Math26, 'B') 280 | Math28_connection = create_connection(Math28, '', Math29, 'B') 281 | Math29_connection = create_connection(Math29, '', Math25, 'A') 282 | Color3_connection = create_connection(Color3, '', Mix02, 'B') 283 | Math26_connection = create_connection(Math26, '', Math24, 'B') 284 | Mix02_connection = create_connection(Mix02, '', Mix03, 'A') 285 | Position3_connection = create_connection(Position3, '', Math28, 'A') 286 | Position3_connection = create_connection(Position3, '', Math27, 'B') 287 | Position3_connection = create_connection(Position3, '', Reroute14, '') 288 | Position3_connection = create_connection(Position3, '', Reroute13, '') 289 | Position3_connection = create_connection(Position3, '', Reroute12, '') 290 | Mix03_connection = create_connection(Mix03, '', Mix04, 'A') 291 | Math30_connection = create_connection(Math30, '', Mix03, 'Alpha') 292 | Math31_connection = create_connection(Math31, '', Math30, 'A') 293 | Math32_connection = create_connection(Math32, '', Math35, 'B') 294 | Math33_connection = create_connection(Math33, '', Math34, 'B') 295 | Math34_connection = create_connection(Math34, '', Math31, 'A') 296 | Math35_connection = create_connection(Math35, '', Math30, 'B') 297 | Reroute11_connection = create_connection(Reroute11, '', Math31, 'B') 298 | Reroute11_connection = create_connection(Reroute11, '', Reroute15, '') 299 | Reroute14_connection = create_connection(Reroute14, '', Math32, 'A') 300 | Reroute13_connection = create_connection(Reroute13, '', Math33, 'B') 301 | Reroute12_connection = create_connection(Reroute12, '', Math35, 'A') 302 | Color4_connection = create_connection(Color4, '', Mix03, 'B') 303 | Position4_connection = create_connection(Position4, '', Math33, 'A') 304 | Position4_connection = create_connection(Position4, '', Math32, 'B') 305 | Position4_connection = create_connection(Position4, '', Reroute18, '') 306 | Position4_connection = create_connection(Position4, '', Reroute17, '') 307 | Position4_connection = create_connection(Position4, '', Reroute16, '') 308 | Math36_connection = create_connection(Math36, '', Mix04, 'Alpha') 309 | Math37_connection = create_connection(Math37, '', Math36, 'A') 310 | Math38_connection = create_connection(Math38, '', Math41, 'B') 311 | Math39_connection = create_connection(Math39, '', Math40, 'B') 312 | Math40_connection = create_connection(Math40, '', Math37, 'A') 313 | Math41_connection = create_connection(Math41, '', Math36, 'B') 314 | Reroute15_connection = create_connection(Reroute15, '', Math37, 'B') 315 | Reroute15_connection = create_connection(Reroute15, '', Reroute19, '') 316 | Reroute18_connection = create_connection(Reroute18, '', Math38, 'A') 317 | Reroute17_connection = create_connection(Reroute17, '', Math39, 'B') 318 | Reroute16_connection = create_connection(Reroute16, '', Math41, 'A') 319 | Mix04_connection = create_connection(Mix04, '', Mix05, 'A') 320 | Color5_connection = create_connection(Color5, '', Mix04, 'B') 321 | Position5_connection = create_connection(Position5, '', Math39, 'A') 322 | Position5_connection = create_connection(Position5, '', Math38, 'B') 323 | Position5_connection = create_connection(Position5, '', Reroute22, '') 324 | Position5_connection = create_connection(Position5, '', Reroute21, '') 325 | Position5_connection = create_connection(Position5, '', Reroute20, '') 326 | Math42_connection = create_connection(Math42, '', Mix05, 'Alpha') 327 | Math43_connection = create_connection(Math43, '', Math42, 'A') 328 | Math44_connection = create_connection(Math44, '', Math47, 'B') 329 | Math45_connection = create_connection(Math45, '', Math46, 'B') 330 | Math46_connection = create_connection(Math46, '', Math43, 'A') 331 | Math47_connection = create_connection(Math47, '', Math42, 'B') 332 | Mix05_connection = create_connection(Mix05, '', Mix06, 'A') 333 | Reroute19_connection = create_connection(Reroute19, '', Math43, 'B') 334 | Reroute19_connection = create_connection(Reroute19, '', Reroute23, '') 335 | Reroute22_connection = create_connection(Reroute22, '', Math44, 'A') 336 | Reroute21_connection = create_connection(Reroute21, '', Math45, 'B') 337 | Reroute20_connection = create_connection(Reroute20, '', Math47, 'A') 338 | Color6_connection = create_connection(Color6, '', Mix05, 'B') 339 | Position6_connection = create_connection(Position6, '', Math45, 'A') 340 | Position6_connection = create_connection(Position6, '', Math44, 'B') 341 | Position6_connection = create_connection(Position6, '', Reroute26, '') 342 | Position6_connection = create_connection(Position6, '', Reroute25, '') 343 | Position6_connection = create_connection(Position6, '', Reroute24, '') 344 | Math48_connection = create_connection(Math48, '', Mix06, 'Alpha') 345 | Math49_connection = create_connection(Math49, '', Math48, 'A') 346 | Math50_connection = create_connection(Math50, '', Math53, 'B') 347 | Math51_connection = create_connection(Math51, '', Math52, 'B') 348 | Math52_connection = create_connection(Math52, '', Math49, 'A') 349 | Math53_connection = create_connection(Math53, '', Math48, 'B') 350 | Reroute26_connection = create_connection(Reroute26, '', Math50, 'A') 351 | Reroute25_connection = create_connection(Reroute25, '', Math51, 'B') 352 | Reroute24_connection = create_connection(Reroute24, '', Math53, 'A') 353 | Reroute23_connection = create_connection(Reroute23, '', Math49, 'B') 354 | Reroute23_connection = create_connection(Reroute23, '', Reroute27, '') 355 | Mix06_connection = create_connection(Mix06, '', Mix07, 'A') 356 | Color7_connection = create_connection(Color7, '', Mix06, 'B') 357 | Position7_connection = create_connection(Position7, '', Math51, 'A') 358 | Position7_connection = create_connection(Position7, '', Math50, 'B') 359 | Position7_connection = create_connection(Position7, '', Reroute30, '') 360 | Position7_connection = create_connection(Position7, '', Reroute29, '') 361 | Position7_connection = create_connection(Position7, '', Reroute28, '') 362 | Math54_connection = create_connection(Math54, '', Mix07, 'Alpha') 363 | Math55_connection = create_connection(Math55, '', Math54, 'A') 364 | Math56_connection = create_connection(Math56, '', Math59, 'B') 365 | Math57_connection = create_connection(Math57, '', Math58, 'B') 366 | Math58_connection = create_connection(Math58, '', Math55, 'A') 367 | Math59_connection = create_connection(Math59, '', Math54, 'B') 368 | Reroute27_connection = create_connection(Reroute27, '', Math55, 'B') 369 | Reroute30_connection = create_connection(Reroute30, '', Math59, 'A') 370 | Reroute29_connection = create_connection(Reroute29, '', Math57, 'B') 371 | Reroute28_connection = create_connection(Reroute28, '', Math56, 'A') 372 | Color8_connection = create_connection(Color8, '', Mix07, 'B') 373 | Position8_connection = create_connection(Position8, '', Math57, 'A') 374 | Position8_connection = create_connection(Position8, '', Math56, 'B') 375 | Factor_connection = create_connection(Factor, '', Reroute01, '') 376 | Mix07_connection = create_connection(Mix07, '', OutputResult, '') 377 | 378 | update_function() -------------------------------------------------------------------------------- /BL_Mapping_MF.py: -------------------------------------------------------------------------------- 1 | import unreal 2 | 3 | BL_Mapping = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_Mapping','/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew()) 4 | BL_Mapping.set_editor_property("expose_to_library", True) 5 | BL_Mapping.set_editor_property("library_categories_text", ("BLUI", "Custom", "Utility")) 6 | 7 | create_expression = unreal.MaterialEditingLibrary.create_material_expression_in_function 8 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 9 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 10 | update_function = unreal.MaterialEditingLibrary.update_material_function 11 | 12 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 13 | mat_func_separate_V2 = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat2Components') 14 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 15 | mat_func_combine_V2 = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat2') 16 | 17 | ### Creating Nodes 18 | Math06 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1960.0, -960.0) 19 | Math01 = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-2120.0, -960.0) 20 | SeparateXYZ = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2360.0, -1100.0) 21 | SeparateXYZ01 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2360.0, -960.0) 22 | SeparateXYZ07 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2700.0, -900.0) 23 | CombineXYZ06 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2540.0, -900.0) 24 | SeparateXYZ08 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2380.0, -760.0) 25 | SeparateXYZ09 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-2380.0, -560.0) 26 | Cosine03 = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, -1200.0) 27 | Multiply101 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1200.0) 28 | Subtract01 = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-1260.0, -1200.0) 29 | Multiply201 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1040.0) 30 | Sine03 = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -1040.0) 31 | Multiply301 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -860.0) 32 | Sine02 = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -860.0) 33 | Add01 = create_expression(BL_Mapping,unreal.MaterialExpressionAdd,-1260.0, -860.0) 34 | Multiply401 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -680.0) 35 | Cosine02 = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, -680.0) 36 | CombineXYZ02 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-1060.0, -1020.0) 37 | VectorMath01 = create_expression(BL_Mapping,unreal.MaterialExpressionAdd,-660.0, -1020.0) 38 | VectorMath = create_expression(BL_Mapping,unreal.MaterialExpressionAdd,-860.0, -1020.0) 39 | SeparateXYZ10 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-480.0, -1020.0) 40 | Math11 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-300.0, -880.0) 41 | Math10 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-300.0, -1020.0) 42 | Math09 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-300.0, -1180.0) 43 | CombineXYZ04 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-120.0, -1020.0) 44 | SeparateXYZ06 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,60.0, -1020.0) 45 | CombineXYZ05 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,240.0, -1020.0) 46 | Math08 = create_expression(BL_Mapping,unreal.MaterialExpressionDivide,-1800.0, -180.0) 47 | Math07 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1960.0, -180.0) 48 | Math02 = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-2120.0, -180.0) 49 | Multiply102 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -480.0) 50 | Cosine04 = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, -480.0) 51 | Subtract02 = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-1260.0, -480.0) 52 | Multiply202 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -320.0) 53 | Sine04 = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -320.0) 54 | Sine05 = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -120.0) 55 | Multiply302 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -120.0) 56 | Add02 = create_expression(BL_Mapping,unreal.MaterialExpressionAdd,-1260.0, -120.0) 57 | Multiply402 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, 40.0) 58 | CombineXYZ03 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-1080.0, -260.0) 59 | Math04 = create_expression(BL_Mapping,unreal.MaterialExpressionDivide,-1800.0, -1600.0) 60 | Math03 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1960.0, -1600.0) 61 | Math = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-2120.0, -1600.0) 62 | Multiply1 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1900.0) 63 | Cosine01 = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, -1900.0) 64 | Subtract = create_expression(BL_Mapping,unreal.MaterialExpressionSubtract,-1260.0, -1900.0) 65 | Multiply2 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1740.0) 66 | Sine = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -1740.0) 67 | Sine01 = create_expression(BL_Mapping,unreal.MaterialExpressionSine,-1580.0, -1560.0) 68 | Multiply3 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1560.0) 69 | Add = create_expression(BL_Mapping,unreal.MaterialExpressionAdd,-1260.0, -1560.0) 70 | Multiply4 = create_expression(BL_Mapping,unreal.MaterialExpressionMultiply,-1420.0, -1400.0) 71 | Cosine = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, -1400.0) 72 | CombineXYZ01 = create_expression(BL_Mapping,unreal.MaterialExpressionMaterialFunctionCall,-1040.0, -1640.0) 73 | Cosine05 = create_expression(BL_Mapping,unreal.MaterialExpressionCosine,-1580.0, 40.0) 74 | Math05 = create_expression(BL_Mapping,unreal.MaterialExpressionDivide,-1800.0, -960.0) 75 | Value02 = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-2120.0, -800.0) 76 | Value = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-2120.0, -1440.0) 77 | Value01 = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-1960.0, -1440.0) 78 | Value05 = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-1960.0, -20.0) 79 | Value03 = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-1960.0, -800.0) 80 | Value04 = create_expression(BL_Mapping,unreal.MaterialExpressionConstant,-2120.0, -20.0) 81 | 82 | OutputResult = create_expression(BL_Mapping, unreal.MaterialExpressionFunctionOutput, 420.0, -1020.0) 83 | 84 | VectorInput = create_expression(BL_Mapping, unreal.MaterialExpressionFunctionInput, -2860.0, -900.0) 85 | Location = create_expression(BL_Mapping,unreal.MaterialExpressionFunctionInput,-2540.0, -1100.0) 86 | Rotation = create_expression(BL_Mapping,unreal.MaterialExpressionFunctionInput,-2540.0, -760.0) 87 | Scale = create_expression(BL_Mapping,unreal.MaterialExpressionFunctionInput,-2540.0, -560.0) 88 | 89 | ### Loading Material Functions and Textures 90 | SeparateXYZ.set_editor_property('material_function',mat_func_separate) 91 | SeparateXYZ01.set_editor_property('material_function',mat_func_separate) 92 | SeparateXYZ07.set_editor_property('material_function',mat_func_separate_V2) 93 | CombineXYZ06.set_editor_property('material_function',mat_func_combine) 94 | SeparateXYZ08.set_editor_property('material_function',mat_func_separate) 95 | SeparateXYZ09.set_editor_property('material_function',mat_func_separate) 96 | CombineXYZ02.set_editor_property('material_function',mat_func_combine) 97 | SeparateXYZ10.set_editor_property('material_function',mat_func_separate) 98 | CombineXYZ04.set_editor_property('material_function',mat_func_combine) 99 | SeparateXYZ06.set_editor_property('material_function',mat_func_separate) 100 | CombineXYZ05.set_editor_property('material_function',mat_func_combine_V2) 101 | CombineXYZ03.set_editor_property('material_function',mat_func_combine) 102 | CombineXYZ01.set_editor_property('material_function',mat_func_combine) 103 | 104 | ### Setting Values 105 | VectorInput.input_name = 'VectorInput' 106 | VectorInput.input_type = unreal.FunctionInputType.FUNCTION_INPUT_VECTOR2 107 | VectorInput.sort_priority = 0 108 | VectorInput.preview_value = (0, 0) 109 | VectorInput.use_preview_value_as_default = True 110 | 111 | Location.input_name = 'Location' 112 | Location.sort_priority = 1 113 | Location.preview_value = (0, 0, 0, 1) 114 | Location.use_preview_value_as_default = True 115 | 116 | Rotation.input_name = 'Rotation' 117 | Rotation.sort_priority = 2 118 | Rotation.preview_value = (0, 0, 0, 1) 119 | Rotation.use_preview_value_as_default = True 120 | 121 | Scale.input_name = 'Scale' 122 | Scale.sort_priority = 3 123 | Scale.preview_value = (1, 1, 1, 1) 124 | Scale.use_preview_value_as_default = True 125 | 126 | Value.r = 3.1419999599456787 127 | Value01.r = 180.0 128 | Value02.r = -3.1419999599456787 129 | Value03.r = 180.0 130 | Value04.r = 3.1419999599456787 131 | Value05.r = 180.0 132 | 133 | ### Creating Connections 134 | Math06_connection = create_connection(Math06, '', Math05, 'A') 135 | Math01_connection = create_connection(Math01, '', Multiply402, 'B') 136 | Math01_connection = create_connection(Math01, '', Multiply202, 'B') 137 | Math01_connection = create_connection(Math01, '', CombineXYZ02, 'Y') 138 | Math01_connection = create_connection(Math01, '', Multiply1, 'B') 139 | Math01_connection = create_connection(Math01, '', Multiply3, 'B') 140 | SeparateXYZ_connection = create_connection(SeparateXYZ, 'R', Math, 'B') 141 | SeparateXYZ_connection = create_connection(SeparateXYZ, 'G', Math01, 'B') 142 | SeparateXYZ_connection = create_connection(SeparateXYZ, 'B', Math02, 'B') 143 | SeparateXYZ01_connection = create_connection(SeparateXYZ01, 'R', Math, 'A') 144 | SeparateXYZ01_connection = create_connection(SeparateXYZ01, 'G', Math01, 'A') 145 | SeparateXYZ01_connection = create_connection(SeparateXYZ01, 'B', Math02, 'A') 146 | Location_connection = create_connection(Location, '', SeparateXYZ, 'Float3') 147 | SeparateXYZ07_connection = create_connection(SeparateXYZ07, 'R', CombineXYZ06, 'X') 148 | SeparateXYZ07_connection = create_connection(SeparateXYZ07, 'G', CombineXYZ06, 'Y') 149 | CombineXYZ06_connection = create_connection(CombineXYZ06, 'Result', SeparateXYZ01, 'Float3') 150 | 151 | VectorInput_connection = create_connection(VectorInput, '', SeparateXYZ07, 'Float2') 152 | 153 | SeparateXYZ08_connection = create_connection(SeparateXYZ08, 'R', Math03, 'A') 154 | SeparateXYZ08_connection = create_connection(SeparateXYZ08, 'G', Math06, 'A') 155 | SeparateXYZ08_connection = create_connection(SeparateXYZ08, 'B', Math07, 'A') 156 | Rotation_connection = create_connection(Rotation, '', SeparateXYZ08, 'Float3') 157 | SeparateXYZ09_connection = create_connection(SeparateXYZ09, 'R', Math09, 'A') 158 | SeparateXYZ09_connection = create_connection(SeparateXYZ09, 'G', Math10, 'A') 159 | SeparateXYZ09_connection = create_connection(SeparateXYZ09, 'B', Math11, 'A') 160 | Scale_connection = create_connection(Scale, '', SeparateXYZ09, 'Float3') 161 | Cosine03_connection = create_connection(Cosine03, '', Multiply101, 'A') 162 | Multiply101_connection = create_connection(Multiply101, '', Subtract01, 'A') 163 | Subtract01_connection = create_connection(Subtract01, '', CombineXYZ02, 'X') 164 | Multiply201_connection = create_connection(Multiply201, '', Subtract01, 'B') 165 | Sine03_connection = create_connection(Sine03, '', Multiply201, 'A') 166 | Multiply301_connection = create_connection(Multiply301, '', Add01, 'A') 167 | Sine02_connection = create_connection(Sine02, '', Multiply301, 'A') 168 | Add01_connection = create_connection(Add01, '', CombineXYZ02, 'Z') 169 | Multiply401_connection = create_connection(Multiply401, '', Add01, 'B') 170 | Cosine02_connection = create_connection(Cosine02, '', Multiply401, 'A') 171 | CombineXYZ02_connection = create_connection(CombineXYZ02, 'Result', VectorMath, 'B') 172 | VectorMath01_connection = create_connection(VectorMath01, '', SeparateXYZ10, 'Float3') 173 | VectorMath_connection = create_connection(VectorMath, '', VectorMath01, 'A') 174 | SeparateXYZ10_connection = create_connection(SeparateXYZ10, 'R', Math09, 'B') 175 | SeparateXYZ10_connection = create_connection(SeparateXYZ10, 'G', Math10, 'B') 176 | SeparateXYZ10_connection = create_connection(SeparateXYZ10, 'B', Math11, 'B') 177 | Math11_connection = create_connection(Math11, '', CombineXYZ04, 'Z') 178 | Math10_connection = create_connection(Math10, '', CombineXYZ04, 'Y') 179 | Math09_connection = create_connection(Math09, '', CombineXYZ04, 'X') 180 | CombineXYZ04_connection = create_connection(CombineXYZ04, 'Result', SeparateXYZ06, 'Float3') 181 | SeparateXYZ06_connection = create_connection(SeparateXYZ06, 'R', CombineXYZ05, 'X') 182 | SeparateXYZ06_connection = create_connection(SeparateXYZ06, 'G', CombineXYZ05, 'Y') 183 | 184 | CombineXYZ05_connection = create_connection(CombineXYZ05, 'Result', OutputResult, '') 185 | 186 | Math08_connection = create_connection(Math08, '', Sine04, '') 187 | Math08_connection = create_connection(Math08, '', Cosine05, '') 188 | Math08_connection = create_connection(Math08, '', Sine05, '') 189 | Math08_connection = create_connection(Math08, '', Cosine04, '') 190 | Math07_connection = create_connection(Math07, '', Math08, 'A') 191 | Math02_connection = create_connection(Math02, '', CombineXYZ03, 'Z') 192 | Math02_connection = create_connection(Math02, '', Multiply401, 'B') 193 | Math02_connection = create_connection(Math02, '', Multiply201, 'B') 194 | Math02_connection = create_connection(Math02, '', Multiply4, 'B') 195 | Math02_connection = create_connection(Math02, '', Multiply2, 'B') 196 | Multiply102_connection = create_connection(Multiply102, '', Subtract02, 'A') 197 | Cosine04_connection = create_connection(Cosine04, '', Multiply102, 'A') 198 | Subtract02_connection = create_connection(Subtract02, '', CombineXYZ03, 'X') 199 | Multiply202_connection = create_connection(Multiply202, '', Subtract02, 'B') 200 | Sine04_connection = create_connection(Sine04, '', Multiply202, 'A') 201 | Sine05_connection = create_connection(Sine05, '', Multiply302, 'A') 202 | Multiply302_connection = create_connection(Multiply302, '', Add02, 'A') 203 | Add02_connection = create_connection(Add02, '', CombineXYZ03, 'Y') 204 | Multiply402_connection = create_connection(Multiply402, '', Add02, 'B') 205 | CombineXYZ03_connection = create_connection(CombineXYZ03, 'Result', VectorMath01, 'B') 206 | Math04_connection = create_connection(Math04, '', Sine, '') 207 | Math04_connection = create_connection(Math04, '', Cosine, '') 208 | Math04_connection = create_connection(Math04, '', Sine01, '') 209 | Math04_connection = create_connection(Math04, '', Cosine01, '') 210 | Math03_connection = create_connection(Math03, '', Math04, 'A') 211 | Math_connection = create_connection(Math, '', Multiply302, 'B') 212 | Math_connection = create_connection(Math, '', Multiply102, 'B') 213 | Math_connection = create_connection(Math, '', Multiply301, 'B') 214 | Math_connection = create_connection(Math, '', Multiply101, 'B') 215 | Math_connection = create_connection(Math, '', CombineXYZ01, 'X') 216 | Multiply1_connection = create_connection(Multiply1, '', Subtract, 'A') 217 | Cosine01_connection = create_connection(Cosine01, '', Multiply1, 'A') 218 | Subtract_connection = create_connection(Subtract, '', CombineXYZ01, 'Y') 219 | Multiply2_connection = create_connection(Multiply2, '', Subtract, 'B') 220 | Sine_connection = create_connection(Sine, '', Multiply2, 'A') 221 | Sine01_connection = create_connection(Sine01, '', Multiply3, 'A') 222 | Multiply3_connection = create_connection(Multiply3, '', Add, 'A') 223 | Add_connection = create_connection(Add, '', CombineXYZ01, 'Z') 224 | Multiply4_connection = create_connection(Multiply4, '', Add, 'B') 225 | Cosine_connection = create_connection(Cosine, '', Multiply4, 'A') 226 | CombineXYZ01_connection = create_connection(CombineXYZ01, 'Result', VectorMath, 'A') 227 | Cosine05_connection = create_connection(Cosine05, '', Multiply402, 'A') 228 | Math05_connection = create_connection(Math05, '', Sine03, '') 229 | Math05_connection = create_connection(Math05, '', Cosine02, '') 230 | Math05_connection = create_connection(Math05, '', Sine02, '') 231 | Math05_connection = create_connection(Math05, '', Cosine03, '') 232 | Value02_connection = create_connection(Value02, '', Math06, 'B') 233 | Value_connection = create_connection(Value, '', Math03, 'B') 234 | Value01_connection = create_connection(Value01, '', Math04, 'B') 235 | Value05_connection = create_connection(Value05, '', Math08, 'B') 236 | Value03_connection = create_connection(Value03, '', Math05, 'B') 237 | Value04_connection = create_connection(Value04, '', Math07, 'B') 238 | 239 | update_function() 240 | 241 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TransMat v0.6.4 2 | Transport, Translate, Transform, Transfer Blender Materials to Unreal 3 | 4 | [![Preview](https://img.youtube.com/vi/jVddavPSJv4/0.jpg)](https://www.youtube.com/watch?v=jVddavPSJv4) 5 | 6 | ## Description 7 | 8 | TransMat is an Add-on for Blender's Node Editor. 9 | 10 | It creates a python file that will instantly, automatically recreate your Blender material in Unreal. 11 | 12 | Check out the example at the bottom of the page to see what it looks like! 13 | 14 | ## How to Install and Use 15 | 16 | Download and unzip the file, then, in __Blender__, click __'Edit'__ > __'Preferences'__ > __'Addons'__ > __'Install'__ and choose __'Transmat.py'__ 17 | 18 | This will add a properties panel to the __Node Editor__. 19 | 20 | Once you have created your material, choose a directory to output the python file to. 21 | 22 | Then, if you wish, you can specify Unreal import subfolders for the material and textures to be placed in. 23 | 24 | If you do not specify any folders, they will go to your game's __Content__ folder by default. 25 | 26 | If you do add a subfolder, the script will either find it, if it exists, or create it, if it doesn't. 27 | 28 | Next, if you're using procedural noise nodes, you can choose your resolution, and bake them to textures. 29 | 30 | _(eg Brick, Checker, Gradient, Magic, Musgrave, Noise, Point Density, Sky, Voronoi, Wave, White Noise)_ 31 | 32 | Be patient if you have a lot of noise nodes and you're baking at a high resolution, it will take time! 33 | 34 | Transmat then checks the output connections of the noise nodes, and replaces them with your newly baked textures! 35 | 36 | Now, click the __'Transfer Material!'__ button. This creates your material file - _eg 'GroupTest1_TM.py'_ 37 | 38 | Then, in __Unreal__ _(with the Python plug-in and Editor Scripting enabled)_ click __'File'__ > __'Execute Python Script'__. 39 | 40 | __NOTE:__ If this is your first time using the addon, navigate to the TransMat folder, select _'TransMat_SetupScript.py'_ and click __'OK'__. 41 | 42 | This will setup the custom Mapping and ColorRamp nodes in Unreal. If you've already done this, then: 43 | 44 | Navigate to the python file that was just created, and click __'OK'__ - _eg 'GroupTest1_TM.py'_ 45 | 46 | Transmat will find and import all the image textures from your Blender material, and plug them into the right nodes! 47 | 48 | ## Currently supported Blender Nodes 49 | 50 | Blender Shader Node | Unreal Material Expression Node 51 | ---|--- 52 | Principled BSDF | MakeMaterialAttributes 53 | Image Texture | TextureSample 54 | Texture Coordinate | TextureCoordinate 55 | UV Map | TextureCoordinate 56 | Mix Shader | BlendMaterialAttributes 57 | Add Shader | Add 58 | Color Ramp | FunctionCall - BL_ColorRamp - see limitations 59 | Invert | OneMinus 60 | Fresnel | Fresnel 61 | Value | Constant 62 | RGB | Constant3Vector 63 | Reroute | Reroute 64 | Separate RGB | FunctionCall - BreakOutFloat3Components 65 | Separate XYZ | FunctionCall - BreakOutFloat3Components 66 | Separate HSV | FunctionCall - BreakOutFloat3Components 67 | Combine RGB | FunctionCall - MakeFloat3 68 | Combine XYZ | FunctionCall - MakeFloat3 69 | Combine HSV | FunctionCall - MakeFloat3 70 | 71 | Math Node Operation | Unreal Material Expression Node 72 | ---|--- 73 | Add | Add 74 | Subtract | Subtract 75 | Multiply | Multiply 76 | Divide | Divide 77 | Sine | Sine 78 | Arcsine | Arcsine 79 | Cosine | Cosine 80 | Arccosine | Arccosine 81 | Power | Power 82 | Minimum | Min 83 | Maximum | Max 84 | Round | Round 85 | Absolute | Abs 86 | 87 | Vector Math Node Operations | Unreal Material Expression Node 88 | ---|--- 89 | Normalize | Normalize 90 | Dot Product | DotProduct 91 | Cross Product | CrossProduct 92 | 93 | MixRGB Node Blend Types | Unreal Material Expression Node 94 | ---|--- 95 | Mix | LinearInterpolate (our friend Lerp!) 96 | Color Burn | FunctionCall - Blend_ColorBurn 97 | Color Dodge | FunctionCall - Blend_ColorDodge 98 | Darken | FunctionCall - Blend_Darken 99 | Difference | FunctionCall - Blend_Difference 100 | Lighten | FunctionCall - Blend_Lighten 101 | Linear Light | FunctionCall - Blend_LinearLight 102 | Overlay | FunctionCall - Blend_Overlay 103 | Screen | FunctionCall - Blend_Screen 104 | Soft Light | FunctionCall - Blend_SoftLight 105 | 106 | Procedural Texture Nodes (via Bake Noise Nodes) | Unreal Material Expression Node 107 | ---|--- 108 | Brick Texture | TextureSample - your baked texture will auto-import 109 | Checker Texture | TextureSample - your baked texture will auto-import 110 | Environment Texture | TextureSample - your baked texture will auto-import 111 | Gradient Texture | TextureSample - your baked texture will auto-import 112 | IES Texture | TextureSample - your baked texture will auto-import 113 | Musgrave Texture | TextureSample - your baked texture will auto-import 114 | Magic Texture | TextureSample - your baked texture will auto-import 115 | Noise Texture | TextureSample - your baked texture will auto-import 116 | Point Density Texture | TextureSample - your baked texture will auto-import 117 | Sky Texture | TextureSample - your baked texture will auto-import 118 | Voronoi Texture | TextureSample - your baked texture will auto-import 119 | Wave Texture | TextureSample - your baked texture will auto-import 120 | White Noise Texture | TextureSample - your baked texture will auto-import 121 | 122 | ## Currently unsupported Blender Nodes 123 | 124 | Anything NOT in the above list can be considered unsupported, however, there are some common Blender nodes that do not currently have support that are likely to be in many materials, those are explicitly stated below. 125 | 126 | - Mapping 127 | 128 | - Normal 129 | 130 | - Bump - __Partial Support - see Limitations__ 131 | 132 | - Displacement 133 | 134 | - RGB Curves 135 | 136 | - Brightness/Contrast 137 | 138 | - Group - __Partial Support - see Limitations__ 139 | 140 | - ShadertoRGB 141 | 142 | - Frame 143 | 144 | - Script 145 | 146 | If a node is in the unsupported list, it doesn't mean it won't be supported, only that I haven't yet found a way to port it over. 147 | 148 | I'm planning on first getting all the nodes that have direct equivalents sorted out, then looking at nodes that require custom coded solutions. 149 | 150 | ## Limitations 151 | Mapping nodes will transfer, HOWEVER, results are not yet consistent with Blender, and manual adjustment will be necessary. 152 | 153 | Packed images will give errors, use textures that have a filepath that exists on your PC. 154 | 155 | Bump nodes will transfer, HOWEVER, they cannot accept an RGB input, so you must create a Texture Object, manually load your texture into that, plug that into the node, then attach whatever you are using as a texture coordinate, to align the textures. 156 | 157 | Node groups work with the __'Transfer Material'__ function, but, for now, in order to bake textures in Groups, the groups must be broken. 158 | 159 | If you use a node that is not on the supported list, your material will likely not transfer properly. 160 | 161 | Some very common Blender nodes are not yet supported and it will take time to figure out the proper Unreal equivalent for all of Blender's Nodes. 162 | 163 | It redirects stdout to create the python file, so if you are printing to the console, it will interfere with the script. 164 | 165 | Color Ramps are supported, but above 4 colours they start to produce unexpected results, with colour banding and other issues. 166 | 167 | This can sometimes be resolved by ensuring the position of the first colour is 0, and the position of the last colour is 1. 168 | 169 | ## Acknowledgements and Thanks 170 | 171 | __angjminer__'s Project BlUEMan demonstrated a similar functionality a few years ago, this is an attempt to achieve a similar result using an open framework. 172 | 173 | __Jim Kroovy__ submitted a crash fix, and a refactoring suggestion. 174 | 175 | __Momchilo__ has pitched in with some licensing resources. 176 | 177 | __PGMath__ posted an article on blender.stackexchange on how to recreate the Mapping and ColorRamp nodes using simple Math nodes, a huge help! 178 | 179 | A massive thanks to __batFINGER__, __CodeManX__, and __sambler__ for their countless contributions over the years to blender.stackexchange! 180 | 181 | And thanks, of course, to __Epic Games__, and __Blender Foundation__! 182 | 183 | ## Example output (GroupTest1_TM.py): 184 | ~~~python 185 | import unreal 186 | 187 | GroupTest1=unreal.AssetToolsHelpers.get_asset_tools().create_asset('GroupTest1','/Game/', unreal.Material, unreal.MaterialFactoryNew()) 188 | GroupTest1.set_editor_property('use_material_attributes',True) 189 | 190 | create_expression = unreal.MaterialEditingLibrary.create_material_expression 191 | create_connection = unreal.MaterialEditingLibrary.connect_material_expressions 192 | connect_property = unreal.MaterialEditingLibrary.connect_material_property 193 | 194 | mat_func_burn = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_ColorBurn') 195 | mat_func_dodge = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_ColorDodge') 196 | mat_func_darken = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Darken') 197 | mat_func_difference = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Difference') 198 | mat_func_lighten = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Lighten') 199 | mat_func_linear_light = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_LinearLight') 200 | mat_func_overlay = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Overlay') 201 | mat_func_screen = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Screen') 202 | mat_func_soft_light = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_SoftLight') 203 | mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components') 204 | mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3') 205 | 206 | import_tasks = [] 207 | 208 | ### Importing Textures 209 | BrickTexture_001 = 'D:\Blender\Scripts\TransmatOutputs\BrickTexture001.png' 210 | 211 | BrickTexture_001_import = unreal.AssetImportTask() 212 | BrickTexture_001_import.set_editor_property('automated',True) 213 | BrickTexture_001_import.set_editor_property('destination_path','/Game/') 214 | BrickTexture_001_import.set_editor_property('destination_name','BrickTexture_001') 215 | BrickTexture_001_import.set_editor_property('factory',unreal.TextureFactory()) 216 | BrickTexture_001_import.set_editor_property('filename',BrickTexture_001) 217 | BrickTexture_001_import.set_editor_property('replace_existing',True) 218 | BrickTexture_001_import.set_editor_property('save',True) 219 | import_tasks.append(BrickTexture_001_import) 220 | 221 | unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(import_tasks) 222 | 223 | ### Creating Nodes 224 | MixShader = create_expression(GroupTest1,unreal.MaterialExpressionBlendMaterialAttributes,-280.0, -40.0) 225 | PrincipledBSDF = create_expression(GroupTest1,unreal.MaterialExpressionMakeMaterialAttributes,-820.0, -80.0) 226 | Mix = create_expression(GroupTest1,unreal.MaterialExpressionMaterialFunctionCall,-1240.0, 260.0) 227 | AddShader = create_expression(GroupTest1,unreal.MaterialExpressionAdd,-520.0, -180.0) 228 | SeparateRGB = create_expression(GroupTest1,unreal.MaterialExpressionMaterialFunctionCall,-1560.0, -120.0) 229 | RGB = create_expression(GroupTest1,unreal.MaterialExpressionConstant3Vector,-1120.0, -200.0) 230 | Value = create_expression(GroupTest1,unreal.MaterialExpressionConstant,-1820.0, 80.0) 231 | VectorMath = create_expression(GroupTest1,unreal.MaterialExpressionAdd,-1300.0, -580.0) 232 | CombineHSV = create_expression(GroupTest1,unreal.MaterialExpressionMaterialFunctionCall,-1500.0, -560.0) 233 | Value1 = create_expression(GroupTest1,unreal.MaterialExpressionConstant,-1820.0, 220.0) 234 | Math = create_expression(GroupTest1,unreal.MaterialExpressionAdd,-1340.0, 0.0) 235 | RGB1 = create_expression(GroupTest1,unreal.MaterialExpressionConstant3Vector,-1860.0, 540.0) 236 | RGB2 = create_expression(GroupTest1,unreal.MaterialExpressionConstant3Vector,-1860.0, 320.0) 237 | CombineRGB = create_expression(GroupTest1,unreal.MaterialExpressionMaterialFunctionCall,-1320.0, -140.0) 238 | ImageTexture = create_expression(GroupTest1,unreal.MaterialExpressionTextureSample,-1160.0, 450.0) 239 | UVMap = create_expression(GroupTest1,unreal.MaterialExpressionTextureCoordinate,-1360.0, 590.0) 240 | 241 | ### Loading Material Functions and Textures 242 | Mix.set_editor_property('material_function',mat_func_soft_light) 243 | SeparateRGB.set_editor_property('material_function',mat_func_separate) 244 | CombineHSV.set_editor_property('material_function',mat_func_combine) 245 | CombineRGB.set_editor_property('material_function',mat_func_combine) 246 | ImageTexture.texture = unreal.load_asset('/Game/BrickTexture_001') 247 | 248 | ### Setting Values 249 | RGB.constant = (0.5382355451583862, 0.004127298481762409, 0.0426042303442955) 250 | Value.r = 0.652999997138977 251 | Value1.r = 0.25600001215934753 252 | RGB1.constant = (0.14932090044021606, 0.23372754454612732, 0.49999991059303284) 253 | RGB2.constant = (0.13467830419540405, 0.49999991059303284, 0.2011043280363083) 254 | 255 | ### Creating Connections 256 | PrincipledBSDF_connection = create_connection(PrincipledBSDF, '', AddShader, 'A') 257 | PrincipledBSDF_connection = create_connection(PrincipledBSDF, '', MixShader, 'B') 258 | Mix_connection = create_connection(Mix, '', PrincipledBSDF, 'Roughness') 259 | AddShader_connection = create_connection(AddShader, '', MixShader, 'A') 260 | SeparateRGB_connection = create_connection(SeparateRGB, 'R', CombineRGB, 'X') 261 | SeparateRGB_connection = create_connection(SeparateRGB, 'G', PrincipledBSDF, 'Specular') 262 | SeparateRGB_connection = create_connection(SeparateRGB, 'G', CombineRGB, 'Y') 263 | SeparateRGB_connection = create_connection(SeparateRGB, 'B', PrincipledBSDF, 'Anisotropy') 264 | SeparateRGB_connection = create_connection(SeparateRGB, 'B', CombineRGB, 'Z') 265 | RGB_connection = create_connection(RGB, '', PrincipledBSDF, 'BaseColor') 266 | Value_connection = create_connection(Value, '', PrincipledBSDF, 'AnisotropicRotation') 267 | Value_connection = create_connection(Value, '', Math, 'A') 268 | Value1_connection = create_connection(Value1, '', PrincipledBSDF, 'SpecularTint') 269 | Value1_connection = create_connection(Value1, '', Math, 'B') 270 | Math_connection = create_connection(Math, '', PrincipledBSDF, 'Metallic') 271 | RGB1_connection = create_connection(RGB1, '', PrincipledBSDF, 'SubsurfaceColor') 272 | RGB1_connection = create_connection(RGB1, '', Mix, 'Blend') 273 | RGB1_connection = create_connection(RGB1, '', SeparateRGB, 'Float3') 274 | RGB2_connection = create_connection(RGB2, '', Mix, 'Base') 275 | CombineRGB_connection = create_connection(CombineRGB, 'Result', PrincipledBSDF, 'Opacity') 276 | ImageTexture_connection = create_connection(ImageTexture, 'RGB', PrincipledBSDF, 'EmissiveColor') 277 | UVMap_connection = create_connection(UVMap, '', ImageTexture, 'UVs') 278 | ~~~ 279 | -------------------------------------------------------------------------------- /TransMat.py: -------------------------------------------------------------------------------- 1 | import bpy, os, re 2 | from contextlib import redirect_stdout 3 | 4 | bl_info = { 5 | 'name': 'TransMat', 6 | 'category': 'Node Editor', 7 | 'author': 'Spectral Vectors', 8 | 'version': (0, 6, 4), 9 | 'blender': (2, 90, 0), 10 | 'location': 'Node Editor', 11 | "description": "Automatically recreates Blender materials in Unreal" 12 | } 13 | 14 | ################################################################################ 15 | # Properties & Directory Code 16 | ################################################################################ 17 | 18 | class TransmatPaths(bpy.types.PropertyGroup): 19 | 20 | exportdirectory : bpy.props.StringProperty( 21 | name = "Export", 22 | description = "Folder where the .py will be saved", 23 | default = "", 24 | subtype = 'DIR_PATH' 25 | ) 26 | 27 | materialdirectory : bpy.props.StringProperty( 28 | name= "Material", 29 | description="Subfolder to save Materials to, relative to Game/Content/", 30 | default = "Materials" 31 | ) 32 | 33 | texturedirectory : bpy.props.StringProperty( 34 | name= "Texture", 35 | description="Subfolder to save Textures to, relative to Game/Content/", 36 | default = "Textures" 37 | ) 38 | 39 | noiseresolution : bpy.props.IntProperty( 40 | name="Resolution", 41 | description="Resolution of the baked noise textures", 42 | default=1024 43 | ) 44 | 45 | ################################################################################ 46 | # Noise Node Baking 47 | ################################################################################ 48 | 49 | class BakeNoises(bpy.types.Operator): 50 | """Bakes procedural noise nodes to textures for export, textures are saved in the Export folder""" 51 | bl_idname = "blui.bakenoises_operator" 52 | bl_label = "Bake Noise Nodes" 53 | 54 | @classmethod 55 | def poll(cls, context): 56 | space = context.space_data 57 | return space.type == 'NODE_EDITOR' 58 | 59 | def execute(self, context): 60 | 61 | # Save the current render engine to reset after baking 62 | previousrenderengine = bpy.context.scene.render.engine 63 | material = bpy.context.material 64 | nodes = material.node_tree.nodes 65 | links = material.node_tree.links 66 | noisenodes = [] 67 | rebuildnodegroups = {} 68 | 69 | ################################################################################ 70 | # Breaking the Groups, a better solution can be found for reassembling later 71 | for node in nodes: 72 | if node.bl_idname == "ShaderNodeGroup": 73 | # groupednodes = [] 74 | # groupednodes.append(node.node_tree.nodes) 75 | # rebuildnodegroups.append(groupednodes) 76 | material.node_tree.nodes.active = node 77 | bpy.ops.node.group_ungroup() 78 | ################################################################################ 79 | 80 | # Set the render engine to Cycles 81 | bpy.context.scene.render.engine = 'CYCLES' 82 | bpy.context.scene.cycles.device = 'GPU' 83 | bpy.context.scene.cycles.samples = 128 84 | 85 | # Loop through all the nodes, all procedural texture nodes start with 86 | # "ShaderNodeTex...", once we remove the Image Texture node, all that 87 | # remains are the procedurals, and we make a list of just those 88 | for node in nodes: 89 | if node.bl_idname.startswith("ShaderNodeTex") and not node.bl_idname == "ShaderNodeTexImage": 90 | noisenode = node 91 | noisenodes.append(noisenode) 92 | # Making note of the Output node, so that we can connect the Emission 93 | # shader for baking 94 | if node.bl_idname == "ShaderNodeOutputMaterial": 95 | output = node 96 | 97 | # In our noise node list, we make a note of the output connection, so that 98 | # we can reconnect the baked textures to the procedural textures outputs 99 | for noisenode in noisenodes: 100 | for link in noisenode.outputs[0].links: 101 | nnlinksocket = link.to_socket 102 | 103 | # Make a new image that is the width and height the user specifies in 104 | # the Addon's panel 105 | noisebake = bpy.data.images.new( 106 | name = str(noisenode.name).replace('.','_').replace(' ',''), 107 | width = context.scene.transmatpaths.noiseresolution, 108 | height = context.scene.transmatpaths.noiseresolution 109 | ) 110 | 111 | # Create a UV Map node, store a reference to it, move it to the left 112 | # of the node we'll be baking from, then link it to the noise node 113 | bpy.ops.node.add_node(type="ShaderNodeUVMap") 114 | uvmap = bpy.context.active_node 115 | bpy.context.active_node.location[0] = noisenode.location[0]-200 116 | bpy.context.active_node.location[1] = noisenode.location[1] 117 | links.new(bpy.context.active_node.outputs[0], noisenode.inputs[0]) 118 | 119 | # Create an Emission Shader, store a reference to it, move it to the right 120 | # of the node we'll be baking from, then link it to the noise node 121 | bpy.ops.node.add_node(type="ShaderNodeEmission") 122 | emission = bpy.context.active_node 123 | bpy.context.active_node.location[0] = noisenode.location[0]+200 124 | bpy.context.active_node.location[1] = noisenode.location[1] 125 | links.new(noisenode.outputs[0], bpy.context.active_node.inputs[0]) 126 | links.new(bpy.context.active_node.outputs[0], output.inputs[0]) 127 | 128 | # Create an Image Texture node, store a reference to it, move it to the left 129 | # of the noise node, then assign the texture we created to the node 130 | # It's important that this is the last node created, because Blender 131 | # looks for the active node, with a loaded texture as a bake target 132 | bpy.ops.node.add_node(type="ShaderNodeTexImage") 133 | image = bpy.context.active_node 134 | bpy.context.active_node.location[0] = noisenode.location[0]-250 135 | bpy.context.active_node.location[1] = noisenode.location[1] 136 | bpy.context.active_node.image = noisebake 137 | 138 | # Now we tell it to bake the Emission pass, pack the image into the .blend 139 | # save it to the Export directory as a PNG, then remove the UV Map 140 | # and Emission Shader, before connecting the newly baked texture node 141 | # to the same output connection the noise node was connected to 142 | bpy.ops.object.bake(type='EMIT') 143 | noisebake.pack() 144 | noisebake.filepath = context.scene.transmatpaths.exportdirectory + str(noisebake.name).replace(' ','').replace('.','') + ".png" 145 | noisebake.file_format = "PNG" 146 | noisebake.save() 147 | nodes.remove(uvmap) 148 | nodes.remove(emission) 149 | links.new(image.outputs[0],nnlinksocket) 150 | 151 | # Reset the render engine to the user's previous setting 152 | bpy.context.scene.render.engine = previousrenderengine 153 | 154 | # for groupnodes in rebuildnodegroups: 155 | # for node in groupnodes: 156 | 157 | 158 | return {'FINISHED'} 159 | 160 | ################################################################################ 161 | # Operator Code 162 | ################################################################################ 163 | 164 | class TransMatOperator(bpy.types.Operator): 165 | """Translates and Transfers Materials from Blender to Unreal""" 166 | bl_idname = "blui.transmat_operator" 167 | bl_label = "Transfer Material!" 168 | 169 | # Make sure we're in the Node Editor 170 | @classmethod 171 | def poll(cls, context): 172 | space = context.space_data 173 | return space.type == 'NODE_EDITOR' 174 | 175 | def execute(self, context): 176 | 177 | # The officially supported Node List (in .bl_idname form) 178 | supported_nodes = [ 179 | "ShaderNodeFresnel", 180 | "ShaderNodeUVMap", 181 | "ShaderNodeSeparateRGB", 182 | "ShaderNodeSeparateXYZ", 183 | "ShaderNodeSeparateHSV", 184 | "ShaderNodeCombineRGB", 185 | "ShaderNodeCombineXYZ", 186 | "ShaderNodeCombineHSV", 187 | "NodeReroute", 188 | #"ShaderNodeOutputMaterial", 189 | "ShaderNodeBsdfPrincipled", 190 | "ShaderNodeMixShader", 191 | "ShaderNodeAddShader", 192 | "ShaderNodeInvert", 193 | "ShaderNodeTexImage", 194 | "ShaderNodeTexCoord", 195 | "ShaderNodeValue", 196 | "ShaderNodeRGB", 197 | "ShaderNodeMath", 198 | "ShaderNodeVectorMath", 199 | "ShaderNodeMixRGB", 200 | "ShaderNodeValToRGB", 201 | "ShaderNodeMapping", 202 | "ShaderNodeBump", 203 | "ShaderNodeNormal", 204 | "ShaderNodeNormalMap", 205 | ] 206 | 207 | # A dictionary with all our nodes paired with their Unreal counterparts 208 | node_translate = { 209 | "ShaderNodeFresnel":"unreal.MaterialExpressionFresnel", 210 | "ShaderNodeUVMap":"unreal.MaterialExpressionTextureCoordinate", 211 | "ShaderNodeSeparateRGB":"unreal.MaterialExpressionMaterialFunctionCall", 212 | "ShaderNodeSeparateXYZ":"unreal.MaterialExpressionMaterialFunctionCall", 213 | "ShaderNodeSeparateHSV":"unreal.MaterialExpressionMaterialFunctionCall", 214 | "ShaderNodeCombineRGB":"unreal.MaterialExpressionMaterialFunctionCall", 215 | "ShaderNodeCombineXYZ":"unreal.MaterialExpressionMaterialFunctionCall", 216 | "ShaderNodeCombineHSV":"unreal.MaterialExpressionMaterialFunctionCall", 217 | "ShaderNodeValToRGB":"unreal.MaterialExpressionMaterialFunctionCall", 218 | "ShaderNodeMapping":"unreal.MaterialExpressionMaterialFunctionCall", 219 | "NodeReroute":"unreal.MaterialExpressionReroute", 220 | "ShaderNodeNormal":"unreal.MaterialExpressionReroute", 221 | "ShaderNodeNormalMap":"unreal.MaterialExpressionReroute", 222 | "ShaderNodeBump":"unreal.MaterialExpressionMaterialFunctionCall", 223 | "ShaderNodeOutputMaterial":"", 224 | "ShaderNodeBsdfPrincipled":"unreal.MaterialExpressionMakeMaterialAttributes", 225 | "ShaderNodeMixShader":"unreal.MaterialExpressionBlendMaterialAttributes", 226 | "ShaderNodeAddShader":"unreal.MaterialExpressionAdd", 227 | "ShaderNodeInvert":"unreal.MaterialExpressionOneMinus", 228 | "ShaderNodeTexImage":"unreal.MaterialExpressionTextureSample", 229 | "ShaderNodeTexCoord":"unreal.MaterialExpressionTextureCoordinate", 230 | "ShaderNodeValue":"unreal.MaterialExpressionConstant", 231 | "ShaderNodeRGB":"unreal.MaterialExpressionConstant3Vector", 232 | # Math Node Operations 233 | "ADD":"unreal.MaterialExpressionAdd", 234 | "SUBTRACT":"unreal.MaterialExpressionSubtract", 235 | "MULTIPLY":"unreal.MaterialExpressionMultiply", 236 | "DIVIDE":"unreal.MaterialExpressionDivide", 237 | "SINE":"unreal.MaterialExpressionSine", 238 | "ARCSINE":"unreal.MaterialExpressionArcsine", 239 | "COSINE":"unreal.MaterialExpressionCosine", 240 | "ARCCOSINE":"unreal.MaterialExpressionArccossine", 241 | "POWER":"unreal.MaterialExpressionPower", 242 | "MINIMUM":"unreal.MaterialExpressionMin", 243 | "MAXIMUM":"unreal.MaterialExpressionMax", 244 | "ROUND":"unreal.MaterialExpressionRound", 245 | "ABSOLUTE":"unreal.MaterialExpressionAbs", 246 | # Vector Math Node Operations 247 | "NORMALIZE":"unreal.MaterialExpressionNormalize", 248 | "DOT_PRODUCT":"unreal.MaterialExpressionDotProduct", 249 | "CROSS_PRODUCT":"unreal.MaterialExpressionCrossProduct", 250 | # Mix RGB Blend Types 251 | "MIX":"unreal.MaterialExpressionLinearInterpolate", 252 | "BURN":"unreal.MaterialExpressionMaterialFunctionCall", 253 | "DODGE":"unreal.MaterialExpressionMaterialFunctionCall", 254 | "DARKEN":"unreal.MaterialExpressionMaterialFunctionCall", 255 | "DIFFERENCE":"unreal.MaterialExpressionMaterialFunctionCall", 256 | "LIGHTEN":"unreal.MaterialExpressionMaterialFunctionCall", 257 | "LINEAR_LIGHT":"unreal.MaterialExpressionMaterialFunctionCall", 258 | "OVERLAY":"unreal.MaterialExpressionMaterialFunctionCall", 259 | "SCREEN":"unreal.MaterialExpressionMaterialFunctionCall", 260 | "SOFT_LIGHT":"unreal.MaterialExpressionMaterialFunctionCall", 261 | } 262 | 263 | # A dictionary with all our nodes and their Blender sockets, paired with their Unreal socket counterparts 264 | # Some are left blank, as Unreal will grab the default output if you supply no name 265 | socket_translate = { 266 | # Principled BSDF begins 267 | "ShaderNodeBsdfPrincipled": { 268 | "Base Color":"BaseColor",#0 269 | "Subsurface":"Subsurface",#1 270 | "Subsurface Radius":"SubsurfaceRadius",#2 271 | "Subsurface Color":"SubsurfaceColor",#3 272 | "Metallic":"Metallic",#4 273 | "Specular":"Specular",#5 274 | "Specular Tint":"SpecularTint",#6 275 | "Roughness":"Roughness",#7 276 | "Anisotropic":"Anisotropy",#8 277 | "Anisotropic Rotation":"AnisotropicRotation",#9 278 | "Sheen":"Sheen",#10 279 | "Sheen Tint":"SheenTint",#11 280 | "Clearcoat":"ClearCoat",#12 281 | "Clearcoat Roughness":"ClearCoatRoughness",#13 282 | "IOR":"Refraction",#14 283 | "Transmission":"Transmission",#15 284 | "Transmission Roughness":"TransmissionRoughness",#16 285 | "Emission":"EmissiveColor",#17 286 | "Alpha":"Opacity",#18 287 | "Normal":"Normal",#19 288 | "Clearcoat Normal":"ClearCoatNormal",#20 289 | "Tangent":"Tangent",#21 290 | "BSDF":"",}, 291 | # Principled BSDF ends, all other nodes are single lines 292 | "ShaderNodeValue": {"Value":"R"}, 293 | "ShaderNodeRGB": {"Color":"Constant"}, 294 | "ShaderNodeSeparateRGB":{"Image":"Float3","R":"R","G":"G","B":"B"}, 295 | "ShaderNodeSeparateXYZ":{"Vector":"Float3","X":"R","Y":"G","Z":"B"}, 296 | "ShaderNodeSeparateHSV":{"Image":"Float3","H":"R","S":"G","V":"B"}, 297 | "ShaderNodeCombineRGB":{"Image":"Result","R":"X","G":"Y","B":"Z"}, 298 | "ShaderNodeCombineXYZ":{"Vector":"Result","X":"X","Y":"Y","Z":"Z"}, 299 | "ShaderNodeCombineHSV":{"Image":"Result","H":"X","S":"Y","V":"Z"}, 300 | # ShaderNodeValToRGB AKA ColorRamp - keyed based on number of colors used 301 | "2":{"Fac":"Factor","Color":"Result","Alpha":""}, 302 | "3":{"Fac":"Factor","Color":"Result","Alpha":""}, 303 | "4":{"Fac":"Factor","Color":"Result","Alpha":""}, 304 | "5":{"Fac":"Factor","Color":"Result","Alpha":""}, 305 | "6":{"Fac":"Factor","Color":"Result","Alpha":""}, 306 | "7":{"Fac":"Factor","Color":"Result","Alpha":""}, 307 | "8":{"Fac":"Factor","Color":"Result","Alpha":""}, 308 | "9":{"Fac":"Factor","Color":"Result","Alpha":""}, 309 | "ShaderNodeMapping":{"Vector":"VectorInput","Location":"Location","Rotation":"Rotation","Scale":"Scale"}, 310 | "ShaderNodeTexImage":{"Vector":"UVs","Color":"RGB"}, 311 | "ShaderNodeFresnel":{"Fac":""}, 312 | "ShaderNodeUVMap":{"UV":""}, 313 | "NodeReroute":{"Input":"", "Output":""}, 314 | "ShaderNodeMixShader":{"0":"Alpha","1":"A","2":"B","Shader":""}, 315 | "ShaderNodeAddShader":{"0":"A","1":"B", "Shader":""}, 316 | "ShaderNodeInvert":{"":""}, 317 | "ShaderNodeTexCoord":{"":"", "Generated":"", "Normal":"", "UV":"", "Object":"", "Camera":"", "Window":"", "Reflection":""}, 318 | "ShaderNodeBump":{"Height":"Height Map", "Strength":"Normal Map Intensity", "Normal":""}, 319 | "ShaderNodeNormal":{"":"","Normal":""}, 320 | "ShaderNodeNormalMap":{"Color":"","Normal":""}, 321 | # Math Node Operations 322 | "ADD":{"0":"A","1":"B", "Scale":"","Value":"", "Vector":""}, 323 | "SUBTRACT":{"0":"A","1":"B","Value":"", "Vector":""}, 324 | "MULTIPLY":{"0":"A","1":"B","Value":"", "Vector":""}, 325 | "DIVIDE":{"0":"A","1":"B","Value":"", "Vector":""}, 326 | "SINE":{"0":"","Value":""}, 327 | "ARCSINE":{"0":"","Value":""}, 328 | "COSINE":{"0":"","Value":""}, 329 | "ARCCOSINE":{"0":"","Value":""}, 330 | "POWER":{"0":"A","1":"B","Value":""}, 331 | "MINIMUM":{"0":"A","1":"B","Value":""}, 332 | "MAXIMUM":{"0":"A","1":"B","Value":""}, 333 | "ROUND":{"0":"","Value":""}, 334 | "ABSOLUTE":{"0":"","Value":""}, 335 | # Vector Math Node Operations 336 | "NORMALIZE":{"0":"A","1":"B","Vector":""}, 337 | "DOT_PRODUCT":{"0":"A","1":"B","Vector":""}, 338 | "CROSS_PRODUCT":{"0":"A","1":"B","Vector":""}, 339 | # Mix RGB Blend Types 340 | "MIX":{"Color1":"A", "Color2":"B", "Fac":"Alpha", "Color":""}, 341 | "BURN":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 342 | "DODGE":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 343 | "DARKEN":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 344 | "DIFFERENCE":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 345 | "LIGHTEN":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 346 | "LINEAR_LIGHT":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 347 | "OVERLAY":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 348 | "SCREEN":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 349 | "SOFT_LIGHT":{"Color1":"Base", "Color2":"Blend", "Fac":"Alpha", "Color":""}, 350 | } 351 | 352 | # A dictionary with our Blender nodes and their Unreal MaterialFunction counterparts 353 | material_function = { 354 | # Mix RGB Blend Types 355 | 'BURN':'mat_func_burn', 356 | 'DODGE':'mat_func_dodge', 357 | 'DARKEN':'mat_func_darken', 358 | 'DIFFERENCE':'mat_func_difference', 359 | 'LIGHTEN':'mat_func_lighten', 360 | 'LINEAR_LIGHT':'mat_func_linear_light', 361 | 'OVERLAY':'mat_func_overlay', 362 | 'SCREEN':'mat_func_screen', 363 | 'SOFT_LIGHT':'mat_func_soft_light', 364 | # All 'Separate' and 'Combine' nodes are handled by the same Break/MakeFloat3 365 | "ShaderNodeSeparateRGB":'mat_func_separate', 366 | "ShaderNodeSeparateXYZ":'mat_func_separate', 367 | "ShaderNodeSeparateHSV":'mat_func_separate', 368 | "ShaderNodeCombineRGB":'mat_func_combine', 369 | "ShaderNodeCombineXYZ":'mat_func_combine', 370 | "ShaderNodeCombineHSV":'mat_func_combine', 371 | # Mapping function 372 | "ShaderNodeMapping":'mat_func_mapping', 373 | # Bump 374 | "ShaderNodeBump":"mat_func_bump", 375 | # ColorRamps are keyed by the number of colors they use 376 | "2":'mat_func_colorramp2', 377 | "3":'mat_func_colorramp3', 378 | "4":'mat_func_colorramp4', 379 | "5":'mat_func_colorramp5', 380 | "6":'mat_func_colorramp6', 381 | "7":'mat_func_colorramp7', 382 | "8":'mat_func_colorramp8', 383 | "9":'mat_func_colorramp9', 384 | } 385 | 386 | # Acting on the currently active material 387 | material = bpy.context.material 388 | 389 | # Shortening our Property variable names for better readability 390 | materialdirectory = context.scene.transmatpaths.materialdirectory 391 | texturedirectory = context.scene.transmatpaths.texturedirectory 392 | exportdirectory = context.scene.transmatpaths.exportdirectory 393 | 394 | # Setting groups to False by default 395 | has_groups = False 396 | 397 | # Ungrouping Group Nodes - first checks to see if there are groups, and, if so, sets has_groups to True 398 | for node in material.node_tree.nodes: 399 | if node.bl_idname == "ShaderNodeGroup": 400 | has_groups = True 401 | material.node_tree.nodes.active = node 402 | bpy.ops.node.group_ungroup() 403 | 404 | ################################################################################ 405 | 406 | # Thanks to Jim Kroovy for this - prevents crashes with unsupported nodes 407 | nodes = [node for node in material.node_tree.nodes if node.bl_idname in supported_nodes] 408 | 409 | # A list of dictionaries holding the formatted strings we need to print 410 | uenodes = [] 411 | 412 | ################################################################################ 413 | 414 | print("###################### IT BEGINS! ######################") 415 | for node in nodes: 416 | 417 | # nodedata - is a dictionary that will update for each loop with new node data 418 | # 'nodename' - is a formatted string of the unique name assigned to each node 419 | # 'uenodename' - is the unreal equivalent of the node, eg: ShaderNodeRGB -> unreal.MaterialExpressionConstant3Vector 420 | # 'location' - is a formatted string of the X and Y node location values, with Y inverted, and offsets added 421 | # 'ID' - is the type of data we use to identify the node type - eg node.bl_idname, node.blend_type, node.operation 422 | # 'load_data' - is a list of textures and material functions to load into nodes 423 | # 'values' - are any numerical values that can be input to nodes: constant, RGB, etc. 424 | # 'connections' - are formatted strings indicating: starting node, starting socket, ending node, ending socket 425 | # The next set of keys are the "Post Load Nodes" pass, a second loop of node creation 426 | # 'pln_create' - are strings, formatted as Unreal node creation statements, adds an RGB or Value node to transfer settings from Principled BSDF and Mapping nodes 427 | # 'pln_values' - are formatted strings, setting the aforementioned RGB/Constant3Vector and Value/Constant values 428 | # 'pln_connections' - are formatted strings creating new connections between our new nodes, and the sockets they are representing 429 | nodedata = { 430 | 'nodename' : '', 431 | 'uenodename' : '', 432 | 'location' : '', 433 | 'ID':'', 434 | 'load_data' : [], 435 | 'values' : [], 436 | 'connections' : [], 437 | 'pln_create': [], 438 | 'pln_values': [], 439 | 'pln_connections': [], 440 | } 441 | 442 | # Gathering and formatting our basic node information - nodename,uenodename,location 443 | nodedata['nodename'] = str(node.name).replace('.0','').replace(' ','') 444 | 445 | # For the most part, using the bl_idname (node type) gives us the type of node we want, but 446 | # whereas Blender has only one Math node, with operations selected via enum, Unreal has separate 447 | # nodes for each operation, so, rather than getting the node type, we get the operation, for 448 | # Math nodes, and the blend type for Mix nodes 449 | if node.bl_idname == 'ShaderNodeMixRGB': 450 | nodedata['uenodename'] = node_translate[node.blend_type] 451 | nodedata['ID'] = node.blend_type 452 | if node.bl_idname == 'ShaderNodeMath' or node.bl_idname == 'ShaderNodeVectorMath': 453 | nodedata['uenodename'] = node_translate[node.operation] 454 | nodedata['ID'] = node.operation 455 | if node.bl_idname == 'ShaderNodeValToRGB': 456 | nodedata['uenodename'] = node_translate[node.bl_idname] 457 | nodedata['ID'] = str(len(node.color_ramp.elements)) 458 | if not node.bl_idname == 'ShaderNodeMixRGB' and not node.bl_idname == 'ShaderNodeMath' and not node.bl_idname == 'ShaderNodeVectorMath': 459 | nodedata['uenodename'] = node_translate[node.bl_idname] 460 | nodedata['ID'] = node.bl_idname 461 | 462 | # The axes in Unreal's node editor seem to be the same for X, but inverted for Y, 463 | # I added an offset that I popped in visually, I could make this a property in the 464 | # preferences panel, if the offset doesn't work for everyone 465 | nodedata['location'] = str(node.location[0] - 1600) + ", " + str(node.location[1] *-1 + 1200) 466 | ID = nodedata['ID'] 467 | nodename = nodedata['nodename'] 468 | 469 | # Input Values on the Principled BSDF will be stored and recreated as additional Value/Constant, and RGBA/Constant4Vector nodes in Unreal 470 | if node.bl_idname == 'ShaderNodeBsdfPrincipled': 471 | offset = 1200 472 | for input in node.inputs: 473 | if not input.bl_idname == 'NodeSocketShader': 474 | if not input.is_linked: 475 | 476 | if input.type == 'RGBA': 477 | nodedata['pln_location'] = str(f"{node.location[0] - 1800}, {node.location[1] *-1 + offset})") 478 | nodedata['pln_create'].append( str(f"{nodename}{socket_translate[ID][input.name]} = create_expression({material.name}, unreal.MaterialExpressionConstant4Vector, {nodedata['pln_location']}") ) 479 | nodedata['pln_values'].append( str(f"{nodename}{socket_translate[ID][input.name]}.constant = ({input.default_value[0]}, {input.default_value[1]}, {input.default_value[2]}, {input.default_value[3]})") ) 480 | nodedata['pln_connections'].append( str(f"{nodename}{socket_translate[ID][input.name]}_connection = create_connection({nodename}{socket_translate[ID][input.name]}, '', {nodename}, '{socket_translate[ID][input.name]}')") ) 481 | offset += 140 482 | 483 | if input.type == 'VALUE' and not input.default_value == 0 and not input.name == 'IOR': 484 | nodedata['pln_location'] = str(f"{node.location[0] - 1800}, {node.location[1] *-1 + offset})") 485 | nodedata['pln_create'].append( str(f"{nodename}{socket_translate[ID][input.name]} = create_expression({material.name}, unreal.MaterialExpressionConstant, {nodedata['pln_location']}") ) 486 | nodedata['pln_values'].append( str(f"{nodename}{socket_translate[ID][input.name]}.r = {input.default_value}") ) 487 | nodedata['pln_connections'].append( str(f"{nodename}{socket_translate[ID][input.name]}_connection = create_connection({nodename}{socket_translate[ID][input.name]}, '', {nodename}, '{socket_translate[ID][input.name]}')") ) 488 | offset += 60 489 | 490 | if node.bl_idname == 'ShaderNodeMapping': 491 | offset = 1200 492 | for input in node.inputs: 493 | if not input.bl_idname == 'NodeSocketShader': 494 | if not input.is_linked: 495 | 496 | if input.type == 'VECTOR': 497 | nodedata['pln_location'] = str(f"{node.location[0] - 1800}, {node.location[1] *-1 + offset})") 498 | nodedata['pln_create'].append( str(f"{nodename}{socket_translate[ID][input.name]} = create_expression({material.name}, unreal.MaterialExpressionConstant3Vector, {nodedata['pln_location']}") ) 499 | nodedata['pln_values'].append( str(f"{nodename}{socket_translate[ID][input.name]}.constant = ({input.default_value[0]}, {input.default_value[1]}, {input.default_value[2]})") ) 500 | nodedata['pln_connections'].append( str(f"{nodename}{socket_translate[ID][input.name]}_connection = create_connection({nodename}{socket_translate[ID][input.name]}, '', {nodename}, '{socket_translate[ID][input.name]}')") ) 501 | offset += 140 502 | 503 | # Output Values are gathered for Value and RGB nodes - values 504 | # When making connections, Unreal requires upper case, but when 505 | # entering values, they must be lower case 506 | if node.bl_idname == 'ShaderNodeValue': 507 | output_name = str(f"{nodename}.{str(socket_translate[ID][node.outputs[0].name]).lower()}") 508 | output_value = str(node.outputs[0].default_value) 509 | value_output = str(output_name + " = " + output_value) 510 | nodedata['values'].append(value_output) 511 | 512 | if node.bl_idname == 'ShaderNodeRGB': 513 | output_name = str(f"{nodename}.{str(socket_translate[ID][node.outputs[0].name]).lower()}") 514 | output_value_0 = str(node.outputs[0].default_value[0]) 515 | output_value_1 = str(node.outputs[0].default_value[1]) 516 | output_value_2 = str(node.outputs[0].default_value[2]) 517 | rgb_output = str(output_name + " = " + "(" + output_value_0 + ", " + output_value_1 + ", " + output_value_2 + ")") 518 | nodedata['values'].append(rgb_output) 519 | 520 | # ColorRamp uses Post Load Nodes to transfer settings to Unreal 521 | if node.bl_idname == 'ShaderNodeValToRGB': 522 | nodedata['ID'] = str(len(node.color_ramp.elements)) 523 | ID = nodedata['ID'] 524 | elements = [] 525 | index = -1 526 | offset = 1200 527 | for element in node.color_ramp.elements: 528 | index += 1 529 | position = element.position 530 | color = element.color 531 | # Post Load Nodes - RGB 532 | nodedata['pln_location'] = str(f"{node.location[0] - 1800}, {node.location[1] *-1 + offset})") 533 | nodedata['pln_create'].append( str(f"{nodename}Color{index} = create_expression({material.name}, unreal.MaterialExpressionConstant3Vector, {nodedata['pln_location']}") ) 534 | nodedata['pln_values'].append( str(f"{nodename}Color{index}.constant = ({color[0]}, {color[1]}, {color[2]})") ) 535 | nodedata['pln_connections'].append( str(f"{nodename}Color{index}_connection = create_connection({nodename}Color{index}, '', {nodename}, 'Color{index}')") ) 536 | offset += 140 537 | # Post Load Nodes - Value 538 | nodedata['pln_location'] = str(f"{node.location[0] - 1800}, {node.location[1] *-1 + offset})") 539 | nodedata['pln_create'].append( str(f"{nodename}Position{index} = create_expression({material.name}, unreal.MaterialExpressionConstant, {nodedata['pln_location']}") ) 540 | nodedata['pln_values'].append( str(f"{nodename}Position{index}.r = {position}") ) 541 | nodedata['pln_connections'].append( str(f"{nodename}Position{index}_connection = create_connection({nodename}Position{index}, '', {nodename}, 'Position{index}')") ) 542 | offset += 60 543 | 544 | # Material Functions and Textures - load_data 545 | if node.bl_idname == "ShaderNodeMixRGB" and not node.blend_type == 'MIX' or node.bl_idname == "ShaderNodeSeparateRGB" or node.bl_idname == "ShaderNodeSeparateXYZ" or node.bl_idname == "ShaderNodeSeparateHSV" or node.bl_idname == "ShaderNodeCombineRGB" or node.bl_idname == "ShaderNodeCombineXYZ" or node.bl_idname == "ShaderNodeCombineHSV" or node.bl_idname == 'ShaderNodeValToRGB' or node.bl_idname == 'ShaderNodeMapping' or node.bl_idname == 'ShaderNodeBump': 546 | mat_func = str(f"{nodename}.set_editor_property('material_function',{material_function[ID]})") 547 | nodedata['load_data'].append(mat_func) 548 | 549 | if node.bl_idname == "ShaderNodeTexImage": 550 | image_name = str(node.image.name).replace('.0','').replace(' ','') 551 | texture = str(f"{nodename}.texture = unreal.load_asset('/Game/{texturedirectory}/{image_name}')") 552 | nodedata['load_data'].append(texture) 553 | 554 | # gathering data and formatting our Connection strings - connections 555 | # We only look at outputs for connections to avoid redundancy 556 | for output in node.outputs: 557 | 558 | # Only checking outputs that are connected 559 | if output.is_linked: 560 | 561 | # Looping through our connections 562 | for link in output.links: 563 | 564 | # Ignoring our Material Output, I should probably just remove this from an earlier list to avoid this ;p 565 | if not link.to_node.bl_idname == 'ShaderNodeOutputMaterial': 566 | ID = nodedata['ID'] 567 | nodename = nodedata['nodename'] 568 | 569 | # Because we now need to gather data from nodes other than the one we're currently operating on 570 | # we will be setting a lot of similar looking variables, but instead of the current node, we'll 571 | # be using the one it's linked TO or linked FROM - eg instead of node.name, we use link.from_node.name 572 | from_node = str(link.from_node.name).replace('.0','').replace(' ','') 573 | 574 | # Certain nodes in Unreal have output values, but not output names. Fortunately, Unreal will connect any blank 575 | # socket name to the default output socket, eg for RGB/Constant3Vector, even though the output is called 'Constant', 576 | # we must leave it blank, as that is how it appears in the Material editor 577 | if link.from_node.bl_idname == 'ShaderNodeRGB' or link.from_node.bl_idname == 'ShaderNodeValue' or link.from_node.bl_idname == 'ShaderNodeMapping': 578 | from_socket = str(f"''") 579 | else: 580 | # For every other node, we can use our socket_translate dictionary to get the proper socket name 581 | from_socket = str(f"'{socket_translate[ID][link.from_socket.name]}'") 582 | 583 | # Blender only has one node for all of its math operations, and all of its inputs have the same name: 'Value' 584 | # In order to tell which socket we should be plugging into, we get its index value, either 0 or 1, use re.sub to 585 | # remove all characters except the 0 or 1, and plug that in as the socket name 586 | if link.to_node.bl_idname == 'ShaderNodeMath' or link.to_node.bl_idname == 'ShaderNodeVectorMath' or link.to_node.bl_idname == 'ShaderNodeMixShader' or link.to_node.bl_idname == 'ShaderNodeAddShader': 587 | socketnumber = re.sub("[^0-9]", "", link.to_socket.path_from_id()) 588 | socketnumberint = int(socketnumber) 589 | linktonodeID = re.sub("[^0-9]", "", link.to_node.name) 590 | 591 | # A second consequence of Blender's single Math node, and its single input name, is that it names all Math Value inputs sequentially 592 | # throughout the material, rather than just throughout the node, so, if you have 3 Multiply nodes, you might expect: (Multiply0 - Input0, Input1) 593 | # (Multiply1 - Input0, Input1), (Multiply2 - Input0, Input1). But, what you get is: (Multiply0 - Input0, Input1), (Multiply1 - Input2, Input3), 594 | # (Multiply2 - Input 4, Input 5). The logic below compensates for this naming convention. 595 | if linktonodeID: 596 | linktonodeIDint = int(linktonodeID) 597 | socket = str(socketnumberint - linktonodeIDint * 10) 598 | else: 599 | socket = str(socketnumberint) 600 | else: 601 | socket = link.to_socket.name 602 | 603 | to_node = str(link.to_node.name).replace('.0','').replace(' ','') 604 | 605 | # Again, this seems to be setting the same thing as the top of the function, but, this time we're pluggin in the node we're linking to 606 | # instead of the node that we're actually operating on 607 | if link.to_node.bl_idname == 'ShaderNodeMixRGB': 608 | ID = link.to_node.blend_type 609 | if link.to_node.bl_idname == 'ShaderNodeMath' or link.to_node.bl_idname == 'ShaderNodeVectorMath': 610 | ID = link.to_node.operation 611 | if not link.to_node.bl_idname == 'ShaderNodeMixRGB' and not link.to_node.bl_idname == 'ShaderNodeMath' and not link.to_node.bl_idname == 'ShaderNodeVectorMath': 612 | ID = link.to_node.bl_idname 613 | 614 | to_socket = str(f"'{socket_translate[ID][socket]}'") 615 | 616 | # Formatting all of our newly gathered data as an Unreal create connection statement, then storing that string in our dictionary 617 | connection = str(nodename + "_connection = create_connection(" + from_node + ", " + from_socket+ ", " + to_node + ", " + to_socket+")") 618 | nodedata['connections'].append(connection) 619 | 620 | # Now that we've got all the data we need for our current node, we package its dictionary into a 621 | # list of nodes that will be recreated in Unreal: uenodes 622 | uenodes.append(nodedata) 623 | 624 | ################################################################################ 625 | # Printing 626 | ################################################################################ 627 | 628 | # Exporting the material as a .py file to be run in Unreal 629 | with open(f'{exportdirectory}{material.name}_TM.py', 'w') as textoutput: 630 | # The file will contain all the print statements until execute 631 | # returns 'FINISHED' 632 | with redirect_stdout(textoutput): 633 | 634 | print("import unreal") 635 | print("") 636 | print(f"{material.name}=unreal.AssetToolsHelpers.get_asset_tools().create_asset('{material.name}','/Game/{materialdirectory}', unreal.Material, unreal.MaterialFactoryNew())") 637 | print(f"{material.name}.set_editor_property('use_material_attributes',True)") 638 | print("") 639 | print("create_expression = unreal.MaterialEditingLibrary.create_material_expression") 640 | print("create_connection = unreal.MaterialEditingLibrary.connect_material_expressions") 641 | print("connect_property = unreal.MaterialEditingLibrary.connect_material_property") 642 | print("") 643 | print(f"mat_func_burn = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_ColorBurn')") 644 | print(f"mat_func_dodge = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_ColorDodge')") 645 | print(f"mat_func_darken = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Darken')") 646 | print(f"mat_func_difference = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Difference')") 647 | print(f"mat_func_lighten = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Lighten')") 648 | print(f"mat_func_linear_light = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_LinearLight')") 649 | print(f"mat_func_overlay = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Overlay')") 650 | print(f"mat_func_screen = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_Screen')") 651 | print(f"mat_func_soft_light = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Blends/Blend_SoftLight')") 652 | print(f"mat_func_separate = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat3Components')") 653 | print(f"mat_func_combine = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat3')") 654 | print(f"mat_func_bump = unreal.load_asset('/Engine/Functions/Engine_MaterialFunctions03/Procedurals/NormalFromHeightmap')") 655 | print("") 656 | print(f"mat_func_mapping = unreal.load_asset('/Engine/Functions/BLUI/BL_Mapping')") 657 | print(f"mat_func_colorramp2 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp2')") 658 | print(f"mat_func_colorramp3 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp3')") 659 | print(f"mat_func_colorramp4 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp4')") 660 | print(f"mat_func_colorramp5 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp5')") 661 | print(f"mat_func_colorramp6 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp6')") 662 | print(f"mat_func_colorramp7 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp7')") 663 | print(f"mat_func_colorramp8 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp8')") 664 | print(f"mat_func_colorramp9 = unreal.load_asset('/Engine/Functions/BLUI/BL_ColorRamp9')") 665 | print("") 666 | print(f"import_tasks = []") 667 | 668 | ################################################################################ 669 | 670 | print("") 671 | print("### Importing Textures") 672 | for node in nodes: 673 | if node.bl_idname == "ShaderNodeTexImage": 674 | image_name = str(node.image.name).replace('.0','').replace(' ','') 675 | image_filepath = str(node.image.filepath_from_user()) 676 | 677 | print(f"{image_name} = r'{image_filepath}'") 678 | print("") 679 | print(f"{image_name}_import = unreal.AssetImportTask()") 680 | print(f"{image_name}_import.set_editor_property('automated',True)") 681 | print(f"{image_name}_import.set_editor_property('destination_path','/Game/{texturedirectory}')") 682 | print(f"{image_name}_import.set_editor_property('destination_name','{image_name}')") 683 | print(f"{image_name}_import.set_editor_property('factory',unreal.TextureFactory())") 684 | print(f"{image_name}_import.set_editor_property('filename',{image_name})") 685 | print(f"{image_name}_import.set_editor_property('replace_existing',True)") 686 | print(f"{image_name}_import.set_editor_property('save',True)") 687 | print(f"import_tasks.append({image_name}_import)") 688 | 689 | print("") 690 | print(f"unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(import_tasks)") 691 | 692 | ################################################################################ 693 | 694 | print() 695 | print("### Creating Nodes") 696 | for nodedata in uenodes: 697 | nodename = nodedata['nodename'] 698 | uenodename = nodedata['uenodename'] 699 | location = nodedata['location'] 700 | 701 | print(f"{nodename} = create_expression({material.name},{uenodename},{location})") 702 | 703 | print() 704 | print("### Loading Material Functions and Textures") 705 | for nodedata in uenodes: 706 | for data in nodedata['load_data']: 707 | print(data) 708 | 709 | print() 710 | print("### Setting Values") 711 | for nodedata in uenodes: 712 | for value in nodedata['values']: 713 | print(value) 714 | 715 | print() 716 | print("### Creating Connections") 717 | for nodedata in uenodes: 718 | for connection in nodedata['connections']: 719 | print(connection) 720 | 721 | print() 722 | print("### Create Post Load Nodes") 723 | for nodedata in uenodes: 724 | for pln_create in nodedata['pln_create']: 725 | print(pln_create) 726 | 727 | print() 728 | print("### Set Post Load Node Values") 729 | for nodedata in uenodes: 730 | for pln_value in nodedata['pln_values']: 731 | print(pln_value) 732 | 733 | print() 734 | print("### Creating Post Load Node Connections") 735 | for nodedata in uenodes: 736 | for pln_connection in nodedata['pln_connections']: 737 | print(pln_connection) 738 | 739 | if has_groups: 740 | bpy.ops.ed.undo() 741 | return {'FINISHED'} 742 | 743 | ################################################################################ 744 | # Panel UI 745 | ################################################################################ 746 | 747 | class TransMatPanel(bpy.types.Panel): 748 | """Creates a Panel in the scene context of the node editor""" 749 | bl_label = "TransMat v0.6.4" 750 | bl_idname = "BLUI_PT_transmat" 751 | bl_category = "TransMat" 752 | bl_space_type = 'NODE_EDITOR' 753 | bl_region_type = 'UI' 754 | bl_context = "scene" 755 | 756 | def draw(self, context): 757 | layout = self.layout 758 | 759 | box = layout.box() 760 | column = box.column() 761 | column.label(text="Export Directory", icon='FILE_FOLDER') 762 | 763 | row = box.row() 764 | row.prop(context.scene.transmatpaths, 'exportdirectory') 765 | 766 | box = layout.box() 767 | column = box.column() 768 | column.label(text="Unreal Import Subfolders", icon='FILE_FOLDER') 769 | 770 | row = box.row() 771 | row.prop(context.scene.transmatpaths, 'materialdirectory') 772 | 773 | row = box.row() 774 | row.prop(context.scene.transmatpaths, 'texturedirectory') 775 | 776 | box = layout.box() 777 | column = box.column() 778 | column.label(text="Bake noise nodes to textures", icon='NODE_SEL') 779 | 780 | row = box.row() 781 | row.prop(context.scene.transmatpaths, 'noiseresolution') 782 | 783 | row = box.row() 784 | row.operator("blui.bakenoises_operator", icon='NODE') 785 | 786 | box = layout.box() 787 | column = box.column() 788 | column.label(text="Translate Material for Unreal", icon='MATERIAL') 789 | 790 | row = box.row() 791 | row.operator("blui.transmat_operator", icon='EXPORT') 792 | 793 | ################################################################################ 794 | # Register 795 | ################################################################################ 796 | 797 | def register(): 798 | bpy.utils.register_class(TransMatPanel) 799 | bpy.utils.register_class(TransMatOperator) 800 | bpy.utils.register_class(TransmatPaths) 801 | bpy.types.Scene.transmatpaths = bpy.props.PointerProperty(type=TransmatPaths) 802 | bpy.utils.register_class(BakeNoises) 803 | 804 | def unregister(): 805 | bpy.utils.unregister_class(BakeNoises) 806 | del bpy.types.Scene.transmatpaths 807 | bpy.utils.unregister_class(TransmatPaths) 808 | bpy.utils.unregister_class(TransMatOperator) 809 | bpy.utils.unregister_class(TransMatPanel) 810 | 811 | if __name__ == "__main__": 812 | register() 813 | -------------------------------------------------------------------------------- /TransMat_SetupScript.py: -------------------------------------------------------------------------------- 1 | import os, unreal 2 | 3 | fileDir = os.path.dirname(os.path.abspath(__file__)) 4 | 5 | files = [] 6 | files.append(str(fileDir) + '/BL_Mapping_MF.py') 7 | files.append(str(fileDir) + '/BL_ColorRamp9_MF.py') 8 | files.append(str(fileDir) + '/BL_ColorRamp8_MF.py') 9 | files.append(str(fileDir) + '/BL_ColorRamp7_MF.py') 10 | files.append(str(fileDir) + '/BL_ColorRamp6_MF.py') 11 | files.append(str(fileDir) + '/BL_ColorRamp5_MF.py') 12 | files.append(str(fileDir) + '/BL_ColorRamp4_MF.py') 13 | files.append(str(fileDir) + '/BL_ColorRamp3_MF.py') 14 | files.append(str(fileDir) + '/BL_ColorRamp2_MF.py') 15 | 16 | execute = unreal.PythonScriptLibrary.execute_python_command 17 | 18 | for file in files: 19 | execute(file) --------------------------------------------------------------------------------