Hi,
I am currently experimenting with MaterialPlugins and would like to switch out a block of code using the regex.
I can follow the examples to switch out a single line without issue, but if I try to switch out multiple lines then I cannot get it to work.
For example, I have tried switching out the following block of code from pbrBlockFinalUnlitComponents:
vec3 finalDiffuse = diffuseBase;
finalDiffuse *= surfaceAlbedo.rgb;
finalDiffuse = max(finalDiffuse, 0.0);
using the following getCustomCode regex logic:
public override getCustomCode(shaderType: string) {
return shaderType === “vertex”
? null
: {
“!vec3\finalDiffuse\=\diffuseBase;\finalDiffuse\*=\surfaceAlbedo.rgb;\finalDiffuse\=\max(finalDiffuse,\0.0);”:vec3 finalDiffuse = vec3(0., 1., 0.);
,
};
}
but it doesn’t seem to do anything.
In addition:
- when using these regexes, are we changing the code exactly as it is written within the checked in .ts files or are we changing some kind of parsed version?
- is it possible to use the regex to change and ifdef statement or is the regex run after the ifdef is already applied?
- is it possible to use the regex to change a #include?
Many thanks.