Skip to content

Layered Material Library API

Python wrapper for the AdvancedMaterialEditingLibrary plugin functionality.

This class provides methods for manipulating layered materials and their parameters in Unreal Engine. It wraps the native C++ functionality exposed through the AdvancedMaterialEditingLibrary plugin.

Attributes:

Name Type Description
CHANNEL_RED LinearColor

Linear color representing the red channel mask (1,0,0,0).

CHANNEL_GREEN LinearColor

Linear color representing the green channel mask (0,1,0,0).

CHANNEL_BLUE LinearColor

Linear color representing the blue channel mask (0,0,1,0).

CHANNEL_ALPHA LinearColor

Linear color representing the alpha channel mask (0,0,0,1).

CHANNELS list[LinearColor]

List containing all channel mask constants.

Example

instance = unreal.load_object(None, '/Game/Materials/MyLayeredMaterial') lib = LayeredMaterialLibrary() if lib.is_layered_material(instance): ... layer_count = lib.get_layer_count(instance) ... print(f"Material has {layer_count} layers")

Source code in Content/Python/layered_material_library.py
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
class LayeredMaterialLibrary:
    """Python wrapper for the AdvancedMaterialEditingLibrary plugin functionality.

    This class provides methods for manipulating layered materials and their parameters in Unreal Engine.
    It wraps the native C++ functionality exposed through the AdvancedMaterialEditingLibrary plugin.

    Attributes:
        CHANNEL_RED (unreal.LinearColor): Linear color representing the red channel mask (1,0,0,0).
        CHANNEL_GREEN (unreal.LinearColor): Linear color representing the green channel mask (0,1,0,0).
        CHANNEL_BLUE (unreal.LinearColor): Linear color representing the blue channel mask (0,0,1,0).
        CHANNEL_ALPHA (unreal.LinearColor): Linear color representing the alpha channel mask (0,0,0,1).
        CHANNELS (list[unreal.LinearColor]): List containing all channel mask constants.

    Example:
        >>> instance = unreal.load_object(None, '/Game/Materials/MyLayeredMaterial')
        >>> lib = LayeredMaterialLibrary()
        >>> if lib.is_layered_material(instance):
        ...     layer_count = lib.get_layer_count(instance)
        ...     print(f"Material has {layer_count} layers")
    """

    # Channel mask constants
    CHANNEL_RED = unreal.LinearColor(1, 0, 0, 0)
    CHANNEL_GREEN = unreal.LinearColor(0, 1, 0, 0)
    CHANNEL_BLUE = unreal.LinearColor(0, 0, 1, 0)
    CHANNEL_ALPHA = unreal.LinearColor(0, 0, 0, 1)
    CHANNELS = [CHANNEL_RED, CHANNEL_GREEN, CHANNEL_BLUE, CHANNEL_ALPHA]

    @staticmethod
    def get_layer_count(instance: 'unreal.MaterialInstance') -> int:
        """Get the number of layers in a material instance.

        Args:
            instance (unreal.MaterialInstance): The material instance to check

        Returns:
            int: Number of layers in the material instance. Returns 0 if instance is invalid.
        """
        return unreal.LayeredMaterialLibrary.get_layer_count(instance)

    @staticmethod
    def add_material_layer(instance: 'unreal.MaterialInstance') -> bool:
        """Add a new material layer and corresponding blend layer to the material instance.

        Args:
            instance (unreal.MaterialInstance): The material instance to modify

        Returns:
            bool: True if the layer was successfully added, False otherwise
        """
        return unreal.LayeredMaterialLibrary.add_material_layer(instance)

    @staticmethod
    def is_layered_material(instance: 'unreal.MaterialInstance') -> bool:
        """Check if a material instance is a layered material.

        Args:
            instance (unreal.MaterialInstance): The material instance to check

        Returns:
            bool: True if the material is a layered material, False otherwise
        """
        return unreal.LayeredMaterialLibrary.is_layered_material(instance)

    @staticmethod
    def assign_layer_material(
        instance: 'unreal.MaterialInstance',
        layer_index: int,
        new_layer_function: 'unreal.MaterialFunctionInterface'
    ) -> bool:
        """Assign a material function to a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to modify
            layer_index (int): Index of the layer to modify. Layer 0 is the base layer.
            new_layer_function (unreal.MaterialFunctionInterface): The material function to assign

        Returns:
            bool: True if the assignment was successful, False otherwise
        """
        return unreal.LayeredMaterialLibrary.assign_layer_material(instance, layer_index, new_layer_function)

    @staticmethod
    def assign_blend_layer(
        instance: 'unreal.MaterialInstance',
        layer_index: int,
        new_blend_layer_function: 'unreal.MaterialFunctionInterface'
    ) -> bool:
        """Assign a blend function to a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to modify
            layer_index (int): Index of the layer. Note: internally offset by 1 from UI (layer 0 has no blend)
            new_blend_layer_function (unreal.MaterialFunctionInterface): The blend function to assign

        Returns:
            bool: True if the assignment was successful, False otherwise
        """
        return unreal.LayeredMaterialLibrary.assign_blend_layer(instance, layer_index, new_blend_layer_function)

    @staticmethod
    def get_layered_material_scalar_parameter_value(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        layer_index: int
    ) -> float:
        """Get the value of a scalar parameter from a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the layer containing the parameter

        Returns:
            float: The parameter value. Returns 0.0 if parameter not found or instance is invalid.
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_scalar_parameter_value(
        instance: 'unreal.MaterialInstanceConstant',
        parameter_name: str,
        layer_index: int,
        value: float
    ) -> bool:
        """Set the value of a scalar parameter in a specific layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the layer containing the parameter
            value (float): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_vector_parameter_value(instance: 'unreal.MaterialInstance',
                                                    parameter_name: str, layer_index: int) -> 'unreal.LinearColor':
        """Get the value of a vector parameter from a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the layer containing the parameter

        Returns:
            unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_vector_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_vector_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                    parameter_name: str, layer_index: int,
                                                    value: 'unreal.LinearColor') -> bool:
        """Set the value of a vector parameter in a specific layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the layer containing the parameter
            value (unreal.LinearColor): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_vector_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_static_switch_parameter_value(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        layer_index: int
    ) -> bool:
        """Get the value of a static switch parameter from a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the layer containing the parameter

        Returns:
            bool: The parameter value. Returns False if parameter not found or instance is invalid.
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_static_switch_parameter_value(
        instance: 'unreal.MaterialInstanceConstant',
        parameter_name: str,
        layer_index: int,
        value: bool
    ) -> bool:
        """Set the value of a static switch parameter in a specific layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the layer containing the parameter
            value (bool): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_texture_parameter_value(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        layer_index: int
    ) -> Optional['unreal.Texture']:
        """Get the value of a texture parameter from a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the layer containing the parameter

        Returns:
            Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid.
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_texture_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_texture_parameter_value(
        instance: 'unreal.MaterialInstanceConstant',
        parameter_name: str,
        layer_index: int,
        value: 'unreal.Texture'
    ) -> bool:
        """Set the value of a texture parameter in a specific layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the layer containing the parameter
            value (unreal.Texture): New texture value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_channel_mask_parameter_value(instance: 'unreal.MaterialInstance',
                                                        parameter_name: str,
                                                        layer_index: int) -> 'unreal.LinearColor':
        """Get the value of a channel mask parameter from a specific layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the layer containing the parameter

        Returns:
            unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_channel_mask_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                        parameter_name: str,
                                                        layer_index: int,
                                                        value: 'unreal.LinearColor') -> bool:
        """Set the value of a channel mask parameter in a specific layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the layer containing the parameter
            value (unreal.LinearColor): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index, value)


    # Blend Layer Parameters
    @staticmethod
    def get_layered_material_blend_scalar_parameter_value(instance: 'unreal.MaterialInstance',
                                                        parameter_name: str, layer_index: int) -> float:
        """Get the value of a scalar parameter from a specific blend layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the blend layer containing the parameter

        Returns:
            float: The parameter value. Returns 0.0 if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_blend_scalar_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                        parameter_name: str, layer_index: int, value: float) -> bool:
        """Set the value of a scalar parameter in a specific blend layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the blend layer containing the parameter
            value (float): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_blend_vector_parameter_value(instance: 'unreal.MaterialInstance',
                                                        parameter_name: str, layer_index: int) -> 'unreal.LinearColor':
        """Get the value of a vector parameter from a specific blend layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the blend layer containing the parameter

        Returns:
            unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_blend_vector_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                        parameter_name: str, layer_index: int,
                                                        value: 'unreal.LinearColor') -> bool:
        """Set the value of a vector parameter in a specific blend layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the blend layer containing the parameter
            value (unreal.LinearColor): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_blend_static_switch_parameter_value(instance: 'unreal.MaterialInstance',
                                                                parameter_name: str, layer_index: int) -> bool:
        """Get the value of a static switch parameter from a specific blend layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the blend layer containing the parameter

        Returns:
            bool: The parameter value. Returns False if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_blend_static_switch_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                                parameter_name: str, layer_index: int, value: bool) -> bool:
        """Set the value of a static switch parameter in a specific blend layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the blend layer containing the parameter
            value (bool): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_blend_texture_parameter_value(instance: 'unreal.MaterialInstance',
                                                        parameter_name: str, layer_index: int) -> Optional['unreal.Texture']:
        """Get the value of a texture parameter from a specific blend layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the blend layer containing the parameter

        Returns:
            Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_blend_texture_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                        parameter_name: str, layer_index: int,
                                                        value: 'unreal.Texture') -> bool:
        """Set the value of a texture parameter in a specific blend layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the blend layer containing the parameter
            value (unreal.Texture): New texture value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_layered_material_blend_channel_mask_parameter_value(instance: 'unreal.MaterialInstance',
                                                            parameter_name: str,
                                                            layer_index: int) -> 'unreal.LinearColor':
        """Get the value of a channel mask parameter from a specific blend layer.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            layer_index (int): Index of the blend layer containing the parameter

        Returns:
            unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index)

    @staticmethod
    def set_layered_material_blend_channel_mask_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                            parameter_name: str,
                                                            layer_index: int,
                                                            value: 'unreal.LinearColor') -> bool:
        """Set the value of a channel mask parameter in a specific blend layer.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            layer_index (int): Index of the blend layer containing the parameter
            value (unreal.LinearColor): New value for the parameter

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index, value)

    # Unlayered Parameters

    @staticmethod
    def get_material_instance_channel_mask_parameter_value(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        association: 'unreal.MaterialParameterAssociation' = unreal.MaterialParameterAssociation.GLOBAL_PARAMETER
    ) -> 'unreal.LinearColor':
        """Get the value of a channel mask parameter from a material. Not for material
        layers, just extends original material functionality that was missing.

        Args:
            instance (unreal.MaterialInstance): The material instance to query
            parameter_name (str): Name of the parameter to get
            association (unreal.MaterialParameterAssociation, optional): Parameter association type.
                Defaults to GlobalParameter.

        Returns:
            unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
        """
        return unreal.LayeredMaterialLibrary.get_material_instance_channel_mask_parameter_value(
            instance,
            parameter_name,
            association
        )

    @staticmethod
    def set_material_instance_channel_mask_parameter_value(
        instance: 'unreal.MaterialInstanceConstant',
        parameter_name: str,
        value: 'unreal.LinearColor',
        association: 'unreal.MaterialParameterAssociation' = unreal.MaterialParameterAssociation.GLOBAL_PARAMETER
    ) -> bool:
        """Set the value of a channel mask parameter in a material. Not for material
        layers, just extends original material functionality that was missing.

        Args:
            instance (unreal.MaterialInstanceConstant): The material instance to modify
            parameter_name (str): Name of the parameter to set
            value (unreal.LinearColor): New value for the parameter
            association (unreal.MaterialParameterAssociation, optional): Parameter association type.
                Defaults to GlobalParameter.

        Returns:
            bool: True if the parameter was successfully set, False otherwise
        """
        return unreal.LayeredMaterialLibrary.set_material_instance_channel_mask_parameter_value(
            instance,
            parameter_name,
            value,
            association
        )

    # Convenience Methods

    @staticmethod
    def get_any_material_parameter_value(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        layer_index: int = 0,
        parameter_type: str = 'scalar',
        parameter_domain: str = 'layer'
    ) -> Union[float, 'unreal.LinearColor', bool, 'unreal.Texture']:
        """Get any material parameter value based on type and domain.

        Args:
            instance: The material instance to query
            parameter_name: Name of the parameter to get
            layer_index: Index of the layer containing the parameter (ignored for global parameters)
            parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')
            parameter_domain: Where to get the parameter from ('layer', 'blend', 'global')

        Returns:
            The parameter value of appropriate type
        """
        # Function mappings for each parameter type and domain
        get_functions = {
            'layer': {
                'scalar': LayeredMaterialLibrary.get_layered_material_scalar_parameter_value,
                'vector': LayeredMaterialLibrary.get_layered_material_vector_parameter_value,
                'static_switch': LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value,
                'texture': LayeredMaterialLibrary.get_layered_material_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.get_layered_material_channel_mask_parameter_value
            },
            'blend': {
                'scalar': LayeredMaterialLibrary.get_layered_material_blend_scalar_parameter_value,
                'vector': LayeredMaterialLibrary.get_layered_material_blend_vector_parameter_value,
                'static_switch': LayeredMaterialLibrary.get_layered_material_blend_static_switch_parameter_value,
                'texture': LayeredMaterialLibrary.get_layered_material_blend_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.get_layered_material_blend_channel_mask_parameter_value
            },
            'global': {
                'scalar': unreal.MaterialEditingLibrary.get_material_instance_scalar_parameter_value,
                'vector': unreal.MaterialEditingLibrary.get_material_instance_vector_parameter_value,
                'static_switch': unreal.MaterialEditingLibrary.get_material_instance_static_switch_parameter_value,
                'texture': unreal.MaterialEditingLibrary.get_material_instance_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.get_material_channel_mask_parameter_value
            }
        }

        func = get_functions.get(parameter_domain, {}).get(parameter_type)
        if not func:
            raise ValueError(f"Invalid parameter_type '{parameter_type}' or parameter_domain '{parameter_domain}'")

        if parameter_domain == 'global':
            return func(instance, parameter_name)
        else:
            return func(instance, parameter_name, layer_index)

    @staticmethod
    def set_any_material_parameter_value(
        instance: 'unreal.MaterialInstanceConstant',
        parameter_name: str,
        value: Union[float, 'unreal.LinearColor', bool, 'unreal.Texture'],
        layer_index: int = 0,
        parameter_type: str = 'scalar',
        parameter_domain: str = 'layer',
        only_if_different: bool = False
    ) -> bool:
        """Set any material parameter value based on type and domain.

        Args:
            instance: The material instance to modify
            parameter_name: Name of the parameter to set
            value: New value for the parameter
            layer_index: Index of the layer containing the parameter (ignored for global parameters)
            parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')
            parameter_domain: Where to set the parameter ('layer', 'blend', 'global')
            only_if_different: Only set the parameter if the new value is different from the current value

        Returns:
            bool: True if the parameter was successfully set
        """
        set_functions = {
            'layer': {
                'scalar': LayeredMaterialLibrary.set_layered_material_scalar_parameter_value,
                'vector': LayeredMaterialLibrary.set_layered_material_vector_parameter_value,
                'static_switch': LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value,
                'texture': LayeredMaterialLibrary.set_layered_material_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.set_layered_material_channel_mask_parameter_value
            },
            'blend': {
                'scalar': LayeredMaterialLibrary.set_layered_material_blend_scalar_parameter_value,
                'vector': LayeredMaterialLibrary.set_layered_material_blend_vector_parameter_value,
                'static_switch': LayeredMaterialLibrary.set_layered_material_blend_static_switch_parameter_value,
                'texture': LayeredMaterialLibrary.set_layered_material_blend_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.set_layered_material_blend_channel_mask_parameter_value
            },
            'global': {
                'scalar': unreal.MaterialEditingLibrary.set_material_instance_scalar_parameter_value,
                'vector': unreal.MaterialEditingLibrary.set_material_instance_vector_parameter_value,
                'static_switch': unreal.MaterialEditingLibrary.set_material_instance_static_switch_parameter_value,
                'texture': unreal.MaterialEditingLibrary.set_material_instance_texture_parameter_value,
                'channel_mask': LayeredMaterialLibrary.set_material_channel_mask_parameter_value
            }
        }

        func = set_functions.get(parameter_domain, {}).get(parameter_type)
        if not func:
            raise ValueError(f"Invalid parameter_type '{parameter_type}' or parameter_domain '{parameter_domain}'")

        if only_if_different:
            # Get current value
            current_value = LayeredMaterialLibrary.get_any_material_parameter_value(
                instance,
                parameter_name,
                layer_index,
                parameter_type,
                parameter_domain)

            # Compare values based on type
            if parameter_type == 'scalar':
                if abs(current_value - value) < 0.0001:  # Use small epsilon for float comparison
                    return True
            elif parameter_type in ('vector', 'channel_mask'):
                # For LinearColor, compare each component
                if (abs(current_value.r - value.r) < 0.0001 and
                    abs(current_value.g - value.g) < 0.0001 and
                    abs(current_value.b - value.b) < 0.0001 and
                    abs(current_value.a - value.a) < 0.0001):
                    return True
            elif parameter_type == 'static_switch':
                if current_value == value:
                    return True
            elif parameter_type == 'texture':
                if current_value == value:  # Direct comparison for texture references
                    return True

        # Set the new value if we get here
        if parameter_domain == 'global':
            return func(instance, parameter_name, value)
        else:
            return func(instance, parameter_name, layer_index, value)

    @staticmethod
    def get_any_parameter_source(
        instance: 'unreal.MaterialInstance',
        parameter_name: str,
        parameter_type: str = 'scalar'
    ) -> Optional[str]:
        """Get the source asset path where a parameter was defined.

        Args:
            instance: Material instance to query
            parameter_name: Name of parameter to look up
            parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture')

        Returns:
            Optional[str]: Path to the asset where parameter was defined, or None
        """
        source_funcs = {
            'scalar': unreal.MaterialEditingLibrary.get_scalar_parameter_source,
            'vector': unreal.MaterialEditingLibrary.get_vector_parameter_source,
            'static_switch': unreal.MaterialEditingLibrary.get_static_switch_parameter_source,
            'texture': unreal.MaterialEditingLibrary.get_texture_parameter_source
        }

        if parameter_type not in source_funcs:
            return None

        return source_funcs[parameter_type](instance, parameter_name)

    @staticmethod
    def get_full_material_as_dict(instance: 'unreal.MaterialInstance') -> dict:
        """Get a comprehensive dictionary of material information.

        This includes global parameters, layer assets, blend assets, and their respective parameters.

        Args:
            instance (unreal.MaterialInstance): The material instance to query.

        Returns:
            dict: A dictionary containing all material information structured as:
                {
                    'global': {
                        'parameters': {...}
                    },
                    'layers': {
                        'layerName': {
                            'layerIndex': int,
                            'layerAsset': {
                                'path': str,
                                'parameters': {...}
                            },
                            'blendAsset': {
                                'path': str,
                                'parameters': {...}
                            }
                        }
                    }
                }
        """
        result = {
            'global': {'parameters': {}},
            'layers': {}
        }

        def get_parameters_for_domain(inst, layer_idx, domain):
            params = {}
            # Get parameter names
            scalar_params = unreal.MaterialEditingLibrary.get_scalar_parameter_names(inst)
            vector_params = unreal.MaterialEditingLibrary.get_vector_parameter_names(inst)
            switch_params = unreal.MaterialEditingLibrary.get_static_switch_parameter_names(inst)
            texture_params = unreal.MaterialEditingLibrary.get_texture_parameter_names(inst)

            def add_param(name, param_type):
                try:
                    value = LayeredMaterialLibrary.get_any_material_parameter_value(
                        inst, name, layer_idx, param_type, domain
                    )
                    param_key = f"{name}_{layer_idx}"
                    params[param_key] = {
                        'value': value,
                        'type': param_type,
                        'domain': domain,
                        'layerIndex': layer_idx,
                        'name': name
                    }
                except:
                    pass

            for name in scalar_params:
                add_param(name, 'scalar')
            for name in vector_params:
                add_param(name, 'vector')
            for name in switch_params:
                add_param(name, 'static_switch')
            for name in texture_params:
                add_param(name, 'texture')

            return params

        # Get global parameters
        result['global']['parameters'] = get_parameters_for_domain(instance, 0, 'global')

        # Get layer information
        layer_count = LayeredMaterialLibrary.get_layer_count(instance)
        for layer_idx in range(layer_count):
            # Get layer and blend assets
            layer_asset = None  # You'll need to implement a way to get the layer asset
            blend_asset = None  # You'll need to implement a way to get the blend asset

            layer_name = f"Layer_{layer_idx}"  # You might want to get actual layer names if possible

            result['layers'][layer_name] = {
                'layerIndex': layer_idx,
                'layerAsset': {
                    'path': layer_asset.get_path_name() if layer_asset else None,
                    'parameters': get_parameters_for_domain(instance, layer_idx, 'layer')
                }
            }

            # Don't add blend asset for base layer
            if layer_idx > 0:
                result['layers'][layer_name]['blendAsset'] = {
                    'path': blend_asset.get_path_name() if blend_asset else None,
                    'parameters': get_parameters_for_domain(instance, layer_idx, 'blend')
                }

        return result

    @staticmethod
    def create_full_material_from_dict(
        instance: 'unreal.MaterialInstanceConstant',
        material_data: dict
    ) -> bool:
        """Create or modify a layered material using a comprehensive dictionary of parameters.

        Args:
            instance: Material instance to modify
            material_data: Dictionary containing material definition as returned by get_parameter_info

        Returns:
            bool: True if successful
        """
        try:
            # Set global parameters
            if 'global' in material_data and 'parameters' in material_data['global']:
                for param_info in material_data['global']['parameters'].values():
                    LayeredMaterialLibrary.set_any_material_parameter_value(
                        instance=instance,
                        parameter_name=param_info['name'],
                        value=param_info['value'],
                        parameter_type=param_info['type'],
                        parameter_domain='global'
                    )

            # Process layers
            if 'layers' in material_data:
                for layer_name, layer_data in material_data['layers'].items():
                    layer_idx = layer_data['layerIndex']

                    # Assign layer asset
                    if 'layerAsset' in layer_data and layer_data['layerAsset']['path']:
                        layer_asset = unreal.load_object(None, layer_data['layerAsset']['path'])
                        if layer_asset:
                            LayeredMaterialLibrary.assign_layer_material(
                                instance, layer_idx, layer_asset
                            )

                            # Set layer parameters
                            for param_info in layer_data['layerAsset']['parameters'].values():
                                LayeredMaterialLibrary.set_any_material_parameter_value(
                                    instance=instance,
                                    parameter_name=param_info['name'],
                                    value=param_info['value'],
                                    layer_index=layer_idx,
                                    parameter_type=param_info['type'],
                                    parameter_domain='layer'
                                )

                    # Assign blend asset (skip for base layer)
                    if layer_idx > 0 and 'blendAsset' in layer_data and layer_data['blendAsset']['path']:
                        blend_asset = unreal.load_object(None, layer_data['blendAsset']['path'])
                        if blend_asset:
                            LayeredMaterialLibrary.assign_blend_layer(
                                instance, layer_idx, blend_asset
                            )

                            # Set blend parameters
                            for param_info in layer_data['blendAsset']['parameters'].values():
                                LayeredMaterialLibrary.set_any_material_parameter_value(
                                    instance=instance,
                                    parameter_name=param_info['name'],
                                    value=param_info['value'],
                                    layer_index=layer_idx,
                                    parameter_type=param_info['type'],
                                    parameter_domain='blend'
                                )

            return True
        except Exception as e:
            print(f"Error creating material from dictionary: {e}")
            return False

