Skip to content

Commit 42677f0

Browse files
kzhswDavid Catuhe
andauthored
PostProcess: add doNotSerialize (#17369)
This commit adds a doNotSerialize to PostProcess with a default false, since it’s a class, existing code should not be broken, and derived classes should inherit this prop. In SceneSerializer._Serialize, doNotSerialize would be checked like all other type of objects for PostProcess. Forum link: <https://forum.babylonjs.com/t/postprocess-add-donotserialize/61186> --------- Co-authored-by: David Catuhe <[email protected]>
1 parent cc641ac commit 42677f0

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/dev/core/src/Misc/sceneSerializer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,10 @@ export class SceneSerializer {
347347
// Post processes
348348
serializationObject.postProcesses = [];
349349
for (index = 0; index < scene.postProcesses.length; index++) {
350-
serializationObject.postProcesses.push(scene.postProcesses[index].serialize());
350+
const postProcess = scene.postProcesses[index];
351+
if (!postProcess.doNotSerialize) {
352+
serializationObject.postProcesses.push(postProcess.serialize());
353+
}
351354
}
352355

353356
// Action Manager

packages/dev/core/src/PostProcesses/postProcess.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ export class PostProcess {
334334
@serialize()
335335
public adaptScaleToCurrentViewport = false;
336336

337+
/**
338+
* Specifies if the post process should be serialized
339+
*/
340+
public doNotSerialize = false;
341+
337342
private _camera: Camera;
338343
protected _scene: Scene;
339344
private _engine: AbstractEngine;

packages/tools/tests/test/visualization/config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,12 @@
400400
},
401401
{
402402
"title": "Node material PBR 1",
403-
"playgroundId": "#D8AK3Z#107",
403+
"playgroundId": "#D8AK3Z#121",
404404
"referenceImage": "node-material-pbr-1.png"
405405
},
406406
{
407407
"title": "Node material PBR Pure WebGPU",
408-
"playgroundId": "#D8AK3Z#108",
408+
"playgroundId": "#D8AK3Z#122",
409409
"referenceImage": "node-material-pbr-2.png",
410410
"excludedEngines": ["webgl1", "webgl2"]
411411
},
@@ -1301,17 +1301,17 @@
13011301
},
13021302
{
13031303
"title": "PBR shader code coverage 1",
1304-
"playgroundId": "#QI7TL3#59",
1304+
"playgroundId": "#QI7TL3#63",
13051305
"referenceImage": "pbr-codecoverage1.png"
13061306
},
13071307
{
13081308
"title": "PBR shader code coverage 2",
1309-
"playgroundId": "#QI7TL3#60",
1309+
"playgroundId": "#QI7TL3#64",
13101310
"referenceImage": "pbr-codecoverage2.png"
13111311
},
13121312
{
13131313
"title": "PBR shader code coverage 3",
1314-
"playgroundId": "#QI7TL3#61",
1314+
"playgroundId": "#QI7TL3#65",
13151315
"referenceImage": "pbr-codecoverage3.png"
13161316
},
13171317
{

0 commit comments

Comments
 (0)