@@ -79,7 +79,11 @@ For the full list of texture maps you can ignore, see the [JSON schema](#json-sc
79
79
By default, an entry in the material overrides file applies when its name matches the material name exactly.
80
80
Since it's common that the same override should apply to multiple materials, you can optionally provide a regular expression as the entry name.
81
81
The field ` nameMatching ` has a default value ` exact ` , but it can be set to ` regex ` to state that the entry should apply to every matching material.
82
- The syntax used is the same syntax used for JavaScript.
82
+ The syntax of the regex is the same syntax used for JavaScript.
83
+
84
+ > [ !TIP]
85
+ > There are free regex testing websites available to test and debug a regular expression against arbitrary strings.
86
+
83
87
The following example shows an override that applies to materials with names like ` Material2 ` , ` Material01 ` and ` Material999 ` .
84
88
85
89
``` json
@@ -97,9 +101,28 @@ The following example shows an override that applies to materials with names lik
97
101
]
98
102
```
99
103
100
- At most, one entry in a material override file applies to a single material.
101
- If there's an exact match (that is, ` nameMatching ` is absent or equals ` exact ` ) for the material name, then that entry is chosen.
102
- Otherwise, the first regex entry in the file that matches the material name is chosen.
104
+ This example shows an override that is applied to _ all_ materials:
105
+
106
+ ``` json
107
+ [
108
+ {
109
+ "name" : " .*" ,
110
+ "nameMatching" : " regex" ,
111
+ "albedoColor" : {
112
+ "r" : 0.0 ,
113
+ "g" : 0.0 ,
114
+ "b" : 1.0 ,
115
+ "a" : 1.0
116
+ }
117
+ }
118
+ ]
119
+ ```
120
+
121
+ The order in which every material finds a matching override is as follows:
122
+ 1 . First, it tests for exact name match (that is, it checks all overrides where ` nameMatching ` is absent or equals ` exact ` ).
123
+ 1 . If no override is found, it tests all overrides with ` regex ` name matching mode and uses _ the first_ override that matches.
124
+
125
+ A single material never gets more than one override applied, even if multiple ` regex ` expressions apply to the material name.
103
126
104
127
### Getting information about which entries applied
105
128
0 commit comments