add_material_layer(instance) staticmethod

Add a new material layer and corresponding blend layer to the material instance.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to modify

required

Returns:

Name Type Description
bool bool

True if the layer was successfully added, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def add_material_layer(instance: 'unreal.MaterialInstance') -> bool:
    """Add a new material layer and corresponding blend layer to the material instance.

    Args:
        instance (unreal.MaterialInstance): The material instance to modify

    Returns:
        bool: True if the layer was successfully added, False otherwise
    """
    return unreal.LayeredMaterialLibrary.add_material_layer(instance)

assign_blend_layer(instance, layer_index, new_blend_layer_function) staticmethod

Assign a blend function to a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to modify

required
layer_index int

Index of the layer. Note: internally offset by 1 from UI (layer 0 has no blend)

required
new_blend_layer_function MaterialFunctionInterface

The blend function to assign

required

Returns:

Name Type Description
bool bool

True if the assignment was successful, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def assign_blend_layer(
    instance: 'unreal.MaterialInstance',
    layer_index: int,
    new_blend_layer_function: 'unreal.MaterialFunctionInterface'
) -> bool:
    """Assign a blend function to a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to modify
        layer_index (int): Index of the layer. Note: internally offset by 1 from UI (layer 0 has no blend)
        new_blend_layer_function (unreal.MaterialFunctionInterface): The blend function to assign

    Returns:
        bool: True if the assignment was successful, False otherwise
    """
    return unreal.LayeredMaterialLibrary.assign_blend_layer(instance, layer_index, new_blend_layer_function)

