Files
cocos4/cocos/rendering/post-process/components/post-process.ts
T
minggo 7ef995b655 Merge branch 'v3.8.0' into v3.8.1-merge-v3.8.0
Conflicts:
	cocos/3d/lights/spot-light-component.ts
	cocos/animation/event/event-emitter.ts
	cocos/physics-2d/box2d/physics-contact.ts
	cocos/physics-2d/box2d/physics-world.ts
	cocos/physics-2d/box2d/platform/physics-contact-listener.ts
	cocos/physics-2d/builtin/builtin-world.ts
	cocos/physics/framework/components/constraints/configurable-constraint.ts
	cocos/spine/assembler/simple.ts
	cocos/spine/skeleton.ts
	native/cocos/editor-support/spine-wasm/spine-model.cpp
	native/cocos/editor-support/spine-wasm/spine-model.h
	native/cocos/editor-support/spine-wasm/spine-skeleton-instance.cpp
	native/cocos/editor-support/spine-wasm/spine-skeleton-instance.h
	native/cocos/editor-support/spine-wasm/spine-type-export.cpp
	native/external-config.json
2023-07-03 15:25:13 +08:00

64 lines
1.9 KiB
TypeScript

import { EDITOR } from 'internal:constants';
import { property } from '../../../core/data/class-decorator';
import { ccclass, disallowMultiple, executeInEditMode, help, range, slide, tooltip } from '../../../core/data/decorators';
import { Director, director } from '../../../game';
import { Component } from '../../../scene-graph';
import { PostProcessSetting } from './post-process-setting';
@ccclass('cc.PostProcess')
@help('cc.PostProcess')
@disallowMultiple
@executeInEditMode
export class PostProcess extends Component {
static all: PostProcess[] = []
@tooltip('i18n:postprocess.global')
@property
global = true;
@property
_shadingScale = 1
@tooltip('i18n:postprocess.shadingScale')
@slide
@range([0.01, 1, 0.01])
@property
get shadingScale (): number {
return this._shadingScale;
}
set shadingScale (v) {
this._shadingScale = v;
if (EDITOR) {
setTimeout(() => {
globalThis.cce.Engine.repaintInEditMode();
}, 50);
}
}
@tooltip('i18n:postprocess.enableShadingScaleInEditor')
@property
enableShadingScaleInEditor = false;
settings: Map<typeof PostProcessSetting, PostProcessSetting> = new Map()
addSetting (setting: PostProcessSetting): void {
this.settings.set(setting.constructor as typeof PostProcessSetting, setting);
}
removeSetting (setting: PostProcessSetting): void {
this.settings.delete(setting.constructor as typeof PostProcessSetting);
}
getSetting (ctor: typeof PostProcessSetting): PostProcessSetting | undefined {
return this.settings.get(ctor);
}
onEnable (): void {
PostProcess.all.push(this);
}
onDisable (): void {
const idx = PostProcess.all.indexOf(this);
if (idx !== -1) {
PostProcess.all.splice(idx, 1);
}
}
}