mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
7ef995b655
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
64 lines
1.9 KiB
TypeScript
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);
|
|
}
|
|
}
|
|
}
|