assign_layer_material(instance, layer_index, new_layer_function) staticmethod

Assign a material function to a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to modify

required
layer_index int

Index of the layer to modify. Layer 0 is the base layer.

required
new_layer_function MaterialFunctionInterface

The material function to assign

required

Returns:

Name Type Description
bool bool

True if the assignment was successful, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def assign_layer_material(
    instance: 'unreal.MaterialInstance',
    layer_index: int,
    new_layer_function: 'unreal.MaterialFunctionInterface'
) -> bool:
    """Assign a material function to a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to modify
        layer_index (int): Index of the layer to modify. Layer 0 is the base layer.
        new_layer_function (unreal.MaterialFunctionInterface): The material function to assign

    Returns:
        bool: True if the assignment was successful, False otherwise
    """
    return unreal.LayeredMaterialLibrary.assign_layer_material(instance, layer_index, new_layer_function)

create_full_material_from_dict(instance, material_data) staticmethod

Create or modify a layered material using a comprehensive dictionary of parameters.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

Material instance to modify

required
material_data dict

Dictionary containing material definition as returned by get_parameter_info

required

Returns:

Name Type Description
bool bool

True if successful

Source code in Content/Python/layered_material_library.py
@staticmethod
def create_full_material_from_dict(
    instance: 'unreal.MaterialInstanceConstant',
    material_data: dict
) -> bool:
    """Create or modify a layered material using a comprehensive dictionary of parameters.

    Args:
        instance: Material instance to modify
        material_data: Dictionary containing material definition as returned by get_parameter_info

    Returns:
        bool: True if successful
    """
    try:
        # Set global parameters
        if 'global' in material_data and 'parameters' in material_data['global']:
            for param_info in material_data['global']['parameters'].values():
                LayeredMaterialLibrary.set_any_material_parameter_value(
                    instance=instance,
                    parameter_name=param_info['name'],
                    value=param_info['value'],
                    parameter_type=param_info['type'],
                    parameter_domain='global'
                )

        # Process layers
        if 'layers' in material_data:
            for layer_name, layer_data in material_data['layers'].items():
                layer_idx = layer_data['layerIndex']

                # Assign layer asset
                if 'layerAsset' in layer_data and layer_data['layerAsset']['path']:
                    layer_asset = unreal.load_object(None, layer_data['layerAsset']['path'])
                    if layer_asset:
                        LayeredMaterialLibrary.assign_layer_material(
                            instance, layer_idx, layer_asset
                        )

                        # Set layer parameters
                        for param_info in layer_data['layerAsset']['parameters'].values():
                            LayeredMaterialLibrary.set_any_material_parameter_value(
                                instance=instance,
                                parameter_name=param_info['name'],
                                value=param_info['value'],
                                layer_index=layer_idx,
                                parameter_type=param_info['type'],
                                parameter_domain='layer'
                            )

                # Assign blend asset (skip for base layer)
                if layer_idx > 0 and 'blendAsset' in layer_data and layer_data['blendAsset']['path']:
                    blend_asset = unreal.load_object(None, layer_data['blendAsset']['path'])
                    if blend_asset:
                        LayeredMaterialLibrary.assign_blend_layer(
                            instance, layer_idx, blend_asset
                        )

                        # Set blend parameters
                        for param_info in layer_data['blendAsset']['parameters'].values():
                            LayeredMaterialLibrary.set_any_material_parameter_value(
                                instance=instance,
                                parameter_name=param_info['name'],
                                value=param_info['value'],
                                layer_index=layer_idx,
                                parameter_type=param_info['type'],
                                parameter_domain='blend'
                            )

        return True
    except Exception as e:
        print(f"Error creating material from dictionary: {e}")
        return False

