Files
cocos4/cocos/rendering/post-process/components/blit-screen.ts
T
PP 509d73b27d merge branch v3.8.0-aot (#15421)
* PR1: add explicit function return type (#15311)

* PR4: add explicit function return type (#15314)

* [ci skip][AUTO]: Automated code generating update: 8843bfe54cd3f8e6f84432948716c8d130ecb233  (#15314) (#15357)

Co-authored-by: cocos-robot <cocos-robot@cocos.com>

* add function return type

* fix version checking

* fix return type

---------

Co-authored-by: Cocos Robot <48829427+cocos-robot@users.noreply.github.com>
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2023-06-13 18:08:45 +08:00

65 lines
1.7 KiB
TypeScript

import { Material } from '../../../asset/assets';
import { property } from '../../../core/data/class-decorator';
import { ccclass, disallowMultiple, executeInEditMode, menu } from '../../../core/data/decorators';
import { PostProcessSetting } from './post-process-setting';
@ccclass('cc.BlitScreenMaterial')
class BlitScreenMaterial {
@property(Material)
_material: Material | undefined;
@property(Material)
get material (): Material | undefined {
return this._material;
}
set material (v) {
this._material = v;
}
@property
enable = true
}
@ccclass('cc.BlitScreen')
@menu('PostProcess/BlitScreen')
@disallowMultiple
@executeInEditMode
export class BlitScreen extends PostProcessSetting {
@property(Material)
_activeMaterials: Material[] = []
@property({ type: Material, visible: false })
get activeMaterials (): Material[] {
return this._activeMaterials;
}
set activeMaterials (v) {
this._activeMaterials = v;
}
@property(BlitScreenMaterial)
_materials: BlitScreenMaterial[] = []
@property(BlitScreenMaterial)
get materials (): BlitScreenMaterial[] {
return this._materials;
}
set materials (v) {
this._materials = v;
this.updateActiveMateirals();
}
updateActiveMateirals (): void {
const materials = this._materials;
this._activeMaterials.length = 0;
for (let i = 0; i < materials.length; i++) {
const m = materials[i];
if (m.enable && m.material) {
this._activeMaterials.push(m.material);
}
}
}
onLoad (): void {
this.updateActiveMateirals();
}
}