get_any_material_parameter_value(instance, parameter_name, layer_index=0, parameter_type='scalar', parameter_domain='layer') staticmethod

Get any material parameter value based on type and domain.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter (ignored for global parameters)

0
parameter_type str

Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')

'scalar'
parameter_domain str

Where to get the parameter from ('layer', 'blend', 'global')

'layer'

Returns:

Type Description
Union[float, LinearColor, bool, Texture]

The parameter value of appropriate type

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_any_material_parameter_value(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    layer_index: int = 0,
    parameter_type: str = 'scalar',
    parameter_domain: str = 'layer'
) -> Union[float, 'unreal.LinearColor', bool, 'unreal.Texture']:
    """Get any material parameter value based on type and domain.

    Args:
        instance: The material instance to query
        parameter_name: Name of the parameter to get
        layer_index: Index of the layer containing the parameter (ignored for global parameters)
        parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')
        parameter_domain: Where to get the parameter from ('layer', 'blend', 'global')

    Returns:
        The parameter value of appropriate type
    """
    # Function mappings for each parameter type and domain
    get_functions = {
        'layer': {
            'scalar': LayeredMaterialLibrary.get_layered_material_scalar_parameter_value,
            'vector': LayeredMaterialLibrary.get_layered_material_vector_parameter_value,
            'static_switch': LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value,
            'texture': LayeredMaterialLibrary.get_layered_material_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.get_layered_material_channel_mask_parameter_value
        },
        'blend': {
            'scalar': LayeredMaterialLibrary.get_layered_material_blend_scalar_parameter_value,
            'vector': LayeredMaterialLibrary.get_layered_material_blend_vector_parameter_value,
            'static_switch': LayeredMaterialLibrary.get_layered_material_blend_static_switch_parameter_value,
            'texture': LayeredMaterialLibrary.get_layered_material_blend_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.get_layered_material_blend_channel_mask_parameter_value
        },
        'global': {
            'scalar': unreal.MaterialEditingLibrary.get_material_instance_scalar_parameter_value,
            'vector': unreal.MaterialEditingLibrary.get_material_instance_vector_parameter_value,
            'static_switch': unreal.MaterialEditingLibrary.get_material_instance_static_switch_parameter_value,
            'texture': unreal.MaterialEditingLibrary.get_material_instance_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.get_material_channel_mask_parameter_value
        }
    }

    func = get_functions.get(parameter_domain, {}).get(parameter_type)
    if not func:
        raise ValueError(f"Invalid parameter_type '{parameter_type}' or parameter_domain '{parameter_domain}'")

    if parameter_domain == 'global':
        return func(instance, parameter_name)
    else:
        return func(instance, parameter_name, layer_index)

get_any_parameter_source(instance, parameter_name, parameter_type='scalar') staticmethod

Get the source asset path where a parameter was defined.

Parameters:

Name Type Description Default
instance MaterialInstance

Material instance to query

required
parameter_name str

Name of parameter to look up

required
parameter_type str

Type of parameter ('scalar', 'vector', 'static_switch', 'texture')

'scalar'

Returns:

Type Description
Optional[str]

Optional[str]: Path to the asset where parameter was defined, or None

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_any_parameter_source(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    parameter_type: str = 'scalar'
) -> Optional[str]:
    """Get the source asset path where a parameter was defined.

    Args:
        instance: Material instance to query
        parameter_name: Name of parameter to look up
        parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture')

    Returns:
        Optional[str]: Path to the asset where parameter was defined, or None
    """
    source_funcs = {
        'scalar': unreal.MaterialEditingLibrary.get_scalar_parameter_source,
        'vector': unreal.MaterialEditingLibrary.get_vector_parameter_source,
        'static_switch': unreal.MaterialEditingLibrary.get_static_switch_parameter_source,
        'texture': unreal.MaterialEditingLibrary.get_texture_parameter_source
    }

    if parameter_type not in source_funcs:
        return None

    return source_funcs[parameter_type](instance, parameter_name)

get_full_material_as_dict(instance) staticmethod

Get a comprehensive dictionary of material information.

This includes global parameters, layer assets, blend assets, and their respective parameters.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query.

required

Returns:

Name Type Description
dict dict

A dictionary containing all material information structured as: { 'global': { 'parameters': {...} }, 'layers': { 'layerName': { 'layerIndex': int, 'layerAsset': { 'path': str, 'parameters': {...} }, 'blendAsset': { 'path': str, 'parameters': {...} } } } }

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_full_material_as_dict(instance: 'unreal.MaterialInstance') -> dict:
    """Get a comprehensive dictionary of material information.

    This includes global parameters, layer assets, blend assets, and their respective parameters.

    Args:
        instance (unreal.MaterialInstance): The material instance to query.

    Returns:
        dict: A dictionary containing all material information structured as:
            {
                'global': {
                    'parameters': {...}
                },
                'layers': {
                    'layerName': {
                        'layerIndex': int,
                        'layerAsset': {
                            'path': str,
                            'parameters': {...}
                        },
                        'blendAsset': {
                            'path': str,
                            'parameters': {...}
                        }
                    }
                }
            }
    """
    result = {
        'global': {'parameters': {}},
        'layers': {}
    }

    def get_parameters_for_domain(inst, layer_idx, domain):
        params = {}
        # Get parameter names
        scalar_params = unreal.MaterialEditingLibrary.get_scalar_parameter_names(inst)
        vector_params = unreal.MaterialEditingLibrary.get_vector_parameter_names(inst)
        switch_params = unreal.MaterialEditingLibrary.get_static_switch_parameter_names(inst)
        texture_params = unreal.MaterialEditingLibrary.get_texture_parameter_names(inst)

        def add_param(name, param_type):
            try:
                value = LayeredMaterialLibrary.get_any_material_parameter_value(
                    inst, name, layer_idx, param_type, domain
                )
                param_key = f"{name}_{layer_idx}"
                params[param_key] = {
                    'value': value,
                    'type': param_type,
                    'domain': domain,
                    'layerIndex': layer_idx,
                    'name': name
                }
            except:
                pass

        for name in scalar_params:
            add_param(name, 'scalar')
        for name in vector_params:
            add_param(name, 'vector')
        for name in switch_params:
            add_param(name, 'static_switch')
        for name in texture_params:
            add_param(name, 'texture')

        return params

    # Get global parameters
    result['global']['parameters'] = get_parameters_for_domain(instance, 0, 'global')

    # Get layer information
    layer_count = LayeredMaterialLibrary.get_layer_count(instance)
    for layer_idx in range(layer_count):
        # Get layer and blend assets
        layer_asset = None  # You'll need to implement a way to get the layer asset
        blend_asset = None  # You'll need to implement a way to get the blend asset

        layer_name = f"Layer_{layer_idx}"  # You might want to get actual layer names if possible

        result['layers'][layer_name] = {
            'layerIndex': layer_idx,
            'layerAsset': {
                'path': layer_asset.get_path_name() if layer_asset else None,
                'parameters': get_parameters_for_domain(instance, layer_idx, 'layer')
            }
        }

        # Don't add blend asset for base layer
        if layer_idx > 0:
            result['layers'][layer_name]['blendAsset'] = {
                'path': blend_asset.get_path_name() if blend_asset else None,
                'parameters': get_parameters_for_domain(instance, layer_idx, 'blend')
            }

    return result

get_layer_count(instance) staticmethod

Get the number of layers in a material instance.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to check

required

Returns:

Name Type Description
int int

Number of layers in the material instance. Returns 0 if instance is invalid.

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layer_count(instance: 'unreal.MaterialInstance') -> int:
    """Get the number of layers in a material instance.

    Args:
        instance (unreal.MaterialInstance): The material instance to check

    Returns:
        int: Number of layers in the material instance. Returns 0 if instance is invalid.
    """
    return unreal.LayeredMaterialLibrary.get_layer_count(instance)

get_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a channel mask parameter from a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the blend layer containing the parameter

required

Returns:

Type Description
LinearColor

unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_blend_channel_mask_parameter_value(instance: 'unreal.MaterialInstance',
                                                        parameter_name: str,
                                                        layer_index: int) -> 'unreal.LinearColor':
    """Get the value of a channel mask parameter from a specific blend layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the blend layer containing the parameter

    Returns:
        unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index)

get_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a scalar parameter from a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the blend layer containing the parameter

required

Returns:

Name Type Description
float float

The parameter value. Returns 0.0 if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_blend_scalar_parameter_value(instance: 'unreal.MaterialInstance',
                                                    parameter_name: str, layer_index: int) -> float:
    """Get the value of a scalar parameter from a specific blend layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the blend layer containing the parameter

    Returns:
        float: The parameter value. Returns 0.0 if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index)

get_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a static switch parameter from a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the blend layer containing the parameter

required

Returns:

Name Type Description
bool bool

The parameter value. Returns False if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_blend_static_switch_parameter_value(instance: 'unreal.MaterialInstance',
                                                            parameter_name: str, layer_index: int) -> bool:
    """Get the value of a static switch parameter from a specific blend layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the blend layer containing the parameter

    Returns:
        bool: The parameter value. Returns False if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index)

get_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a texture parameter from a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the blend layer containing the parameter

required

Returns:

Type Description
Optional[Texture]

Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_blend_texture_parameter_value(instance: 'unreal.MaterialInstance',
                                                    parameter_name: str, layer_index: int) -> Optional['unreal.Texture']:
    """Get the value of a texture parameter from a specific blend layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the blend layer containing the parameter

    Returns:
        Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index)

get_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a vector parameter from a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the blend layer containing the parameter

required

Returns:

Type Description
LinearColor

unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_blend_vector_parameter_value(instance: 'unreal.MaterialInstance',
                                                    parameter_name: str, layer_index: int) -> 'unreal.LinearColor':
    """Get the value of a vector parameter from a specific blend layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the blend layer containing the parameter

    Returns:
        unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index)

get_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a channel mask parameter from a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter

required

Returns:

Type Description
LinearColor

unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_channel_mask_parameter_value(instance: 'unreal.MaterialInstance',
                                                    parameter_name: str,
                                                    layer_index: int) -> 'unreal.LinearColor':
    """Get the value of a channel mask parameter from a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the layer containing the parameter

    Returns:
        unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index)

get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a scalar parameter from a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter

required

Returns:

Name Type Description
float float

The parameter value. Returns 0.0 if parameter not found or instance is invalid.

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_scalar_parameter_value(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    layer_index: int
) -> float:
    """Get the value of a scalar parameter from a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the layer containing the parameter

    Returns:
        float: The parameter value. Returns 0.0 if parameter not found or instance is invalid.
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_scalar_parameter_value(instance, parameter_name, layer_index)

get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a static switch parameter from a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter

required

Returns:

Name Type Description
bool bool

The parameter value. Returns False if parameter not found or instance is invalid.

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_static_switch_parameter_value(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    layer_index: int
) -> bool:
    """Get the value of a static switch parameter from a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the layer containing the parameter

    Returns:
        bool: The parameter value. Returns False if parameter not found or instance is invalid.
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index)

get_layered_material_texture_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a texture parameter from a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter

required

Returns:

Type Description
Optional[Texture]

Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid.

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_texture_parameter_value(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    layer_index: int
) -> Optional['unreal.Texture']:
    """Get the value of a texture parameter from a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the layer containing the parameter

    Returns:
        Optional[unreal.Texture]: The texture parameter value. Returns None if parameter not found or instance is invalid.
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_texture_parameter_value(instance, parameter_name, layer_index)

get_layered_material_vector_parameter_value(instance, parameter_name, layer_index) staticmethod

Get the value of a vector parameter from a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
layer_index int

Index of the layer containing the parameter

required

Returns:

Type Description
LinearColor

unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_layered_material_vector_parameter_value(instance: 'unreal.MaterialInstance',
                                                parameter_name: str, layer_index: int) -> 'unreal.LinearColor':
    """Get the value of a vector parameter from a specific layer.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        layer_index (int): Index of the layer containing the parameter

    Returns:
        unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_layered_material_vector_parameter_value(instance, parameter_name, layer_index)

get_material_instance_channel_mask_parameter_value(instance, parameter_name, association=unreal.MaterialParameterAssociation.GLOBAL_PARAMETER) staticmethod

Get the value of a channel mask parameter from a material. Not for material layers, just extends original material functionality that was missing.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to query

required
parameter_name str

Name of the parameter to get

required
association MaterialParameterAssociation

Parameter association type. Defaults to GlobalParameter.

GLOBAL_PARAMETER

Returns:

Type Description
LinearColor

unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid

Source code in Content/Python/layered_material_library.py
@staticmethod
def get_material_instance_channel_mask_parameter_value(
    instance: 'unreal.MaterialInstance',
    parameter_name: str,
    association: 'unreal.MaterialParameterAssociation' = unreal.MaterialParameterAssociation.GLOBAL_PARAMETER
) -> 'unreal.LinearColor':
    """Get the value of a channel mask parameter from a material. Not for material
    layers, just extends original material functionality that was missing.

    Args:
        instance (unreal.MaterialInstance): The material instance to query
        parameter_name (str): Name of the parameter to get
        association (unreal.MaterialParameterAssociation, optional): Parameter association type.
            Defaults to GlobalParameter.

    Returns:
        unreal.LinearColor: The parameter value. Returns (0,0,0,0) if parameter not found or instance is invalid
    """
    return unreal.LayeredMaterialLibrary.get_material_instance_channel_mask_parameter_value(
        instance,
        parameter_name,
        association
    )

is_layered_material(instance) staticmethod

Check if a material instance is a layered material.

Parameters:

Name Type Description Default
instance MaterialInstance

The material instance to check

required

Returns:

Name Type Description
bool bool

True if the material is a layered material, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def is_layered_material(instance: 'unreal.MaterialInstance') -> bool:
    """Check if a material instance is a layered material.

    Args:
        instance (unreal.MaterialInstance): The material instance to check

    Returns:
        bool: True if the material is a layered material, False otherwise
    """
    return unreal.LayeredMaterialLibrary.is_layered_material(instance)

set_any_material_parameter_value(instance, parameter_name, value, layer_index=0, parameter_type='scalar', parameter_domain='layer', only_if_different=False) staticmethod

Set any material parameter value based on type and domain.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
value Union[float, LinearColor, bool, Texture]

New value for the parameter

required
layer_index int

Index of the layer containing the parameter (ignored for global parameters)

0
parameter_type str

Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')

'scalar'
parameter_domain str

Where to set the parameter ('layer', 'blend', 'global')

'layer'
only_if_different bool

Only set the parameter if the new value is different from the current value

False

Returns:

Name Type Description
bool bool

True if the parameter was successfully set

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_any_material_parameter_value(
    instance: 'unreal.MaterialInstanceConstant',
    parameter_name: str,
    value: Union[float, 'unreal.LinearColor', bool, 'unreal.Texture'],
    layer_index: int = 0,
    parameter_type: str = 'scalar',
    parameter_domain: str = 'layer',
    only_if_different: bool = False
) -> bool:
    """Set any material parameter value based on type and domain.

    Args:
        instance: The material instance to modify
        parameter_name: Name of the parameter to set
        value: New value for the parameter
        layer_index: Index of the layer containing the parameter (ignored for global parameters)
        parameter_type: Type of parameter ('scalar', 'vector', 'static_switch', 'texture', 'channel_mask')
        parameter_domain: Where to set the parameter ('layer', 'blend', 'global')
        only_if_different: Only set the parameter if the new value is different from the current value

    Returns:
        bool: True if the parameter was successfully set
    """
    set_functions = {
        'layer': {
            'scalar': LayeredMaterialLibrary.set_layered_material_scalar_parameter_value,
            'vector': LayeredMaterialLibrary.set_layered_material_vector_parameter_value,
            'static_switch': LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value,
            'texture': LayeredMaterialLibrary.set_layered_material_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.set_layered_material_channel_mask_parameter_value
        },
        'blend': {
            'scalar': LayeredMaterialLibrary.set_layered_material_blend_scalar_parameter_value,
            'vector': LayeredMaterialLibrary.set_layered_material_blend_vector_parameter_value,
            'static_switch': LayeredMaterialLibrary.set_layered_material_blend_static_switch_parameter_value,
            'texture': LayeredMaterialLibrary.set_layered_material_blend_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.set_layered_material_blend_channel_mask_parameter_value
        },
        'global': {
            'scalar': unreal.MaterialEditingLibrary.set_material_instance_scalar_parameter_value,
            'vector': unreal.MaterialEditingLibrary.set_material_instance_vector_parameter_value,
            'static_switch': unreal.MaterialEditingLibrary.set_material_instance_static_switch_parameter_value,
            'texture': unreal.MaterialEditingLibrary.set_material_instance_texture_parameter_value,
            'channel_mask': LayeredMaterialLibrary.set_material_channel_mask_parameter_value
        }
    }

    func = set_functions.get(parameter_domain, {}).get(parameter_type)
    if not func:
        raise ValueError(f"Invalid parameter_type '{parameter_type}' or parameter_domain '{parameter_domain}'")

    if only_if_different:
        # Get current value
        current_value = LayeredMaterialLibrary.get_any_material_parameter_value(
            instance,
            parameter_name,
            layer_index,
            parameter_type,
            parameter_domain)

        # Compare values based on type
        if parameter_type == 'scalar':
            if abs(current_value - value) < 0.0001:  # Use small epsilon for float comparison
                return True
        elif parameter_type in ('vector', 'channel_mask'):
            # For LinearColor, compare each component
            if (abs(current_value.r - value.r) < 0.0001 and
                abs(current_value.g - value.g) < 0.0001 and
                abs(current_value.b - value.b) < 0.0001 and
                abs(current_value.a - value.a) < 0.0001):
                return True
        elif parameter_type == 'static_switch':
            if current_value == value:
                return True
        elif parameter_type == 'texture':
            if current_value == value:  # Direct comparison for texture references
                return True

    # Set the new value if we get here
    if parameter_domain == 'global':
        return func(instance, parameter_name, value)
    else:
        return func(instance, parameter_name, layer_index, value)

set_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a channel mask parameter in a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the blend layer containing the parameter

required
value LinearColor

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_blend_channel_mask_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                        parameter_name: str,
                                                        layer_index: int,
                                                        value: 'unreal.LinearColor') -> bool:
    """Set the value of a channel mask parameter in a specific blend layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the blend layer containing the parameter
        value (unreal.LinearColor): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_blend_channel_mask_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a scalar parameter in a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the blend layer containing the parameter

required
value float

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_blend_scalar_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                    parameter_name: str, layer_index: int, value: float) -> bool:
    """Set the value of a scalar parameter in a specific blend layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the blend layer containing the parameter
        value (float): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_blend_scalar_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a static switch parameter in a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the blend layer containing the parameter

required
value bool

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_blend_static_switch_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                            parameter_name: str, layer_index: int, value: bool) -> bool:
    """Set the value of a static switch parameter in a specific blend layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the blend layer containing the parameter
        value (bool): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_blend_static_switch_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a texture parameter in a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the blend layer containing the parameter

required
value Texture

New texture value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_blend_texture_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                    parameter_name: str, layer_index: int,
                                                    value: 'unreal.Texture') -> bool:
    """Set the value of a texture parameter in a specific blend layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the blend layer containing the parameter
        value (unreal.Texture): New texture value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_blend_texture_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a vector parameter in a specific blend layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the blend layer containing the parameter

required
value LinearColor

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_blend_vector_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                    parameter_name: str, layer_index: int,
                                                    value: 'unreal.LinearColor') -> bool:
    """Set the value of a vector parameter in a specific blend layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the blend layer containing the parameter
        value (unreal.LinearColor): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_blend_vector_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a channel mask parameter in a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the layer containing the parameter

required
value LinearColor

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_channel_mask_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                    parameter_name: str,
                                                    layer_index: int,
                                                    value: 'unreal.LinearColor') -> bool:
    """Set the value of a channel mask parameter in a specific layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the layer containing the parameter
        value (unreal.LinearColor): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_channel_mask_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a scalar parameter in a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the layer containing the parameter

required
value float

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_scalar_parameter_value(
    instance: 'unreal.MaterialInstanceConstant',
    parameter_name: str,
    layer_index: int,
    value: float
) -> bool:
    """Set the value of a scalar parameter in a specific layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the layer containing the parameter
        value (float): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_scalar_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a static switch parameter in a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the layer containing the parameter

required
value bool

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_static_switch_parameter_value(
    instance: 'unreal.MaterialInstanceConstant',
    parameter_name: str,
    layer_index: int,
    value: bool
) -> bool:
    """Set the value of a static switch parameter in a specific layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the layer containing the parameter
        value (bool): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_static_switch_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a texture parameter in a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the layer containing the parameter

required
value Texture

New texture value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_texture_parameter_value(
    instance: 'unreal.MaterialInstanceConstant',
    parameter_name: str,
    layer_index: int,
    value: 'unreal.Texture'
) -> bool:
    """Set the value of a texture parameter in a specific layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the layer containing the parameter
        value (unreal.Texture): New texture value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_texture_parameter_value(instance, parameter_name, layer_index, value)

set_layered_material_vector_parameter_value(instance, parameter_name, layer_index, value) staticmethod

Set the value of a vector parameter in a specific layer.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
layer_index int

Index of the layer containing the parameter

required
value LinearColor

New value for the parameter

required

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_layered_material_vector_parameter_value(instance: 'unreal.MaterialInstanceConstant',
                                                parameter_name: str, layer_index: int,
                                                value: 'unreal.LinearColor') -> bool:
    """Set the value of a vector parameter in a specific layer.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        layer_index (int): Index of the layer containing the parameter
        value (unreal.LinearColor): New value for the parameter

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_layered_material_vector_parameter_value(instance, parameter_name, layer_index, value)

set_material_instance_channel_mask_parameter_value(instance, parameter_name, value, association=unreal.MaterialParameterAssociation.GLOBAL_PARAMETER) staticmethod

Set the value of a channel mask parameter in a material. Not for material layers, just extends original material functionality that was missing.

Parameters:

Name Type Description Default
instance MaterialInstanceConstant

The material instance to modify

required
parameter_name str

Name of the parameter to set

required
value LinearColor

New value for the parameter

required
association MaterialParameterAssociation

Parameter association type. Defaults to GlobalParameter.

GLOBAL_PARAMETER

Returns:

Name Type Description
bool bool

True if the parameter was successfully set, False otherwise

Source code in Content/Python/layered_material_library.py
@staticmethod
def set_material_instance_channel_mask_parameter_value(
    instance: 'unreal.MaterialInstanceConstant',
    parameter_name: str,
    value: 'unreal.LinearColor',
    association: 'unreal.MaterialParameterAssociation' = unreal.MaterialParameterAssociation.GLOBAL_PARAMETER
) -> bool:
    """Set the value of a channel mask parameter in a material. Not for material
    layers, just extends original material functionality that was missing.

    Args:
        instance (unreal.MaterialInstanceConstant): The material instance to modify
        parameter_name (str): Name of the parameter to set
        value (unreal.LinearColor): New value for the parameter
        association (unreal.MaterialParameterAssociation, optional): Parameter association type.
            Defaults to GlobalParameter.

    Returns:
        bool: True if the parameter was successfully set, False otherwise
    """
    return unreal.LayeredMaterialLibrary.set_material_instance_channel_mask_parameter_value(
        instance,
        parameter_name,
        value,
        association
    )