From b2bb2bf5599243259f511a62507dc9afcac5e39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:34:50 +0800 Subject: [PATCH] jsb classes apply decorator from .ts source files (#14403) * decorator parser * remove used variable --- .github/workflows/gen_decorators.js | 105 + .github/workflows/native-bindings.yml | 12 + cocos/3d/assets/mesh.jsb.ts | 8 +- cocos/3d/assets/skeleton.jsb.ts | 8 +- cocos/asset/asset-manager/factory.ts | 2 +- cocos/asset/assets/asset.jsb.ts | 8 +- cocos/asset/assets/buffer-asset.jsb.ts | 7 +- cocos/asset/assets/effect-asset.jsb.ts | 13 +- cocos/asset/assets/image-asset.jsb.ts | 8 +- cocos/asset/assets/index.jsb.ts | 2 +- cocos/asset/assets/index.ts | 2 +- cocos/asset/assets/material.jsb.ts | 17 +- cocos/asset/assets/render-texture.jsb.ts | 4 +- cocos/asset/assets/scene-asset.jsb.ts | 7 +- cocos/asset/assets/simple-texture.jsb.ts | 7 +- cocos/asset/assets/text-asset.jsb.ts | 7 +- cocos/asset/assets/text-asset.ts | 2 +- cocos/asset/assets/texture-2d.jsb.ts | 6 +- cocos/asset/assets/texture-base.jsb.ts | 13 +- cocos/asset/assets/texture-cube.jsb.ts | 9 +- cocos/gi/light-probe/delaunay.jsb.ts | 25 +- cocos/gi/light-probe/light-probe.jsb.ts | 14 +- cocos/native-binding/decorators.ts | 1816 +++++++++++++++++ cocos/native-binding/index.ts | 22 +- cocos/render-scene/scene/camera.jsb.ts | 1 - cocos/rendering/index.jsb.ts | 111 +- cocos/scene-graph/node.jsb.ts | 252 +-- cocos/scene-graph/scene-globals.jsb.ts | 309 +-- cocos/scene-graph/scene.jsb.ts | 10 +- .../src/babel-plugins/decorator-parser.ts | 1147 +++++++++++ scripts/build-engine/src/index.ts | 74 +- 31 files changed, 3327 insertions(+), 701 deletions(-) create mode 100644 .github/workflows/gen_decorators.js create mode 100644 cocos/native-binding/decorators.ts create mode 100644 scripts/build-engine/src/babel-plugins/decorator-parser.ts diff --git a/.github/workflows/gen_decorators.js b/.github/workflows/gen_decorators.js new file mode 100644 index 0000000000..5a8b907437 --- /dev/null +++ b/.github/workflows/gen_decorators.js @@ -0,0 +1,105 @@ +/// generate jsb decorators + + +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable max-len */ +/* eslint-disable @typescript-eslint/no-var-requires */ +const path = require('path'); +const fs = require('fs'); +const os = require('os'); + +const contentLines = []; +process.on('message', (msg) => { + if (msg.event === 'write-decorator') { + contentLines.push({ className: msg.className, lines: msg.lines }); + } +}); + +const engineDir = path.resolve(__dirname, '../..'); +const tmpDir = os.tmpdir(); + +const BUILD_CONFIG = { + options: { + engine: engineDir, + platform: 'HTML5', + moduleFormat: 2, + compress: false, + split: false, + ammoJsWasm: 'fallback', + assetURLFormat: 'runtime-resolved', + noDeprecatedFeatures: false, + engineName: 'cocos-js', + sourceMaps: false, + features: [ + '2d', '3d', + 'animation', 'audio', + 'base', 'dragon-bones', + 'gfx-webgl', 'gfx-webgl2', + 'intersection-2d', 'light-probe', + 'marionette', 'particle', + 'particle-2d', 'physics-2d-box2d', + 'physics-ammo', 'primitive', + 'profiler', 'skeletal-animation', + 'spine', 'terrain', + 'tiled-map', 'tween', + 'ui', 'video', + 'websocket', 'webview', + ], + loose: true, + mode: 'BUILD', + flags: { DEBUG: false, UI_GPU_DRIVEN: false }, + name: 'cocos-js', + // incremental: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\CocosCreator\\3.7.2\\builder\\engine\\8e98547c3502329ef2d27ebed2ca0eac.watch-files.json', + //out: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\CocosCreator\\3.7.2\\builder\\engine\\8e98547c3502329ef2d27ebed2ca0eac', + out: tmpDir, + buildTimeConstants: { + HTML5: true, + NATIVE: false, + WECHAT: false, + BAIDU: false, + XIAOMI: false, + ALIPAY: false, + TAOBAO: false, + BYTEDANCE: false, + OPPO: false, + VIVO: false, + HUAWEI: false, + COCOSPLAY: false, + QTT: false, + LINKSURE: false, + EDITOR: false, + PREVIEW: false, + BUILD: true, + TEST: false, + DEBUG: true, + SERVER_MODE: false, + DEV: false, + MINIGAME: false, + RUNTIME_BASED: false, + SUPPORT_JIT: true, + JSB: false, + NOT_PACK_PHYSX_LIBS: false, + NET_MODE: 0, + WEBGPU: false, + }, + generateDecoratorsForJSB: true, + // metaFile: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\CocosCreator\\3.7.2\\builder\\engine\\8e98547c3502329ef2d27ebed2ca0eac.meta\\meta.json' + }, +}; + +process.env.ENGINE_PATH = engineDir; + +const buildEngine = require(`${engineDir}/scripts/build-engine/dist/index.js`); + +buildEngine.build(BUILD_CONFIG.options).then((result) => { + console.log('done!!!'); + + console.log(result); + const sortedLines = contentLines.sort((a, b) => a.className.localeCompare(b.className)).map((x) => x.lines.join('\n')).join('\n'); + const destFile = path.join(engineDir, 'cocos/native-binding/decorators.ts'); + fs.writeFileSync(destFile, `${sortedLines}\n`, 'utf8'); + process.exit(0); +}).catch((err) => { + console.error(err); + process.exit(-1); +}); diff --git a/.github/workflows/native-bindings.yml b/.github/workflows/native-bindings.yml index e5d478c5ee..5141f57859 100644 --- a/.github/workflows/native-bindings.yml +++ b/.github/workflows/native-bindings.yml @@ -14,6 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Generate decorators + run: | + npm install + cd scripts/build-engine + npm install + npm install @babel/types @babel/traverse @babel/generator + npm run build + cd ../.. + node .github/workflows/gen_decorators.js + cd scripts/build-engine + git checkout HEAD . # revert all changes within build-engine/ + - name: Download external libraries run: | EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` diff --git a/cocos/3d/assets/mesh.jsb.ts b/cocos/3d/assets/mesh.jsb.ts index 8f562b41fb..f29a888b44 100644 --- a/cocos/3d/assets/mesh.jsb.ts +++ b/cocos/3d/assets/mesh.jsb.ts @@ -21,8 +21,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, serializable } from 'cc.decorator'; import { cclegacy, Vec3 } from '../../core'; +import { patch_cc_Mesh } from '../../native-binding/decorators'; declare const jsb: any; @@ -163,8 +163,4 @@ meshAssetProto.onLoaded = function () { cclegacy.Mesh = jsb.Mesh; // handle meta data, it is generated automatically -const MeshProto = Mesh.prototype; -serializable(MeshProto, '_struct', () => { return { vertexBundles: [], primitives: [] } }); -serializable(MeshProto, '_hash', () => 0); -serializable(MeshProto, '_allowDataAccess', () => true); -ccclass('cc.Mesh')(Mesh); +patch_cc_Mesh({Mesh}); \ No newline at end of file diff --git a/cocos/3d/assets/skeleton.jsb.ts b/cocos/3d/assets/skeleton.jsb.ts index 139ff9907a..ef254fb16d 100644 --- a/cocos/3d/assets/skeleton.jsb.ts +++ b/cocos/3d/assets/skeleton.jsb.ts @@ -22,10 +22,10 @@ THE SOFTWARE. */ -import { ccclass, type, serializable } from 'cc.decorator'; import { CCString, cclegacy, Mat4 } from '../../core'; import { DataPoolManager } from '../skeletal-animation/data-pool-manager'; import { Asset } from '../../asset/assets/asset'; +import { patch_cc_Skeleton } from '../../native-binding/decorators'; export const Skeleton = jsb.Skeleton; export type Skeleton = jsb.Skeleton; @@ -62,8 +62,4 @@ skeletonProto.onLoaded = function () { }; // handle meta data, it is generated automatically -const SkeletonProto = Skeleton.prototype; -type([CCString])(SkeletonProto, '_joints', () => []); -type([Mat4])(SkeletonProto, '_bindposes', () => []); -serializable(SkeletonProto, '_hash', () => 0); -ccclass('cc.Skeleton')(Skeleton); \ No newline at end of file +patch_cc_Skeleton({Skeleton, CCString, Mat4}); \ No newline at end of file diff --git a/cocos/asset/asset-manager/factory.ts b/cocos/asset/asset-manager/factory.ts index 5d77950426..3d1cd620c5 100644 --- a/cocos/asset/asset-manager/factory.ts +++ b/cocos/asset/asset-manager/factory.ts @@ -25,7 +25,7 @@ import { EDITOR } from 'internal:constants'; import { ImageAsset } from '../assets/image-asset'; import JsonAsset from '../assets/json-asset'; -import TextAsset from '../assets/text-asset'; +import { TextAsset } from '../assets/text-asset'; import { Asset } from '../assets/asset'; import { BufferAsset } from '../assets/buffer-asset'; import Bundle, { resources } from './bundle'; diff --git a/cocos/asset/assets/asset.jsb.ts b/cocos/asset/assets/asset.jsb.ts index 55caae9c28..0e44152c0a 100644 --- a/cocos/asset/assets/asset.jsb.ts +++ b/cocos/asset/assets/asset.jsb.ts @@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, serializable } from 'cc.decorator'; import { cclegacy, js, _decorator, path, jsbUtils, CallbacksInvoker, applyMixins } from '../../core'; import { getUrlWithUuid } from '../asset-manager/helper'; +import { patch_cc_Asset } from '../../native-binding/decorators'; declare const jsb: any; @@ -121,8 +121,4 @@ export const Asset = jsb.Asset; cclegacy.Asset = jsb.Asset; // handle meta data, it is generated automatically -const AssetProto = Asset.prototype; -serializable(AssetProto, '_native', () => ''); -const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(AssetProto, '_nativeAsset'); -_decorator.property(AssetProto, '_nativeAsset', _nativeAssetDescriptor); -ccclass('cc.Asset')(Asset); +patch_cc_Asset({Asset}); \ No newline at end of file diff --git a/cocos/asset/assets/buffer-asset.jsb.ts b/cocos/asset/assets/buffer-asset.jsb.ts index e62c491d05..b4ede886e4 100644 --- a/cocos/asset/assets/buffer-asset.jsb.ts +++ b/cocos/asset/assets/buffer-asset.jsb.ts @@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, override } from 'cc.decorator'; import { cclegacy } from '../../core'; import './asset'; +import { patch_cc_BufferAsset } from '../../native-binding/decorators'; export type BufferAsset = jsb.BufferAsset; export const BufferAsset = jsb.BufferAsset; @@ -31,7 +31,4 @@ export const BufferAsset = jsb.BufferAsset; cclegacy.BufferAsset = jsb.BufferAsset; // handle meta data, it is generated automatically -const BufferAssetProto = BufferAsset.prototype; -const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(BufferAssetProto, '_nativeAsset'); -override(BufferAssetProto, '_nativeAsset', _nativeAssetDescriptor); -ccclass('cc.BufferAsset')(BufferAsset); +patch_cc_BufferAsset({BufferAsset}); diff --git a/cocos/asset/assets/effect-asset.jsb.ts b/cocos/asset/assets/effect-asset.jsb.ts index ebe182c4d9..53dbc16ab7 100644 --- a/cocos/asset/assets/effect-asset.jsb.ts +++ b/cocos/asset/assets/effect-asset.jsb.ts @@ -22,9 +22,9 @@ THE SOFTWARE. */ -import { ccclass, editable, editorOnly, serializable } from 'cc.decorator'; import{ cclegacy } from '../../core'; import './asset'; +import { patch_cc_EffectAsset } from '../../native-binding/decorators'; export type EffectAsset = jsb.EffectAsset; export const EffectAsset = jsb.EffectAsset; @@ -39,13 +39,4 @@ effectAssetProto._ctor = function () { }; // handle meta data, it is generated automatically -const EffectAssetProto = EffectAsset.prototype; -editable(EffectAssetProto, 'techniques', () => []); -serializable(EffectAssetProto, 'techniques', () => []); -editable(EffectAssetProto, 'shaders', () => []); -serializable(EffectAssetProto, 'shaders', () => []); -editable(EffectAssetProto, 'combinations', () => []); -serializable(EffectAssetProto, 'combinations', () => []); -editorOnly(EffectAssetProto, 'hideInEditor', () => false); -serializable(EffectAssetProto, 'hideInEditor', () => false); -ccclass('cc.EffectAsset')(EffectAsset); +patch_cc_EffectAsset({EffectAsset}) diff --git a/cocos/asset/assets/image-asset.jsb.ts b/cocos/asset/assets/image-asset.jsb.ts index de0cffc104..fb0d4dfb72 100644 --- a/cocos/asset/assets/image-asset.jsb.ts +++ b/cocos/asset/assets/image-asset.jsb.ts @@ -21,11 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, override } from 'cc.decorator'; import { ALIPAY, XIAOMI, JSB, TEST, BAIDU } from 'internal:constants'; import { Format, FormatFeatureBit, deviceManager } from '../../gfx'; import { PixelFormat } from './asset-enum'; import { sys, macro, warnID, cclegacy } from '../../core'; +import { patch_cc_ImageAsset } from '../../native-binding/decorators'; import './asset'; export type ImageAsset = jsb.ImageAsset; @@ -273,7 +273,5 @@ imageAssetProto._deserialize = function (data: any) { cclegacy.ImageAsset = jsb.ImageAsset; // handle meta data, it is generated automatically -const ImageAssetProto = ImageAsset.prototype; -const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(ImageAssetProto, '_nativeAsset'); -override(ImageAssetProto, '_nativeAsset', _nativeAssetDescriptor); -ccclass('cc.ImageAsset')(ImageAsset); +patch_cc_ImageAsset({ImageAsset}); + diff --git a/cocos/asset/assets/index.jsb.ts b/cocos/asset/assets/index.jsb.ts index 3518a821bc..f6a5f5d51e 100644 --- a/cocos/asset/assets/index.jsb.ts +++ b/cocos/asset/assets/index.jsb.ts @@ -30,7 +30,7 @@ export { BufferAsset } from './buffer-asset'; export * from './scripts'; export { RenderingSubMesh } from './rendering-sub-mesh'; export { SceneAsset } from './scene-asset'; -export { default as TextAsset } from './text-asset'; +export { TextAsset } from './text-asset'; export { default as JsonAsset } from './json-asset'; export { ImageAsset } from './image-asset'; export { Texture2D } from './texture-2d'; diff --git a/cocos/asset/assets/index.ts b/cocos/asset/assets/index.ts index 5d070e946e..156675951d 100644 --- a/cocos/asset/assets/index.ts +++ b/cocos/asset/assets/index.ts @@ -30,7 +30,7 @@ export { BufferAsset } from './buffer-asset'; export * from './scripts'; export { RenderingSubMesh } from './rendering-sub-mesh'; export { SceneAsset } from './scene-asset'; -export { default as TextAsset } from './text-asset'; +export { TextAsset } from './text-asset'; export { default as JsonAsset } from './json-asset'; export { ImageAsset } from './image-asset'; export { Texture2D } from './texture-2d'; diff --git a/cocos/asset/assets/material.jsb.ts b/cocos/asset/assets/material.jsb.ts index 52c9fcacde..4c98779c5f 100644 --- a/cocos/asset/assets/material.jsb.ts +++ b/cocos/asset/assets/material.jsb.ts @@ -27,8 +27,8 @@ import { Texture } from '../../gfx'; import { TextureBase } from './texture-base'; import { PassOverrides, MacroRecord, MaterialProperty } from '../../render-scene'; import { Color, Mat3, Mat4, Quat, Vec2, Vec3, Vec4, cclegacy } from '../../core'; -import { type, serializable, ccclass } from '../../core/data/decorators'; import './asset'; +import { patch_cc_Material } from '../../native-binding/decorators'; /** * @en The basic infos for material initialization. @@ -78,7 +78,7 @@ declare const jsb: any; const matProto: any = jsb.Material.prototype; type setProperyCB = (name: string, val: MaterialPropertyFull | MaterialPropertyFull[], passIdx?: number) => void; -function wrapSetProperty (cb: setProperyCB, target: Material, name: string, val: MaterialPropertyFull | MaterialPropertyFull[], passIdx?: number) { +function wrapSetProperty(cb: setProperyCB, target: Material, name: string, val: MaterialPropertyFull | MaterialPropertyFull[], passIdx?: number) { if (passIdx != undefined) { cb.call(target, name, val, passIdx); } else { @@ -158,7 +158,7 @@ matProto.setProperty = function (name: string, val: MaterialPropertyFull | Mater this.setPropertyNull(name); } } - else { + else { cclegacy.error(`Material.setProperty Unknown type: ${val}`); } }; @@ -283,7 +283,7 @@ materialProto._onPassesUpdated = function () { Object.defineProperty(materialProto, 'passes', { enumerable: true, configurable: true, - get () { + get() { if (!this._isCtorCalled) { // Builtin materials are created in cpp, the _passes property is not updated when access it in JS. // So we need to invoke getPasses() to sync _passes property. @@ -296,11 +296,4 @@ Object.defineProperty(materialProto, 'passes', { }); // handle meta data, it is generated automatically -const MaterialProto = Material.prototype; -// @ts-expect-error -type(EffectAsset)(MaterialProto, '_effectAsset', () => null); -serializable(MaterialProto, '_techIdx', () => 0); -serializable(MaterialProto, '_defines', () => []); -serializable(MaterialProto, '_states', () => []); -serializable(MaterialProto, '_props', () => []); -ccclass('cc.Material')(Material); +patch_cc_Material({ Material, EffectAsset}); diff --git a/cocos/asset/assets/render-texture.jsb.ts b/cocos/asset/assets/render-texture.jsb.ts index 0b416023b4..fd2a5661e2 100644 --- a/cocos/asset/assets/render-texture.jsb.ts +++ b/cocos/asset/assets/render-texture.jsb.ts @@ -21,11 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass } from 'cc.decorator'; import { EDITOR, TEST } from 'internal:constants'; import { cclegacy } from '../../core'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import './asset'; +import { patch_cc_RenderTexture } from '../../native-binding/decorators'; declare const jsb: any; const renderTextureProto: any = jsb.RenderTexture.prototype; @@ -76,4 +76,4 @@ renderTextureProto.readPixels = function readPixels (x: number, y: number, width cclegacy.RenderTexture = jsb.RenderTexture; // handle meta data, it is generated automatically -ccclass('cc.RenderTexture')(RenderTexture); +patch_cc_RenderTexture({RenderTexture}); \ No newline at end of file diff --git a/cocos/asset/assets/scene-asset.jsb.ts b/cocos/asset/assets/scene-asset.jsb.ts index 09b61dfe26..8ed7c78e33 100644 --- a/cocos/asset/assets/scene-asset.jsb.ts +++ b/cocos/asset/assets/scene-asset.jsb.ts @@ -21,8 +21,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, editable, serializable } from 'cc.decorator'; import { cclegacy } from '../../core'; +import { patch_cc_SceneAsset } from '../../native-binding/decorators'; import './asset'; export const SceneAsset = jsb.SceneAsset; @@ -53,7 +53,4 @@ sceneAssetProto._ctor = function () { }; // handle meta data, it is generated automatically -const SceneAssetProto = SceneAsset.prototype; -serializable(SceneAssetProto, 'scene', () => null); -editable(SceneAssetProto, 'scene', () => null); -ccclass('cc.SceneAsset')(SceneAsset); +patch_cc_SceneAsset({SceneAsset}); \ No newline at end of file diff --git a/cocos/asset/assets/simple-texture.jsb.ts b/cocos/asset/assets/simple-texture.jsb.ts index 687541f105..7f9e853b5e 100644 --- a/cocos/asset/assets/simple-texture.jsb.ts +++ b/cocos/asset/assets/simple-texture.jsb.ts @@ -21,11 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass } from 'cc.decorator'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import dependUtil from '../asset-manager/depend-util'; import { js, macro, cclegacy } from '../../core'; import './texture-base'; +import { patch_cc_SimpleTexture } from '../../native-binding/decorators'; declare const jsb: any; @@ -55,8 +55,6 @@ simpleTextureProto.uploadData = function (source, level = 0, arrayIndex = 0) { oldUpdateDataFunc.call(this, data, level, arrayIndex); }; -const clsDecorator = ccclass('cc.SimpleTexture'); - simpleTextureProto._ctor = function () { jsb.TextureBase.prototype._ctor.apply(this, arguments); this._gfxTexture = null; @@ -86,6 +84,7 @@ simpleTextureProto._onAfterAssignImage = function (image) { } }; -clsDecorator(SimpleTexture); +patch_cc_SimpleTexture({SimpleTexture}); cclegacy.SimpleTexture = jsb.SimpleTexture; + diff --git a/cocos/asset/assets/text-asset.jsb.ts b/cocos/asset/assets/text-asset.jsb.ts index 0385ddc391..4fa8185cca 100644 --- a/cocos/asset/assets/text-asset.jsb.ts +++ b/cocos/asset/assets/text-asset.jsb.ts @@ -21,8 +21,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, editable, serializable } from 'cc.decorator'; import { cclegacy } from '../../core'; +import { patch_cc_TextAsset } from '../../native-binding/decorators'; import './asset'; const textAssetProto: any = jsb.TextAsset.prototype; @@ -39,7 +39,4 @@ textAssetProto._ctor = function () { cclegacy.TextAsset = jsb.TextAsset; // handle meta data, it is generated automatically -const TextAssetProto = TextAsset.prototype; -editable(TextAssetProto, 'text', () => ''); -serializable(TextAssetProto, 'text', () => ''); -ccclass('cc.TextAsset')(TextAsset); +patch_cc_TextAsset({TextAsset}); diff --git a/cocos/asset/assets/text-asset.ts b/cocos/asset/assets/text-asset.ts index 400e76de8a..c3f1631a05 100644 --- a/cocos/asset/assets/text-asset.ts +++ b/cocos/asset/assets/text-asset.ts @@ -32,7 +32,7 @@ import { cclegacy } from '../../core'; * @zh 文本资源。 */ @ccclass('cc.TextAsset') -export default class TextAsset extends Asset { +export class TextAsset extends Asset { /** * @en The text content. * @zh 此资源包含的文本。 diff --git a/cocos/asset/assets/texture-2d.jsb.ts b/cocos/asset/assets/texture-2d.jsb.ts index b060a3d09e..a95dd0bfe8 100644 --- a/cocos/asset/assets/texture-2d.jsb.ts +++ b/cocos/asset/assets/texture-2d.jsb.ts @@ -21,13 +21,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, type } from 'cc.decorator'; import { ImageAsset } from './image-asset'; import { SimpleTexture } from './simple-texture'; import { TextureBase } from './texture-base.jsb'; import { js, cclegacy } from '../../core'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import './simple-texture'; +import { patch_cc_Texture2D } from '../../native-binding/decorators'; const texture2DProto: any = jsb.Texture2D.prototype; @@ -121,6 +121,4 @@ Object.defineProperty(texture2DProto, 'mipmaps', { cclegacy.Texture2D = jsb.Texture2D; // handle meta data, it is generated automatically -const Texture2DProto = Texture2D.prototype; -type([ImageAsset])(Texture2DProto, '_mipmaps'); -ccclass('cc.Texture2D')(Texture2D); +patch_cc_Texture2D({Texture2D, ImageAsset}); diff --git a/cocos/asset/assets/texture-base.jsb.ts b/cocos/asset/assets/texture-base.jsb.ts index 9f94cfe8f9..23caa1545d 100644 --- a/cocos/asset/assets/texture-base.jsb.ts +++ b/cocos/asset/assets/texture-base.jsb.ts @@ -21,12 +21,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, serializable } from 'cc.decorator'; import { TEST, EDITOR } from 'internal:constants'; import { deviceManager } from '../../gfx'; import { cclegacy } from '../../core'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import './asset'; +import { patch_cc_TextureBase } from '../../native-binding/decorators'; const textureBaseProto: any = jsb.TextureBase.prototype; @@ -136,13 +136,4 @@ textureBaseProto._onGFXSamplerUpdated = function (gfxSampler, samplerInfo) { cclegacy.TextureBase = jsb.TextureBase; // handle meta data, it is generated automatically -const TextureBaseProto = TextureBase.prototype; -serializable(TextureBaseProto, '_format', () => PixelFormat.RGBA8888); -serializable(TextureBaseProto, '_minFilter', () => Filter.LINEAR); -serializable(TextureBaseProto, '_magFilter', () => Filter.LINEAR); -serializable(TextureBaseProto, '_mipFilter', () => Filter.NONE); -serializable(TextureBaseProto, '_wrapS', () => WrapMode.REPEAT); -serializable(TextureBaseProto, '_wrapT', () => WrapMode.REPEAT); -serializable(TextureBaseProto, '_wrapR', () => WrapMode.REPEAT); -serializable(TextureBaseProto, '_anisotropy', () => 0); -ccclass('cc.TextureBase')(TextureBase); +patch_cc_TextureBase({TextureBase, Filter, WrapMode, PixelFormat}); \ No newline at end of file diff --git a/cocos/asset/assets/texture-cube.jsb.ts b/cocos/asset/assets/texture-cube.jsb.ts index bfc9ba5139..40508d71fd 100644 --- a/cocos/asset/assets/texture-cube.jsb.ts +++ b/cocos/asset/assets/texture-cube.jsb.ts @@ -21,11 +21,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { ccclass, serializable } from 'cc.decorator'; import { Filter, PixelFormat, WrapMode } from './asset-enum'; import { js, cclegacy } from '../../core'; import './simple-texture'; import { EDITOR, TEST } from 'internal:constants'; +import { patch_cc_TextureCube } from '../../native-binding/decorators'; const textureCubeProto: any = jsb.TextureCube.prototype; interface ITextureCubeSerializeData { @@ -226,9 +226,4 @@ textureCubeProto._deserialize = function (serializedData: ITextureCubeSerializeD cclegacy.TextureCube = jsb.TextureCube; // handle meta data, it is generated automatically -const TextureCubeProto = TextureCube.prototype; -serializable(TextureCubeProto, 'isRGBE', () => false); -serializable(TextureCubeProto, '_mipmaps', () => []); -serializable(TextureCubeProto, '_mipmapMode', () => MipmapMode.NONE); -serializable(TextureCubeProto, '_mipmapAtlas', () => null); -ccclass('cc.TextureCube')(TextureCube); +patch_cc_TextureCube({TextureCube, MipmapMode}); diff --git a/cocos/gi/light-probe/delaunay.jsb.ts b/cocos/gi/light-probe/delaunay.jsb.ts index 6dab49911c..f5fc1255b5 100644 --- a/cocos/gi/light-probe/delaunay.jsb.ts +++ b/cocos/gi/light-probe/delaunay.jsb.ts @@ -22,31 +22,14 @@ THE SOFTWARE. */ import { Mat3, Vec3, _decorator } from "../../core"; +import { patch_cc_CircumSphere, patch_cc_Tetrahedron, patch_cc_Vertex } from "../../native-binding/decorators"; -const { ccclass, serializable } = _decorator; export const Vertex = jsb.Vertex; -const VertexProto = Vertex.prototype; -serializable(VertexProto, 'position', () => new Vec3(0, 0, 0)); -serializable(VertexProto, 'normal', () => new Vec3(0, 0, 0)); -serializable(VertexProto, 'coefficients', () => []); -ccclass('cc.Vertex')(Vertex); +patch_cc_Vertex({Vertex, Vec3}); export const CircumSphere = jsb.CircumSphere; -const CircumSphereProto = CircumSphere.prototype; -serializable(CircumSphereProto, 'center', () => new Vec3(0, 0, 0)); -serializable(CircumSphereProto, 'radiusSquared', () => 0.0); -ccclass('cc.CircumSphere')(CircumSphere); +patch_cc_CircumSphere({CircumSphere, Vec3}); export const Tetrahedron = jsb.Tetrahedron; -const TetrahedronProto = Tetrahedron.prototype; -serializable(TetrahedronProto, 'invalid', () => false); -serializable(TetrahedronProto, 'vertex0', () => -1); -serializable(TetrahedronProto, 'vertex1', () => -1); -serializable(TetrahedronProto, 'vertex2', () => -1); -serializable(TetrahedronProto, 'vertex3', () => -1); -serializable(TetrahedronProto, 'neighbours', () => [-1, -1, -1, -1]); -serializable(TetrahedronProto, 'matrix', () => new Mat3()); -serializable(TetrahedronProto, 'offset', () => new Vec3(0.0, 0.0, 0.0)); -serializable(TetrahedronProto, 'sphere', () => new CircumSphere()); -ccclass('cc.Tetrahedron')(Tetrahedron); +patch_cc_Tetrahedron({Tetrahedron, Mat3, Vec3, CircumSphere}); \ No newline at end of file diff --git a/cocos/gi/light-probe/light-probe.jsb.ts b/cocos/gi/light-probe/light-probe.jsb.ts index 7f78479545..2106ab42e9 100644 --- a/cocos/gi/light-probe/light-probe.jsb.ts +++ b/cocos/gi/light-probe/light-probe.jsb.ts @@ -22,21 +22,15 @@ THE SOFTWARE. */ import { _decorator } from '../../core'; +import { patch_cc_LightProbesData } from '../../native-binding/decorators'; import { Tetrahedron, Vertex } from './delaunay'; -const { ccclass, serializable, type } = _decorator; export const LightProbes = jsb.LightProbes; -ccclass('cc.LightProbes')(LightProbes); +_decorator.ccclass('cc.LightProbes')(LightProbes); +// patch_cc_LightProbes({LightProbes}); // not exists export const LightProbesData = jsb.LightProbesData; -const LightProbesDataProto = LightProbesData.prototype; -// @ts-expect-error -type([Vertex])(LightProbesDataProto, '_probes', () => []); -serializable(LightProbesDataProto, '_probes', () => []); +patch_cc_LightProbesData({LightProbesData, Vertex, Tetrahedron}); -// @ts-expect-error -type([Tetrahedron])(LightProbesDataProto, '_tetrahedrons', () => []); -serializable(LightProbesDataProto, '_tetrahedrons', () => []); -ccclass('cc.LightProbesData')(LightProbesData); diff --git a/cocos/native-binding/decorators.ts b/cocos/native-binding/decorators.ts new file mode 100644 index 0000000000..02deec96a3 --- /dev/null +++ b/cocos/native-binding/decorators.ts @@ -0,0 +1,1816 @@ +/* This file is generated by script, do not modify it manually. */ + +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ +/* eslint-disable brace-style */ +/* eslint-disable @typescript-eslint/indent */ +/* eslint-disable max-len */ +/* eslint-disable arrow-body-style */ +/* eslint-disable comma-dangle */ +/* eslint-disable func-names */ +/* eslint-disable space-before-function-paren */ + +import * as $$ from 'cc.decorator'; +import { _decorator as $ } from '../core'; + +const defaultExec = (cb: () => void, decorator?: string, attr?: string | null) => { cb(); }; + +//---- class BloomStage +interface BloomStage_Context_Args { + BloomStage: any; + Material: any; +} +export function patch_BloomStage(ctx: BloomStage_Context_Args, apply = defaultExec) { + const { BloomStage, Material } = { ...ctx }; + apply(() => { $.displayOrder(3)(BloomStage.prototype, '_bloomMaterial', () => { return null; }); }, 'displayOrder', '_bloomMaterial'); + apply(() => { $.serializable(BloomStage.prototype, '_bloomMaterial', () => { return null; }); }, 'serializable', '_bloomMaterial'); + apply(() => { $.type(Material)(BloomStage.prototype, '_bloomMaterial'); }, 'type', '_bloomMaterial'); + apply(() => { $.ccclass('BloomStage')(BloomStage); }, 'ccclass', null); +} // end of patch_BloomStage + +//---- class cc_AmbientInfo +interface cc_AmbientInfo_Context_Args { + AmbientInfo: any; + legacyCC: any; + CCFloat: any; + Vec4: any; + Ambient: any; +} +export function patch_cc_AmbientInfo(ctx: cc_AmbientInfo_Context_Args, apply = defaultExec) { + const { AmbientInfo, legacyCC, CCFloat, Vec4, Ambient } = { ...ctx }; + const skyLightingColorDescriptor = Object.getOwnPropertyDescriptor(AmbientInfo.prototype, 'skyLightingColor'); + const skyIllumDescriptor = Object.getOwnPropertyDescriptor(AmbientInfo.prototype, 'skyIllum'); + const groundLightingColorDescriptor = Object.getOwnPropertyDescriptor(AmbientInfo.prototype, 'groundLightingColor'); + apply(() => { $.tooltip('i18n:ambient.skyLightingColor')(AmbientInfo.prototype, 'skyLightingColor', skyLightingColorDescriptor); }, 'tooltip', 'skyLightingColor'); + apply(() => { $.editable(AmbientInfo.prototype, 'skyLightingColor', skyLightingColorDescriptor); }, 'editable', 'skyLightingColor'); + apply(() => { $.visible(() => { + const scene = legacyCC.director.getScene(); + const skybox = scene.globals.skybox; + if (skybox.useIBL && skybox.applyDiffuseMap) { + return false; + } else { + return true; + } +})(AmbientInfo.prototype, 'skyLightingColor', skyLightingColorDescriptor); }, 'visible', 'skyLightingColor'); + apply(() => { $.tooltip('i18n:ambient.skyIllum')(AmbientInfo.prototype, 'skyIllum', skyIllumDescriptor); }, 'tooltip', 'skyIllum'); + apply(() => { $.type(CCFloat)(AmbientInfo.prototype, 'skyIllum'); }, 'type', 'skyIllum'); + apply(() => { $.editable(AmbientInfo.prototype, 'skyIllum', skyIllumDescriptor); }, 'editable', 'skyIllum'); + apply(() => { $.tooltip('i18n:ambient.groundLightingColor')(AmbientInfo.prototype, 'groundLightingColor', groundLightingColorDescriptor); }, 'tooltip', 'groundLightingColor'); + apply(() => { $.editable(AmbientInfo.prototype, 'groundLightingColor', groundLightingColorDescriptor); }, 'editable', 'groundLightingColor'); + apply(() => { $.visible(() => { + const scene = legacyCC.director.getScene(); + const skybox = scene.globals.skybox; + if (skybox.useIBL && skybox.applyDiffuseMap) { + return false; + } else { + return true; + } +})(AmbientInfo.prototype, 'groundLightingColor', groundLightingColorDescriptor); }, 'visible', 'groundLightingColor'); + apply(() => { $.formerlySerializedAs('_skyColor')(AmbientInfo.prototype, '_skyColorHDR', () => { return new Vec4(0.2, 0.5, 0.8, 1.0); }); }, 'formerlySerializedAs', '_skyColorHDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_skyColorHDR', () => { return new Vec4(0.2, 0.5, 0.8, 1.0); }); }, 'serializable', '_skyColorHDR'); + apply(() => { $.formerlySerializedAs('_skyIllum')(AmbientInfo.prototype, '_skyIllumHDR', () => { return Ambient.SKY_ILLUM; }); }, 'formerlySerializedAs', '_skyIllumHDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_skyIllumHDR', () => { return Ambient.SKY_ILLUM; }); }, 'serializable', '_skyIllumHDR'); + apply(() => { $.formerlySerializedAs('_groundAlbedo')(AmbientInfo.prototype, '_groundAlbedoHDR', () => { return new Vec4(0.2, 0.2, 0.2, 1.0); }); }, 'formerlySerializedAs', '_groundAlbedoHDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_groundAlbedoHDR', () => { return new Vec4(0.2, 0.2, 0.2, 1.0); }); }, 'serializable', '_groundAlbedoHDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_skyColorLDR', () => { return new Vec4(0.2, 0.5, 0.8, 1.0); }); }, 'serializable', '_skyColorLDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_skyIllumLDR', () => { return Ambient.SKY_ILLUM; }); }, 'serializable', '_skyIllumLDR'); + apply(() => { $.serializable(AmbientInfo.prototype, '_groundAlbedoLDR', () => { return new Vec4(0.2, 0.2, 0.2, 1.0); }); }, 'serializable', '_groundAlbedoLDR'); + apply(() => { $.ccclass('cc.AmbientInfo')(AmbientInfo); }, 'ccclass', null); +} // end of patch_cc_AmbientInfo + +//---- class cc_Asset +interface cc_Asset_Context_Args { + Asset: any; +} +export function patch_cc_Asset(ctx: cc_Asset_Context_Args, apply = defaultExec) { + const { Asset } = { ...ctx }; + const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(Asset.prototype, '_nativeAsset'); + apply(() => { $.serializable(Asset.prototype, '_native', () => { return ''; }); }, 'serializable', '_native'); + apply(() => { $.property(Asset.prototype, '_nativeAsset', _nativeAssetDescriptor); }, 'property', '_nativeAsset'); + apply(() => { $.ccclass('cc.Asset')(Asset); }, 'ccclass', null); +} // end of patch_cc_Asset + +//---- class cc_BufferAsset +interface cc_BufferAsset_Context_Args { + BufferAsset: any; +} +export function patch_cc_BufferAsset(ctx: cc_BufferAsset_Context_Args, apply = defaultExec) { + const { BufferAsset } = { ...ctx }; + const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(BufferAsset.prototype, '_nativeAsset'); + apply(() => { $.override(BufferAsset.prototype, '_nativeAsset', _nativeAssetDescriptor); }, 'override', '_nativeAsset'); + apply(() => { $.ccclass('cc.BufferAsset')(BufferAsset); }, 'ccclass', null); +} // end of patch_cc_BufferAsset + +//---- class cc_Camera +interface cc_Camera_Context_Args { + Camera: any; + ProjectionType: any; + FOVAxis: any; + Color: any; + ClearFlag: any; + Rect: any; + Aperture: any; + Shutter: any; + ISO: any; + CAMERA_DEFAULT_MASK: any; + CameraType: any; + TrackingType: any; + Layers: any; + RenderTexture: any; +} +export function patch_cc_Camera(ctx: cc_Camera_Context_Args, apply = defaultExec) { + type Camera = any; + const { Camera, ProjectionType, FOVAxis, Color, ClearFlag, Rect, Aperture, Shutter, ISO, CAMERA_DEFAULT_MASK, CameraType, TrackingType, Layers, RenderTexture } = { ...ctx }; + const priorityDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'priority'); + const visibilityDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'visibility'); + const clearFlagsDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'clearFlags'); + const clearColorDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'clearColor'); + const clearDepthDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'clearDepth'); + const clearStencilDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'clearStencil'); + const projectionDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'projection'); + const fovAxisDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'fovAxis'); + const fovDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'fov'); + const orthoHeightDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'orthoHeight'); + const nearDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'near'); + const farDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'far'); + const apertureDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'aperture'); + const shutterDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'shutter'); + const isoDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'iso'); + const rectDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'rect'); + const targetTextureDescriptor = Object.getOwnPropertyDescriptor(Camera.prototype, 'targetTexture'); + apply(() => { $.serializable(Camera.prototype, '_projection', () => { return ProjectionType.PERSPECTIVE; }); }, 'serializable', '_projection'); + apply(() => { $.serializable(Camera.prototype, '_priority', () => { return 0; }); }, 'serializable', '_priority'); + apply(() => { $.serializable(Camera.prototype, '_fov', () => { return 45; }); }, 'serializable', '_fov'); + apply(() => { $.serializable(Camera.prototype, '_fovAxis', () => { return FOVAxis.VERTICAL; }); }, 'serializable', '_fovAxis'); + apply(() => { $.serializable(Camera.prototype, '_orthoHeight', () => { return 10; }); }, 'serializable', '_orthoHeight'); + apply(() => { $.serializable(Camera.prototype, '_near', () => { return 1; }); }, 'serializable', '_near'); + apply(() => { $.serializable(Camera.prototype, '_far', () => { return 1000; }); }, 'serializable', '_far'); + apply(() => { $.serializable(Camera.prototype, '_color', () => { return new Color('#333333'); }); }, 'serializable', '_color'); + apply(() => { $.serializable(Camera.prototype, '_depth', () => { return 1; }); }, 'serializable', '_depth'); + apply(() => { $.serializable(Camera.prototype, '_stencil', () => { return 0; }); }, 'serializable', '_stencil'); + apply(() => { $.serializable(Camera.prototype, '_clearFlags', () => { return ClearFlag.SOLID_COLOR; }); }, 'serializable', '_clearFlags'); + apply(() => { $.serializable(Camera.prototype, '_rect', () => { return new Rect(0, 0, 1, 1); }); }, 'serializable', '_rect'); + apply(() => { $.serializable(Camera.prototype, '_aperture', () => { return Aperture.F16_0; }); }, 'serializable', '_aperture'); + apply(() => { $.serializable(Camera.prototype, '_shutter', () => { return Shutter.D125; }); }, 'serializable', '_shutter'); + apply(() => { $.serializable(Camera.prototype, '_iso', () => { return ISO.ISO100; }); }, 'serializable', '_iso'); + apply(() => { $.serializable(Camera.prototype, '_screenScale', () => { return 1; }); }, 'serializable', '_screenScale'); + apply(() => { $.serializable(Camera.prototype, '_visibility', () => { return CAMERA_DEFAULT_MASK; }); }, 'serializable', '_visibility'); + apply(() => { $.serializable(Camera.prototype, '_targetTexture', () => { return null; }); }, 'serializable', '_targetTexture'); + apply(() => { $.serializable(Camera.prototype, '_cameraType', () => { return CameraType.DEFAULT; }); }, 'serializable', '_cameraType'); + apply(() => { $.serializable(Camera.prototype, '_trackingType', () => { return TrackingType.NO_TRACKING; }); }, 'serializable', '_trackingType'); + apply(() => { $.tooltip('i18n:camera.priority')(Camera.prototype, 'priority', priorityDescriptor); }, 'tooltip', 'priority'); + apply(() => { $.range([0, 65535, 1])(Camera.prototype, 'priority', priorityDescriptor); }, 'range', 'priority'); + apply(() => { $.displayOrder(0)(Camera.prototype, 'priority', priorityDescriptor); }, 'displayOrder', 'priority'); + apply(() => { $.tooltip('i18n:camera.visibility')(Camera.prototype, 'visibility', visibilityDescriptor); }, 'tooltip', 'visibility'); + apply(() => { $.displayOrder(1)(Camera.prototype, 'visibility', visibilityDescriptor); }, 'displayOrder', 'visibility'); + apply(() => { $.type(Layers.BitMask)(Camera.prototype, 'visibility'); }, 'type', 'visibility'); + apply(() => { $.tooltip('i18n:camera.clear_flags')(Camera.prototype, 'clearFlags', clearFlagsDescriptor); }, 'tooltip', 'clearFlags'); + apply(() => { $.displayOrder(2)(Camera.prototype, 'clearFlags', clearFlagsDescriptor); }, 'displayOrder', 'clearFlags'); + apply(() => { $.type(ClearFlag)(Camera.prototype, 'clearFlags'); }, 'type', 'clearFlags'); + apply(() => { $.tooltip('i18n:camera.color')(Camera.prototype, 'clearColor', clearColorDescriptor); }, 'tooltip', 'clearColor'); + apply(() => { $.displayOrder(3)(Camera.prototype, 'clearColor', clearColorDescriptor); }, 'displayOrder', 'clearColor'); + apply(() => { $.tooltip('i18n:camera.depth')(Camera.prototype, 'clearDepth', clearDepthDescriptor); }, 'tooltip', 'clearDepth'); + apply(() => { $.displayOrder(4)(Camera.prototype, 'clearDepth', clearDepthDescriptor); }, 'displayOrder', 'clearDepth'); + apply(() => { $.tooltip('i18n:camera.stencil')(Camera.prototype, 'clearStencil', clearStencilDescriptor); }, 'tooltip', 'clearStencil'); + apply(() => { $.displayOrder(5)(Camera.prototype, 'clearStencil', clearStencilDescriptor); }, 'displayOrder', 'clearStencil'); + apply(() => { $.tooltip('i18n:camera.projection')(Camera.prototype, 'projection', projectionDescriptor); }, 'tooltip', 'projection'); + apply(() => { $.displayOrder(6)(Camera.prototype, 'projection', projectionDescriptor); }, 'displayOrder', 'projection'); + apply(() => { $.type(ProjectionType)(Camera.prototype, 'projection'); }, 'type', 'projection'); + apply(() => { $.tooltip('i18n:camera.fov_axis')(Camera.prototype, 'fovAxis', fovAxisDescriptor); }, 'tooltip', 'fovAxis'); + apply(() => { $.visible(function (this: Camera) { + return this._projection === ProjectionType.PERSPECTIVE; +})(Camera.prototype, 'fovAxis', fovAxisDescriptor); }, 'visible', 'fovAxis'); + apply(() => { $.displayOrder(7)(Camera.prototype, 'fovAxis', fovAxisDescriptor); }, 'displayOrder', 'fovAxis'); + apply(() => { $.type(FOVAxis)(Camera.prototype, 'fovAxis'); }, 'type', 'fovAxis'); + apply(() => { $.tooltip('i18n:camera.fov')(Camera.prototype, 'fov', fovDescriptor); }, 'tooltip', 'fov'); + apply(() => { $.range([1, 180, 1])(Camera.prototype, 'fov', fovDescriptor); }, 'range', 'fov'); + apply(() => { $.visible(function (this: Camera) { + return this._projection === ProjectionType.PERSPECTIVE; +})(Camera.prototype, 'fov', fovDescriptor); }, 'visible', 'fov'); + apply(() => { $.displayOrder(8)(Camera.prototype, 'fov', fovDescriptor); }, 'displayOrder', 'fov'); + apply(() => { $.tooltip('i18n:camera.ortho_height')(Camera.prototype, 'orthoHeight', orthoHeightDescriptor); }, 'tooltip', 'orthoHeight'); + apply(() => { $$.rangeMin(1)(Camera.prototype, 'orthoHeight', orthoHeightDescriptor); }, 'rangeMin', 'orthoHeight'); + apply(() => { $.visible(function (this: Camera) { + return this._projection === ProjectionType.ORTHO; +})(Camera.prototype, 'orthoHeight', orthoHeightDescriptor); }, 'visible', 'orthoHeight'); + apply(() => { $.displayOrder(9)(Camera.prototype, 'orthoHeight', orthoHeightDescriptor); }, 'displayOrder', 'orthoHeight'); + apply(() => { $.tooltip('i18n:camera.near')(Camera.prototype, 'near', nearDescriptor); }, 'tooltip', 'near'); + apply(() => { $$.rangeMin(0)(Camera.prototype, 'near', nearDescriptor); }, 'rangeMin', 'near'); + apply(() => { $.displayOrder(10)(Camera.prototype, 'near', nearDescriptor); }, 'displayOrder', 'near'); + apply(() => { $.tooltip('i18n:camera.far')(Camera.prototype, 'far', farDescriptor); }, 'tooltip', 'far'); + apply(() => { $$.rangeMin(0)(Camera.prototype, 'far', farDescriptor); }, 'rangeMin', 'far'); + apply(() => { $.displayOrder(11)(Camera.prototype, 'far', farDescriptor); }, 'displayOrder', 'far'); + apply(() => { $.tooltip('i18n:camera.aperture')(Camera.prototype, 'aperture', apertureDescriptor); }, 'tooltip', 'aperture'); + apply(() => { $.displayOrder(12)(Camera.prototype, 'aperture', apertureDescriptor); }, 'displayOrder', 'aperture'); + apply(() => { $.type(Aperture)(Camera.prototype, 'aperture'); }, 'type', 'aperture'); + apply(() => { $.tooltip('i18n:camera.shutter')(Camera.prototype, 'shutter', shutterDescriptor); }, 'tooltip', 'shutter'); + apply(() => { $.displayOrder(13)(Camera.prototype, 'shutter', shutterDescriptor); }, 'displayOrder', 'shutter'); + apply(() => { $.type(Shutter)(Camera.prototype, 'shutter'); }, 'type', 'shutter'); + apply(() => { $.tooltip('i18n:camera.ISO')(Camera.prototype, 'iso', isoDescriptor); }, 'tooltip', 'iso'); + apply(() => { $.displayOrder(14)(Camera.prototype, 'iso', isoDescriptor); }, 'displayOrder', 'iso'); + apply(() => { $.type(ISO)(Camera.prototype, 'iso'); }, 'type', 'iso'); + apply(() => { $.tooltip('i18n:camera.rect')(Camera.prototype, 'rect', rectDescriptor); }, 'tooltip', 'rect'); + apply(() => { $.displayOrder(15)(Camera.prototype, 'rect', rectDescriptor); }, 'displayOrder', 'rect'); + apply(() => { $.tooltip('i18n:camera.target_texture')(Camera.prototype, 'targetTexture', targetTextureDescriptor); }, 'tooltip', 'targetTexture'); + apply(() => { $.displayOrder(16)(Camera.prototype, 'targetTexture', targetTextureDescriptor); }, 'displayOrder', 'targetTexture'); + apply(() => { $.type(RenderTexture)(Camera.prototype, 'targetTexture'); }, 'type', 'targetTexture'); + apply(() => { $.executeInEditMode(Camera); }, 'executeInEditMode', null); + apply(() => { $.menu('Rendering/Camera')(Camera); }, 'menu', null); + apply(() => { $.help('i18n:cc.Camera')(Camera); }, 'help', null); + apply(() => { $.ccclass('cc.Camera')(Camera); }, 'ccclass', null); +} // end of patch_cc_Camera + +//---- class cc_CircumSphere +interface cc_CircumSphere_Context_Args { + CircumSphere: any; + Vec3: any; +} +export function patch_cc_CircumSphere(ctx: cc_CircumSphere_Context_Args, apply = defaultExec) { + const { CircumSphere, Vec3 } = { ...ctx }; + apply(() => { $.serializable(CircumSphere.prototype, 'center', () => { return new Vec3(0, 0, 0); }); }, 'serializable', 'center'); + apply(() => { $.serializable(CircumSphere.prototype, 'radiusSquared', () => { return 0.0; }); }, 'serializable', 'radiusSquared'); + apply(() => { $.ccclass('cc.CircumSphere')(CircumSphere); }, 'ccclass', null); +} // end of patch_cc_CircumSphere + +//---- class cc_DirectionalLight +interface cc_DirectionalLight_Context_Args { + DirectionalLight: any; + Camera: any; + PCFType: any; + CSMLevel: any; + CSMOptimizationMode: any; + cclegacy: any; + ShadowType: any; + CCBoolean: any; + CCFloat: any; +} +export function patch_cc_DirectionalLight(ctx: cc_DirectionalLight_Context_Args, apply = defaultExec) { + type Root = any; + type DirectionalLight = any; + const { DirectionalLight, Camera, PCFType, CSMLevel, CSMOptimizationMode, cclegacy, ShadowType, CCBoolean, CCFloat } = { ...ctx }; + const illuminanceDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'illuminance'); + const shadowEnabledDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowEnabled'); + const shadowPcfDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowPcf'); + const shadowBiasDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowBias'); + const shadowNormalBiasDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowNormalBias'); + const shadowSaturationDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowSaturation'); + const shadowDistanceDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowDistance'); + const shadowInvisibleOcclusionRangeDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange'); + const csmLevelDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmLevel'); + const enableCSMDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'enableCSM'); + const csmLayerLambdaDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmLayerLambda'); + const csmOptimizationModeDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmOptimizationMode'); + const shadowFixedAreaDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowFixedArea'); + const shadowNearDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowNear'); + const shadowFarDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowFar'); + const shadowOrthoSizeDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'shadowOrthoSize'); + const csmAdvancedOptionsDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmAdvancedOptions'); + const csmLayersTransitionDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmLayersTransition'); + const csmTransitionRangeDescriptor = Object.getOwnPropertyDescriptor(DirectionalLight.prototype, 'csmTransitionRange'); + apply(() => { $.formerlySerializedAs('_illuminance')(DirectionalLight.prototype, '_illuminanceHDR', () => { return 65000; }); }, 'formerlySerializedAs', '_illuminanceHDR'); + apply(() => { $.property(DirectionalLight.prototype, '_illuminanceHDR', () => { return 65000; }); }, 'property', '_illuminanceHDR'); + apply(() => { $.serializable(DirectionalLight.prototype, '_illuminanceLDR', () => { return 65000 * Camera.standardExposureValue; }); }, 'serializable', '_illuminanceLDR'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowEnabled', () => { return false; }); }, 'serializable', '_shadowEnabled'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowPcf', () => { return PCFType.HARD; }); }, 'serializable', '_shadowPcf'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowBias', () => { return 0.00001; }); }, 'serializable', '_shadowBias'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowNormalBias', () => { return 0.0; }); }, 'serializable', '_shadowNormalBias'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowSaturation', () => { return 1.0; }); }, 'serializable', '_shadowSaturation'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowDistance', () => { return 50; }); }, 'serializable', '_shadowDistance'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowInvisibleOcclusionRange', () => { return 200; }); }, 'serializable', '_shadowInvisibleOcclusionRange'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmLevel', () => { return CSMLevel.LEVEL_4; }); }, 'serializable', '_csmLevel'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmLayerLambda', () => { return 0.75; }); }, 'serializable', '_csmLayerLambda'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmOptimizationMode', () => { return CSMOptimizationMode.RemoveDuplicates; }); }, 'serializable', '_csmOptimizationMode'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmAdvancedOptions', () => { return false; }); }, 'serializable', '_csmAdvancedOptions'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmLayersTransition', () => { return false; }); }, 'serializable', '_csmLayersTransition'); + apply(() => { $.serializable(DirectionalLight.prototype, '_csmTransitionRange', () => { return 0.05; }); }, 'serializable', '_csmTransitionRange'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowFixedArea', () => { return false; }); }, 'serializable', '_shadowFixedArea'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowNear', () => { return 0.1; }); }, 'serializable', '_shadowNear'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowFar', () => { return 10.0; }); }, 'serializable', '_shadowFar'); + apply(() => { $.serializable(DirectionalLight.prototype, '_shadowOrthoSize', () => { return 5; }); }, 'serializable', '_shadowOrthoSize'); + apply(() => { $.tooltip('i18n:lights.illuminance')(DirectionalLight.prototype, 'illuminance', illuminanceDescriptor); }, 'tooltip', 'illuminance'); + apply(() => { $.type(CCBoolean)(DirectionalLight.prototype, 'shadowEnabled'); }, 'type', 'shadowEnabled'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'editable', 'shadowEnabled'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 1 + } +})(DirectionalLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'property', 'shadowEnabled'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'visible', 'shadowEnabled'); + apply(() => { $.tooltip('i18n:lights.shadowEnabled')(DirectionalLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'tooltip', 'shadowEnabled'); + apply(() => { $.type(PCFType)(DirectionalLight.prototype, 'shadowPcf'); }, 'type', 'shadowPcf'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'editable', 'shadowPcf'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 5 + } +})(DirectionalLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'property', 'shadowPcf'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'visible', 'shadowPcf'); + apply(() => { $.tooltip('i18n:lights.shadowPcf')(DirectionalLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'tooltip', 'shadowPcf'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowBias'); }, 'type', 'shadowBias'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'editable', 'shadowBias'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 6 + } +})(DirectionalLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'property', 'shadowBias'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'visible', 'shadowBias'); + apply(() => { $.tooltip('i18n:lights.shadowBias')(DirectionalLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'tooltip', 'shadowBias'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowNormalBias'); }, 'type', 'shadowNormalBias'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'editable', 'shadowNormalBias'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 7 + } +})(DirectionalLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'property', 'shadowNormalBias'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'visible', 'shadowNormalBias'); + apply(() => { $.tooltip('i18n:lights.shadowNormalBias')(DirectionalLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'tooltip', 'shadowNormalBias'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowSaturation'); }, 'type', 'shadowSaturation'); + apply(() => { $.slide(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'slide', 'shadowSaturation'); + apply(() => { $.range([0.0, 1.0, 0.01])(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'range', 'shadowSaturation'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'editable', 'shadowSaturation'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 8 + } +})(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'property', 'shadowSaturation'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'visible', 'shadowSaturation'); + apply(() => { $.tooltip('i18n:lights.shadowSaturation')(DirectionalLight.prototype, 'shadowSaturation', shadowSaturationDescriptor); }, 'tooltip', 'shadowSaturation'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowDistance'); }, 'type', 'shadowDistance'); + apply(() => { $.slide(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'slide', 'shadowDistance'); + apply(() => { $.range([0.0, 2000.0, 0.1])(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'range', 'shadowDistance'); + apply(() => { $.tooltip('shadow visible distance: shadow quality is inversely proportional of the magnitude of this value')(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'tooltip', 'shadowDistance'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'editable', 'shadowDistance'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 9 + } +})(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'property', 'shadowDistance'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === false; +})(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'visible', 'shadowDistance'); + apply(() => { $.tooltip('i18n:lights.shadowDistance')(DirectionalLight.prototype, 'shadowDistance', shadowDistanceDescriptor); }, 'tooltip', 'shadowDistance'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange'); }, 'type', 'shadowInvisibleOcclusionRange'); + apply(() => { $.slide(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'slide', 'shadowInvisibleOcclusionRange'); + apply(() => { $.range([0.0, 2000.0, 1.0])(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'range', 'shadowInvisibleOcclusionRange'); + apply(() => { $.tooltip('if shadow has been culled, increase this value to fix it')(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'tooltip', 'shadowInvisibleOcclusionRange'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'editable', 'shadowInvisibleOcclusionRange'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 22 + } +})(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'property', 'shadowInvisibleOcclusionRange'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === false && this._csmAdvancedOptions; +})(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'visible', 'shadowInvisibleOcclusionRange'); + apply(() => { $.tooltip('i18n:lights.shadowInvisibleOcclusionRange')(DirectionalLight.prototype, 'shadowInvisibleOcclusionRange', shadowInvisibleOcclusionRangeDescriptor); }, 'tooltip', 'shadowInvisibleOcclusionRange'); + apply(() => { $.type(CSMLevel)(DirectionalLight.prototype, 'csmLevel'); }, 'type', 'csmLevel'); + apply(() => { $.slide(DirectionalLight.prototype, 'csmLevel', csmLevelDescriptor); }, 'slide', 'csmLevel'); + apply(() => { $.tooltip('CSM Level')(DirectionalLight.prototype, 'csmLevel', csmLevelDescriptor); }, 'tooltip', 'csmLevel'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmLevel', csmLevelDescriptor); }, 'editable', 'csmLevel'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 10 + } +})(DirectionalLight.prototype, 'csmLevel', csmLevelDescriptor); }, 'property', 'csmLevel'); + apply(() => { $.visible(false)(DirectionalLight.prototype, 'csmLevel', csmLevelDescriptor); }, 'visible', 'csmLevel'); + apply(() => { $.type(CCBoolean)(DirectionalLight.prototype, 'enableCSM'); }, 'type', 'enableCSM'); + apply(() => { $.slide(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'slide', 'enableCSM'); + apply(() => { $.tooltip('enable CSM')(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'tooltip', 'enableCSM'); + apply(() => { $.editable(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'editable', 'enableCSM'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 11 + } +})(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'property', 'enableCSM'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === false; +})(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'visible', 'enableCSM'); + apply(() => { $.tooltip('i18n:lights.enableCSM')(DirectionalLight.prototype, 'enableCSM', enableCSMDescriptor); }, 'tooltip', 'enableCSM'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'csmLayerLambda'); }, 'type', 'csmLayerLambda'); + apply(() => { $.slide(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'slide', 'csmLayerLambda'); + apply(() => { $.range([0.0, 1.0, 0.01])(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'range', 'csmLayerLambda'); + apply(() => { $.tooltip('CSM Level ratio')(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'tooltip', 'csmLayerLambda'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'editable', 'csmLayerLambda'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 12 + } +})(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'property', 'csmLayerLambda'); + apply(() => { $.visible(false)(DirectionalLight.prototype, 'csmLayerLambda', csmLayerLambdaDescriptor); }, 'visible', 'csmLayerLambda'); + apply(() => { $.type(CSMOptimizationMode)(DirectionalLight.prototype, 'csmOptimizationMode'); }, 'type', 'csmOptimizationMode'); + apply(() => { $.slide(DirectionalLight.prototype, 'csmOptimizationMode', csmOptimizationModeDescriptor); }, 'slide', 'csmOptimizationMode'); + apply(() => { $.tooltip('CSM Performance Optimization Mode')(DirectionalLight.prototype, 'csmOptimizationMode', csmOptimizationModeDescriptor); }, 'tooltip', 'csmOptimizationMode'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmOptimizationMode', csmOptimizationModeDescriptor); }, 'editable', 'csmOptimizationMode'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 13 + } +})(DirectionalLight.prototype, 'csmOptimizationMode', csmOptimizationModeDescriptor); }, 'property', 'csmOptimizationMode'); + apply(() => { $.visible(false)(DirectionalLight.prototype, 'csmOptimizationMode', csmOptimizationModeDescriptor); }, 'visible', 'csmOptimizationMode'); + apply(() => { $.type(CCBoolean)(DirectionalLight.prototype, 'shadowFixedArea'); }, 'type', 'shadowFixedArea'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowFixedArea', shadowFixedAreaDescriptor); }, 'editable', 'shadowFixedArea'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 14 + } +})(DirectionalLight.prototype, 'shadowFixedArea', shadowFixedAreaDescriptor); }, 'property', 'shadowFixedArea'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(DirectionalLight.prototype, 'shadowFixedArea', shadowFixedAreaDescriptor); }, 'visible', 'shadowFixedArea'); + apply(() => { $.tooltip('i18n:lights.shadowFixedArea')(DirectionalLight.prototype, 'shadowFixedArea', shadowFixedAreaDescriptor); }, 'tooltip', 'shadowFixedArea'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowNear'); }, 'type', 'shadowNear'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowNear', shadowNearDescriptor); }, 'editable', 'shadowNear'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 15 + } +})(DirectionalLight.prototype, 'shadowNear', shadowNearDescriptor); }, 'property', 'shadowNear'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === true; +})(DirectionalLight.prototype, 'shadowNear', shadowNearDescriptor); }, 'visible', 'shadowNear'); + apply(() => { $.tooltip('i18n:lights.shadowNear')(DirectionalLight.prototype, 'shadowNear', shadowNearDescriptor); }, 'tooltip', 'shadowNear'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowFar'); }, 'type', 'shadowFar'); + apply(() => { $.editable(DirectionalLight.prototype, 'shadowFar', shadowFarDescriptor); }, 'editable', 'shadowFar'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 16 + } +})(DirectionalLight.prototype, 'shadowFar', shadowFarDescriptor); }, 'property', 'shadowFar'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === true; +})(DirectionalLight.prototype, 'shadowFar', shadowFarDescriptor); }, 'visible', 'shadowFar'); + apply(() => { $.tooltip('i18n:lights.shadowFar')(DirectionalLight.prototype, 'shadowFar', shadowFarDescriptor); }, 'tooltip', 'shadowFar'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'shadowOrthoSize'); }, 'type', 'shadowOrthoSize'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 17 + } +})(DirectionalLight.prototype, 'shadowOrthoSize', shadowOrthoSizeDescriptor); }, 'property', 'shadowOrthoSize'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._shadowFixedArea === true; +})(DirectionalLight.prototype, 'shadowOrthoSize', shadowOrthoSizeDescriptor); }, 'visible', 'shadowOrthoSize'); + apply(() => { $.tooltip('i18n:lights.shadowOrthoSize')(DirectionalLight.prototype, 'shadowOrthoSize', shadowOrthoSizeDescriptor); }, 'tooltip', 'shadowOrthoSize'); + apply(() => { $.type(CCBoolean)(DirectionalLight.prototype, 'csmAdvancedOptions'); }, 'type', 'csmAdvancedOptions'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmAdvancedOptions', csmAdvancedOptionsDescriptor); }, 'editable', 'csmAdvancedOptions'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 19 + } +})(DirectionalLight.prototype, 'csmAdvancedOptions', csmAdvancedOptionsDescriptor); }, 'property', 'csmAdvancedOptions'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._csmLevel > CSMLevel.LEVEL_1; +})(DirectionalLight.prototype, 'csmAdvancedOptions', csmAdvancedOptionsDescriptor); }, 'visible', 'csmAdvancedOptions'); + apply(() => { $.tooltip('i18n:lights.shadowAdvancedOptions')(DirectionalLight.prototype, 'csmAdvancedOptions', csmAdvancedOptionsDescriptor); }, 'tooltip', 'csmAdvancedOptions'); + apply(() => { $.type(CCBoolean)(DirectionalLight.prototype, 'csmLayersTransition'); }, 'type', 'csmLayersTransition'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmLayersTransition', csmLayersTransitionDescriptor); }, 'editable', 'csmLayersTransition'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 20 + } +})(DirectionalLight.prototype, 'csmLayersTransition', csmLayersTransitionDescriptor); }, 'property', 'csmLayersTransition'); + apply(() => { $.visible(function (this: DirectionalLight) { + return (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.enabled && (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap && this._csmLevel > CSMLevel.LEVEL_1 && this._csmAdvancedOptions; +})(DirectionalLight.prototype, 'csmLayersTransition', csmLayersTransitionDescriptor); }, 'visible', 'csmLayersTransition'); + apply(() => { $.tooltip('i18n:lights.csmLayersTransition')(DirectionalLight.prototype, 'csmLayersTransition', csmLayersTransitionDescriptor); }, 'tooltip', 'csmLayersTransition'); + apply(() => { $.type(CCFloat)(DirectionalLight.prototype, 'csmTransitionRange'); }, 'type', 'csmTransitionRange'); + apply(() => { $.slide(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'slide', 'csmTransitionRange'); + apply(() => { $.range([0.0, 0.1, 0.01])(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'range', 'csmTransitionRange'); + apply(() => { $.editable(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'editable', 'csmTransitionRange'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 21 + } +})(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'property', 'csmTransitionRange'); + apply(() => { $.visible(false)(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'visible', 'csmTransitionRange'); + apply(() => { $.tooltip('i18n:lights.csmTransitionRange')(DirectionalLight.prototype, 'csmTransitionRange', csmTransitionRangeDescriptor); }, 'tooltip', 'csmTransitionRange'); + apply(() => { $.executeInEditMode(DirectionalLight); }, 'executeInEditMode', null); + apply(() => { $.menu('Light/DirectionalLight')(DirectionalLight); }, 'menu', null); + apply(() => { $.help('i18n:cc.DirectionalLight')(DirectionalLight); }, 'help', null); + apply(() => { $.ccclass('cc.DirectionalLight')(DirectionalLight); }, 'ccclass', null); +} // end of patch_cc_DirectionalLight + +//---- class cc_EffectAsset +interface cc_EffectAsset_Context_Args { + EffectAsset: any; +} +export function patch_cc_EffectAsset(ctx: cc_EffectAsset_Context_Args, apply = defaultExec) { + const { EffectAsset } = { ...ctx }; + apply(() => { $.editable(EffectAsset.prototype, 'techniques', () => { return []; }); }, 'editable', 'techniques'); + apply(() => { $.serializable(EffectAsset.prototype, 'techniques', () => { return []; }); }, 'serializable', 'techniques'); + apply(() => { $.editable(EffectAsset.prototype, 'shaders', () => { return []; }); }, 'editable', 'shaders'); + apply(() => { $.serializable(EffectAsset.prototype, 'shaders', () => { return []; }); }, 'serializable', 'shaders'); + apply(() => { $.editable(EffectAsset.prototype, 'combinations', () => { return []; }); }, 'editable', 'combinations'); + apply(() => { $.serializable(EffectAsset.prototype, 'combinations', () => { return []; }); }, 'serializable', 'combinations'); + apply(() => { $$.editorOnly(EffectAsset.prototype, 'hideInEditor', () => { return false; }); }, 'editorOnly', 'hideInEditor'); + apply(() => { $.serializable(EffectAsset.prototype, 'hideInEditor', () => { return false; }); }, 'serializable', 'hideInEditor'); + apply(() => { $.ccclass('cc.EffectAsset')(EffectAsset); }, 'ccclass', null); +} // end of patch_cc_EffectAsset + +//---- class cc_FogInfo +interface cc_FogInfo_Context_Args { + FogInfo: any; + FogType: any; + CCFloat: any; + Color: any; +} +export function patch_cc_FogInfo(ctx: cc_FogInfo_Context_Args, apply = defaultExec) { + type FogInfo = any; + const { FogInfo, FogType, CCFloat, Color } = { ...ctx }; + const enabledDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'enabled'); + const accurateDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'accurate'); + const fogColorDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogColor'); + const typeDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'type'); + const fogDensityDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogDensity'); + const fogStartDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogStart'); + const fogEndDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogEnd'); + const fogAttenDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogAtten'); + const fogTopDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogTop'); + const fogRangeDescriptor = Object.getOwnPropertyDescriptor(FogInfo.prototype, 'fogRange'); + apply(() => { $.displayOrder(0)(FogInfo.prototype, 'enabled', enabledDescriptor); }, 'displayOrder', 'enabled'); + apply(() => { $.tooltip('i18n:fog.enabled')(FogInfo.prototype, 'enabled', enabledDescriptor); }, 'tooltip', 'enabled'); + apply(() => { $.editable(FogInfo.prototype, 'enabled', enabledDescriptor); }, 'editable', 'enabled'); + apply(() => { $.displayOrder(0)(FogInfo.prototype, 'accurate', accurateDescriptor); }, 'displayOrder', 'accurate'); + apply(() => { $.tooltip('i18n:fog.accurate')(FogInfo.prototype, 'accurate', accurateDescriptor); }, 'tooltip', 'accurate'); + apply(() => { $.editable(FogInfo.prototype, 'accurate', accurateDescriptor); }, 'editable', 'accurate'); + apply(() => { $.tooltip('i18n:fog.fogColor')(FogInfo.prototype, 'fogColor', fogColorDescriptor); }, 'tooltip', 'fogColor'); + apply(() => { $.editable(FogInfo.prototype, 'fogColor', fogColorDescriptor); }, 'editable', 'fogColor'); + apply(() => { $.tooltip('i18n:fog.type')(FogInfo.prototype, 'type', typeDescriptor); }, 'tooltip', 'type'); + apply(() => { $.displayOrder(1)(FogInfo.prototype, 'type', typeDescriptor); }, 'displayOrder', 'type'); + apply(() => { $.type(FogType)(FogInfo.prototype, 'type'); }, 'type', 'type'); + apply(() => { $.editable(FogInfo.prototype, 'type', typeDescriptor); }, 'editable', 'type'); + apply(() => { $.tooltip('i18n:fog.fogDensity')(FogInfo.prototype, 'fogDensity', fogDensityDescriptor); }, 'tooltip', 'fogDensity'); + apply(() => { $.slide(FogInfo.prototype, 'fogDensity', fogDensityDescriptor); }, 'slide', 'fogDensity'); + apply(() => { $.range([0, 1, 0.01])(FogInfo.prototype, 'fogDensity', fogDensityDescriptor); }, 'range', 'fogDensity'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogDensity'); }, 'type', 'fogDensity'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type !== FogType.LAYERED && this._type !== FogType.LINEAR; +})(FogInfo.prototype, 'fogDensity', fogDensityDescriptor); }, 'visible', 'fogDensity'); + apply(() => { $.tooltip('i18n:fog.fogStart')(FogInfo.prototype, 'fogStart', fogStartDescriptor); }, 'tooltip', 'fogStart'); + apply(() => { $.rangeStep(0.01)(FogInfo.prototype, 'fogStart', fogStartDescriptor); }, 'rangeStep', 'fogStart'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogStart'); }, 'type', 'fogStart'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type !== FogType.LAYERED; +})(FogInfo.prototype, 'fogStart', fogStartDescriptor); }, 'visible', 'fogStart'); + apply(() => { $.tooltip('i18n:fog.fogEnd')(FogInfo.prototype, 'fogEnd', fogEndDescriptor); }, 'tooltip', 'fogEnd'); + apply(() => { $.rangeStep(0.01)(FogInfo.prototype, 'fogEnd', fogEndDescriptor); }, 'rangeStep', 'fogEnd'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogEnd'); }, 'type', 'fogEnd'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type === FogType.LINEAR; +})(FogInfo.prototype, 'fogEnd', fogEndDescriptor); }, 'visible', 'fogEnd'); + apply(() => { $.tooltip('i18n:fog.fogAtten')(FogInfo.prototype, 'fogAtten', fogAttenDescriptor); }, 'tooltip', 'fogAtten'); + apply(() => { $.rangeStep(0.01)(FogInfo.prototype, 'fogAtten', fogAttenDescriptor); }, 'rangeStep', 'fogAtten'); + apply(() => { $$.rangeMin(0.01)(FogInfo.prototype, 'fogAtten', fogAttenDescriptor); }, 'rangeMin', 'fogAtten'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogAtten'); }, 'type', 'fogAtten'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type !== FogType.LINEAR; +})(FogInfo.prototype, 'fogAtten', fogAttenDescriptor); }, 'visible', 'fogAtten'); + apply(() => { $.tooltip('i18n:fog.fogTop')(FogInfo.prototype, 'fogTop', fogTopDescriptor); }, 'tooltip', 'fogTop'); + apply(() => { $.rangeStep(0.01)(FogInfo.prototype, 'fogTop', fogTopDescriptor); }, 'rangeStep', 'fogTop'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogTop'); }, 'type', 'fogTop'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type === FogType.LAYERED; +})(FogInfo.prototype, 'fogTop', fogTopDescriptor); }, 'visible', 'fogTop'); + apply(() => { $.tooltip('i18n:fog.fogRange')(FogInfo.prototype, 'fogRange', fogRangeDescriptor); }, 'tooltip', 'fogRange'); + apply(() => { $.rangeStep(0.01)(FogInfo.prototype, 'fogRange', fogRangeDescriptor); }, 'rangeStep', 'fogRange'); + apply(() => { $.type(CCFloat)(FogInfo.prototype, 'fogRange'); }, 'type', 'fogRange'); + apply(() => { $.visible(function (this: FogInfo) { + return this._type === FogType.LAYERED; +})(FogInfo.prototype, 'fogRange', fogRangeDescriptor); }, 'visible', 'fogRange'); + apply(() => { $.serializable(FogInfo.prototype, '_type', () => { return FogType.LINEAR; }); }, 'serializable', '_type'); + apply(() => { $.serializable(FogInfo.prototype, '_fogColor', () => { return new Color('#C8C8C8'); }); }, 'serializable', '_fogColor'); + apply(() => { $.serializable(FogInfo.prototype, '_enabled', () => { return false; }); }, 'serializable', '_enabled'); + apply(() => { $.serializable(FogInfo.prototype, '_fogDensity', () => { return 0.3; }); }, 'serializable', '_fogDensity'); + apply(() => { $.serializable(FogInfo.prototype, '_fogStart', () => { return 0.5; }); }, 'serializable', '_fogStart'); + apply(() => { $.serializable(FogInfo.prototype, '_fogEnd', () => { return 300; }); }, 'serializable', '_fogEnd'); + apply(() => { $.serializable(FogInfo.prototype, '_fogAtten', () => { return 5; }); }, 'serializable', '_fogAtten'); + apply(() => { $.serializable(FogInfo.prototype, '_fogTop', () => { return 1.5; }); }, 'serializable', '_fogTop'); + apply(() => { $.serializable(FogInfo.prototype, '_fogRange', () => { return 1.2; }); }, 'serializable', '_fogRange'); + apply(() => { $.serializable(FogInfo.prototype, '_accurate', () => { return false; }); }, 'serializable', '_accurate'); + apply(() => { $.ccclass('cc.FogInfo')(FogInfo); }, 'ccclass', null); +} // end of patch_cc_FogInfo + +//---- class cc_ImageAsset +interface cc_ImageAsset_Context_Args { + ImageAsset: any; +} +export function patch_cc_ImageAsset(ctx: cc_ImageAsset_Context_Args, apply = defaultExec) { + const { ImageAsset } = { ...ctx }; + const _nativeAssetDescriptor = Object.getOwnPropertyDescriptor(ImageAsset.prototype, '_nativeAsset'); + apply(() => { $.override(ImageAsset.prototype, '_nativeAsset', _nativeAssetDescriptor); }, 'override', '_nativeAsset'); + apply(() => { $.ccclass('cc.ImageAsset')(ImageAsset); }, 'ccclass', null); +} // end of patch_cc_ImageAsset + +//---- class cc_Light +interface cc_Light_Context_Args { + Light: any; + Color: any; + StaticLightSettings: any; + CAMERA_DEFAULT_MASK: any; + Layers: any; +} +export function patch_cc_Light(ctx: cc_Light_Context_Args, apply = defaultExec) { + const { Light, Color, StaticLightSettings, CAMERA_DEFAULT_MASK, Layers } = { ...ctx }; + const colorDescriptor = Object.getOwnPropertyDescriptor(Light.prototype, 'color'); + const useColorTemperatureDescriptor = Object.getOwnPropertyDescriptor(Light.prototype, 'useColorTemperature'); + const colorTemperatureDescriptor = Object.getOwnPropertyDescriptor(Light.prototype, 'colorTemperature'); + const staticSettingsDescriptor = Object.getOwnPropertyDescriptor(Light.prototype, 'staticSettings'); + const visibilityDescriptor = Object.getOwnPropertyDescriptor(Light.prototype, 'visibility'); + apply(() => { $.serializable(Light.prototype, '_color', () => { return Color.WHITE.clone(); }); }, 'serializable', '_color'); + apply(() => { $.serializable(Light.prototype, '_useColorTemperature', () => { return false; }); }, 'serializable', '_useColorTemperature'); + apply(() => { $.serializable(Light.prototype, '_colorTemperature', () => { return 6550; }); }, 'serializable', '_colorTemperature'); + apply(() => { $.serializable(Light.prototype, '_staticSettings', () => { return new StaticLightSettings(); }); }, 'serializable', '_staticSettings'); + apply(() => { $.serializable(Light.prototype, '_visibility', () => { return CAMERA_DEFAULT_MASK; }); }, 'serializable', '_visibility'); + apply(() => { $.tooltip('i18n:lights.color')(Light.prototype, 'color', colorDescriptor); }, 'tooltip', 'color'); + apply(() => { $.tooltip('i18n:lights.use_color_temperature')(Light.prototype, 'useColorTemperature', useColorTemperatureDescriptor); }, 'tooltip', 'useColorTemperature'); + apply(() => { $.tooltip('i18n:lights.color_temperature')(Light.prototype, 'colorTemperature', colorTemperatureDescriptor); }, 'tooltip', 'colorTemperature'); + apply(() => { $.range([1000, 15000, 1])(Light.prototype, 'colorTemperature', colorTemperatureDescriptor); }, 'range', 'colorTemperature'); + apply(() => { $.slide(Light.prototype, 'colorTemperature', colorTemperatureDescriptor); }, 'slide', 'colorTemperature'); + apply(() => { $.displayOrder(50)(Light.prototype, 'staticSettings', staticSettingsDescriptor); }, 'displayOrder', 'staticSettings'); + apply(() => { $.type(StaticLightSettings)(Light.prototype, 'staticSettings'); }, 'type', 'staticSettings'); + apply(() => { $.type(Layers.BitMask)(Light.prototype, 'visibility'); }, 'type', 'visibility'); + apply(() => { $.displayOrder(255)(Light.prototype, 'visibility', visibilityDescriptor); }, 'displayOrder', 'visibility'); + apply(() => { $.tooltip('i18n:lights.visibility')(Light.prototype, 'visibility', visibilityDescriptor); }, 'tooltip', 'visibility'); + apply(() => { $.ccclass('cc.Light')(Light); }, 'ccclass', null); +} // end of patch_cc_Light + +//---- class cc_LightProbeInfo +interface cc_LightProbeInfo_Context_Args { + LightProbeInfo: any; + CCFloat: any; + CCInteger: any; +} +export function patch_cc_LightProbeInfo(ctx: cc_LightProbeInfo_Context_Args, apply = defaultExec) { + const { LightProbeInfo, CCFloat, CCInteger } = { ...ctx }; + const giScaleDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'giScale'); + const giSamplesDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'giSamples'); + const bouncesDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'bounces'); + const reduceRingingDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'reduceRinging'); + const showProbeDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'showProbe'); + const showWireframeDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'showWireframe'); + const showConvexDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfo.prototype, 'showConvex'); + apply(() => { $.displayName('GIScale')(LightProbeInfo.prototype, 'giScale', giScaleDescriptor); }, 'displayName', 'giScale'); + apply(() => { $.tooltip('i18n:light_probe.giScale')(LightProbeInfo.prototype, 'giScale', giScaleDescriptor); }, 'tooltip', 'giScale'); + apply(() => { $.type(CCFloat)(LightProbeInfo.prototype, 'giScale'); }, 'type', 'giScale'); + apply(() => { $.range([0, 100, 1])(LightProbeInfo.prototype, 'giScale', giScaleDescriptor); }, 'range', 'giScale'); + apply(() => { $.editable(LightProbeInfo.prototype, 'giScale', giScaleDescriptor); }, 'editable', 'giScale'); + apply(() => { $.displayName('GISamples')(LightProbeInfo.prototype, 'giSamples', giSamplesDescriptor); }, 'displayName', 'giSamples'); + apply(() => { $.tooltip('i18n:light_probe.giSamples')(LightProbeInfo.prototype, 'giSamples', giSamplesDescriptor); }, 'tooltip', 'giSamples'); + apply(() => { $.type(CCInteger)(LightProbeInfo.prototype, 'giSamples'); }, 'type', 'giSamples'); + apply(() => { $.range([64, 65535, 1])(LightProbeInfo.prototype, 'giSamples', giSamplesDescriptor); }, 'range', 'giSamples'); + apply(() => { $.editable(LightProbeInfo.prototype, 'giSamples', giSamplesDescriptor); }, 'editable', 'giSamples'); + apply(() => { $.tooltip('i18n:light_probe.bounces')(LightProbeInfo.prototype, 'bounces', bouncesDescriptor); }, 'tooltip', 'bounces'); + apply(() => { $.type(CCInteger)(LightProbeInfo.prototype, 'bounces'); }, 'type', 'bounces'); + apply(() => { $.range([1, 4, 1])(LightProbeInfo.prototype, 'bounces', bouncesDescriptor); }, 'range', 'bounces'); + apply(() => { $.editable(LightProbeInfo.prototype, 'bounces', bouncesDescriptor); }, 'editable', 'bounces'); + apply(() => { $.tooltip('i18n:light_probe.reduceRinging')(LightProbeInfo.prototype, 'reduceRinging', reduceRingingDescriptor); }, 'tooltip', 'reduceRinging'); + apply(() => { $.type(CCFloat)(LightProbeInfo.prototype, 'reduceRinging'); }, 'type', 'reduceRinging'); + apply(() => { $.slide(LightProbeInfo.prototype, 'reduceRinging', reduceRingingDescriptor); }, 'slide', 'reduceRinging'); + apply(() => { $.range([0.0, 0.05, 0.001])(LightProbeInfo.prototype, 'reduceRinging', reduceRingingDescriptor); }, 'range', 'reduceRinging'); + apply(() => { $.editable(LightProbeInfo.prototype, 'reduceRinging', reduceRingingDescriptor); }, 'editable', 'reduceRinging'); + apply(() => { $.tooltip('i18n:light_probe.showProbe')(LightProbeInfo.prototype, 'showProbe', showProbeDescriptor); }, 'tooltip', 'showProbe'); + apply(() => { $.editable(LightProbeInfo.prototype, 'showProbe', showProbeDescriptor); }, 'editable', 'showProbe'); + apply(() => { $.tooltip('i18n:light_probe.showWireframe')(LightProbeInfo.prototype, 'showWireframe', showWireframeDescriptor); }, 'tooltip', 'showWireframe'); + apply(() => { $.editable(LightProbeInfo.prototype, 'showWireframe', showWireframeDescriptor); }, 'editable', 'showWireframe'); + apply(() => { $.tooltip('i18n:light_probe.showConvex')(LightProbeInfo.prototype, 'showConvex', showConvexDescriptor); }, 'tooltip', 'showConvex'); + apply(() => { $.editable(LightProbeInfo.prototype, 'showConvex', showConvexDescriptor); }, 'editable', 'showConvex'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_giScale', () => { return 1.0; }); }, 'serializable', '_giScale'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_giSamples', () => { return 1024; }); }, 'serializable', '_giSamples'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_bounces', () => { return 2; }); }, 'serializable', '_bounces'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_reduceRinging', () => { return 0.0; }); }, 'serializable', '_reduceRinging'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_showProbe', () => { return true; }); }, 'serializable', '_showProbe'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_showWireframe', () => { return true; }); }, 'serializable', '_showWireframe'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_showConvex', () => { return false; }); }, 'serializable', '_showConvex'); + apply(() => { $.serializable(LightProbeInfo.prototype, '_data', () => { return null; }); }, 'serializable', '_data'); + apply(() => { $.ccclass('cc.LightProbeInfo')(LightProbeInfo); }, 'ccclass', null); +} // end of patch_cc_LightProbeInfo + +//---- class cc_LightProbesData +interface cc_LightProbesData_Context_Args { + LightProbesData: any; + Vertex: any; + Tetrahedron: any; +} +export function patch_cc_LightProbesData(ctx: cc_LightProbesData_Context_Args, apply = defaultExec) { + const { LightProbesData, Vertex, Tetrahedron } = { ...ctx }; + apply(() => { $.type([Vertex])(LightProbesData.prototype, '_probes'); }, 'type', '_probes'); + apply(() => { $.serializable(LightProbesData.prototype, '_probes', () => { return []; }); }, 'serializable', '_probes'); + apply(() => { $.type([Tetrahedron])(LightProbesData.prototype, '_tetrahedrons'); }, 'type', '_tetrahedrons'); + apply(() => { $.serializable(LightProbesData.prototype, '_tetrahedrons', () => { return []; }); }, 'serializable', '_tetrahedrons'); + apply(() => { $.ccclass('cc.LightProbesData')(LightProbesData); }, 'ccclass', null); +} // end of patch_cc_LightProbesData + +//---- class cc_Line +interface cc_Line_Context_Args { + Line: any; + Texture2D: any; + Material: any; + Vec3: any; + CurveRange: any; + Vec2: any; + GradientRange: any; +} +export function patch_cc_Line(ctx: cc_Line_Context_Args, apply = defaultExec) { + const { Line, Texture2D, Material, Vec3, CurveRange, Vec2, GradientRange } = { ...ctx }; + const textureDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'texture'); + const materialDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'material'); + const worldSpaceDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'worldSpace'); + const positionsDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'positions'); + const widthDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'width'); + const tileDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'tile'); + const offsetDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'offset'); + const colorDescriptor = Object.getOwnPropertyDescriptor(Line.prototype, 'color'); + apply(() => { $.type(Texture2D)(Line.prototype, '_texture'); }, 'type', '_texture'); + apply(() => { $.tooltip('i18n:line.texture')(Line.prototype, 'texture', textureDescriptor); }, 'tooltip', 'texture'); + apply(() => { $.displayOrder(0)(Line.prototype, 'texture', textureDescriptor); }, 'displayOrder', 'texture'); + apply(() => { $.type(Texture2D)(Line.prototype, 'texture'); }, 'type', 'texture'); + apply(() => { $.serializable(Line.prototype, '_material', () => { return null; }); }, 'serializable', '_material'); + apply(() => { $.tooltip('i18n:line.material')(Line.prototype, 'material', materialDescriptor); }, 'tooltip', 'material'); + apply(() => { $.displayOrder(1)(Line.prototype, 'material', materialDescriptor); }, 'displayOrder', 'material'); + apply(() => { $.type(Material)(Line.prototype, 'material'); }, 'type', 'material'); + apply(() => { $.serializable(Line.prototype, '_worldSpace', () => { return false; }); }, 'serializable', '_worldSpace'); + apply(() => { $.tooltip('i18n:line.worldSpace')(Line.prototype, 'worldSpace', worldSpaceDescriptor); }, 'tooltip', 'worldSpace'); + apply(() => { $.displayOrder(1)(Line.prototype, 'worldSpace', worldSpaceDescriptor); }, 'displayOrder', 'worldSpace'); + apply(() => { $.type([Vec3])(Line.prototype, '_positions'); }, 'type', '_positions'); + apply(() => { $.tooltip('i18n:line.positions')(Line.prototype, 'positions', positionsDescriptor); }, 'tooltip', 'positions'); + apply(() => { $.displayOrder(2)(Line.prototype, 'positions', positionsDescriptor); }, 'displayOrder', 'positions'); + apply(() => { $.type([Vec3])(Line.prototype, 'positions'); }, 'type', 'positions'); + apply(() => { $.type(CurveRange)(Line.prototype, '_width'); }, 'type', '_width'); + apply(() => { $.tooltip('i18n:line.width')(Line.prototype, 'width', widthDescriptor); }, 'tooltip', 'width'); + apply(() => { $.displayOrder(3)(Line.prototype, 'width', widthDescriptor); }, 'displayOrder', 'width'); + apply(() => { $.range([0, 1])(Line.prototype, 'width', widthDescriptor); }, 'range', 'width'); + apply(() => { $.type(CurveRange)(Line.prototype, 'width'); }, 'type', 'width'); + apply(() => { $.serializable(Line.prototype, '_tile', () => { return new Vec2(1, 1); }); }, 'serializable', '_tile'); + apply(() => { $.tooltip('i18n:line.tile')(Line.prototype, 'tile', tileDescriptor); }, 'tooltip', 'tile'); + apply(() => { $.displayOrder(4)(Line.prototype, 'tile', tileDescriptor); }, 'displayOrder', 'tile'); + apply(() => { $.type(Vec2)(Line.prototype, 'tile'); }, 'type', 'tile'); + apply(() => { $.serializable(Line.prototype, '_offset', () => { return new Vec2(0, 0); }); }, 'serializable', '_offset'); + apply(() => { $.tooltip('i18n:line.offset')(Line.prototype, 'offset', offsetDescriptor); }, 'tooltip', 'offset'); + apply(() => { $.displayOrder(5)(Line.prototype, 'offset', offsetDescriptor); }, 'displayOrder', 'offset'); + apply(() => { $.type(Vec2)(Line.prototype, 'offset'); }, 'type', 'offset'); + apply(() => { $.type(GradientRange)(Line.prototype, '_color'); }, 'type', '_color'); + apply(() => { $.tooltip('i18n:line.color')(Line.prototype, 'color', colorDescriptor); }, 'tooltip', 'color'); + apply(() => { $.displayOrder(6)(Line.prototype, 'color', colorDescriptor); }, 'displayOrder', 'color'); + apply(() => { $.type(GradientRange)(Line.prototype, 'color'); }, 'type', 'color'); + apply(() => { $.executeInEditMode(Line); }, 'executeInEditMode', null); + apply(() => { $.menu('Effects/Line')(Line); }, 'menu', null); + apply(() => { $.help('i18n:cc.Line')(Line); }, 'help', null); + apply(() => { $.ccclass('cc.Line')(Line); }, 'ccclass', null); +} // end of patch_cc_Line + +//---- class cc_LODGroup +interface cc_LODGroup_Context_Args { + LODGroup: any; + Vec3: any; + CCFloat: any; + LOD: any; +} +export function patch_cc_LODGroup(ctx: cc_LODGroup_Context_Args, apply = defaultExec) { + const { LODGroup, Vec3, CCFloat, LOD } = { ...ctx }; + apply(() => { $.serializable(LODGroup.prototype, '_localBoundaryCenter', () => { return new Vec3(0, 0, 0); }); }, 'serializable', '_localBoundaryCenter'); + apply(() => { $.serializable(LODGroup.prototype, '_objectSize', () => { return 0; }); }, 'serializable', '_objectSize'); + apply(() => { $.serializable(LODGroup.prototype, '_LODs', () => { return []; }); }, 'serializable', '_LODs'); + apply(() => { $.type(CCFloat)(LODGroup.prototype, 'objectSize'); }, 'type', 'objectSize'); + apply(() => { $.type([LOD])(LODGroup.prototype, 'LODs'); }, 'type', 'LODs'); + apply(() => { $.executeInEditMode(LODGroup); }, 'executeInEditMode', null); + apply(() => { $.menu('Rendering/LOD Group')(LODGroup); }, 'menu', null); + apply(() => { $.ccclass('cc.LODGroup')(LODGroup); }, 'ccclass', null); +} // end of patch_cc_LODGroup + +//---- class cc_Material +interface cc_Material_Context_Args { + Material: any; + EffectAsset: any; +} +export function patch_cc_Material(ctx: cc_Material_Context_Args, apply = defaultExec) { + const { Material, EffectAsset } = { ...ctx }; + apply(() => { $.type(EffectAsset)(Material.prototype, '_effectAsset'); }, 'type', '_effectAsset'); + apply(() => { $.serializable(Material.prototype, '_techIdx', () => { return 0; }); }, 'serializable', '_techIdx'); + apply(() => { $.serializable(Material.prototype, '_defines', () => { return []; }); }, 'serializable', '_defines'); + apply(() => { $.serializable(Material.prototype, '_states', () => { return []; }); }, 'serializable', '_states'); + apply(() => { $.serializable(Material.prototype, '_props', () => { return []; }); }, 'serializable', '_props'); + apply(() => { $.ccclass('cc.Material')(Material); }, 'ccclass', null); +} // end of patch_cc_Material + +//---- class cc_Mesh +interface cc_Mesh_Context_Args { + Mesh: any; +} +export function patch_cc_Mesh(ctx: cc_Mesh_Context_Args, apply = defaultExec) { + const { Mesh } = { ...ctx }; + apply(() => { $.serializable(Mesh.prototype, '_struct', () => { return { + vertexBundles: [], + primitives: [] +}; }); }, 'serializable', '_struct'); + apply(() => { $.serializable(Mesh.prototype, '_hash', () => { return 0; }); }, 'serializable', '_hash'); + apply(() => { $.serializable(Mesh.prototype, '_allowDataAccess', () => { return true; }); }, 'serializable', '_allowDataAccess'); + apply(() => { $.ccclass('cc.Mesh')(Mesh); }, 'ccclass', null); +} // end of patch_cc_Mesh + +//---- class cc_Node +interface cc_Node_Context_Args { + Node: any; + Vec3: any; + Quat: any; + MobilityMode: any; + Layers: any; +} +export function patch_cc_Node(ctx: cc_Node_Context_Args, apply = defaultExec) { + const { Node, Vec3, Quat, MobilityMode, Layers } = { ...ctx }; + const _persistNodeDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, '_persistNode'); + const nameDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'name'); + const childrenDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'children'); + const activeDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'active'); + const activeInHierarchyDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'activeInHierarchy'); + const parentDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'parent'); + const angleDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'angle'); + const mobilityDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'mobility'); + const layerDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'layer'); + apply(() => { $.property(Node.prototype, '_persistNode', _persistNodeDescriptor); }, 'property', '_persistNode'); + apply(() => { $.editable(Node.prototype, 'name', nameDescriptor); }, 'editable', 'name'); + apply(() => { $.editable(Node.prototype, 'children', childrenDescriptor); }, 'editable', 'children'); + apply(() => { $.editable(Node.prototype, 'active', activeDescriptor); }, 'editable', 'active'); + apply(() => { $.editable(Node.prototype, 'activeInHierarchy', activeInHierarchyDescriptor); }, 'editable', 'activeInHierarchy'); + apply(() => { $.editable(Node.prototype, 'parent', parentDescriptor); }, 'editable', 'parent'); + apply(() => { $.serializable(Node.prototype, '_parent', () => { return null; }); }, 'serializable', '_parent'); + apply(() => { $.serializable(Node.prototype, '_children', () => { return []; }); }, 'serializable', '_children'); + apply(() => { $.serializable(Node.prototype, '_active', () => { return true; }); }, 'serializable', '_active'); + apply(() => { $.serializable(Node.prototype, '_components', () => { return []; }); }, 'serializable', '_components'); + apply(() => { $.serializable(Node.prototype, '_prefab', () => { return null; }); }, 'serializable', '_prefab'); + apply(() => { $.serializable(Node.prototype, '_lpos', () => { return new Vec3(); }); }, 'serializable', '_lpos'); + apply(() => { $.serializable(Node.prototype, '_lrot', () => { return new Quat(); }); }, 'serializable', '_lrot'); + apply(() => { $.serializable(Node.prototype, '_lscale', () => { return new Vec3(1, 1, 1); }); }, 'serializable', '_lscale'); + apply(() => { $.serializable(Node.prototype, '_mobility', () => { return MobilityMode.Static; }); }, 'serializable', '_mobility'); + apply(() => { $.serializable(Node.prototype, '_layer', () => { return Layers.Enum.DEFAULT; }); }, 'serializable', '_layer'); + apply(() => { $.serializable(Node.prototype, '_euler', () => { return new Vec3(); }); }, 'serializable', '_euler'); + apply(() => { $.type(Vec3)(Node.prototype, 'eulerAngles'); }, 'type', 'eulerAngles'); + apply(() => { $.editable(Node.prototype, 'angle', angleDescriptor); }, 'editable', 'angle'); + apply(() => { $.type(MobilityMode)(Node.prototype, 'mobility'); }, 'type', 'mobility'); + apply(() => { $.editable(Node.prototype, 'mobility', mobilityDescriptor); }, 'editable', 'mobility'); + apply(() => { $.editable(Node.prototype, 'layer', layerDescriptor); }, 'editable', 'layer'); + apply(() => { $.ccclass('cc.Node')(Node); }, 'ccclass', null); +} // end of patch_cc_Node + +//---- class cc_OctreeInfo +interface cc_OctreeInfo_Context_Args { + OctreeInfo: any; + CCInteger: any; + Vec3: any; + DEFAULT_WORLD_MIN_POS: any; + DEFAULT_WORLD_MAX_POS: any; + DEFAULT_OCTREE_DEPTH: any; +} +export function patch_cc_OctreeInfo(ctx: cc_OctreeInfo_Context_Args, apply = defaultExec) { + const { OctreeInfo, CCInteger, Vec3, DEFAULT_WORLD_MIN_POS, DEFAULT_WORLD_MAX_POS, DEFAULT_OCTREE_DEPTH } = { ...ctx }; + const enabledDescriptor = Object.getOwnPropertyDescriptor(OctreeInfo.prototype, 'enabled'); + const minPosDescriptor = Object.getOwnPropertyDescriptor(OctreeInfo.prototype, 'minPos'); + const maxPosDescriptor = Object.getOwnPropertyDescriptor(OctreeInfo.prototype, 'maxPos'); + const depthDescriptor = Object.getOwnPropertyDescriptor(OctreeInfo.prototype, 'depth'); + apply(() => { $.tooltip('i18n:octree_culling.enabled')(OctreeInfo.prototype, 'enabled', enabledDescriptor); }, 'tooltip', 'enabled'); + apply(() => { $.editable(OctreeInfo.prototype, 'enabled', enabledDescriptor); }, 'editable', 'enabled'); + apply(() => { $.displayName('World MinPos')(OctreeInfo.prototype, 'minPos', minPosDescriptor); }, 'displayName', 'minPos'); + apply(() => { $.tooltip('i18n:octree_culling.minPos')(OctreeInfo.prototype, 'minPos', minPosDescriptor); }, 'tooltip', 'minPos'); + apply(() => { $.editable(OctreeInfo.prototype, 'minPos', minPosDescriptor); }, 'editable', 'minPos'); + apply(() => { $.displayName('World MaxPos')(OctreeInfo.prototype, 'maxPos', maxPosDescriptor); }, 'displayName', 'maxPos'); + apply(() => { $.tooltip('i18n:octree_culling.maxPos')(OctreeInfo.prototype, 'maxPos', maxPosDescriptor); }, 'tooltip', 'maxPos'); + apply(() => { $.editable(OctreeInfo.prototype, 'maxPos', maxPosDescriptor); }, 'editable', 'maxPos'); + apply(() => { $.tooltip('i18n:octree_culling.depth')(OctreeInfo.prototype, 'depth', depthDescriptor); }, 'tooltip', 'depth'); + apply(() => { $.type(CCInteger)(OctreeInfo.prototype, 'depth'); }, 'type', 'depth'); + apply(() => { $.slide(OctreeInfo.prototype, 'depth', depthDescriptor); }, 'slide', 'depth'); + apply(() => { $.range([4, 12, 1])(OctreeInfo.prototype, 'depth', depthDescriptor); }, 'range', 'depth'); + apply(() => { $.editable(OctreeInfo.prototype, 'depth', depthDescriptor); }, 'editable', 'depth'); + apply(() => { $.serializable(OctreeInfo.prototype, '_enabled', () => { return false; }); }, 'serializable', '_enabled'); + apply(() => { $.serializable(OctreeInfo.prototype, '_minPos', () => { return new Vec3(DEFAULT_WORLD_MIN_POS); }); }, 'serializable', '_minPos'); + apply(() => { $.serializable(OctreeInfo.prototype, '_maxPos', () => { return new Vec3(DEFAULT_WORLD_MAX_POS); }); }, 'serializable', '_maxPos'); + apply(() => { $.serializable(OctreeInfo.prototype, '_depth', () => { return DEFAULT_OCTREE_DEPTH; }); }, 'serializable', '_depth'); + apply(() => { $.ccclass('cc.OctreeInfo')(OctreeInfo); }, 'ccclass', null); +} // end of patch_cc_OctreeInfo + +//---- class cc_ReflectionProbe +interface cc_ReflectionProbe_Context_Args { + ReflectionProbe: any; + ProbeClearFlag: any; + Color: any; + CAMERA_DEFAULT_MASK: any; + ProbeType: any; + Vec3: any; + Enum: any; + ProbeResolution: any; + Layers: any; + Camera: any; +} +export function patch_cc_ReflectionProbe(ctx: cc_ReflectionProbe_Context_Args, apply = defaultExec) { + type ReflectionProbe = any; + const { ReflectionProbe, ProbeClearFlag, Color, CAMERA_DEFAULT_MASK, ProbeType, Vec3, Enum, ProbeResolution, Layers, Camera } = { ...ctx }; + const resolutionDescriptor = Object.getOwnPropertyDescriptor(ReflectionProbe.prototype, 'resolution'); + const backgroundColorDescriptor = Object.getOwnPropertyDescriptor(ReflectionProbe.prototype, 'backgroundColor'); + const visibilityDescriptor = Object.getOwnPropertyDescriptor(ReflectionProbe.prototype, 'visibility'); + const sourceCameraDescriptor = Object.getOwnPropertyDescriptor(ReflectionProbe.prototype, 'sourceCamera'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_resolution', () => { return 256; }); }, 'serializable', '_resolution'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_clearFlag', () => { return ProbeClearFlag.SKYBOX; }); }, 'serializable', '_clearFlag'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_backgroundColor', () => { return new Color(0, 0, 0, 255); }); }, 'serializable', '_backgroundColor'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_visibility', () => { return CAMERA_DEFAULT_MASK; }); }, 'serializable', '_visibility'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_probeType', () => { return ProbeType.CUBE; }); }, 'serializable', '_probeType'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_cubemap', () => { return null; }); }, 'serializable', '_cubemap'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_size', () => { return new Vec3(1, 1, 1); }); }, 'serializable', '_size'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_sourceCamera', () => { return null; }); }, 'serializable', '_sourceCamera'); + apply(() => { $.serializable(ReflectionProbe.prototype, '_probeId', () => { return -1; }); }, 'serializable', '_probeId'); + apply(() => { $.type(Vec3)(ReflectionProbe.prototype, 'size'); }, 'type', 'size'); + apply(() => { $.type(Enum(ProbeType))(ReflectionProbe.prototype, 'probeType'); }, 'type', 'probeType'); + apply(() => { $.type(Enum(ProbeResolution))(ReflectionProbe.prototype, 'resolution'); }, 'type', 'resolution'); + apply(() => { $.visible(function (this: ReflectionProbe) { + return this.probeType === ProbeType.CUBE; +})(ReflectionProbe.prototype, 'resolution', resolutionDescriptor); }, 'visible', 'resolution'); + apply(() => { $.type(Enum(ProbeClearFlag))(ReflectionProbe.prototype, 'clearFlag'); }, 'type', 'clearFlag'); + apply(() => { $.type(Color)(ReflectionProbe.prototype, 'backgroundColor'); }, 'type', 'backgroundColor'); + apply(() => { $.visible(function (this: ReflectionProbe) { + return this._clearFlag === ProbeClearFlag.SOLID_COLOR; +})(ReflectionProbe.prototype, 'backgroundColor', backgroundColorDescriptor); }, 'visible', 'backgroundColor'); + apply(() => { $.tooltip('i18n:camera.visibility')(ReflectionProbe.prototype, 'visibility', visibilityDescriptor); }, 'tooltip', 'visibility'); + apply(() => { $.type(Layers.BitMask)(ReflectionProbe.prototype, 'visibility'); }, 'type', 'visibility'); + apply(() => { $.type(Camera)(ReflectionProbe.prototype, 'sourceCamera'); }, 'type', 'sourceCamera'); + apply(() => { $.visible(function (this: ReflectionProbe) { + return this.probeType === ProbeType.PLANAR; +})(ReflectionProbe.prototype, 'sourceCamera', sourceCameraDescriptor); }, 'visible', 'sourceCamera'); + apply(() => { $.playOnFocus(ReflectionProbe); }, 'playOnFocus', null); + apply(() => { $.executeInEditMode(ReflectionProbe); }, 'executeInEditMode', null); + apply(() => { $.menu('Rendering/ReflectionProbe')(ReflectionProbe); }, 'menu', null); + apply(() => { $.ccclass('cc.ReflectionProbe')(ReflectionProbe); }, 'ccclass', null); +} // end of patch_cc_ReflectionProbe + +//---- class cc_RenderPipeline +interface cc_RenderPipeline_Context_Args { + RenderPipeline: any; + RenderFlow: any; +} +export function patch_cc_RenderPipeline(ctx: cc_RenderPipeline_Context_Args, apply = defaultExec) { + const { RenderPipeline, RenderFlow } = { ...ctx }; + apply(() => { $.serializable(RenderPipeline.prototype, '_tag', () => { return 0; }); }, 'serializable', '_tag'); + apply(() => { $.displayOrder(0)(RenderPipeline.prototype, '_tag', () => { return 0; }); }, 'displayOrder', '_tag'); + apply(() => { $.serializable(RenderPipeline.prototype, '_flows', () => { return []; }); }, 'serializable', '_flows'); + apply(() => { $.type([RenderFlow])(RenderPipeline.prototype, '_flows'); }, 'type', '_flows'); + apply(() => { $.displayOrder(1)(RenderPipeline.prototype, '_flows', () => { return []; }); }, 'displayOrder', '_flows'); + apply(() => { $.ccclass('cc.RenderPipeline')(RenderPipeline); }, 'ccclass', null); +} // end of patch_cc_RenderPipeline + +//---- class cc_RenderTexture +interface cc_RenderTexture_Context_Args { + RenderTexture: any; +} +export function patch_cc_RenderTexture(ctx: cc_RenderTexture_Context_Args, apply = defaultExec) { + const { RenderTexture } = { ...ctx }; + apply(() => { $.ccclass('cc.RenderTexture')(RenderTexture); }, 'ccclass', null); +} // end of patch_cc_RenderTexture + +//---- class cc_RigidBody +interface cc_RigidBody_Context_Args { + RigidBody: any; + PhysicsSystem: any; + ERigidBodyType: any; + isDynamicBody: any; + Vec3: any; +} +export function patch_cc_RigidBody(ctx: cc_RigidBody_Context_Args, apply = defaultExec) { + const { RigidBody, PhysicsSystem, ERigidBodyType, isDynamicBody, Vec3 } = { ...ctx }; + const groupDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'group'); + const typeDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'type'); + const massDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'mass'); + const allowSleepDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'allowSleep'); + const linearDampingDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'linearDamping'); + const angularDampingDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'angularDamping'); + const useGravityDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'useGravity'); + const linearFactorDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'linearFactor'); + const angularFactorDescriptor = Object.getOwnPropertyDescriptor(RigidBody.prototype, 'angularFactor'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.group')(RigidBody.prototype, 'group', groupDescriptor); }, 'tooltip', 'group'); + apply(() => { $.displayOrder(-2)(RigidBody.prototype, 'group', groupDescriptor); }, 'displayOrder', 'group'); + apply(() => { $.type(PhysicsSystem.PhysicsGroup)(RigidBody.prototype, 'group'); }, 'type', 'group'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.type')(RigidBody.prototype, 'type', typeDescriptor); }, 'tooltip', 'type'); + apply(() => { $.displayOrder(-1)(RigidBody.prototype, 'type', typeDescriptor); }, 'displayOrder', 'type'); + apply(() => { $.type(ERigidBodyType)(RigidBody.prototype, 'type'); }, 'type', 'type'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.mass')(RigidBody.prototype, 'mass', massDescriptor); }, 'tooltip', 'mass'); + apply(() => { $.displayOrder(0)(RigidBody.prototype, 'mass', massDescriptor); }, 'displayOrder', 'mass'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'mass', massDescriptor); }, 'visible', 'mass'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.allowSleep')(RigidBody.prototype, 'allowSleep', allowSleepDescriptor); }, 'tooltip', 'allowSleep'); + apply(() => { $.displayOrder(0.5)(RigidBody.prototype, 'allowSleep', allowSleepDescriptor); }, 'displayOrder', 'allowSleep'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'allowSleep', allowSleepDescriptor); }, 'visible', 'allowSleep'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.linearDamping')(RigidBody.prototype, 'linearDamping', linearDampingDescriptor); }, 'tooltip', 'linearDamping'); + apply(() => { $.displayOrder(1)(RigidBody.prototype, 'linearDamping', linearDampingDescriptor); }, 'displayOrder', 'linearDamping'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'linearDamping', linearDampingDescriptor); }, 'visible', 'linearDamping'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.angularDamping')(RigidBody.prototype, 'angularDamping', angularDampingDescriptor); }, 'tooltip', 'angularDamping'); + apply(() => { $.displayOrder(2)(RigidBody.prototype, 'angularDamping', angularDampingDescriptor); }, 'displayOrder', 'angularDamping'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'angularDamping', angularDampingDescriptor); }, 'visible', 'angularDamping'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.useGravity')(RigidBody.prototype, 'useGravity', useGravityDescriptor); }, 'tooltip', 'useGravity'); + apply(() => { $.displayOrder(4)(RigidBody.prototype, 'useGravity', useGravityDescriptor); }, 'displayOrder', 'useGravity'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'useGravity', useGravityDescriptor); }, 'visible', 'useGravity'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.linearFactor')(RigidBody.prototype, 'linearFactor', linearFactorDescriptor); }, 'tooltip', 'linearFactor'); + apply(() => { $.displayOrder(6)(RigidBody.prototype, 'linearFactor', linearFactorDescriptor); }, 'displayOrder', 'linearFactor'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'linearFactor', linearFactorDescriptor); }, 'visible', 'linearFactor'); + apply(() => { $.tooltip('i18n:physics3d.rigidbody.angularFactor')(RigidBody.prototype, 'angularFactor', angularFactorDescriptor); }, 'tooltip', 'angularFactor'); + apply(() => { $.displayOrder(7)(RigidBody.prototype, 'angularFactor', angularFactorDescriptor); }, 'displayOrder', 'angularFactor'); + apply(() => { $.visible(isDynamicBody)(RigidBody.prototype, 'angularFactor', angularFactorDescriptor); }, 'visible', 'angularFactor'); + apply(() => { $.serializable(RigidBody.prototype, '_group', () => { return PhysicsSystem.PhysicsGroup.DEFAULT; }); }, 'serializable', '_group'); + apply(() => { $.serializable(RigidBody.prototype, '_type', () => { return ERigidBodyType.DYNAMIC; }); }, 'serializable', '_type'); + apply(() => { $.serializable(RigidBody.prototype, '_mass', () => { return 1; }); }, 'serializable', '_mass'); + apply(() => { $.serializable(RigidBody.prototype, '_allowSleep', () => { return true; }); }, 'serializable', '_allowSleep'); + apply(() => { $.serializable(RigidBody.prototype, '_linearDamping', () => { return 0.1; }); }, 'serializable', '_linearDamping'); + apply(() => { $.serializable(RigidBody.prototype, '_angularDamping', () => { return 0.1; }); }, 'serializable', '_angularDamping'); + apply(() => { $.serializable(RigidBody.prototype, '_useGravity', () => { return true; }); }, 'serializable', '_useGravity'); + apply(() => { $.serializable(RigidBody.prototype, '_linearFactor', () => { return new Vec3(1, 1, 1); }); }, 'serializable', '_linearFactor'); + apply(() => { $.serializable(RigidBody.prototype, '_angularFactor', () => { return new Vec3(1, 1, 1); }); }, 'serializable', '_angularFactor'); + apply(() => { $.executionOrder(-1)(RigidBody); }, 'executionOrder', null); + apply(() => { $.disallowMultiple(RigidBody); }, 'disallowMultiple', null); + apply(() => { $.executeInEditMode(RigidBody); }, 'executeInEditMode', null); + apply(() => { $.menu('Physics/RigidBody')(RigidBody); }, 'menu', null); + apply(() => { $.help('i18n:cc.RigidBody')(RigidBody); }, 'help', null); + apply(() => { $.ccclass('cc.RigidBody')(RigidBody); }, 'ccclass', null); +} // end of patch_cc_RigidBody + +//---- class cc_Scene +interface cc_Scene_Context_Args { + Scene: any; + SceneGlobals: any; +} +export function patch_cc_Scene(ctx: cc_Scene_Context_Args, apply = defaultExec) { + const { Scene, SceneGlobals } = { ...ctx }; + const globalsDescriptor = Object.getOwnPropertyDescriptor(Scene.prototype, 'globals'); + apply(() => { $.editable(Scene.prototype, 'globals', globalsDescriptor); }, 'editable', 'globals'); + apply(() => { $.editable(Scene.prototype, 'autoReleaseAssets', () => { return false; }); }, 'editable', 'autoReleaseAssets'); + apply(() => { $.serializable(Scene.prototype, 'autoReleaseAssets', () => { return false; }); }, 'serializable', 'autoReleaseAssets'); + apply(() => { $.serializable(Scene.prototype, '_globals', () => { return new SceneGlobals(); }); }, 'serializable', '_globals'); + apply(() => { $.ccclass('cc.Scene')(Scene); }, 'ccclass', null); +} // end of patch_cc_Scene + +//---- class cc_SceneAsset +interface cc_SceneAsset_Context_Args { + SceneAsset: any; +} +export function patch_cc_SceneAsset(ctx: cc_SceneAsset_Context_Args, apply = defaultExec) { + const { SceneAsset } = { ...ctx }; + apply(() => { $.serializable(SceneAsset.prototype, 'scene', () => { return null; }); }, 'serializable', 'scene'); + apply(() => { $.editable(SceneAsset.prototype, 'scene', () => { return null; }); }, 'editable', 'scene'); + apply(() => { $.ccclass('cc.SceneAsset')(SceneAsset); }, 'ccclass', null); +} // end of patch_cc_SceneAsset + +//---- class cc_SceneGlobals +interface cc_SceneGlobals_Context_Args { + SceneGlobals: any; + AmbientInfo: any; + ShadowsInfo: any; + SkyboxInfo: any; + FogInfo: any; + OctreeInfo: any; + LightProbeInfo: any; +} +export function patch_cc_SceneGlobals(ctx: cc_SceneGlobals_Context_Args, apply = defaultExec) { + const { SceneGlobals, AmbientInfo, ShadowsInfo, SkyboxInfo, FogInfo, OctreeInfo, LightProbeInfo } = { ...ctx }; + const skyboxDescriptor = Object.getOwnPropertyDescriptor(SceneGlobals.prototype, 'skybox'); + apply(() => { $.editable(SceneGlobals.prototype, 'ambient', () => { return new AmbientInfo(); }); }, 'editable', 'ambient'); + apply(() => { $.serializable(SceneGlobals.prototype, 'ambient', () => { return new AmbientInfo(); }); }, 'serializable', 'ambient'); + apply(() => { $.editable(SceneGlobals.prototype, 'shadows', () => { return new ShadowsInfo(); }); }, 'editable', 'shadows'); + apply(() => { $.serializable(SceneGlobals.prototype, 'shadows', () => { return new ShadowsInfo(); }); }, 'serializable', 'shadows'); + apply(() => { $.serializable(SceneGlobals.prototype, '_skybox', () => { return new SkyboxInfo(); }); }, 'serializable', '_skybox'); + apply(() => { $.serializable(SceneGlobals.prototype, 'fog', () => { return new FogInfo(); }); }, 'serializable', 'fog'); + apply(() => { $.editable(SceneGlobals.prototype, 'fog', () => { return new FogInfo(); }); }, 'editable', 'fog'); + apply(() => { $.type(SkyboxInfo)(SceneGlobals.prototype, 'skybox'); }, 'type', 'skybox'); + apply(() => { $.editable(SceneGlobals.prototype, 'skybox', skyboxDescriptor); }, 'editable', 'skybox'); + apply(() => { $.serializable(SceneGlobals.prototype, 'octree', () => { return new OctreeInfo(); }); }, 'serializable', 'octree'); + apply(() => { $.editable(SceneGlobals.prototype, 'octree', () => { return new OctreeInfo(); }); }, 'editable', 'octree'); + apply(() => { $.serializable(SceneGlobals.prototype, 'lightProbeInfo', () => { return new LightProbeInfo(); }); }, 'serializable', 'lightProbeInfo'); + apply(() => { $.editable(SceneGlobals.prototype, 'lightProbeInfo', () => { return new LightProbeInfo(); }); }, 'editable', 'lightProbeInfo'); + apply(() => { $.serializable(SceneGlobals.prototype, 'bakedWithStationaryMainLight', () => { return false; }); }, 'serializable', 'bakedWithStationaryMainLight'); + apply(() => { $.editable(SceneGlobals.prototype, 'bakedWithStationaryMainLight', () => { return false; }); }, 'editable', 'bakedWithStationaryMainLight'); + apply(() => { $.serializable(SceneGlobals.prototype, 'bakedWithHighpLightmap', () => { return false; }); }, 'serializable', 'bakedWithHighpLightmap'); + apply(() => { $.editable(SceneGlobals.prototype, 'bakedWithHighpLightmap', () => { return false; }); }, 'editable', 'bakedWithHighpLightmap'); + apply(() => { $.ccclass('cc.SceneGlobals')(SceneGlobals); }, 'ccclass', null); +} // end of patch_cc_SceneGlobals + +//---- class cc_ShadowsInfo +interface cc_ShadowsInfo_Context_Args { + ShadowsInfo: any; + ShadowType: any; + CCFloat: any; + CCInteger: any; + ShadowSize: any; + Vec3: any; + Color: any; + Vec2: any; +} +export function patch_cc_ShadowsInfo(ctx: cc_ShadowsInfo_Context_Args, apply = defaultExec) { + type ShadowsInfo = any; + const { ShadowsInfo, ShadowType, CCFloat, CCInteger, ShadowSize, Vec3, Color, Vec2 } = { ...ctx }; + const enabledDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'enabled'); + const typeDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'type'); + const shadowColorDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'shadowColor'); + const planeDirectionDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'planeDirection'); + const planeHeightDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'planeHeight'); + const maxReceivedDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'maxReceived'); + const shadowMapSizeDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfo.prototype, 'shadowMapSize'); + apply(() => { $.tooltip('i18n:shadow.enabled')(ShadowsInfo.prototype, 'enabled', enabledDescriptor); }, 'tooltip', 'enabled'); + apply(() => { $.editable(ShadowsInfo.prototype, 'enabled', enabledDescriptor); }, 'editable', 'enabled'); + apply(() => { $.type(ShadowType)(ShadowsInfo.prototype, 'type'); }, 'type', 'type'); + apply(() => { $.editable(ShadowsInfo.prototype, 'type', typeDescriptor); }, 'editable', 'type'); + apply(() => { $.tooltip('i18n:shadow.type')(ShadowsInfo.prototype, 'type', typeDescriptor); }, 'tooltip', 'type'); + apply(() => { $.visible(function (this: ShadowsInfo) { + return this._type === ShadowType.Planar; +})(ShadowsInfo.prototype, 'shadowColor', shadowColorDescriptor); }, 'visible', 'shadowColor'); + apply(() => { $.tooltip('i18n:shadow.shadowColor')(ShadowsInfo.prototype, 'shadowColor', shadowColorDescriptor); }, 'tooltip', 'shadowColor'); + apply(() => { $.visible(function (this: ShadowsInfo) { + return this._type === ShadowType.Planar; +})(ShadowsInfo.prototype, 'planeDirection', planeDirectionDescriptor); }, 'visible', 'planeDirection'); + apply(() => { $.tooltip('i18n:shadow.planeDirection')(ShadowsInfo.prototype, 'planeDirection', planeDirectionDescriptor); }, 'tooltip', 'planeDirection'); + apply(() => { $.visible(function (this: ShadowsInfo) { + return this._type === ShadowType.Planar; +})(ShadowsInfo.prototype, 'planeHeight', planeHeightDescriptor); }, 'visible', 'planeHeight'); + apply(() => { $.type(CCFloat)(ShadowsInfo.prototype, 'planeHeight'); }, 'type', 'planeHeight'); + apply(() => { $.editable(ShadowsInfo.prototype, 'planeHeight', planeHeightDescriptor); }, 'editable', 'planeHeight'); + apply(() => { $.tooltip('i18n:shadow.planeHeight')(ShadowsInfo.prototype, 'planeHeight', planeHeightDescriptor); }, 'tooltip', 'planeHeight'); + apply(() => { $.visible(function (this: ShadowsInfo) { + return this._type === ShadowType.ShadowMap; +})(ShadowsInfo.prototype, 'maxReceived', maxReceivedDescriptor); }, 'visible', 'maxReceived'); + apply(() => { $.type(CCInteger)(ShadowsInfo.prototype, 'maxReceived'); }, 'type', 'maxReceived'); + apply(() => { $.tooltip('i18n:shadow.maxReceived')(ShadowsInfo.prototype, 'maxReceived', maxReceivedDescriptor); }, 'tooltip', 'maxReceived'); + apply(() => { $.visible(function (this: ShadowsInfo) { + return this._type === ShadowType.ShadowMap; +})(ShadowsInfo.prototype, 'shadowMapSize', shadowMapSizeDescriptor); }, 'visible', 'shadowMapSize'); + apply(() => { $.type(ShadowSize)(ShadowsInfo.prototype, 'shadowMapSize'); }, 'type', 'shadowMapSize'); + apply(() => { $.tooltip('i18n:shadow.shadowMapSize')(ShadowsInfo.prototype, 'shadowMapSize', shadowMapSizeDescriptor); }, 'tooltip', 'shadowMapSize'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_enabled', () => { return false; }); }, 'serializable', '_enabled'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_type', () => { return ShadowType.Planar; }); }, 'serializable', '_type'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_normal', () => { return new Vec3(0, 1, 0); }); }, 'serializable', '_normal'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_distance', () => { return 0; }); }, 'serializable', '_distance'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_shadowColor', () => { return new Color(0, 0, 0, 76); }); }, 'serializable', '_shadowColor'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_maxReceived', () => { return 4; }); }, 'serializable', '_maxReceived'); + apply(() => { $.serializable(ShadowsInfo.prototype, '_size', () => { return new Vec2(1024, 1024); }); }, 'serializable', '_size'); + apply(() => { $.ccclass('cc.ShadowsInfo')(ShadowsInfo); }, 'ccclass', null); +} // end of patch_cc_ShadowsInfo + +//---- class cc_SimpleTexture +interface cc_SimpleTexture_Context_Args { + SimpleTexture: any; +} +export function patch_cc_SimpleTexture(ctx: cc_SimpleTexture_Context_Args, apply = defaultExec) { + const { SimpleTexture } = { ...ctx }; + apply(() => { $.ccclass('cc.SimpleTexture')(SimpleTexture); }, 'ccclass', null); +} // end of patch_cc_SimpleTexture + +//---- class cc_Skeleton +interface cc_Skeleton_Context_Args { + Skeleton: any; + CCString: any; + Mat4: any; +} +export function patch_cc_Skeleton(ctx: cc_Skeleton_Context_Args, apply = defaultExec) { + const { Skeleton, CCString, Mat4 } = { ...ctx }; + apply(() => { $.type([CCString])(Skeleton.prototype, '_joints'); }, 'type', '_joints'); + apply(() => { $.type([Mat4])(Skeleton.prototype, '_bindposes'); }, 'type', '_bindposes'); + apply(() => { $.serializable(Skeleton.prototype, '_hash', () => { return 0; }); }, 'serializable', '_hash'); + apply(() => { $.ccclass('cc.Skeleton')(Skeleton); }, 'ccclass', null); +} // end of patch_cc_Skeleton + +//---- class cc_SkyboxInfo +interface cc_SkyboxInfo_Context_Args { + SkyboxInfo: any; + EnvironmentLightingType: any; + TextureCube: any; + CCFloat: any; + Material: any; +} +export function patch_cc_SkyboxInfo(ctx: cc_SkyboxInfo_Context_Args, apply = defaultExec) { + type SkyboxInfo = any; + const { SkyboxInfo, EnvironmentLightingType, TextureCube, CCFloat, Material } = { ...ctx }; + const enabledDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'enabled'); + const envLightingTypeDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'envLightingType'); + const useHDRDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'useHDR'); + const envmapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'envmap'); + const rotationAngleDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'rotationAngle'); + const diffuseMapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'diffuseMap'); + const reflectionMapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'reflectionMap'); + const skyboxMaterialDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfo.prototype, 'skyboxMaterial'); + apply(() => { $.tooltip('i18n:skybox.enabled')(SkyboxInfo.prototype, 'enabled', enabledDescriptor); }, 'tooltip', 'enabled'); + apply(() => { $.editable(SkyboxInfo.prototype, 'enabled', enabledDescriptor); }, 'editable', 'enabled'); + apply(() => { $.tooltip('i18n:skybox.EnvironmentLightingType')(SkyboxInfo.prototype, 'envLightingType', envLightingTypeDescriptor); }, 'tooltip', 'envLightingType'); + apply(() => { $.type(EnvironmentLightingType)(SkyboxInfo.prototype, 'envLightingType'); }, 'type', 'envLightingType'); + apply(() => { $.editable(SkyboxInfo.prototype, 'envLightingType', envLightingTypeDescriptor); }, 'editable', 'envLightingType'); + apply(() => { $.tooltip('i18n:skybox.useHDR')(SkyboxInfo.prototype, 'useHDR', useHDRDescriptor); }, 'tooltip', 'useHDR'); + apply(() => { $.editable(SkyboxInfo.prototype, 'useHDR', useHDRDescriptor); }, 'editable', 'useHDR'); + apply(() => { $.tooltip('i18n:skybox.envmap')(SkyboxInfo.prototype, 'envmap', envmapDescriptor); }, 'tooltip', 'envmap'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, 'envmap'); }, 'type', 'envmap'); + apply(() => { $.editable(SkyboxInfo.prototype, 'envmap', envmapDescriptor); }, 'editable', 'envmap'); + apply(() => { $.tooltip('i18n:skybox.rotationAngle')(SkyboxInfo.prototype, 'rotationAngle', rotationAngleDescriptor); }, 'tooltip', 'rotationAngle'); + apply(() => { $.slide(SkyboxInfo.prototype, 'rotationAngle', rotationAngleDescriptor); }, 'slide', 'rotationAngle'); + apply(() => { $.range([0, 360, 1])(SkyboxInfo.prototype, 'rotationAngle', rotationAngleDescriptor); }, 'range', 'rotationAngle'); + apply(() => { $.type(CCFloat)(SkyboxInfo.prototype, 'rotationAngle'); }, 'type', 'rotationAngle'); + apply(() => { $.displayOrder(100)(SkyboxInfo.prototype, 'diffuseMap', diffuseMapDescriptor); }, 'displayOrder', 'diffuseMap'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, 'diffuseMap'); }, 'type', 'diffuseMap'); + apply(() => { $$.readOnly(SkyboxInfo.prototype, 'diffuseMap', diffuseMapDescriptor); }, 'readOnly', 'diffuseMap'); + apply(() => { $.editable(SkyboxInfo.prototype, 'diffuseMap', diffuseMapDescriptor); }, 'editable', 'diffuseMap'); + apply(() => { $.visible(function (this: SkyboxInfo) { + if (this.useIBL && this.applyDiffuseMap) { + return true; + } + return false; +})(SkyboxInfo.prototype, 'diffuseMap', diffuseMapDescriptor); }, 'visible', 'diffuseMap'); + apply(() => { $.displayOrder(100)(SkyboxInfo.prototype, 'reflectionMap', reflectionMapDescriptor); }, 'displayOrder', 'reflectionMap'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, 'reflectionMap'); }, 'type', 'reflectionMap'); + apply(() => { $$.readOnly(SkyboxInfo.prototype, 'reflectionMap', reflectionMapDescriptor); }, 'readOnly', 'reflectionMap'); + apply(() => { $.editable(SkyboxInfo.prototype, 'reflectionMap', reflectionMapDescriptor); }, 'editable', 'reflectionMap'); + apply(() => { $.visible(function (this: SkyboxInfo) { + if (this._resource?.reflectionMap) { + return true; + } + return false; +})(SkyboxInfo.prototype, 'reflectionMap', reflectionMapDescriptor); }, 'visible', 'reflectionMap'); + apply(() => { $.tooltip('i18n:skybox.material')(SkyboxInfo.prototype, 'skyboxMaterial', skyboxMaterialDescriptor); }, 'tooltip', 'skyboxMaterial'); + apply(() => { $.type(Material)(SkyboxInfo.prototype, 'skyboxMaterial'); }, 'type', 'skyboxMaterial'); + apply(() => { $.editable(SkyboxInfo.prototype, 'skyboxMaterial', skyboxMaterialDescriptor); }, 'editable', 'skyboxMaterial'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_envLightingType', () => { return EnvironmentLightingType.HEMISPHERE_DIFFUSE; }); }, 'serializable', '_envLightingType'); + apply(() => { $.formerlySerializedAs('_envmap')(SkyboxInfo.prototype, '_envmapHDR', () => { return null; }); }, 'formerlySerializedAs', '_envmapHDR'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_envmapHDR'); }, 'type', '_envmapHDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_envmapHDR', () => { return null; }); }, 'serializable', '_envmapHDR'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_envmapLDR'); }, 'type', '_envmapLDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_envmapLDR', () => { return null; }); }, 'serializable', '_envmapLDR'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_diffuseMapHDR'); }, 'type', '_diffuseMapHDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_diffuseMapHDR', () => { return null; }); }, 'serializable', '_diffuseMapHDR'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_diffuseMapLDR'); }, 'type', '_diffuseMapLDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_diffuseMapLDR', () => { return null; }); }, 'serializable', '_diffuseMapLDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_enabled', () => { return false; }); }, 'serializable', '_enabled'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_useHDR', () => { return true; }); }, 'serializable', '_useHDR'); + apply(() => { $.type(Material)(SkyboxInfo.prototype, '_editableMaterial'); }, 'type', '_editableMaterial'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_editableMaterial', () => { return null; }); }, 'serializable', '_editableMaterial'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_reflectionHDR'); }, 'type', '_reflectionHDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_reflectionHDR', () => { return null; }); }, 'serializable', '_reflectionHDR'); + apply(() => { $.type(TextureCube)(SkyboxInfo.prototype, '_reflectionLDR'); }, 'type', '_reflectionLDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_reflectionLDR', () => { return null; }); }, 'serializable', '_reflectionLDR'); + apply(() => { $.serializable(SkyboxInfo.prototype, '_rotationAngle', () => { return 0; }); }, 'serializable', '_rotationAngle'); + apply(() => { $.ccclass('cc.SkyboxInfo')(SkyboxInfo); }, 'ccclass', null); +} // end of patch_cc_SkyboxInfo + +//---- class cc_SphereLight +interface cc_SphereLight_Context_Args { + SphereLight: any; + scene: any; + Camera: any; + PhotometricTerm: any; +} +export function patch_cc_SphereLight(ctx: cc_SphereLight_Context_Args, apply = defaultExec) { + const { SphereLight, scene, Camera, PhotometricTerm } = { ...ctx }; + const luminousFluxDescriptor = Object.getOwnPropertyDescriptor(SphereLight.prototype, 'luminousFlux'); + const luminanceDescriptor = Object.getOwnPropertyDescriptor(SphereLight.prototype, 'luminance'); + const termDescriptor = Object.getOwnPropertyDescriptor(SphereLight.prototype, 'term'); + const sizeDescriptor = Object.getOwnPropertyDescriptor(SphereLight.prototype, 'size'); + const rangeDescriptor = Object.getOwnPropertyDescriptor(SphereLight.prototype, 'range'); + apply(() => { $.serializable(SphereLight.prototype, '_size', () => { return 0.15; }); }, 'serializable', '_size'); + apply(() => { $.formerlySerializedAs('_luminance')(SphereLight.prototype, '_luminanceHDR', () => { return 1700 / scene.nt2lm(0.15); }); }, 'formerlySerializedAs', '_luminanceHDR'); + apply(() => { $.serializable(SphereLight.prototype, '_luminanceHDR', () => { return 1700 / scene.nt2lm(0.15); }); }, 'serializable', '_luminanceHDR'); + apply(() => { $.serializable(SphereLight.prototype, '_luminanceLDR', () => { return 1700 / scene.nt2lm(0.15) * Camera.standardExposureValue * Camera.standardLightMeterScale; }); }, 'serializable', '_luminanceLDR'); + apply(() => { $.serializable(SphereLight.prototype, '_term', () => { return PhotometricTerm.LUMINOUS_FLUX; }); }, 'serializable', '_term'); + apply(() => { $.serializable(SphereLight.prototype, '_range', () => { return 1; }); }, 'serializable', '_range'); + apply(() => { $.tooltip('i18n:lights.luminous_flux')(SphereLight.prototype, 'luminousFlux', luminousFluxDescriptor); }, 'tooltip', 'luminousFlux'); + apply(() => { $.displayOrder(-1)(SphereLight.prototype, 'luminousFlux', luminousFluxDescriptor); }, 'displayOrder', 'luminousFlux'); + apply(() => { $.tooltip('i18n:lights.luminance')(SphereLight.prototype, 'luminance', luminanceDescriptor); }, 'tooltip', 'luminance'); + apply(() => { $.displayOrder(-1)(SphereLight.prototype, 'luminance', luminanceDescriptor); }, 'displayOrder', 'luminance'); + apply(() => { $.tooltip('i18n:lights.term')(SphereLight.prototype, 'term', termDescriptor); }, 'tooltip', 'term'); + apply(() => { $.displayOrder(-2)(SphereLight.prototype, 'term', termDescriptor); }, 'displayOrder', 'term'); + apply(() => { $.type(PhotometricTerm)(SphereLight.prototype, 'term'); }, 'type', 'term'); + apply(() => { $.tooltip('i18n:lights.size')(SphereLight.prototype, 'size', sizeDescriptor); }, 'tooltip', 'size'); + apply(() => { $.tooltip('i18n:lights.range')(SphereLight.prototype, 'range', rangeDescriptor); }, 'tooltip', 'range'); + apply(() => { $.executeInEditMode(SphereLight); }, 'executeInEditMode', null); + apply(() => { $.menu('Light/SphereLight')(SphereLight); }, 'menu', null); + apply(() => { $.help('i18n:cc.SphereLight')(SphereLight); }, 'help', null); + apply(() => { $.ccclass('cc.SphereLight')(SphereLight); }, 'ccclass', null); +} // end of patch_cc_SphereLight + +//---- class cc_SpotLight +interface cc_SpotLight_Context_Args { + SpotLight: any; + scene: any; + Camera: any; + PhotometricTerm: any; + PCFType: any; + cclegacy: any; + ShadowType: any; + CCBoolean: any; + CCFloat: any; +} +export function patch_cc_SpotLight(ctx: cc_SpotLight_Context_Args, apply = defaultExec) { + type Root = any; + const { SpotLight, scene, Camera, PhotometricTerm, PCFType, cclegacy, ShadowType, CCBoolean, CCFloat } = { ...ctx }; + const luminousFluxDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'luminousFlux'); + const luminanceDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'luminance'); + const termDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'term'); + const sizeDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'size'); + const rangeDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'range'); + const spotAngleDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'spotAngle'); + const shadowEnabledDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'shadowEnabled'); + const shadowPcfDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'shadowPcf'); + const shadowBiasDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'shadowBias'); + const shadowNormalBiasDescriptor = Object.getOwnPropertyDescriptor(SpotLight.prototype, 'shadowNormalBias'); + apply(() => { $.serializable(SpotLight.prototype, '_size', () => { return 0.15; }); }, 'serializable', '_size'); + apply(() => { $.formerlySerializedAs('_luminance')(SpotLight.prototype, '_luminanceHDR', () => { return 1700 / scene.nt2lm(0.15); }); }, 'formerlySerializedAs', '_luminanceHDR'); + apply(() => { $.serializable(SpotLight.prototype, '_luminanceHDR', () => { return 1700 / scene.nt2lm(0.15); }); }, 'serializable', '_luminanceHDR'); + apply(() => { $.serializable(SpotLight.prototype, '_luminanceLDR', () => { return 1700 / scene.nt2lm(0.15) * Camera.standardExposureValue * Camera.standardLightMeterScale; }); }, 'serializable', '_luminanceLDR'); + apply(() => { $.serializable(SpotLight.prototype, '_term', () => { return PhotometricTerm.LUMINOUS_FLUX; }); }, 'serializable', '_term'); + apply(() => { $.serializable(SpotLight.prototype, '_range', () => { return 1; }); }, 'serializable', '_range'); + apply(() => { $.serializable(SpotLight.prototype, '_spotAngle', () => { return 60; }); }, 'serializable', '_spotAngle'); + apply(() => { $.serializable(SpotLight.prototype, '_shadowEnabled', () => { return false; }); }, 'serializable', '_shadowEnabled'); + apply(() => { $.serializable(SpotLight.prototype, '_shadowPcf', () => { return PCFType.HARD; }); }, 'serializable', '_shadowPcf'); + apply(() => { $.serializable(SpotLight.prototype, '_shadowBias', () => { return 0.00001; }); }, 'serializable', '_shadowBias'); + apply(() => { $.serializable(SpotLight.prototype, '_shadowNormalBias', () => { return 0.0; }); }, 'serializable', '_shadowNormalBias'); + apply(() => { $.displayOrder(-1)(SpotLight.prototype, 'luminousFlux', luminousFluxDescriptor); }, 'displayOrder', 'luminousFlux'); + apply(() => { $.tooltip('i18n:lights.luminous_flux')(SpotLight.prototype, 'luminousFlux', luminousFluxDescriptor); }, 'tooltip', 'luminousFlux'); + apply(() => { $.displayOrder(-1)(SpotLight.prototype, 'luminance', luminanceDescriptor); }, 'displayOrder', 'luminance'); + apply(() => { $.tooltip('i18n:lights.luminance')(SpotLight.prototype, 'luminance', luminanceDescriptor); }, 'tooltip', 'luminance'); + apply(() => { $.tooltip('i18n:lights.term')(SpotLight.prototype, 'term', termDescriptor); }, 'tooltip', 'term'); + apply(() => { $.displayOrder(-2)(SpotLight.prototype, 'term', termDescriptor); }, 'displayOrder', 'term'); + apply(() => { $.type(PhotometricTerm)(SpotLight.prototype, 'term'); }, 'type', 'term'); + apply(() => { $.tooltip('i18n:lights.size')(SpotLight.prototype, 'size', sizeDescriptor); }, 'tooltip', 'size'); + apply(() => { $.tooltip('i18n:lights.range')(SpotLight.prototype, 'range', rangeDescriptor); }, 'tooltip', 'range'); + apply(() => { $.tooltip('The spot light cone angle')(SpotLight.prototype, 'spotAngle', spotAngleDescriptor); }, 'tooltip', 'spotAngle'); + apply(() => { $.range([2, 180, 1])(SpotLight.prototype, 'spotAngle', spotAngleDescriptor); }, 'range', 'spotAngle'); + apply(() => { $.slide(SpotLight.prototype, 'spotAngle', spotAngleDescriptor); }, 'slide', 'spotAngle'); + apply(() => { $.type(CCBoolean)(SpotLight.prototype, 'shadowEnabled'); }, 'type', 'shadowEnabled'); + apply(() => { $.editable(SpotLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'editable', 'shadowEnabled'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 1 + } +})(SpotLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'property', 'shadowEnabled'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(SpotLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'visible', 'shadowEnabled'); + apply(() => { $.tooltip('i18n:lights.shadowEnabled')(SpotLight.prototype, 'shadowEnabled', shadowEnabledDescriptor); }, 'tooltip', 'shadowEnabled'); + apply(() => { $.type(PCFType)(SpotLight.prototype, 'shadowPcf'); }, 'type', 'shadowPcf'); + apply(() => { $.editable(SpotLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'editable', 'shadowPcf'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 2 + } +})(SpotLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'property', 'shadowPcf'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(SpotLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'visible', 'shadowPcf'); + apply(() => { $.tooltip('i18n:lights.shadowPcf')(SpotLight.prototype, 'shadowPcf', shadowPcfDescriptor); }, 'tooltip', 'shadowPcf'); + apply(() => { $.type(CCFloat)(SpotLight.prototype, 'shadowBias'); }, 'type', 'shadowBias'); + apply(() => { $.editable(SpotLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'editable', 'shadowBias'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 3 + } +})(SpotLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'property', 'shadowBias'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(SpotLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'visible', 'shadowBias'); + apply(() => { $.tooltip('i18n:lights.shadowBias')(SpotLight.prototype, 'shadowBias', shadowBiasDescriptor); }, 'tooltip', 'shadowBias'); + apply(() => { $.type(CCFloat)(SpotLight.prototype, 'shadowNormalBias'); }, 'type', 'shadowNormalBias'); + apply(() => { $.editable(SpotLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'editable', 'shadowNormalBias'); + apply(() => { $.property({ + group: { + name: 'DynamicShadowSettings', + displayOrder: 4 + } +})(SpotLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'property', 'shadowNormalBias'); + apply(() => { $.visible(() => (cclegacy.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)(SpotLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'visible', 'shadowNormalBias'); + apply(() => { $.tooltip('i18n:lights.shadowNormalBias')(SpotLight.prototype, 'shadowNormalBias', shadowNormalBiasDescriptor); }, 'tooltip', 'shadowNormalBias'); + apply(() => { $.executeInEditMode(SpotLight); }, 'executeInEditMode', null); + apply(() => { $.menu('Light/SpotLight')(SpotLight); }, 'menu', null); + apply(() => { $.help('i18n:cc.SpotLight')(SpotLight); }, 'help', null); + apply(() => { $.ccclass('cc.SpotLight')(SpotLight); }, 'ccclass', null); +} // end of patch_cc_SpotLight + +//---- class cc_SpriteFrame +interface cc_SpriteFrame_Context_Args { + SpriteFrame: any; +} +export function patch_cc_SpriteFrame(ctx: cc_SpriteFrame_Context_Args, apply = defaultExec) { + const { SpriteFrame } = { ...ctx }; + apply(() => { $.ccclass('cc.SpriteFrame')(SpriteFrame); }, 'ccclass', null); +} // end of patch_cc_SpriteFrame + +//---- class cc_Tetrahedron +interface cc_Tetrahedron_Context_Args { + Tetrahedron: any; + Mat3: any; + Vec3: any; + CircumSphere: any; +} +export function patch_cc_Tetrahedron(ctx: cc_Tetrahedron_Context_Args, apply = defaultExec) { + const { Tetrahedron, Mat3, Vec3, CircumSphere } = { ...ctx }; + apply(() => { $.serializable(Tetrahedron.prototype, 'invalid', () => { return false; }); }, 'serializable', 'invalid'); + apply(() => { $.serializable(Tetrahedron.prototype, 'vertex0', () => { return -1; }); }, 'serializable', 'vertex0'); + apply(() => { $.serializable(Tetrahedron.prototype, 'vertex1', () => { return -1; }); }, 'serializable', 'vertex1'); + apply(() => { $.serializable(Tetrahedron.prototype, 'vertex2', () => { return -1; }); }, 'serializable', 'vertex2'); + apply(() => { $.serializable(Tetrahedron.prototype, 'vertex3', () => { return -1; }); }, 'serializable', 'vertex3'); + apply(() => { $.serializable(Tetrahedron.prototype, 'neighbours', () => { return [-1, -1, -1, -1]; }); }, 'serializable', 'neighbours'); + apply(() => { $.serializable(Tetrahedron.prototype, 'matrix', () => { return new Mat3(); }); }, 'serializable', 'matrix'); + apply(() => { $.serializable(Tetrahedron.prototype, 'offset', () => { return new Vec3(0.0, 0.0, 0.0); }); }, 'serializable', 'offset'); + apply(() => { $.serializable(Tetrahedron.prototype, 'sphere', () => { return new CircumSphere(); }); }, 'serializable', 'sphere'); + apply(() => { $.ccclass('cc.Tetrahedron')(Tetrahedron); }, 'ccclass', null); +} // end of patch_cc_Tetrahedron + +//---- class cc_TextAsset +interface cc_TextAsset_Context_Args { + TextAsset: any; +} +export function patch_cc_TextAsset(ctx: cc_TextAsset_Context_Args, apply = defaultExec) { + const { TextAsset } = { ...ctx }; + apply(() => { $.editable(TextAsset.prototype, 'text', () => { return ''; }); }, 'editable', 'text'); + apply(() => { $.serializable(TextAsset.prototype, 'text', () => { return ''; }); }, 'serializable', 'text'); + apply(() => { $.ccclass('cc.TextAsset')(TextAsset); }, 'ccclass', null); +} // end of patch_cc_TextAsset + +//---- class cc_Texture2D +interface cc_Texture2D_Context_Args { + Texture2D: any; + ImageAsset: any; +} +export function patch_cc_Texture2D(ctx: cc_Texture2D_Context_Args, apply = defaultExec) { + const { Texture2D, ImageAsset } = { ...ctx }; + apply(() => { $.type([ImageAsset])(Texture2D.prototype, '_mipmaps'); }, 'type', '_mipmaps'); + apply(() => { $.ccclass('cc.Texture2D')(Texture2D); }, 'ccclass', null); +} // end of patch_cc_Texture2D + +//---- class cc_TextureBase +interface cc_TextureBase_Context_Args { + TextureBase: any; + PixelFormat: any; + Filter: any; + WrapMode: any; +} +export function patch_cc_TextureBase(ctx: cc_TextureBase_Context_Args, apply = defaultExec) { + const { TextureBase, PixelFormat, Filter, WrapMode } = { ...ctx }; + apply(() => { $.serializable(TextureBase.prototype, '_format', () => { return PixelFormat.RGBA8888; }); }, 'serializable', '_format'); + apply(() => { $.serializable(TextureBase.prototype, '_minFilter', () => { return Filter.LINEAR; }); }, 'serializable', '_minFilter'); + apply(() => { $.serializable(TextureBase.prototype, '_magFilter', () => { return Filter.LINEAR; }); }, 'serializable', '_magFilter'); + apply(() => { $.serializable(TextureBase.prototype, '_mipFilter', () => { return Filter.NONE; }); }, 'serializable', '_mipFilter'); + apply(() => { $.serializable(TextureBase.prototype, '_wrapS', () => { return WrapMode.REPEAT; }); }, 'serializable', '_wrapS'); + apply(() => { $.serializable(TextureBase.prototype, '_wrapT', () => { return WrapMode.REPEAT; }); }, 'serializable', '_wrapT'); + apply(() => { $.serializable(TextureBase.prototype, '_wrapR', () => { return WrapMode.REPEAT; }); }, 'serializable', '_wrapR'); + apply(() => { $.serializable(TextureBase.prototype, '_anisotropy', () => { return 0; }); }, 'serializable', '_anisotropy'); + apply(() => { $.ccclass('cc.TextureBase')(TextureBase); }, 'ccclass', null); +} // end of patch_cc_TextureBase + +//---- class cc_TextureCube +interface cc_TextureCube_Context_Args { + TextureCube: any; + MipmapMode: any; +} +export function patch_cc_TextureCube(ctx: cc_TextureCube_Context_Args, apply = defaultExec) { + const { TextureCube, MipmapMode } = { ...ctx }; + apply(() => { $.serializable(TextureCube.prototype, 'isRGBE', () => { return false; }); }, 'serializable', 'isRGBE'); + apply(() => { $.serializable(TextureCube.prototype, '_mipmapAtlas', () => { return null; }); }, 'serializable', '_mipmapAtlas'); + apply(() => { $.serializable(TextureCube.prototype, '_mipmapMode', () => { return MipmapMode.NONE; }); }, 'serializable', '_mipmapMode'); + apply(() => { $.serializable(TextureCube.prototype, '_mipmaps', () => { return []; }); }, 'serializable', '_mipmaps'); + apply(() => { $.ccclass('cc.TextureCube')(TextureCube); }, 'ccclass', null); +} // end of patch_cc_TextureCube + +//---- class cc_Vertex +interface cc_Vertex_Context_Args { + Vertex: any; + Vec3: any; +} +export function patch_cc_Vertex(ctx: cc_Vertex_Context_Args, apply = defaultExec) { + const { Vertex, Vec3 } = { ...ctx }; + apply(() => { $.serializable(Vertex.prototype, 'position', () => { return new Vec3(0, 0, 0); }); }, 'serializable', 'position'); + apply(() => { $.serializable(Vertex.prototype, 'normal', () => { return new Vec3(0, 0, 0); }); }, 'serializable', 'normal'); + apply(() => { $.serializable(Vertex.prototype, 'coefficients', () => { return []; }); }, 'serializable', 'coefficients'); + apply(() => { $.ccclass('cc.Vertex')(Vertex); }, 'ccclass', null); +} // end of patch_cc_Vertex + +//---- class cc_VideoPlayer +interface cc_VideoPlayer_Context_Args { + VideoPlayer: any; + UITransform: any; + ResourceType: any; + VideoClip: any; + ComponentEventHandler: any; +} +export function patch_cc_VideoPlayer(ctx: cc_VideoPlayer_Context_Args, apply = defaultExec) { + const { VideoPlayer, UITransform, ResourceType, VideoClip, ComponentEventHandler } = { ...ctx }; + const resourceTypeDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'resourceType'); + const remoteURLDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'remoteURL'); + const clipDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'clip'); + const playOnAwakeDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'playOnAwake'); + const playbackRateDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'playbackRate'); + const volumeDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'volume'); + const muteDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'mute'); + const loopDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'loop'); + const keepAspectRatioDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'keepAspectRatio'); + const fullScreenOnAwakeDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'fullScreenOnAwake'); + const stayOnBottomDescriptor = Object.getOwnPropertyDescriptor(VideoPlayer.prototype, 'stayOnBottom'); + apply(() => { $.serializable(VideoPlayer.prototype, '_resourceType', () => { return ResourceType.LOCAL; }); }, 'serializable', '_resourceType'); + apply(() => { $.serializable(VideoPlayer.prototype, '_remoteURL', () => { return ''; }); }, 'serializable', '_remoteURL'); + apply(() => { $.serializable(VideoPlayer.prototype, '_clip', () => { return null; }); }, 'serializable', '_clip'); + apply(() => { $.type(VideoClip)(VideoPlayer.prototype, '_clip'); }, 'type', '_clip'); + apply(() => { $.serializable(VideoPlayer.prototype, '_playOnAwake', () => { return true; }); }, 'serializable', '_playOnAwake'); + apply(() => { $.serializable(VideoPlayer.prototype, '_volume', () => { return 1.0; }); }, 'serializable', '_volume'); + apply(() => { $.serializable(VideoPlayer.prototype, '_mute', () => { return false; }); }, 'serializable', '_mute'); + apply(() => { $.serializable(VideoPlayer.prototype, '_playbackRate', () => { return 1; }); }, 'serializable', '_playbackRate'); + apply(() => { $.serializable(VideoPlayer.prototype, '_loop', () => { return false; }); }, 'serializable', '_loop'); + apply(() => { $.serializable(VideoPlayer.prototype, '_fullScreenOnAwake', () => { return false; }); }, 'serializable', '_fullScreenOnAwake'); + apply(() => { $.serializable(VideoPlayer.prototype, '_stayOnBottom', () => { return false; }); }, 'serializable', '_stayOnBottom'); + apply(() => { $.serializable(VideoPlayer.prototype, '_keepAspectRatio', () => { return true; }); }, 'serializable', '_keepAspectRatio'); + apply(() => { $.tooltip('i18n:videoplayer.resourceType')(VideoPlayer.prototype, 'resourceType', resourceTypeDescriptor); }, 'tooltip', 'resourceType'); + apply(() => { $.type(ResourceType)(VideoPlayer.prototype, 'resourceType'); }, 'type', 'resourceType'); + apply(() => { $.tooltip('i18n:videoplayer.remoteURL')(VideoPlayer.prototype, 'remoteURL', remoteURLDescriptor); }, 'tooltip', 'remoteURL'); + apply(() => { $.tooltip('i18n:videoplayer.clip')(VideoPlayer.prototype, 'clip', clipDescriptor); }, 'tooltip', 'clip'); + apply(() => { $.type(VideoClip)(VideoPlayer.prototype, 'clip'); }, 'type', 'clip'); + apply(() => { $.tooltip('i18n:videoplayer.playOnAwake')(VideoPlayer.prototype, 'playOnAwake', playOnAwakeDescriptor); }, 'tooltip', 'playOnAwake'); + apply(() => { $.tooltip('i18n:videoplayer.playbackRate')(VideoPlayer.prototype, 'playbackRate', playbackRateDescriptor); }, 'tooltip', 'playbackRate'); + apply(() => { $.range([0.0, 10, 1.0])(VideoPlayer.prototype, 'playbackRate', playbackRateDescriptor); }, 'range', 'playbackRate'); + apply(() => { $.slide(VideoPlayer.prototype, 'playbackRate', playbackRateDescriptor); }, 'slide', 'playbackRate'); + apply(() => { $.tooltip('i18n:videoplayer.volume')(VideoPlayer.prototype, 'volume', volumeDescriptor); }, 'tooltip', 'volume'); + apply(() => { $.range([0.0, 1.0, 0.1])(VideoPlayer.prototype, 'volume', volumeDescriptor); }, 'range', 'volume'); + apply(() => { $.slide(VideoPlayer.prototype, 'volume', volumeDescriptor); }, 'slide', 'volume'); + apply(() => { $.tooltip('i18n:videoplayer.mute')(VideoPlayer.prototype, 'mute', muteDescriptor); }, 'tooltip', 'mute'); + apply(() => { $.tooltip('i18n:videoplayer.loop')(VideoPlayer.prototype, 'loop', loopDescriptor); }, 'tooltip', 'loop'); + apply(() => { $.tooltip('i18n:videoplayer.keepAspectRatio')(VideoPlayer.prototype, 'keepAspectRatio', keepAspectRatioDescriptor); }, 'tooltip', 'keepAspectRatio'); + apply(() => { $.tooltip('i18n:videoplayer.fullScreenOnAwake')(VideoPlayer.prototype, 'fullScreenOnAwake', fullScreenOnAwakeDescriptor); }, 'tooltip', 'fullScreenOnAwake'); + apply(() => { $.tooltip('i18n:videoplayer.stayOnBottom')(VideoPlayer.prototype, 'stayOnBottom', stayOnBottomDescriptor); }, 'tooltip', 'stayOnBottom'); + apply(() => { $.tooltip('i18n:videoplayer.videoPlayerEvent')(VideoPlayer.prototype, 'videoPlayerEvent', () => { return []; }); }, 'tooltip', 'videoPlayerEvent'); + apply(() => { $.displayOrder(100)(VideoPlayer.prototype, 'videoPlayerEvent', () => { return []; }); }, 'displayOrder', 'videoPlayerEvent'); + apply(() => { $.type([ComponentEventHandler])(VideoPlayer.prototype, 'videoPlayerEvent'); }, 'type', 'videoPlayerEvent'); + apply(() => { $.serializable(VideoPlayer.prototype, 'videoPlayerEvent', () => { return []; }); }, 'serializable', 'videoPlayerEvent'); + apply(() => { $.executeInEditMode(VideoPlayer); }, 'executeInEditMode', null); + apply(() => { $.requireComponent(UITransform)(VideoPlayer); }, 'requireComponent', null); + apply(() => { $.menu('Video/VideoPlayer')(VideoPlayer); }, 'menu', null); + apply(() => { $.help('i18n:cc.VideoPlayer')(VideoPlayer); }, 'help', null); + apply(() => { $.ccclass('cc.VideoPlayer')(VideoPlayer); }, 'ccclass', null); +} // end of patch_cc_VideoPlayer + +//---- class cc_WebView +interface cc_WebView_Context_Args { + WebView: any; + UITransform: any; + ComponentEventHandler: any; +} +export function patch_cc_WebView(ctx: cc_WebView_Context_Args, apply = defaultExec) { + const { WebView, UITransform, ComponentEventHandler } = { ...ctx }; + const urlDescriptor = Object.getOwnPropertyDescriptor(WebView.prototype, 'url'); + apply(() => { $.serializable(WebView.prototype, '_url', () => { return 'https://cocos.com'; }); }, 'serializable', '_url'); + apply(() => { $.tooltip('i18n:webview.url')(WebView.prototype, 'url', urlDescriptor); }, 'tooltip', 'url'); + apply(() => { $.tooltip('i18n:webview.webviewEvents')(WebView.prototype, 'webviewEvents', () => { return []; }); }, 'tooltip', 'webviewEvents'); + apply(() => { $.displayOrder(20)(WebView.prototype, 'webviewEvents', () => { return []; }); }, 'displayOrder', 'webviewEvents'); + apply(() => { $.type([ComponentEventHandler])(WebView.prototype, 'webviewEvents'); }, 'type', 'webviewEvents'); + apply(() => { $.serializable(WebView.prototype, 'webviewEvents', () => { return []; }); }, 'serializable', 'webviewEvents'); + apply(() => { $.executeInEditMode(WebView); }, 'executeInEditMode', null); + apply(() => { $.requireComponent(UITransform)(WebView); }, 'requireComponent', null); + apply(() => { $.menu('Miscellaneous/WebView')(WebView); }, 'menu', null); + apply(() => { $.help('i18n:cc.WebView')(WebView); }, 'help', null); + apply(() => { $.ccclass('cc.WebView')(WebView); }, 'ccclass', null); +} // end of patch_cc_WebView + +//---- class DeferredPipeline +interface DeferredPipeline_Context_Args { + DeferredPipeline: any; + RenderTextureConfig: any; +} +export function patch_DeferredPipeline(ctx: DeferredPipeline_Context_Args, apply = defaultExec) { + const { DeferredPipeline, RenderTextureConfig } = { ...ctx }; + apply(() => { $.displayOrder(2)(DeferredPipeline.prototype, 'renderTextures', () => { return []; }); }, 'displayOrder', 'renderTextures'); + apply(() => { $.serializable(DeferredPipeline.prototype, 'renderTextures', () => { return []; }); }, 'serializable', 'renderTextures'); + apply(() => { $.type([RenderTextureConfig])(DeferredPipeline.prototype, 'renderTextures'); }, 'type', 'renderTextures'); + apply(() => { $.ccclass('DeferredPipeline')(DeferredPipeline); }, 'ccclass', null); +} // end of patch_DeferredPipeline + +//---- class ForwardFlow +interface ForwardFlow_Context_Args { + ForwardFlow: any; +} +export function patch_ForwardFlow(ctx: ForwardFlow_Context_Args, apply = defaultExec) { + const { ForwardFlow } = { ...ctx }; + apply(() => { $.ccclass('ForwardFlow')(ForwardFlow); }, 'ccclass', null); +} // end of patch_ForwardFlow + +//---- class ForwardPipeline +interface ForwardPipeline_Context_Args { + ForwardPipeline: any; + RenderTextureConfig: any; +} +export function patch_ForwardPipeline(ctx: ForwardPipeline_Context_Args, apply = defaultExec) { + const { ForwardPipeline, RenderTextureConfig } = { ...ctx }; + apply(() => { $.displayOrder(2)(ForwardPipeline.prototype, 'renderTextures', () => { return []; }); }, 'displayOrder', 'renderTextures'); + apply(() => { $.serializable(ForwardPipeline.prototype, 'renderTextures', () => { return []; }); }, 'serializable', 'renderTextures'); + apply(() => { $.type([RenderTextureConfig])(ForwardPipeline.prototype, 'renderTextures'); }, 'type', 'renderTextures'); + apply(() => { $.ccclass('ForwardPipeline')(ForwardPipeline); }, 'ccclass', null); +} // end of patch_ForwardPipeline + +//---- class ForwardStage +interface ForwardStage_Context_Args { + ForwardStage: any; + RenderQueueDesc: any; +} +export function patch_ForwardStage(ctx: ForwardStage_Context_Args, apply = defaultExec) { + const { ForwardStage, RenderQueueDesc } = { ...ctx }; + apply(() => { $.displayOrder(2)(ForwardStage.prototype, 'renderQueues', () => { return []; }); }, 'displayOrder', 'renderQueues'); + apply(() => { $.serializable(ForwardStage.prototype, 'renderQueues', () => { return []; }); }, 'serializable', 'renderQueues'); + apply(() => { $.type([RenderQueueDesc])(ForwardStage.prototype, 'renderQueues'); }, 'type', 'renderQueues'); + apply(() => { $.ccclass('ForwardStage')(ForwardStage); }, 'ccclass', null); +} // end of patch_ForwardStage + +//---- class FrameBufferDesc +interface FrameBufferDesc_Context_Args { + FrameBufferDesc: any; + CCString: any; + RenderTexture: any; +} +export function patch_FrameBufferDesc(ctx: FrameBufferDesc_Context_Args, apply = defaultExec) { + const { FrameBufferDesc, CCString, RenderTexture } = { ...ctx }; + apply(() => { $.editable(FrameBufferDesc.prototype, 'name', () => { return ''; }); }, 'editable', 'name'); + apply(() => { $.serializable(FrameBufferDesc.prototype, 'name', () => { return ''; }); }, 'serializable', 'name'); + apply(() => { $.editable(FrameBufferDesc.prototype, 'renderPass', () => { return 0; }); }, 'editable', 'renderPass'); + apply(() => { $.serializable(FrameBufferDesc.prototype, 'renderPass', () => { return 0; }); }, 'serializable', 'renderPass'); + apply(() => { $.type([CCString])(FrameBufferDesc.prototype, 'colorTextures'); }, 'type', 'colorTextures'); + apply(() => { $.editable(FrameBufferDesc.prototype, 'depthStencilTexture', () => { return ''; }); }, 'editable', 'depthStencilTexture'); + apply(() => { $.serializable(FrameBufferDesc.prototype, 'depthStencilTexture', () => { return ''; }); }, 'serializable', 'depthStencilTexture'); + apply(() => { $.type(RenderTexture)(FrameBufferDesc.prototype, 'texture'); }, 'type', 'texture'); + apply(() => { $.ccclass('FrameBufferDesc')(FrameBufferDesc); }, 'ccclass', null); +} // end of patch_FrameBufferDesc + +//---- class GbufferStage +interface GbufferStage_Context_Args { + GbufferStage: any; + RenderQueueDesc: any; +} +export function patch_GbufferStage(ctx: GbufferStage_Context_Args, apply = defaultExec) { + const { GbufferStage, RenderQueueDesc } = { ...ctx }; + apply(() => { $.displayOrder(2)(GbufferStage.prototype, 'renderQueues', () => { return []; }); }, 'displayOrder', 'renderQueues'); + apply(() => { $.serializable(GbufferStage.prototype, 'renderQueues', () => { return []; }); }, 'serializable', 'renderQueues'); + apply(() => { $.type([RenderQueueDesc])(GbufferStage.prototype, 'renderQueues'); }, 'type', 'renderQueues'); + apply(() => { $.ccclass('GbufferStage')(GbufferStage); }, 'ccclass', null); +} // end of patch_GbufferStage + +//---- class LightingStage +interface LightingStage_Context_Args { + LightingStage: any; + Material: any; + RenderQueueDesc: any; +} +export function patch_LightingStage(ctx: LightingStage_Context_Args, apply = defaultExec) { + const { LightingStage, Material, RenderQueueDesc } = { ...ctx }; + apply(() => { $.displayOrder(3)(LightingStage.prototype, '_deferredMaterial', () => { return null; }); }, 'displayOrder', '_deferredMaterial'); + apply(() => { $.serializable(LightingStage.prototype, '_deferredMaterial', () => { return null; }); }, 'serializable', '_deferredMaterial'); + apply(() => { $.type(Material)(LightingStage.prototype, '_deferredMaterial'); }, 'type', '_deferredMaterial'); + apply(() => { $.displayOrder(2)(LightingStage.prototype, 'renderQueues', () => { return []; }); }, 'displayOrder', 'renderQueues'); + apply(() => { $.serializable(LightingStage.prototype, 'renderQueues', () => { return []; }); }, 'serializable', 'renderQueues'); + apply(() => { $.type([RenderQueueDesc])(LightingStage.prototype, 'renderQueues'); }, 'type', 'renderQueues'); + apply(() => { $.ccclass('LightingStage')(LightingStage); }, 'ccclass', null); +} // end of patch_LightingStage + +//---- class MainFlow +interface MainFlow_Context_Args { + MainFlow: any; +} +export function patch_MainFlow(ctx: MainFlow_Context_Args, apply = defaultExec) { + const { MainFlow } = { ...ctx }; + apply(() => { $.ccclass('MainFlow')(MainFlow); }, 'ccclass', null); +} // end of patch_MainFlow + +//---- class PostProcessStage +interface PostProcessStage_Context_Args { + PostProcessStage: any; + Material: any; + RenderQueueDesc: any; +} +export function patch_PostProcessStage(ctx: PostProcessStage_Context_Args, apply = defaultExec) { + const { PostProcessStage, Material, RenderQueueDesc } = { ...ctx }; + apply(() => { $.displayOrder(3)(PostProcessStage.prototype, '_postProcessMaterial', () => { return null; }); }, 'displayOrder', '_postProcessMaterial'); + apply(() => { $.serializable(PostProcessStage.prototype, '_postProcessMaterial', () => { return null; }); }, 'serializable', '_postProcessMaterial'); + apply(() => { $.type(Material)(PostProcessStage.prototype, '_postProcessMaterial'); }, 'type', '_postProcessMaterial'); + apply(() => { $.displayOrder(2)(PostProcessStage.prototype, 'renderQueues', () => { return []; }); }, 'displayOrder', 'renderQueues'); + apply(() => { $.serializable(PostProcessStage.prototype, 'renderQueues', () => { return []; }); }, 'serializable', 'renderQueues'); + apply(() => { $.type([RenderQueueDesc])(PostProcessStage.prototype, 'renderQueues'); }, 'type', 'renderQueues'); + apply(() => { $.ccclass('PostProcessStage')(PostProcessStage); }, 'ccclass', null); +} // end of patch_PostProcessStage + +//---- class ReflectionProbeFlow +interface ReflectionProbeFlow_Context_Args { + ReflectionProbeFlow: any; +} +export function patch_ReflectionProbeFlow(ctx: ReflectionProbeFlow_Context_Args, apply = defaultExec) { + const { ReflectionProbeFlow } = { ...ctx }; + apply(() => { $.ccclass('ReflectionProbeFlow')(ReflectionProbeFlow); }, 'ccclass', null); +} // end of patch_ReflectionProbeFlow + +//---- class ReflectionProbeStage +interface ReflectionProbeStage_Context_Args { + ReflectionProbeStage: any; +} +export function patch_ReflectionProbeStage(ctx: ReflectionProbeStage_Context_Args, apply = defaultExec) { + const { ReflectionProbeStage } = { ...ctx }; + apply(() => { $.ccclass('ReflectionProbeStage')(ReflectionProbeStage); }, 'ccclass', null); +} // end of patch_ReflectionProbeStage + +//---- class RenderFlow +interface RenderFlow_Context_Args { + RenderFlow: any; + RenderStage: any; +} +export function patch_RenderFlow(ctx: RenderFlow_Context_Args, apply = defaultExec) { + const { RenderFlow, RenderStage } = { ...ctx }; + apply(() => { $.serializable(RenderFlow.prototype, '_name', () => { return ''; }); }, 'serializable', '_name'); + apply(() => { $.displayOrder(0)(RenderFlow.prototype, '_name', () => { return ''; }); }, 'displayOrder', '_name'); + apply(() => { $.serializable(RenderFlow.prototype, '_priority', () => { return 0; }); }, 'serializable', '_priority'); + apply(() => { $.displayOrder(1)(RenderFlow.prototype, '_priority', () => { return 0; }); }, 'displayOrder', '_priority'); + apply(() => { $.serializable(RenderFlow.prototype, '_tag', () => { return 0; }); }, 'serializable', '_tag'); + apply(() => { $.displayOrder(2)(RenderFlow.prototype, '_tag', () => { return 0; }); }, 'displayOrder', '_tag'); + apply(() => { $.serializable(RenderFlow.prototype, '_stages', () => { return []; }); }, 'serializable', '_stages'); + apply(() => { $.type([RenderStage])(RenderFlow.prototype, '_stages'); }, 'type', '_stages'); + apply(() => { $.displayOrder(3)(RenderFlow.prototype, '_stages', () => { return []; }); }, 'displayOrder', '_stages'); + apply(() => { $.ccclass('RenderFlow')(RenderFlow); }, 'ccclass', null); +} // end of patch_RenderFlow + +//---- class RenderPassDesc +interface RenderPassDesc_Context_Args { + RenderPassDesc: any; + ColorDesc: any; + DepthStencilDesc: any; +} +export function patch_RenderPassDesc(ctx: RenderPassDesc_Context_Args, apply = defaultExec) { + const { RenderPassDesc, ColorDesc, DepthStencilDesc } = { ...ctx }; + apply(() => { $.editable(RenderPassDesc.prototype, 'index', () => { return -1; }); }, 'editable', 'index'); + apply(() => { $.serializable(RenderPassDesc.prototype, 'index', () => { return -1; }); }, 'serializable', 'index'); + apply(() => { $.type([ColorDesc])(RenderPassDesc.prototype, 'colorAttachments'); }, 'type', 'colorAttachments'); + apply(() => { $.type(DepthStencilDesc)(RenderPassDesc.prototype, 'depthStencilAttachment'); }, 'type', 'depthStencilAttachment'); + apply(() => { $.ccclass('RenderPassDesc')(RenderPassDesc); }, 'ccclass', null); +} // end of patch_RenderPassDesc + +//---- class RenderQueueDesc +interface RenderQueueDesc_Context_Args { + RenderQueueDesc: any; + RenderQueueSortMode: any; + CCString: any; +} +export function patch_RenderQueueDesc(ctx: RenderQueueDesc_Context_Args, apply = defaultExec) { + const { RenderQueueDesc, RenderQueueSortMode, CCString } = { ...ctx }; + apply(() => { $.editable(RenderQueueDesc.prototype, 'isTransparent', () => { return false; }); }, 'editable', 'isTransparent'); + apply(() => { $.serializable(RenderQueueDesc.prototype, 'isTransparent', () => { return false; }); }, 'serializable', 'isTransparent'); + apply(() => { $.type(RenderQueueSortMode)(RenderQueueDesc.prototype, 'sortMode'); }, 'type', 'sortMode'); + apply(() => { $.type([CCString])(RenderQueueDesc.prototype, 'stages'); }, 'type', 'stages'); + apply(() => { $.ccclass('RenderQueueDesc')(RenderQueueDesc); }, 'ccclass', null); +} // end of patch_RenderQueueDesc + +//---- class RenderStage +interface RenderStage_Context_Args { + RenderStage: any; +} +export function patch_RenderStage(ctx: RenderStage_Context_Args, apply = defaultExec) { + const { RenderStage } = { ...ctx }; + apply(() => { $.serializable(RenderStage.prototype, '_name', () => { return ''; }); }, 'serializable', '_name'); + apply(() => { $.displayOrder(0)(RenderStage.prototype, '_name', () => { return ''; }); }, 'displayOrder', '_name'); + apply(() => { $.serializable(RenderStage.prototype, '_priority', () => { return 0; }); }, 'serializable', '_priority'); + apply(() => { $.displayOrder(1)(RenderStage.prototype, '_priority', () => { return 0; }); }, 'displayOrder', '_priority'); + apply(() => { $.serializable(RenderStage.prototype, '_tag', () => { return 0; }); }, 'serializable', '_tag'); + apply(() => { $.displayOrder(2)(RenderStage.prototype, '_tag', () => { return 0; }); }, 'displayOrder', '_tag'); + apply(() => { $.ccclass('RenderStage')(RenderStage); }, 'ccclass', null); +} // end of patch_RenderStage + +//---- class RenderTextureDesc +interface RenderTextureDesc_Context_Args { + RenderTextureDesc: any; + TextureType: any; + TextureUsageBit: any; + Format: any; +} +export function patch_RenderTextureDesc(ctx: RenderTextureDesc_Context_Args, apply = defaultExec) { + const { RenderTextureDesc, TextureType, TextureUsageBit, Format } = { ...ctx }; + apply(() => { $.editable(RenderTextureDesc.prototype, 'name', () => { return ''; }); }, 'editable', 'name'); + apply(() => { $.serializable(RenderTextureDesc.prototype, 'name', () => { return ''; }); }, 'serializable', 'name'); + apply(() => { $.type(TextureType)(RenderTextureDesc.prototype, 'type'); }, 'type', 'type'); + apply(() => { $.type(TextureUsageBit)(RenderTextureDesc.prototype, 'usage'); }, 'type', 'usage'); + apply(() => { $.type(Format)(RenderTextureDesc.prototype, 'format'); }, 'type', 'format'); + apply(() => { $.editable(RenderTextureDesc.prototype, 'width', () => { return -1; }); }, 'editable', 'width'); + apply(() => { $.serializable(RenderTextureDesc.prototype, 'width', () => { return -1; }); }, 'serializable', 'width'); + apply(() => { $.editable(RenderTextureDesc.prototype, 'height', () => { return -1; }); }, 'editable', 'height'); + apply(() => { $.serializable(RenderTextureDesc.prototype, 'height', () => { return -1; }); }, 'serializable', 'height'); + apply(() => { $.ccclass('RenderTextureDesc')(RenderTextureDesc); }, 'ccclass', null); +} // end of patch_RenderTextureDesc + +//---- class ShadowFlow +interface ShadowFlow_Context_Args { + ShadowFlow: any; +} +export function patch_ShadowFlow(ctx: ShadowFlow_Context_Args, apply = defaultExec) { + const { ShadowFlow } = { ...ctx }; + apply(() => { $.ccclass('ShadowFlow')(ShadowFlow); }, 'ccclass', null); +} // end of patch_ShadowFlow + +//---- class ShadowStage +interface ShadowStage_Context_Args { + ShadowStage: any; +} +export function patch_ShadowStage(ctx: ShadowStage_Context_Args, apply = defaultExec) { + const { ShadowStage } = { ...ctx }; + apply(() => { $.ccclass('ShadowStage')(ShadowStage); }, 'ccclass', null); +} // end of patch_ShadowStage diff --git a/cocos/native-binding/index.ts b/cocos/native-binding/index.ts index b790a34370..6e474015a8 100644 --- a/cocos/native-binding/index.ts +++ b/cocos/native-binding/index.ts @@ -81,17 +81,17 @@ export declare namespace native { } export namespace EventAssetsManager { - export const ERROR_NO_LOCAL_MANIFEST:number; - export const ERROR_DOWNLOAD_MANIFEST:number; - export const ERROR_PARSE_MANIFEST :number; - export const NEW_VERSION_FOUND :number; - export const ALREADY_UP_TO_DATE :number; - export const UPDATE_PROGRESSION :number; - export const ASSET_UPDATED :number; - export const ERROR_UPDATING :number; - export const UPDATE_FINISHED :number; - export const UPDATE_FAILED :number; - export const ERROR_DECOMPRESS :number; + export const ERROR_NO_LOCAL_MANIFEST: number; + export const ERROR_DOWNLOAD_MANIFEST: number; + export const ERROR_PARSE_MANIFEST: number; + export const NEW_VERSION_FOUND: number; + export const ALREADY_UP_TO_DATE: number; + export const UPDATE_PROGRESSION: number; + export const ASSET_UPDATED: number; + export const ERROR_UPDATING: number; + export const UPDATE_FINISHED: number; + export const UPDATE_FAILED: number; + export const ERROR_DECOMPRESS: number; } export interface ManifestAsset { diff --git a/cocos/render-scene/scene/camera.jsb.ts b/cocos/render-scene/scene/camera.jsb.ts index 1b20aec76b..5f60677b08 100644 --- a/cocos/render-scene/scene/camera.jsb.ts +++ b/cocos/render-scene/scene/camera.jsb.ts @@ -272,4 +272,3 @@ cameraProto.worldMatrixToScreen = function worldMatrixToScreen (out: Mat4, world return out; }; - diff --git a/cocos/rendering/index.jsb.ts b/cocos/rendering/index.jsb.ts index 05f774f2bb..20a99057f5 100644 --- a/cocos/rendering/index.jsb.ts +++ b/cocos/rendering/index.jsb.ts @@ -28,8 +28,9 @@ declare const jsb: any; import { getPhaseID } from './pass-phase'; import { ccenum, CCString, js } from '../core'; import * as pipeline from './define'; -import { ccclass, serializable, editable, type, visible } from '../core/data/class-decorator'; +import { ccclass, serializable, editable, type } from '../core/data/class-decorator'; import { legacyCC } from '../core/global-exports'; +import * as decors from '../native-binding/decorators'; export { pipeline }; nr.getPhaseID = getPhaseID; @@ -389,98 +390,36 @@ function proxyArrayAttributeImpl(proto: any, attr: string) { }); } -function declType(proto: any, attrType: any, attr: string, dft: () => any) { - (type(attrType) as any)(proto, attr, dft); -} - - - - let proxyArrayAttribute = proxyArrayAttributeImpl; -editable(RenderStage.prototype, '_name', () => ''); -editable(RenderStage.prototype, '_tag', () => 0); -editable(RenderStage.prototype, '_priority', () => 0); -serializable(RenderStage.prototype, '_tag', () => 0); -serializable(RenderStage.prototype, '_priority', () => 0); - -editable(RenderFlow.prototype, '_name', () => ''); -editable(RenderFlow.prototype, '_priority', () => 0); -editable(RenderFlow.prototype, '_tag', () => 0); -editable(RenderFlow.prototype, '_stages', () => []); -declType(RenderFlow.prototype, [RenderStage], '_stages', () => []); proxyArrayAttribute(RenderFlow.prototype, '_stages'); -serializable(RenderFlow.prototype, '_name', () => ''); -serializable(RenderFlow.prototype, '_priority', () => 0); -serializable(RenderFlow.prototype, '_tag', () => 0); -serializable(RenderFlow.prototype, '_stages', () => []); -editable(RenderPipeline.prototype, '_tag', () => 0); -editable(RenderPipeline.prototype, '_name', () => []); -serializable(RenderPipeline.prototype, '_tag', () => 0); -serializable(RenderPipeline.prototype, '_name', () => ''); - -editable(RenderPipeline.prototype, '_flows', () => []); -declType(RenderPipeline.prototype, [RenderFlow], '_flows', () => []); proxyArrayAttribute(RenderPipeline.prototype, '_flows'); -serializable(RenderPipeline.prototype, '_flows', () => []); - -editable(DeferredPipeline.prototype, 'renderTextures', () => []); -declType(DeferredPipeline.prototype, [RenderTextureConfig], "renderTextures", () => []); -serializable(DeferredPipeline.prototype, 'renderTextures', () => []); -editable(DeferredPipeline.prototype, 'renderTextures', () => []); - - -editable(ForwardPipeline.prototype, 'renderTextures', () => []); -declType(ForwardPipeline.prototype, [RenderTextureConfig], "renderTextures", () => []); -serializable(ForwardPipeline.prototype, 'renderTextures', () => []); - -declType(GbufferStage.prototype, [RenderQueueDesc], 'renderQueues', () => []); -serializable(GbufferStage.prototype, 'renderQueues', () => []); -editable(GbufferStage.prototype, 'renderQueues', () => []); - - -editable(LightingStage.prototype, '_deferredMaterial', () => null); -declType(LightingStage.prototype, jsb.Material, '_deferredMaterial', () => null); -declType(LightingStage.prototype, [RenderQueueDesc], 'renderQueues', () => []); -serializable(LightingStage.prototype, '_deferredMaterial', () => null); -serializable(LightingStage.prototype, 'renderQueue', () => []); -editable(LightingStage.prototype, 'renderQueue', () => []); - -editable(BloomStage.prototype, '_bloomMaterial', () => null); -declType(BloomStage.prototype, jsb.Material, '_bloomMaterial', () => []); -serializable(BloomStage.prototype, '_bloomMaterial', () => null); - - -declType(PostProcessStage.prototype, [RenderQueueDesc], 'renderQueues', () => []); -editable(PostProcessStage.prototype, '_postProcessMaterial', () => null); -declType(PostProcessStage.prototype, jsb.Material, '_postProcessMaterial', () => null); -serializable(PostProcessStage.prototype, 'renderQueues', () => []); -editable(PostProcessStage.prototype, 'renderQueues', () => []); -serializable(PostProcessStage.prototype, '_postProcessMaterial', () => null); - -declType(ForwardStage.prototype, [RenderQueueDesc], 'renderQueues', () => []); -serializable(ForwardStage.prototype, 'renderQueues', () => []); -editable(ForwardStage.prototype, 'renderQueues', () => []); //-------------------- register types -------------------- -ccclass('RenderQueueDesc')(RenderQueueDesc); -ccclass('RenderStage')(RenderStage) -ccclass('ReflectionProbeStage')(ReflectionProbeStage); -ccclass('GbufferStage')(GbufferStage); -ccclass('LightingStage')(LightingStage); -ccclass('BloomStage')(BloomStage); -ccclass('PostProcessStage')(PostProcessStage); -ccclass('ForwardStage')(ForwardStage); -ccclass('ShadowStage')(ShadowStage); -ccclass('RenderFlow')(RenderFlow) -ccclass('MainFlow')(MainFlow); -ccclass('ForwardFlow')(ForwardFlow); -ccclass('ShadowFlow')(ShadowFlow); -ccclass('ReflectionProbeFlow')(ReflectionProbeFlow); +const Material = jsb.Material; + +decors.patch_RenderQueueDesc({RenderQueueDesc, RenderQueueSortMode, CCString}); +decors.patch_RenderStage({RenderStage}); +decors.patch_ReflectionProbeStage({ReflectionProbeStage}); +decors.patch_GbufferStage({GbufferStage, RenderQueueDesc}); +decors.patch_LightingStage({LightingStage, RenderQueueDesc, Material}); +decors.patch_BloomStage({BloomStage, Material}); +decors.patch_PostProcessStage({PostProcessStage, Material, RenderQueueDesc}); +decors.patch_ForwardStage({ForwardStage, RenderQueueDesc}); +decors.patch_ShadowStage({ShadowStage}); + +decors.patch_RenderFlow({RenderFlow, RenderStage}); +decors.patch_MainFlow({MainFlow}); +decors.patch_ForwardFlow({ForwardFlow}); +decors.patch_ShadowFlow({ShadowFlow}); +decors.patch_ReflectionProbeFlow({ReflectionProbeFlow}); + +decors.patch_cc_RenderPipeline({RenderPipeline, RenderFlow}); +decors.patch_ForwardPipeline({ForwardPipeline, RenderTextureConfig}); +decors.patch_DeferredPipeline({DeferredPipeline, RenderTextureConfig}); + + -ccclass('cc.RenderPipeline')(RenderPipeline); -ccclass('ForwardPipeline')(ForwardPipeline); -ccclass('DeferredPipeline')(DeferredPipeline); \ No newline at end of file diff --git a/cocos/scene-graph/node.jsb.ts b/cocos/scene-graph/node.jsb.ts index 46de753d30..7122e28826 100644 --- a/cocos/scene-graph/node.jsb.ts +++ b/cocos/scene-graph/node.jsb.ts @@ -21,7 +21,6 @@ */ import { EDITOR } from 'internal:constants'; -import { ccclass, editable, serializable, type } from 'cc.decorator' import { legacyCC } from '../core/global-exports'; import { errorID, getError } from '../core/platform/debug'; import { Component } from './component'; @@ -38,6 +37,7 @@ import { syncNodeValues } from "../core/utils/jsb-utils"; import { property } from '../core/data/class-decorator'; import { nodePolyfill } from './node-dev'; import * as js from '../core/utils/js'; +import { patch_cc_Node } from '../native-binding/decorators'; const reserveContentsForAllSyncablePrefabTag = Symbol('ReserveContentsForAllSyncablePrefab'); @@ -86,7 +86,7 @@ const Destroying = CCObject.Flags.Destroying; Node._setTempFloatArray(_tempFloatArray.buffer); -function getConstructor (typeOrClassName) { +function getConstructor(typeOrClassName) { if (!typeOrClassName) { return null; } @@ -111,7 +111,7 @@ function getConstructor (typeOrClassName) { * node.attr(attrs); * ``` */ -nodeProto.attr = function(attrs: unknown) { +nodeProto.attr = function (attrs: unknown) { js.mixin(this, attrs); } @@ -329,11 +329,11 @@ nodeProto.targetOff = function (target: string | unknown) { } }; -nodeProto.pauseSystemEvents = function pauseSystemEvents (recursive: boolean): void { +nodeProto.pauseSystemEvents = function pauseSystemEvents(recursive: boolean): void { this._eventProcessor.setEnabled(false, recursive); }; -nodeProto.resumeSystemEvents = function resumeSystemEvents (recursive: boolean): void { +nodeProto.resumeSystemEvents = function resumeSystemEvents(recursive: boolean): void { this._eventProcessor.setEnabled(true, recursive); }; @@ -442,7 +442,7 @@ nodeProto._onChildAdded = function (child) { }; const oldPreDestroy = nodeProto._onPreDestroy; -nodeProto._onPreDestroy = function _onPreDestroy () { +nodeProto._onPreDestroy = function _onPreDestroy() { const ret = oldPreDestroy.call(this); // emit node destroy event (this should before event processor destroy) @@ -469,7 +469,7 @@ nodeProto._onPreDestroy = function _onPreDestroy () { return ret; }; -nodeProto.destroyAllChildren = function destroyAllChildren () { +nodeProto.destroyAllChildren = function destroyAllChildren() { const children = this._children; for (let i = 0, len = children.length; i < len; ++i) { children[i].destroy(); @@ -589,7 +589,7 @@ NodeCls.isNode = function (obj: unknown): obj is jsb.Node { }; let _tempQuat = new Quat(); -nodeProto.setRTS = function setRTS (rot?: Quat | Vec3, pos?: Vec3, scale?: Vec3) { +nodeProto.setRTS = function setRTS(rot?: Quat | Vec3, pos?: Vec3, scale?: Vec3) { if (rot) { let val = _tempQuat; if (rot instanceof Quat) { @@ -628,14 +628,14 @@ nodeProto.setRTS = function setRTS (rot?: Quat | Vec3, pos?: Vec3, scale?: Vec3) this._setRTS(); }; -nodeProto.getPosition = function getPosition (out?: Vec3): Vec3 { +nodeProto.getPosition = function getPosition(out?: Vec3): Vec3 { if (out) { return Vec3.set(out, this._lpos.x, this._lpos.y, this._lpos.z); } return Vec3.copy(new Vec3(), this._lpos); }; -nodeProto.setPosition = function setPosition (val: Readonly | number, y?: number, z?: number) { +nodeProto.setPosition = function setPosition(val: Readonly | number, y?: number, z?: number) { if (y === undefined && z === undefined) { _tempFloatArray[0] = 3; const pos = val as Vec3; @@ -655,7 +655,7 @@ nodeProto.setPosition = function setPosition (val: Readonly | number, y?: this._setPosition(); }; -nodeProto.getRotation = function getRotation (out?: Quat): Quat { +nodeProto.getRotation = function getRotation(out?: Quat): Quat { const lrot = this._lrot; if (out) { return Quat.set(out, lrot.x, lrot.y, lrot.z, lrot.w); @@ -663,7 +663,7 @@ nodeProto.getRotation = function getRotation (out?: Quat): Quat { return Quat.copy(new Quat(), lrot); }; -nodeProto.setRotation = function setRotation (val: Readonly | number, y?: number, z?: number, w?: number): void { +nodeProto.setRotation = function setRotation(val: Readonly | number, y?: number, z?: number, w?: number): void { if (y === undefined || z === undefined || w === undefined) { const rot = val as Readonly; this._lrot.x = _tempFloatArray[0] = rot.x; @@ -680,7 +680,7 @@ nodeProto.setRotation = function setRotation (val: Readonly | number, y?: this._setRotation(); }; -nodeProto.setRotationFromEuler = function setRotationFromEuler (val: Vec3 | number, y?: number, zOpt?: number): void { +nodeProto.setRotationFromEuler = function setRotationFromEuler(val: Vec3 | number, y?: number, zOpt?: number): void { const z = zOpt === undefined ? this._euler.z : zOpt; if (y === undefined) { @@ -697,14 +697,14 @@ nodeProto.setRotationFromEuler = function setRotationFromEuler (val: Vec3 | numb this._setRotationFromEuler(); }; -nodeProto.getScale = function getScale (out?: Vec3): Vec3 { +nodeProto.getScale = function getScale(out?: Vec3): Vec3 { if (out) { return Vec3.set(out, this._lscale.x, this._lscale.y, this._lscale.z); } return Vec3.copy(new Vec3(), this._lscale); }; -nodeProto.setScale = function setScale (val: Readonly | number, y?: number, z?: number) { +nodeProto.setScale = function setScale(val: Readonly | number, y?: number, z?: number) { if (y === undefined && z === undefined) { _tempFloatArray[0] = 3; const scale = val as Vec3; @@ -724,56 +724,56 @@ nodeProto.setScale = function setScale (val: Readonly | number, y?: number this._setScale(); }; -nodeProto.getWorldPosition = function getWorldPosition (out?: Vec3): Vec3 { +nodeProto.getWorldPosition = function getWorldPosition(out?: Vec3): Vec3 { this._getWorldPosition(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.getWorldRotation = function getWorldRotation (out?: Quat): Quat { +nodeProto.getWorldRotation = function getWorldRotation(out?: Quat): Quat { this._getWorldRotation(); out = out || new Quat(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2], _tempFloatArray[3]); }; -nodeProto.getWorldScale = function getWorldScale (out?: Vec3): Vec3 { +nodeProto.getWorldScale = function getWorldScale(out?: Vec3): Vec3 { this._getWorldScale(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.getWorldMatrix = function getWorldMatrix (out?: Mat4): Mat4 { +nodeProto.getWorldMatrix = function getWorldMatrix(out?: Mat4): Mat4 { this._getWorldMatrix(); out = out || new Mat4(); fillMat4WithTempFloatArray(out); return out; }; -nodeProto.getEulerAngles = function getEulerAngles (out?: Vec3): Vec3 { +nodeProto.getEulerAngles = function getEulerAngles(out?: Vec3): Vec3 { this._getEulerAngles(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.getForward = function getForward (out?: Vec3): Vec3 { +nodeProto.getForward = function getForward(out?: Vec3): Vec3 { this._getForward(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.getUp = function getUp (out?: Vec3): Vec3 { +nodeProto.getUp = function getUp(out?: Vec3): Vec3 { this._getUp(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.getRight = function getRight (out?: Vec3): Vec3 { +nodeProto.getRight = function getRight(out?: Vec3): Vec3 { this._getRight(); out = out || new Vec3(); return out.set(_tempFloatArray[0], _tempFloatArray[1], _tempFloatArray[2]); }; -nodeProto.inverseTransformPoint = function inverseTransformPoint (out: Vec3, p: Vec3) : Vec3 { +nodeProto.inverseTransformPoint = function inverseTransformPoint(out: Vec3, p: Vec3): Vec3 { _tempFloatArray[0] = p.x; _tempFloatArray[1] = p.y; _tempFloatArray[2] = p.z; @@ -784,14 +784,14 @@ nodeProto.inverseTransformPoint = function inverseTransformPoint (out: Vec3, p: return out; }; -nodeProto.getWorldRT = function getWorldRT (out?: Mat4): Mat4 { +nodeProto.getWorldRT = function getWorldRT(out?: Mat4): Mat4 { out = out || new Mat4(); this._getWorldRT(); fillMat4WithTempFloatArray(out); return out; }; -nodeProto.getWorldRS = function getWorldRS (out?: Mat4): Mat4 { +nodeProto.getWorldRS = function getWorldRS(out?: Mat4): Mat4 { out = out || new Mat4(); this._getWorldRS(); fillMat4WithTempFloatArray(out); @@ -812,10 +812,10 @@ Object.defineProperty(nodeProto, 'name', { Object.defineProperty(nodeProto, 'position', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._lpos; }, - set (v: Readonly) { + set(v: Readonly) { this.setPosition(v as Vec3); }, }); @@ -823,10 +823,10 @@ Object.defineProperty(nodeProto, 'position', { Object.defineProperty(nodeProto, 'rotation', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._lrot; }, - set (v: Readonly) { + set(v: Readonly) { this.setRotation(v as Quat); }, }); @@ -834,10 +834,10 @@ Object.defineProperty(nodeProto, 'rotation', { Object.defineProperty(nodeProto, 'scale', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._lscale; }, - set (v: Readonly) { + set(v: Readonly) { this.setScale(v as Vec3); }, }); @@ -845,10 +845,10 @@ Object.defineProperty(nodeProto, 'scale', { Object.defineProperty(nodeProto, 'worldPosition', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldPosition(); }, - set (v: Readonly) { + set(v: Readonly) { this.setWorldPosition(v as Vec3); }, }); @@ -856,10 +856,10 @@ Object.defineProperty(nodeProto, 'worldPosition', { Object.defineProperty(nodeProto, 'worldRotation', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldRotation(); }, - set (v: Readonly) { + set(v: Readonly) { this.setWorldRotation(v as Quat); }, }); @@ -867,10 +867,10 @@ Object.defineProperty(nodeProto, 'worldRotation', { Object.defineProperty(nodeProto, 'worldScale', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldScale(); }, - set (v: Readonly) { + set(v: Readonly) { this.setWorldScale(v as Vec3); }, }); @@ -878,7 +878,7 @@ Object.defineProperty(nodeProto, 'worldScale', { Object.defineProperty(nodeProto, '_pos', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldPosition(); } }); @@ -886,7 +886,7 @@ Object.defineProperty(nodeProto, '_pos', { Object.defineProperty(nodeProto, '_rot', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldRotation(); } }); @@ -894,7 +894,7 @@ Object.defineProperty(nodeProto, '_rot', { Object.defineProperty(nodeProto, '_scale', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldScale(); } }); @@ -902,10 +902,10 @@ Object.defineProperty(nodeProto, '_scale', { Object.defineProperty(nodeProto, 'eulerAngles', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getEulerAngles(); }, - set (v: Readonly) { + set(v: Readonly) { this.setRotationFromEuler(v.x, v.y, v.z); }, }); @@ -913,7 +913,7 @@ Object.defineProperty(nodeProto, 'eulerAngles', { Object.defineProperty(nodeProto, 'worldMatrix', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldMatrix(); }, }); @@ -921,7 +921,7 @@ Object.defineProperty(nodeProto, 'worldMatrix', { Object.defineProperty(nodeProto, '_mat', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this.getWorldMatrix(); }, }); @@ -929,10 +929,10 @@ Object.defineProperty(nodeProto, '_mat', { Object.defineProperty(nodeProto, 'activeInHierarchy', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._sharedUint8Arr[0] != 0; // Uint8, 0: activeInHierarchy }, - set (v) { + set(v) { this._sharedUint8Arr[0] = (v ? 1 : 0); // Uint8, 0: activeInHierarchy }, }); @@ -940,10 +940,10 @@ Object.defineProperty(nodeProto, 'activeInHierarchy', { Object.defineProperty(nodeProto, '_activeInHierarchy', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._sharedUint8Arr[0] != 0; // Uint8, 0: activeInHierarchy }, - set (v) { + set(v) { this._sharedUint8Arr[0] = (v ? 1 : 0); // Uint8, 0: activeInHierarchy }, }); @@ -951,10 +951,10 @@ Object.defineProperty(nodeProto, '_activeInHierarchy', { Object.defineProperty(nodeProto, 'layer', { configurable: true, enumerable: true, - get () { + get() { return this._sharedUint32Arr[1]; // Uint32, 1: layer }, - set (v) { + set(v) { this._sharedUint32Arr[1] = v; // Uint32, 1: layer if (this._uiProps && this._uiProps.uiComp) { this._uiProps.uiComp.setNodeDirty(); @@ -967,10 +967,10 @@ Object.defineProperty(nodeProto, 'layer', { Object.defineProperty(nodeProto, '_layer', { configurable: true, enumerable: true, - get () { + get() { return this._sharedUint32Arr[1]; // Uint32, 1: layer }, - set (v) { + set(v) { this._sharedUint32Arr[1] = v; // Uint32, 1: layer }, }); @@ -978,10 +978,10 @@ Object.defineProperty(nodeProto, '_layer', { Object.defineProperty(nodeProto, '_eventMask', { configurable: true, enumerable: true, - get () { + get() { return this._sharedUint32Arr[0]; // Uint32, 0: eventMask }, - set (v) { + set(v) { this._sharedUint32Arr[0] = v; // Uint32, 0: eventMask }, }); @@ -989,10 +989,10 @@ Object.defineProperty(nodeProto, '_eventMask', { Object.defineProperty(nodeProto, '_siblingIndex', { configurable: true, enumerable: true, - get () { + get() { return this._sharedInt32Arr[0]; // Int32, 0: siblingIndex }, - set (v) { + set(v) { this._sharedInt32Arr[0] = v; // Int32, 0: siblingIndex }, }); @@ -1004,10 +1004,10 @@ nodeProto.getSiblingIndex = function getSiblingIndex() { Object.defineProperty(nodeProto, '_dirtyFlags', { configurable: true, enumerable: true, - get () { + get() { return this._sharedUint32Arr[2]; // Uint32, 2: dirtyFlags }, - set (v) { + set(v) { this._sharedUint32Arr[2] = v; // Uint32, 2: dirtyFlags }, }); @@ -1015,10 +1015,10 @@ Object.defineProperty(nodeProto, '_dirtyFlags', { Object.defineProperty(nodeProto, '_active', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._sharedUint8Arr[1] != 0; // Uint8, 1: active }, - set (v) { + set(v) { this._sharedUint8Arr[1] = (v ? 1 : 0); // Uint8, 1: active }, }); @@ -1026,10 +1026,10 @@ Object.defineProperty(nodeProto, '_active', { Object.defineProperty(nodeProto, 'active', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._sharedUint8Arr[1] != 0; // Uint8, 1: active }, - set (v) { + set(v) { this.setActive(!!v); }, }); @@ -1037,10 +1037,10 @@ Object.defineProperty(nodeProto, 'active', { Object.defineProperty(nodeProto, '_static', { configurable: true, enumerable: true, - get (): Readonly { + get(): Readonly { return this._sharedUint8Arr[2] != 0; }, - set (v) { + set(v) { this._sharedUint8Arr[2] = (v ? 1 : 0); }, }); @@ -1048,10 +1048,10 @@ Object.defineProperty(nodeProto, '_static', { Object.defineProperty(nodeProto, 'forward', { configurable: true, enumerable: true, - get (): Vec3 { + get(): Vec3 { return this.getForward(); }, - set (dir: Vec3) { + set(dir: Vec3) { this.setForward(dir); }, }); @@ -1059,7 +1059,7 @@ Object.defineProperty(nodeProto, 'forward', { Object.defineProperty(nodeProto, 'up', { configurable: true, enumerable: true, - get (): Vec3 { + get(): Vec3 { return this.getUp(); }, }); @@ -1067,7 +1067,7 @@ Object.defineProperty(nodeProto, 'up', { Object.defineProperty(nodeProto, 'right', { configurable: true, enumerable: true, - get (): Vec3 { + get(): Vec3 { return this.getRight(); }, }); @@ -1075,7 +1075,7 @@ Object.defineProperty(nodeProto, 'right', { Object.defineProperty(nodeProto, 'eventProcessor', { configurable: true, enumerable: true, - get () { + get() { return this._eventProcessor; }, }); @@ -1083,7 +1083,7 @@ Object.defineProperty(nodeProto, 'eventProcessor', { Object.defineProperty(nodeProto, 'components', { configurable: true, enumerable: true, - get (): ReadonlyArray { + get(): ReadonlyArray { return this._components; }, }); @@ -1091,11 +1091,11 @@ Object.defineProperty(nodeProto, 'components', { Object.defineProperty(nodeProto, '_parent', { configurable: true, enumerable: true, - get () { + get() { this._parentRef = this._parentInternal; return this._parentRef; }, - set (v) { + set(v) { this._parentRef = this._parentInternal = v; }, }); @@ -1103,11 +1103,11 @@ Object.defineProperty(nodeProto, '_parent', { Object.defineProperty(nodeProto, 'parent', { configurable: true, enumerable: true, - get () { + get() { this._parentRef = this.getParent(); return this._parentRef; }, - set (v) { + set(v) { this._parentRef = v; this.setParent(v); }, @@ -1116,10 +1116,10 @@ Object.defineProperty(nodeProto, 'parent', { Object.defineProperty(nodeProto, 'children', { configurable: true, enumerable: true, - get () { + get() { return this._children; }, - set (v) { + set(v) { this._children = v; }, }); @@ -1127,7 +1127,7 @@ Object.defineProperty(nodeProto, 'children', { Object.defineProperty(nodeProto, 'scene', { configurable: true, enumerable: true, - get () { + get() { return this._scene; } }); @@ -1166,35 +1166,35 @@ nodeProto[serializeTag] = function (serializationOutput: SerializationOutput, co } // Detects if this node is mounted node of `PrefabInstance` - // TODO: optimize - const isMountedChild = () => !!(this[editorExtrasTag] as any)?.mountedRoot; - // Returns if this node is under `PrefabInstance` - // eslint-disable-next-line arrow-body-style - const isSyncPrefab = () => { - // 1. Under `PrefabInstance`, but not mounted - // 2. If the mounted node is a `PrefabInstance`, it's also a "sync prefab". - return this._prefab?.root?._prefab?.instance && (this?._prefab?.instance || !isMountedChild()); - }; - const canDiscardByPrefabRoot = () => !(context.customArguments[(reserveContentsForAllSyncablePrefabTag) as any] - || !isSyncPrefab() || context.root === this); - if (canDiscardByPrefabRoot()) { - // discard props disallow to synchronize - const isRoot = this._prefab?.root === this; - if (isRoot) { - serializationOutput.writeProperty('_objFlags', this._objFlags); - serializationOutput.writeProperty('_parent', this._parent); - serializationOutput.writeProperty('_prefab', this._prefab); - if (context.customArguments.keepNodeUuid) { - serializationOutput.writeProperty('_id', this._id); - } - // TODO: editorExtrasTag may be a symbol in the future - serializationOutput.writeProperty(editorExtrasTag, this[editorExtrasTag]); - } else { - // should not serialize child node of synchronizable prefab + // TODO: optimize + const isMountedChild = () => !!(this[editorExtrasTag] as any)?.mountedRoot; + // Returns if this node is under `PrefabInstance` + // eslint-disable-next-line arrow-body-style + const isSyncPrefab = () => { + // 1. Under `PrefabInstance`, but not mounted + // 2. If the mounted node is a `PrefabInstance`, it's also a "sync prefab". + return this._prefab?.root?._prefab?.instance && (this?._prefab?.instance || !isMountedChild()); + }; + const canDiscardByPrefabRoot = () => !(context.customArguments[(reserveContentsForAllSyncablePrefabTag) as any] + || !isSyncPrefab() || context.root === this); + if (canDiscardByPrefabRoot()) { + // discard props disallow to synchronize + const isRoot = this._prefab?.root === this; + if (isRoot) { + serializationOutput.writeProperty('_objFlags', this._objFlags); + serializationOutput.writeProperty('_parent', this._parent); + serializationOutput.writeProperty('_prefab', this._prefab); + if (context.customArguments.keepNodeUuid) { + serializationOutput.writeProperty('_id', this._id); } + // TODO: editorExtrasTag may be a symbol in the future + serializationOutput.writeProperty(editorExtrasTag, this[editorExtrasTag]); } else { - serializationOutput.writeThis(); + // should not serialize child node of synchronizable prefab } + } else { + serializationOutput.writeThis(); + } }; nodeProto._onActiveNode = function (shouldActiveNow: boolean) { @@ -1342,40 +1342,14 @@ nodeProto._ctor = function (name?: string) { this._registeredNodeEventTypeMask = 0; }; -// handle meta data, it is generated automatically -const NodeProto = Node.prototype; -const _persistNodeDescriptor = Object.getOwnPropertyDescriptor(NodeProto, '_persistNode'); -property(NodeProto, '_persistNode', _persistNodeDescriptor); -const nameDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'name'); -editable(NodeProto, 'name', nameDescriptor); -const childrenDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'children'); -editable(NodeProto, 'children', childrenDescriptor); -const activeDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'active'); -editable(NodeProto, 'active', activeDescriptor); -const activeInHierarchyDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'activeInHierarchy'); -editable(NodeProto, 'activeInHierarchy', activeInHierarchyDescriptor); -const parentDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'parent'); -editable(NodeProto, 'parent', parentDescriptor); -serializable(NodeProto, '_parent', () => null); -serializable(NodeProto, '_children', () => []); -serializable(NodeProto, '_active', () => true); -serializable(NodeProto, '_components', () => []); -serializable(NodeProto, '_prefab', () => null); -serializable(NodeProto, '_lpos', () => new Vec3()); -serializable(NodeProto, '_lrot', () => new Quat()); -serializable(NodeProto, '_lscale', () => new Vec3(1, 1, 1)); -serializable(NodeProto, '_mobility', () => MobilityMode.Static); -serializable(NodeProto, '_layer', () => Layers.Enum.DEFAULT); -serializable(NodeProto, '_euler', () => new Vec3()); -const eulerAnglesDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'eulerAngles'); -type(Vec3)(NodeProto, 'eulerAngles', eulerAnglesDescriptor); -const angleDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'angle'); -editable(NodeProto, 'angle', angleDescriptor); -const mobilityDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'mobility'); -editable(NodeProto, 'mobility', mobilityDescriptor); -type(MobilityMode)(NodeProto, 'mobility', mobilityDescriptor); -const layerDescriptor = Object.getOwnPropertyDescriptor(NodeProto, 'layer'); -editable(NodeProto, 'layer', layerDescriptor); nodePolyfill(Node); -ccclass('cc.Node')(Node); + +// handle meta data, it is generated automatically +patch_cc_Node({ + Node, + Vec3, + Quat, + MobilityMode, + Layers +}); \ No newline at end of file diff --git a/cocos/scene-graph/scene-globals.jsb.ts b/cocos/scene-graph/scene-globals.jsb.ts index 7b1e6475cc..470348a621 100644 --- a/cocos/scene-graph/scene-globals.jsb.ts +++ b/cocos/scene-graph/scene-globals.jsb.ts @@ -20,26 +20,14 @@ THE SOFTWARE. */ -import { - displayName, - editable, - formerlySerializedAs, - range, - readOnly, - serializable, - tooltip, - type, - visible - // @ts-ignore -} from 'cc.decorator'; import { legacyCC } from '../core/global-exports'; import { CCFloat, CCInteger } from '../core/data'; import { TextureCube } from '../asset/assets/texture-cube'; import { Enum } from '../core/value-types'; -import { ccclass, displayOrder, rangeMin, rangeStep, slide } from '../core/data/decorators'; import { Ambient, EnvironmentLightingType } from '../render-scene/scene'; import { Material } from '../asset/assets/material'; import { Vec2, Vec3, Color, Vec4 } from '../core/math'; +import * as decros from '../native-binding/decorators'; export const DEFAULT_WORLD_MIN_POS = new Vec3(-1024.0, -1024.0, -1024.0); export const DEFAULT_WORLD_MAX_POS = new Vec3(1024.0, 1024.0, 1024.0); @@ -275,300 +263,19 @@ legacyCC.SceneGlobals = SceneGlobals; })(); -function ambientSkyLightEnable() { - const scene = legacyCC.director.getScene(); - const skybox = scene.globals.skybox; - if (skybox.useIBL && skybox.applyDiffuseMap) { - return false; - } else { - return true; - } -} - -function checkFieldIs(attr: string, value: number) { - return function () { - return this[attr] === value; - }; -} -function checkFieldNot(attr: string, value: number) { - return function () { - return this[attr] !== value; - }; -} // handle meta data, it is generated automatically -const SceneGlobalsProto = SceneGlobals.prototype; -editable(SceneGlobalsProto, 'ambient', () => new AmbientInfo()); -serializable(SceneGlobalsProto, 'ambient', () => new AmbientInfo()); -editable(SceneGlobalsProto, 'shadows', () => new ShadowsInfo()); -serializable(SceneGlobalsProto, 'shadows', () => new ShadowsInfo()); -serializable(SceneGlobalsProto, '_skybox', () => new SkyboxInfo()); -serializable(SceneGlobalsProto, 'fog', () => new FogInfo()); -editable(SceneGlobalsProto, 'fog', () => new FogInfo()); -const skyboxDescriptor = Object.getOwnPropertyDescriptor(SceneGlobalsProto, 'skybox'); -type(SkyboxInfo)(SceneGlobalsProto, 'skybox', skyboxDescriptor); -editable(SceneGlobalsProto, 'skybox', skyboxDescriptor); -serializable(SceneGlobalsProto, 'octree', () => new OctreeInfo()); -editable(SceneGlobalsProto, 'octree', () => new OctreeInfo()); -serializable(SceneGlobalsProto, 'lightProbeInfo', () => new LightProbeInfo()); -editable(SceneGlobalsProto, 'lightProbeInfo', () => new LightProbeInfo()); -ccclass('cc.SceneGlobals')(SceneGlobals); +decros.patch_cc_SceneGlobals({SceneGlobals, AmbientInfo, SkyboxInfo, FogInfo, ShadowsInfo, LightProbeInfo, OctreeInfo, LightProbeInfo}); -const OctreeInfoProto = OctreeInfo.prototype; -serializable(OctreeInfoProto, '_enabled', () => false); -serializable(OctreeInfoProto, '_minPos', () => new Vec3(DEFAULT_WORLD_MIN_POS)); -serializable(OctreeInfoProto, '_maxPos', () => new Vec3(DEFAULT_WORLD_MAX_POS)); -serializable(OctreeInfoProto, '_depth', () => DEFAULT_OCTREE_DEPTH); -const enabledDescriptor = Object.getOwnPropertyDescriptor(OctreeInfoProto, 'enabled'); -tooltip('i18n:octree_culling.enabled')(OctreeInfoProto, 'enabled', enabledDescriptor); -editable(OctreeInfoProto, 'enabled', enabledDescriptor); -const minPosDescriptor = Object.getOwnPropertyDescriptor(OctreeInfoProto, 'minPos'); -displayName('World MinPos')(OctreeInfoProto, 'minPos', minPosDescriptor); -tooltip('i18n:octree_culling.minPos')(OctreeInfoProto, 'minPos', minPosDescriptor); -editable(OctreeInfoProto, 'minPos', minPosDescriptor); -const maxPosDescriptor = Object.getOwnPropertyDescriptor(OctreeInfoProto, 'maxPos'); -displayName('World MaxPos')(OctreeInfoProto, 'maxPos', maxPosDescriptor); -tooltip('i18n:octree_culling.maxPos')(OctreeInfoProto, 'maxPos', maxPosDescriptor); -editable(OctreeInfoProto, 'maxPos', maxPosDescriptor); -const depthDescriptor = Object.getOwnPropertyDescriptor(OctreeInfoProto, 'depth'); -tooltip('i18n:octree_culling.depth')(OctreeInfoProto, 'depth', depthDescriptor); -type(CCInteger)(OctreeInfoProto, 'depth', depthDescriptor); -slide(OctreeInfoProto, 'depth', depthDescriptor); -range([4, 12, 1])(OctreeInfoProto, 'depth', depthDescriptor); -editable(OctreeInfoProto, 'depth', depthDescriptor); -ccclass('cc.OctreeInfo')(OctreeInfo); +decros.patch_cc_OctreeInfo({OctreeInfo, CCInteger, Vec3, DEFAULT_WORLD_MAX_POS, DEFAULT_WORLD_MIN_POS, DEFAULT_OCTREE_DEPTH}); -const ShadowsInfoProto = ShadowsInfo.prototype; -serializable(ShadowsInfoProto, '_enabled', () => false); -serializable(ShadowsInfoProto, '_type', () => ShadowType.Planar); -serializable(ShadowsInfoProto, '_normal', () => new Vec3(0, 1, 0)); -serializable(ShadowsInfoProto, '_distance', () => 0); -serializable(ShadowsInfoProto, '_shadowColor', () => new Color(0, 0, 0, 76)); -serializable(ShadowsInfoProto, '_maxReceived', () => 4); -serializable(ShadowsInfoProto, '_size', () => new Vec2(1024, 1024)); -const shadowEnabledDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'enabled'); -tooltip('i18n:shadow.enabled')(ShadowsInfoProto, 'enabled', shadowEnabledDescriptor); -editable(ShadowsInfoProto, 'enabled', shadowEnabledDescriptor); -const typeDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'type'); -tooltip('i18n:shadow.type')(ShadowsInfoProto, 'type', typeDescriptor) -type(ShadowType)(ShadowsInfoProto, 'type', typeDescriptor); -editable(ShadowsInfoProto, 'type', typeDescriptor); -const shadowColorDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'shadowColor'); -tooltip('i18n:shadow.shadowColor')(ShadowsInfoProto, 'shadowColor', shadowColorDescriptor); -visible(checkFieldIs("_type", ShadowType.Planar))(ShadowsInfoProto, 'shadowColor', shadowColorDescriptor); -const planeDirectionDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'planeDirection'); -tooltip('i18n:shadow.planeDirection')(ShadowsInfoProto, 'planeDirection', planeDirectionDescriptor); -visible(checkFieldIs("_type", ShadowType.Planar))(ShadowsInfoProto, 'planeDirection', planeDirectionDescriptor); -const planeHeightDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'planeHeight'); -tooltip('i18n:shadow.planeHeight')(ShadowsInfoProto, 'planeHeight', planeHeightDescriptor); -visible(checkFieldIs("_type", ShadowType.Planar))(ShadowsInfoProto, 'planeHeight', planeHeightDescriptor); -type(CCFloat)(ShadowsInfoProto, 'planeHeight', planeHeightDescriptor); -editable(ShadowsInfoProto, 'planeHeight', planeHeightDescriptor); -const maxReceivedDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'maxReceived'); -visible(checkFieldIs("_type", ShadowType.ShadowMap))(ShadowsInfoProto, 'maxReceived', maxReceivedDescriptor); -tooltip('i18n:shadow.maxReceived')(ShadowsInfoProto, 'maxReceived', maxReceivedDescriptor); -type(CCInteger)(ShadowsInfoProto, 'maxReceived', maxReceivedDescriptor); -const shadowMapSizeDescriptor = Object.getOwnPropertyDescriptor(ShadowsInfoProto, 'shadowMapSize'); -visible(checkFieldIs("_type", ShadowType.ShadowMap))(ShadowsInfoProto, 'shadowMapSize', shadowMapSizeDescriptor); -tooltip('i18n:shadow.shadowMapSize')(ShadowsInfoProto, 'shadowMapSize', shadowMapSizeDescriptor); -type(ShadowSize)(ShadowsInfoProto, 'shadowMapSize', shadowMapSizeDescriptor); -ccclass('cc.ShadowsInfo')(ShadowsInfo); +decros.patch_cc_ShadowsInfo({ShadowsInfo, ShadowType, CCFloat, CCInteger, ShadowSize, Vec3, Color, Vec2}); -const FogInfoProto = FogInfo.prototype; -serializable(FogInfoProto, '_type', () => FogType.LINEAR); -serializable(FogInfoProto, '_fogColor', () => new Color('#C8C8C8')); -serializable(FogInfoProto, '_enabled', () => false); -serializable(FogInfoProto, '_fogDensity', () => 0.3); -serializable(FogInfoProto, '_fogStart', () => 0.5); -serializable(FogInfoProto, '_fogEnd', () => 300); -serializable(FogInfoProto, '_fogAtten', () => 5); -serializable(FogInfoProto, '_fogTop', () => 1.5); -serializable(FogInfoProto, '_fogRange', () => 1.2); -serializable(FogInfoProto, '_accurate', () => false); -const fogEnabledDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'enabled'); -displayOrder(0)(FogInfoProto, 'enabled', fogEnabledDescriptor); -tooltip('i18n:fog.enabled')(FogInfoProto, 'enabled', fogEnabledDescriptor); -editable(FogInfoProto, 'enabled', fogEnabledDescriptor); -const accurateDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'accurate'); -displayOrder(0)(FogInfoProto, 'accurate', accurateDescriptor); -tooltip('i18n:fog.accurate')(FogInfoProto, 'accurate', accurateDescriptor); -editable(FogInfoProto, 'accurate', accurateDescriptor); -const fogColorDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogColor'); -tooltip('i18n:fog.fogColor')(FogInfoProto, 'fogColor', fogColorDescriptor); -editable(FogInfoProto, 'fogColor', fogColorDescriptor); -const fogTypeDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'type'); -tooltip('i18n:fog.type')(FogInfoProto, 'type', fogTypeDescriptor); -displayOrder(1)(FogInfoProto, 'type', fogTypeDescriptor); -type(FogType)(FogInfoProto, 'type', fogTypeDescriptor); -editable(FogInfoProto, 'type', fogTypeDescriptor); -const fogDensityDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogDensity'); -tooltip('i18n:fog.fogDensity')(FogInfoProto, 'fogDensity', fogDensityDescriptor); -slide(FogInfoProto, 'fogDensity', fogDensityDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogDensity', fogDensityDescriptor); -range([0, 1])(FogInfoProto, 'fogDensity', fogDensityDescriptor); -type(CCFloat)(FogInfoProto, 'fogDensity', fogDensityDescriptor); -visible(function () { this._type !== FogType.LAYERED && this._type !== FogType.LINEAR; })(FogInfoProto, 'fogDensity', fogDensityDescriptor); -const fogStartDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogStart'); -tooltip('i18n:fog.fogStart')(FogInfoProto, 'fogStart', fogStartDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogStart', fogStartDescriptor); -type(CCFloat)(FogInfoProto, 'fogStart', fogStartDescriptor); -visible(checkFieldNot("_type", FogType.LAYERED))(FogInfoProto, 'fogStart', fogStartDescriptor); -const fogEndDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogEnd'); -tooltip('i18n:fog.fogEnd')(FogInfoProto, 'fogEnd', fogEndDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogEnd', fogEndDescriptor); -type(CCFloat)(FogInfoProto, 'fogEnd', fogEndDescriptor); -visible(checkFieldIs("_type", FogType.LINEAR))(FogInfoProto, 'fogEnd', fogEndDescriptor); -const fogAttenDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogAtten'); -tooltip('i18n:fog.fogAtten')(FogInfoProto, 'fogAtten', fogAttenDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogAtten', fogAttenDescriptor); -rangeMin(0.01)(FogInfoProto, 'fogAtten', fogAttenDescriptor); -type(CCFloat)(FogInfoProto, 'fogAtten', fogAttenDescriptor); -visible(checkFieldNot("_type", FogType.LINEAR))(FogInfoProto, 'fogAtten', fogAttenDescriptor); -const fogTopDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogTop'); -tooltip('i18n:fog.fogTop')(FogInfoProto, 'fogTop', fogTopDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogTop', fogTopDescriptor); -type(CCFloat)(FogInfoProto, 'fogTop', fogTopDescriptor); -visible(checkFieldIs("_type", FogType.LAYERED))(FogInfoProto, 'fogTop', fogTopDescriptor); -const fogRangeDescriptor = Object.getOwnPropertyDescriptor(FogInfoProto, 'fogRange'); -tooltip('i18n:fog.fogRange')(FogInfoProto, 'fogRange', fogRangeDescriptor); -rangeStep(0.01)(FogInfoProto, 'fogRange', fogRangeDescriptor); -type(CCFloat)(FogInfoProto, 'fogRange', fogRangeDescriptor); -visible(checkFieldIs("_type", FogType.LAYERED))(FogInfoProto, 'fogRange', fogRangeDescriptor); -ccclass('cc.FogInfo')(FogInfo); +decros.patch_cc_FogInfo({FogInfo, FogType, CCFloat, Color}); -const SkyboxInfoProto = SkyboxInfo.prototype; -serializable(SkyboxInfoProto, '_envLightingType', () => EnvironmentLightingType.HEMISPHERE_DIFFUSE); -formerlySerializedAs('_envmap')(SkyboxInfoProto, '_envmapHDR', () => null); -type(TextureCube)(SkyboxInfoProto, '_envmapHDR', () => null); -serializable(SkyboxInfoProto, '_envmapHDR', () => null); -type(TextureCube)(SkyboxInfoProto, '_envmapLDR', () => null); -serializable(SkyboxInfoProto, '_envmapLDR', () => null); -type(TextureCube)(SkyboxInfoProto, '_diffuseMapHDR', () => null); -serializable(SkyboxInfoProto, '_diffuseMapHDR', () => null); -type(TextureCube)(SkyboxInfoProto, '_diffuseMapLDR', () => null); -serializable(SkyboxInfoProto, '_diffuseMapLDR', () => null); -serializable(SkyboxInfoProto, '_enabled', () => false); -serializable(SkyboxInfoProto, '_useHDR', () => true); -type(Material)(SkyboxInfoProto, '_editableMaterial', () => null); -serializable(SkyboxInfoProto, '_editableMaterial', () => null); -type(TextureCube)(SkyboxInfoProto, '_reflectionHDR', () => null); -serializable(SkyboxInfoProto, '_reflectionHDR', () => null); -type(TextureCube)(SkyboxInfoProto, '_reflectionLDR', () => null); -serializable(SkyboxInfoProto, '_reflectionLDR', () => null); +decros.patch_cc_SkyboxInfo({SkyboxInfo, EnvironmentLightingType, TextureCube, CCFloat, Material }); -const skyboxRotationAngleDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'rotationAngle'); -type(CCFloat)(SkyboxInfoProto, 'rotationAngle', skyboxRotationAngleDescriptor); -range([0, 360])(SkyboxInfoProto, 'rotationAngle', skyboxRotationAngleDescriptor); -rangeStep(1)(SkyboxInfoProto, 'rotationAngle', skyboxRotationAngleDescriptor); -slide(SkyboxInfoProto, 'rotationAngle', skyboxRotationAngleDescriptor); -tooltip('i18n:skybox.rotationAngle')(SkyboxInfoProto, 'rotationAngle', skyboxRotationAngleDescriptor); +decros.patch_cc_AmbientInfo({AmbientInfo, Vec4, Ambient, CCFloat, legacyCC}); -const skyboxReflectionMapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'reflectionMap'); -editable(SkyboxInfoProto, 'reflectionMap', skyboxReflectionMapDescriptor); -readOnly(SkyboxInfoProto, 'reflectionMap', skyboxReflectionMapDescriptor) -type(TextureCube)(SkyboxInfoProto, 'reflectionMap', skyboxReflectionMapDescriptor) -displayOrder(100)(SkyboxInfoProto, 'reflectionMap', skyboxReflectionMapDescriptor) - -const skyboxEnabledDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'enabled'); -tooltip('i18n:skybox.enabled')(SkyboxInfoProto, 'enabled', skyboxEnabledDescriptor); -editable(SkyboxInfoProto, 'enabled', skyboxEnabledDescriptor); -const envLightingTypeDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'envLightingType'); -tooltip('i18n:skybox.EnvironmentLightingType')(SkyboxInfoProto, 'envLightingType', envLightingTypeDescriptor); -type(EnvironmentLightingType)(SkyboxInfoProto, 'envLightingType', envLightingTypeDescriptor); -editable(SkyboxInfoProto, 'envLightingType', envLightingTypeDescriptor); -const useHDRDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'useHDR'); -tooltip('i18n:skybox.useHDR')(SkyboxInfoProto, 'useHDR', useHDRDescriptor); -editable(SkyboxInfoProto, 'useHDR', useHDRDescriptor); -const envmapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'envmap'); -tooltip('i18n:skybox.envmap')(SkyboxInfoProto, 'envmap', envmapDescriptor); -type(TextureCube)(SkyboxInfoProto, 'envmap', envmapDescriptor); -editable(SkyboxInfoProto, 'envmap', envmapDescriptor); -const diffuseMapDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'diffuseMap'); -displayOrder(100)(SkyboxInfoProto, 'diffuseMap', diffuseMapDescriptor); -type(TextureCube)(SkyboxInfoProto, 'diffuseMap', diffuseMapDescriptor); -readOnly(SkyboxInfoProto, 'diffuseMap', diffuseMapDescriptor); -editable(SkyboxInfoProto, 'diffuseMap', diffuseMapDescriptor); -visible(function () { return this.useIBL && this.applyDiffuseMap; })(SkyboxInfoProto, 'diffuseMap', diffuseMapDescriptor); -const skyboxMaterialDescriptor = Object.getOwnPropertyDescriptor(SkyboxInfoProto, 'skyboxMaterial'); -tooltip('i18n:skybox.material')(SkyboxInfoProto, 'skyboxMaterial', skyboxMaterialDescriptor); -type(Material)(SkyboxInfoProto, 'skyboxMaterial', skyboxMaterialDescriptor); -editable(SkyboxInfoProto, 'skyboxMaterial', skyboxMaterialDescriptor); -serializable(SkyboxInfoProto, '_rotationAngle', () => 0); -ccclass('cc.SkyboxInfo')(SkyboxInfo); - -const AmbientInfoProto = AmbientInfo.prototype; -formerlySerializedAs('_skyColor')(AmbientInfoProto, '_skyColorHDR', () => new Vec4(0.2, 0.5, 0.8, 1.0)); -serializable(AmbientInfoProto, '_skyColorHDR', () => new Vec4(0.2, 0.5, 0.8, 1.0)); -formerlySerializedAs('_skyIllum')(AmbientInfoProto, '_skyIllumHDR', () => Ambient.SKY_ILLUM); -serializable(AmbientInfoProto, '_skyIllumHDR', () => Ambient.SKY_ILLUM); -formerlySerializedAs('_groundAlbedo')(AmbientInfoProto, '_groundAlbedoHDR', () => new Vec4(0.2, 0.2, 0.2, 1.0)); -serializable(AmbientInfoProto, '_groundAlbedoHDR', () => new Vec4(0.2, 0.2, 0.2, 1.0)); -serializable(AmbientInfoProto, '_skyColorLDR', () => new Vec4(0.2, 0.5, 0.8, 1.0)); -serializable(AmbientInfoProto, '_skyIllumLDR', () => Ambient.SKY_ILLUM); -serializable(AmbientInfoProto, '_groundAlbedoLDR', () => new Vec4(0.2, 0.2, 0.2, 1.0)); -const skyLightingColorDescriptor = Object.getOwnPropertyDescriptor(AmbientInfoProto, 'skyLightingColor'); -tooltip('i18n:ambient.skyLightingColor')(AmbientInfoProto, 'skyLightingColor', skyLightingColorDescriptor); -editable(AmbientInfoProto, 'skyLightingColor', skyLightingColorDescriptor); -visible(ambientSkyLightEnable)(AmbientInfoProto, 'skyLightingColor', skyLightingColorDescriptor); -const skyIllumDescriptor = Object.getOwnPropertyDescriptor(AmbientInfoProto, 'skyIllum'); -tooltip('i18n:ambient.skyIllum')(AmbientInfoProto, 'skyIllum', skyIllumDescriptor); -type(CCFloat)(AmbientInfoProto, 'skyIllum', skyIllumDescriptor); -editable(AmbientInfoProto, 'skyIllum', skyIllumDescriptor); -const groundLightingColorDescriptor = Object.getOwnPropertyDescriptor(AmbientInfoProto, 'groundLightingColor'); -tooltip('i18n:ambient.groundLightingColor')(AmbientInfoProto, 'groundLightingColor', groundLightingColorDescriptor); -editable(AmbientInfoProto, 'groundLightingColor', groundLightingColorDescriptor); -visible(ambientSkyLightEnable)(AmbientInfoProto, 'groundLightingColor', groundLightingColorDescriptor); -ccclass('cc.AmbientInfo')(AmbientInfo); - -const LightProbeInfoProto = LightProbeInfo.prototype; -serializable(LightProbeInfoProto, '_giScale', () => 1.0); -serializable(LightProbeInfoProto, '_giSamples', () => 1024); -serializable(LightProbeInfoProto, '_bounces', () => 2); -serializable(LightProbeInfoProto, '_reduceRinging', () => 0.0); -serializable(LightProbeInfoProto, '_showProbe', () => true); -serializable(LightProbeInfoProto, '_showWireframe', () => true); -serializable(LightProbeInfoProto, '_showConvex', () => false); -serializable(LightProbeInfoProto, '_data', () => null); - -const lightProbeGIScaleDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'giScale'); -range([0, 100, 1])(LightProbeInfoProto, 'giScale', lightProbeGIScaleDescriptor) -type(CCFloat)(LightProbeInfoProto, 'giScale', lightProbeGIScaleDescriptor) -displayName('GIScale')(LightProbeInfoProto, 'giScale', lightProbeGIScaleDescriptor) -tooltip('i18n:light_probe.giScale')(LightProbeInfoProto, 'giScale', lightProbeGIScaleDescriptor); -editable(LightProbeInfoProto, 'giScale', lightProbeGIScaleDescriptor); - -const lightProbeGISamplesDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'giSamples'); -tooltip('i18n:light_probe.giSamples')(LightProbeInfoProto, 'giSamples', lightProbeGISamplesDescriptor); -editable(LightProbeInfoProto, 'giSamples', lightProbeGISamplesDescriptor); -range([64, 65536, 1])(LightProbeInfoProto, 'giSamples', lightProbeGISamplesDescriptor); -type(CCInteger)(LightProbeInfoProto, 'giSamples', lightProbeGISamplesDescriptor); -displayName('GISamples')(LightProbeInfoProto, 'giSamples', lightProbeGISamplesDescriptor); - -const lightProbeBouncesDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'bounces'); -tooltip('i18n:light_probe.bounces')(LightProbeInfoProto, 'bounces', lightProbeBouncesDescriptor); -editable(LightProbeInfoProto, 'bounces', lightProbeBouncesDescriptor); -range([1, 4, 1])(LightProbeInfoProto, 'bounces', lightProbeBouncesDescriptor); -type(CCInteger)(LightProbeInfoProto, 'bounces', lightProbeBouncesDescriptor); -tooltip('i18n:light_probe.bounces')(LightProbeInfoProto, 'bounces', lightProbeBouncesDescriptor); - -const lightProbeReduceRingingDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'reduceRinging'); -tooltip('i18n:light_probe.reduceRinging')(LightProbeInfoProto, 'reduceRinging', lightProbeReduceRingingDescriptor); -editable(LightProbeInfoProto, 'reduceRinging', lightProbeReduceRingingDescriptor); -range([0.0, 0.05, 0.001])(LightProbeInfoProto, 'reduceRinging', lightProbeReduceRingingDescriptor); -slide(LightProbeInfoProto, 'reduceRinging', lightProbeReduceRingingDescriptor); -type(CCFloat)(LightProbeInfoProto, 'reduceRinging', lightProbeReduceRingingDescriptor); - -const lightProbeShowProbeDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'showProbe'); -tooltip('i18n:light_probe.showProbe')(LightProbeInfoProto, 'showProbe', lightProbeShowProbeDescriptor); -editable(LightProbeInfoProto, 'showProbe', lightProbeShowProbeDescriptor); - -const lightProbeShowWireframeDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'showWireframe'); -tooltip('i18n:light_probe.showWireframe')(LightProbeInfoProto, 'showWireframe', lightProbeShowWireframeDescriptor); -editable(LightProbeInfoProto, 'showWireframe', lightProbeShowWireframeDescriptor); - -const lightProbeShowConvexDescriptor = Object.getOwnPropertyDescriptor(LightProbeInfoProto, 'showConvex'); -tooltip('i18n:light_probe.showConvex')(LightProbeInfoProto, 'showConvex', lightProbeShowConvexDescriptor); -editable(LightProbeInfoProto, 'showConvex', lightProbeShowConvexDescriptor); - -ccclass('cc.LightProbeInfo')(LightProbeInfo); \ No newline at end of file +decros.patch_cc_LightProbeInfo({LightProbeInfo, CCFloat, CCInteger}); \ No newline at end of file diff --git a/cocos/scene-graph/scene.jsb.ts b/cocos/scene-graph/scene.jsb.ts index 1c69e73eca..b540ae0341 100644 --- a/cocos/scene-graph/scene.jsb.ts +++ b/cocos/scene-graph/scene.jsb.ts @@ -20,7 +20,6 @@ THE SOFTWARE. */ -import { ccclass, editable, serializable } from 'cc.decorator'; import { EDITOR, TEST } from "internal:constants"; import { legacyCC } from '../core/global-exports'; import { Node } from './node'; @@ -28,6 +27,7 @@ import { applyTargetOverrides, expandNestedPrefabInstanceNode } from "./prefab/u import { assert } from "../core/platform/debug"; import { updateChildrenForDeserialize } from '../core/utils/jsb-utils'; import { SceneGlobals } from './scene-globals'; +import { patch_cc_Scene } from '../native-binding/decorators'; export const Scene = jsb.Scene; export type Scene = jsb.Scene; @@ -134,10 +134,4 @@ sceneProto._activate = function (active: boolean) { }; // handle meta data, it is generated automatically -const SceneProto = Scene.prototype; -const globalsDescriptor = Object.getOwnPropertyDescriptor(SceneProto, 'globals'); -editable(SceneProto, 'globals', globalsDescriptor); -editable(SceneProto, 'autoReleaseAssets', () => false); -serializable(SceneProto, 'autoReleaseAssets', () => false); -serializable(SceneProto, '_globals', () => new SceneGlobals()); -ccclass('cc.Scene')(Scene); +patch_cc_Scene({Scene, SceneGlobals}); diff --git a/scripts/build-engine/src/babel-plugins/decorator-parser.ts b/scripts/build-engine/src/babel-plugins/decorator-parser.ts new file mode 100644 index 0000000000..7aac1e8fad --- /dev/null +++ b/scripts/build-engine/src/babel-plugins/decorator-parser.ts @@ -0,0 +1,1147 @@ +/* eslint-disable space-before-function-paren */ +/* eslint-disable import/no-extraneous-dependencies */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable max-len */ + +import * as babel from '@babel/core'; +import generate from '@babel/generator'; +import traverse from '@babel/traverse'; +import * as parser from '@babel/parser'; +import * as t from '@babel/types'; + +import path from 'path'; +import fs from 'fs'; + +const enginePath = process.env.ENGINE_PATH!; +const applyFnName = `apply`; + +if (!enginePath) { + throw new Error('ENGINE_PATH environment variable not set'); +} + +interface DecoratorParseResult { + decoratorName?: string; + attrName?: string; + attrValue?: string; + decoratorArgs?: string[]; + isGetterOrSetter?: boolean; +} + +interface ClassDecoratorContext { + className: string; + commands: DecoratorParseResult[]; + descriptors: { name: string, decl: string }[]; + identifiers: string[]; + declTypes: string[]; +} + +function getParentNodes(path: any): any[] { + const parents = []; + let target = path; + while (target) { + parents.push(target.node); + target = target.parentPath; + } + parents.reverse(); + return parents; +} + +function isInFunctionDeclaration(path: any) { + return getParentNodes(path.parentPath).some((parent) => parent.type === 'FunctionDeclaration'); +} + +/** + * collectt all variables which is defined outside current function and save into `ctx` + */ +function collectGlobalVars(code: string, oldPath: babel.Node, ctx: ClassDecoratorContext) { + try { + const ast = parser.parse(code); + traverse(ast, { + ReferencedIdentifier(path: any) { + const name = path.node.name; + if (path.scope.hasBinding(name, true)) { return; } + + if (name === 'arguments') { + if (isInFunctionDeclaration(path)) return; + } + + if (name in globalThis) { + return; + } + if (ctx.identifiers.indexOf(path.node.name) === -1) { + ctx.identifiers.push(path.node.name); + } + }, + } as any); + } catch (e) { + try { + const result = visitAst(oldPath); + mergeArray(ctx.declTypes, result.types); + mergeArray(ctx.identifiers, result.identifiers); + } catch (ee) { + console.error(ee); + } + } +} + +/** + * convert decorators to `DecoratorParsedResult[]` + */ +function parseNodeDecorators(targetNode: any, decorators: any[], classCtx: ClassDecoratorContext): DecoratorParseResult[] { + const result: DecoratorParseResult[] = []; + + const attrName = targetNode?.key?.name ?? ''; + const attrValue = targetNode.value! ? generate(targetNode.value).code : 'undefined'; + const isGetterOrSetter = targetNode.kind === 'get' || targetNode.kind === 'set'; + + if (targetNode.value) { + collectGlobalVars(attrValue, targetNode.value, classCtx); + } + + for (const decor of decorators) { + if (decor.expression.type === 'CallExpression') { + const content: DecoratorParseResult = { decoratorName: decor.expression.callee.name }; + content.attrName = attrName; + content.attrValue = attrValue; + content.isGetterOrSetter = isGetterOrSetter; + + try { + const argNodesCode = decor.expression.arguments.map((a: any) => { + const argCode = generate(a).code; + collectGlobalVars(argCode, a, classCtx); + return argCode; + }); + content.decoratorArgs = argNodesCode; + } catch (e) { + console.error(` @[failed]${decor.expression.callee.name as string} / ${targetNode.key.name as string}`); + continue; + } + result.push(content); + } else if (decor.expression.type === 'Identifier') { + result.push({ decoratorName: decor.expression.name, attrName, attrValue, isGetterOrSetter }); + } else { + console.error(`unknown decorator type ${decor.expression.type as string}`); + } + } + return result; +} + +// head content for the generated file +const outputLines: string[] = []; +outputLines.push(`/* This file is generated by script, do not modify it manually. */`); +outputLines.push(''); +outputLines.push(`/* eslint-disable @typescript-eslint/no-unsafe-return */`); +outputLines.push(`/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */`); +outputLines.push(`/* eslint-disable brace-style */`); +outputLines.push(`/* eslint-disable @typescript-eslint/indent */`); +outputLines.push(`/* eslint-disable max-len */`); +outputLines.push(`/* eslint-disable arrow-body-style */`); +outputLines.push(`/* eslint-disable comma-dangle */`); +outputLines.push(`/* eslint-disable func-names */`); +outputLines.push(`/* eslint-disable space-before-function-paren */`); +outputLines.push(''); +outputLines.push(`import * as $$ from 'cc.decorator';`); +outputLines.push(`import { _decorator as $ } from '../core';`); +outputLines.push(''); +outputLines.push(`const defaultExec = (cb: () => void, decorator?: string, attr?: string | null) => { cb(); };`); + +// write lines to file through IPC messages +function writeLines(lines: string[], className: string) { + process.emit('message', { event: 'write-decorator', lines, className }, null); +} + +writeLines(outputLines, ''); + +function mergeArray(dst: T[], src: T[]) { + for (const e of src) { + if (dst.indexOf(e) === -1) { + dst.push(e); + } + } +} + +/** + * generate variable names for property descriptors + */ +function allocPropVariable(className: string, property: string) { + return `${property}Descriptor`; +} + +function nameDecorators(name: string) { + if (name.startsWith('rangeM') || name === 'readOnly' || name === 'editorOnly') { + // these decorators are exported by `import { _decorator as $ } from '../core';` + // should be referenced from `cc.decorator` + return `$$.${name}`; + } + return `$.${name}`; +} + +/** + * convert class decorator to text + */ +function cvtClassDecorators(className: string) { + return (d: DecoratorParseResult) => ` ${nameDecorators(d.decoratorName!)}${d.decoratorArgs ? `(${d.decoratorArgs.join(',')})` : ''}(${className})`; +} + +/** + * convert property decorator to text + */ +function cvtPropDecorators(className: string, ctx: ClassDecoratorContext) { + return (d: DecoratorParseResult) => { + let gs: string | undefined; + // NOTE: the decorator `type` has only 2 arguments + if (d.isGetterOrSetter && d.decoratorName !== 'type') { + gs = allocPropVariable(className, d.attrName!); + const found = ctx.descriptors.reduce((p, c) => p || c.name === gs, false); + if (!found) { + ctx.descriptors.push({ name: gs, decl: `const ${gs} = Object.getOwnPropertyDescriptor(${className}.prototype, '${d.attrName as string}');` }); + } + } + if (d.decoratorName === 'type') { + // same reason, `type` has only 2 arguments + return ` ${nameDecorators(d.decoratorName)}${d.decoratorArgs ? `(${d.decoratorArgs.join(',')})` : ''}(${className}.prototype, '${d.attrName}')`; + } + return ` ${nameDecorators(d.decoratorName!)}${d.decoratorArgs ? `(${d.decoratorArgs.join(',')})` : ''}(${className}.prototype, '${d.attrName}', ${gs || `() => { return ${d.attrValue}; }`})`; + }; +} + +export default function recordDecorators(): babel.PluginObj { + return { + name: 'decorator-collector', + visitor: { + ClassDeclaration(nodePath, state) { + const superClass = nodePath.node.superClass; + let superClassName: string | null = null; + if (superClass) { + if (superClass.type === 'Identifier') { + superClassName = superClass.name; + } else { + superClassName = 'others'; + } + } + + if (superClassName === 'Component') { + // filter #1, all sub classes of `Component` + return; + } else if (superClassName === 'others') { + const fileName = state?.file?.opts?.filename; + if (fileName && fileName.indexOf('component') >= 0) { + // filter #2, skip files which path contains `component` && may be sub class of Compnonet + return; + } + } + + + const currentClassName = nodePath.node.id.name; + const classDecoratorNodes: any[] | undefined | null = nodePath.node.decorators; + let classDecoratorResults: DecoratorParseResult[] = []; + if (!classDecoratorNodes) { // filter #3, no decorators for current class + return; + } + const cppClasses = getExportedClassesFromCppSourceCode(); + if (!cppClasses.has(currentClassName)) { // filter #4, no C++ binding type found with the same name + return; + } + + const detail = cppClasses.get(currentClassName)!; + if (detail.length > 1) { + console.warn(`class ${currentClassName} has ${detail.length} JSB class: ${detail.map((d) => `${d.tip}.${d.name}`).join(', ')}`); + } + + let classContent: string[] = []; // file content to write for current class + + const decoratorCtx: ClassDecoratorContext = { + commands: [], + descriptors: [], + identifiers: [currentClassName], + className: currentClassName, + declTypes: [], + }; + + classDecoratorResults = parseNodeDecorators(nodePath.node, classDecoratorNodes, decoratorCtx); + const classNameByDecorator = classDecoratorResults.filter((x) => x.decoratorName === 'ccclass').map((x: any) => x.decoratorArgs[0].replace(/['"]/g, '').replace(/\./g, '_') as string); + // filter #5, return if no ccclass found or classes from `sp.` (spine) modules + // Add more conditions if classes need to be skipped. + if (classNameByDecorator.length === 0 || classNameByDecorator[0].startsWith('sp_')) { + return; + } + let classDecorator_Lines = classDecoratorResults.map(cvtClassDecorators(currentClassName)); + classDecorator_Lines = classDecorator_Lines.map((x, idx) => ` ${applyFnName}(() => { ${x.trim()}; }, '${classDecoratorResults[idx].decoratorName}', null);`); + const ccclassName = classNameByDecorator.length > 0 ? classNameByDecorator[0] : currentClassName; + const contextArgType = `${ccclassName}_Context_Args`; + let propDecorator_Lines: string[] = []; + const children = nodePath.node.body.body as any[]; + for (const decro of children) { + if (decro.decorators) { + const memberDecorators = parseNodeDecorators(decro, decro.decorators, decoratorCtx); + let memberLines = memberDecorators.map(cvtPropDecorators(currentClassName, decoratorCtx)); + memberLines = memberLines.map((x, idx) => ` ${applyFnName}(() => { ${x.trim()}; }, '${memberDecorators[idx].decoratorName}', '${memberDecorators[idx].attrName}');`); + propDecorator_Lines = propDecorator_Lines.concat(memberLines.reverse().join('\n')); + } + } + + // assemble file content + classContent.push(`\n//---- class ${ccclassName}`); + classContent.push(`interface ${contextArgType} {`); // argument type interface defination + if (decoratorCtx.identifiers.length > 0) { + for (const id of decoratorCtx.identifiers) { + classContent.push(` ${id}: any;`); // field for argument type + } + } + classContent.push(`}`); + classContent.push(`export function patch_${ccclassName}(ctx: ${contextArgType}, ${applyFnName} = defaultExec) {`); + for (const tp of decoratorCtx.declTypes) { + classContent.push(` type ${tp} = any;`); // type alias using in current funtion, set to any type. + } + + if (decoratorCtx.identifiers.length > 0) { + const contextArgs = decoratorCtx.identifiers; + classContent.push(` const { ${contextArgs.join(', ')} } = { ...ctx };`); // unpack all variables from argument + } + + if (decoratorCtx.descriptors.length > 0) { + // local variables for propert descriptors + classContent = classContent.concat(decoratorCtx.descriptors.map((d) => ` ${d.decl}`).join('\n')); + } + classContent = classContent.concat(propDecorator_Lines); // property decorators + classContent = classContent.concat(classDecorator_Lines.reverse().join('\n')); // class decorators + classContent.push(`} // end of patch_${ccclassName}`); + writeLines(classContent, ccclassName); + }, + }, + }; +} + +const cppClassMap: Map = new Map(); + +function getExportedClassesFromCppSourceCode() { + if (cppClassMap.size > 0) { + return cppClassMap; + } + + const cppSourceFiles: string[] = []; + const toFullPath = (prefix: string) => (filename: string) => path.join(prefix, filename); + const findInDir = (filterCb: { (p: string): boolean }) => (dir: string) => fs.readdirSync(dir).filter(filterCb).map(toFullPath(dir)).forEach((fp) => cppSourceFiles.push(fp)); + + ['native/cocos/bindings/manual', 'native/cocos/bindings/auto'].map(toFullPath(enginePath)).forEach(findInDir((x) => x.startsWith('jsb_') && x.endsWith('.cpp'))); + + const se_Class_create = /se::Class::create\((\{("\w+",\s*"\w+")+\}|("\w+"))/; + + const skipChars = /["{}]/; + + console.log('searching for exported classes'); + + function trimClassName(x: string) { + let start = 0; + let end = x.length - 1; + const len = x.length; + while (start < len && skipChars.test(x[start])) start++; + while (end > 0 && skipChars.test(x[end])) end--; + return start < end ? x.substring(start, end + 1) : ''; + } + function tideClassName(str: string) { + return str.split(',').map((x) => trimClassName(x.trim())); + } + + for (const file of cppSourceFiles) { + fs.readFileSync(file, 'utf8').split('\n').map((x) => x.trim()).filter((x) => { + const createClassR = se_Class_create.exec(x); + if (createClassR) { + const pathComps = path.basename(file).split('_')[1]; + if (pathComps.includes('dragonbone') || pathComps.includes('spine')) { + // filter #6, skip spine/dragonbones binding source files + return null; + } + const classNameComps = tideClassName(createClassR[1] ? createClassR[1] : createClassR[2]); + const className = classNameComps[classNameComps.length - 1]; + let classItems = cppClassMap.get(className); + if (!classItems) { + classItems = []; + cppClassMap.set(classNameComps[0], classItems); + } + classItems.push({ file, name: classNameComps.join('.'), tip: pathComps }); + if (classItems.length > 1) { + console.error(`Multiple classes found: ${className} / ${classItems.map((x) => `${path.basename(x.file)}:${x.name}`).join(', ')} . ${file}`); + } + } + return createClassR; + }); + } + return cppClassMap; +} + +function debugLog(...args: string[]) { + // console.log.apply(console, args); +} + +class VisitContext { + identifiers: string[] = []; + types: string[] = []; + + addIdentifier(identifier: string) { + if (this.identifiers.indexOf(identifier) === -1) { + this.identifiers.push(identifier); + } + } + + addType(type: string) { + if (this.types.indexOf(type) === -1) { + this.types.push(type); + } + } + + reset() { + this.identifiers.length = 0; + this.types.length = 0; + } + + dump() { + if (this.types.length > 0 || this.identifiers.length > 0) { + console.log(`types: ${this.types.join(',')}`); + console.log(`identifiers: ${this.identifiers.join(',')}`); + } + } +} + +const context = new VisitContext(); + +namespace p { + + export function Identifier(np: t.Identifier) { + if (np.typeAnnotation) { + // context.addType(np.typeAnnotation); + visitAstRecursive(np.typeAnnotation); + } + debugLog(`[${np.type}] ${np.name}`); + } + + export function Import(np: t.Import) { + debugLog(`[import]`); + } + + export function StringLiteral(np: t.StringLiteral) { + debugLog(`[${np.type}] "${np.value}"`); + } + + export function SequenceExpression(np: t.SequenceExpression) { + debugLog(`[sequence expression]`); + for (const d of np.expressions) { + visitAstRecursive(d); + } + } + + export function ClassDeclaration(np: t.ClassDeclaration) { + debugLog(`[class def] skipped`); + } + + export function ObjectExpression(np: t.ObjectExpression) { + for (const p of np.properties) { + visitAstRecursive(p); + } + } + + export function ObjectMethod(np: t.ObjectMethod) { + debugLog(`[obj method] ${np.kind}`); + visitAstRecursive(np.key); + for (const p of np.params) { + visitAstRecursive(p); + } + visitAstRecursive(np.body); + if (np.returnType) visitAstRecursive(np.returnType); + if (np.typeParameters) visitAstRecursive(np.typeParameters); + } + + export function ObjectProperty(np: t.ObjectProperty) { + debugLog(`[obj property]`); + visitAstRecursive(np.key); + visitAstRecursive(np.value); + } + + export function ExportNamedDeclaration(np: t.ExportNamedDeclaration) { + console.error(`[export named] skipped`); + } + + export function ExportDefaultDeclaration(np: t.ExportDefaultDeclaration) { + console.error(`[export default] skipped`); + } + + export function ExportAllDeclaration(np: t.ExportAllDeclaration) { + console.error(`[export all] skipped`); + } + + export function ExportSpecifier(np: t.ExportSpecifier) { + console.error(`[export specifier] skipped`); + } + + export function ImportDeclaration(np: t.ImportDeclaration) { + console.error(`[import declaration] skipped`); + } + + export function UpdateExpression(np: t.UpdateExpression) { + debugLog(`[update] ${np.operator}, prefix: ${np.prefix}`); + visitAstRecursive(np.argument); + } + + export function ObjectPattern(np: t.ObjectPattern) { + debugLog(`[objectpattern]`); + for (const p of np.properties) { + visitAstRecursive(p); + } + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + } + + export function ArrayPattern(np: t.ArrayPattern) { + debugLog(`[arraypattern]`); + for (const p of np.elements) { + if (p) { // TODO: handle null elements + visitAstRecursive(p); + } + } + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + } + + export function ArrayExpression(np: t.ArrayExpression) { + for (const ele of np.elements) { + if (ele) visitAstRecursive(ele); // skip null elements? + } + } + + export function ThisExpression(np: t.ThisExpression) { + debugLog(`[this]`); + } + + export function Super(np: t.Super) { + debugLog(`[super]`); + } + + export function TSTypeAssertion(np: t.TSTypeAssertion) { + debugLog(`[type assertion]`); + visitAstRecursive(np.typeAnnotation); + visitAstRecursive(np.expression); + } + + export function TSPropertySignature(np: t.TSPropertySignature) { + debugLog(`[ts prop]`); + visitAstRecursive(np.key); + if (np.initializer) visitAstRecursive(np.initializer); + if (np.typeAnnotation) visitAstRecursive(np.typeAnnotation); + } + + export function TSMethodSignature(np: t.TSMethodSignature) { + debugLog(`[ts method]`); + visitAstRecursive(np.key); + for (const p of np.parameters) { + visitAstRecursive(p); + } + if (np.typeParameters) visitAstRecursive(np.typeParameters); + if (np.typeAnnotation) visitAstRecursive(np.typeAnnotation); + } + + export function TSIndexSignature(np: t.TSIndexSignature) { + debugLog(`[ts index]`); + for (const p of np.parameters) { + visitAstRecursive(p); + } + if (np.typeAnnotation) visitAstRecursive(np.typeAnnotation); + } + + export function MemberExpression(np: t.MemberExpression) { + debugLog(`[member]: optional ${np.optional}`); + visitAstRecursive(np.object); + visitAstRecursive(np.property); + if (np.object.type === 'Identifier') { + context.addIdentifier(np.object.name); + } + } + + export function OptionalMemberExpression(np: t.OptionalMemberExpression) { + debugLog(`[optional-member]: optional ${np.optional}`); + visitAstRecursive(np.object); + visitAstRecursive(np.property); + } + + export function VariableDeclaration(np: t.VariableDeclaration) { + debugLog(`[var] ${np.kind}`); + for (const v of np.declarations) { + visitAstRecursive(v); + } + } + + export function TSQualifiedName(np: t.TSQualifiedName) { + debugLog(`[qualified]`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + } + + export function VariableDeclarator(np: t.VariableDeclarator) { + debugLog(`[var instant] definite ${np.definite}`); + visitAstRecursive(np.id); + if (np.init) visitAstRecursive(np.init); + } + + export function FunctionExpression(np: t.FunctionExpression) { + debugLog(`[function]`); + if (np.id) { visitAstRecursive(np.id); } + // param + if (np.params) { + for (const p of np.params) { + visitAstRecursive(p); + } + } + // body + if (np.body) { + visitAstRecursive(np.body); + } + if (np.returnType) { + visitAstRecursive(np.returnType); + } + + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + + export function ArrowFunctionExpression(np: t.ArrowFunctionExpression) { + debugLog(`[arrow-function]`); + // param + for (const p of np.params) { + if (p) visitAstRecursive(p); // null should be acceptable + } + // body + visitAstRecursive(np.body); + if (np.returnType) { + visitAstRecursive(np.returnType); + } + + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + if (np.predicate) { + visitAstRecursive(np.predicate); + } + } + + export function NewExpression(np: t.NewExpression) { + debugLog(`[new]`); + visitAstRecursive(np.callee); + for (const p of np.arguments) { + visitAstRecursive(p); + } + if (np.typeArguments) { + visitAstRecursive(np.typeArguments); + } + + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + + export function TryStatement(np: t.TryStatement) { + debugLog(`[TryStatement]`); + visitAstRecursive(np.block); + if (np.handler) visitAstRecursive(np.handler); + if (np.finalizer) visitAstRecursive(np.finalizer); + } + + export function CatchClause(np: t.CatchClause) { + debugLog(`[CatchClause]`); + if (np.param) visitAstRecursive(np.param); + visitAstRecursive(np.body); + } + + export function BlockStatement(np: t.BlockStatement) { + debugLog(`[block]`); + for (const d of np.directives) { + visitAstRecursive(d); + } + for (const p of np.body) { + visitAstRecursive(p); + } + } + + export function ExpressionStatement(np: t.ExpressionStatement) { + debugLog(`[expression]`); + visitAstRecursive(np.expression); + } + + export function CallExpression(np: t.CallExpression) { + debugLog(`[call]`); + visitAstRecursive(np.callee); + for (const a of np.arguments) { + visitAstRecursive(a); + } + if (np.typeArguments) { + visitAstRecursive(np.typeArguments); + } + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + + export function OptionalCallExpression(np: t.OptionalCallExpression) { + debugLog(`[optional call?]`); + visitAstRecursive(np.callee); + for (const a of np.arguments) { + visitAstRecursive(a); + } + if (np.typeArguments) { + visitAstRecursive(np.typeArguments); + } + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + + export function AssignmentPattern(np: t.AssignmentPattern) { + debugLog(`[assignment pattern] optional: ${np.optional}`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + } + + export function AssignmentExpression(np: t.AssignmentExpression) { + debugLog(`[assignment] ${np.operator}`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + } + + export function RestElement(np: t.RestElement) { + debugLog(`[rest element] optional: ${np.optional}`); + visitAstRecursive(np.argument); + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + } + + export function SpreadElement(np: t.SpreadElement) { + debugLog(`[spread]`); + visitAstRecursive(np.argument); + } + + export function LogicalExpression(np: t.LogicalExpression) { + debugLog(`[logical] ${np.operator}`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + } + + export function ConditionalExpression(np: t.ConditionalExpression) { + debugLog(`[conditional] ${np.test}`); + visitAstRecursive(np.test); + visitAstRecursive(np.consequent); + visitAstRecursive(np.alternate); + } + + export function BinaryExpression(np: t.BinaryExpression) { + debugLog(`[binary] ${np.operator}`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + } + + export function SwitchStatement(np: t.SwitchStatement) { + debugLog(`[switch]`); + visitAstRecursive(np.discriminant); + for (const c of np.cases) { + visitAstRecursive(c); + } + } + + export function SwitchCase(np: t.SwitchCase) { + debugLog(`[switch cast]`); + if (np.test) visitAstRecursive(np.test); + for (const c of np.consequent) { + visitAstRecursive(c); + } + } + + export function ThrowStatement(np: t.ThrowStatement) { + debugLog(`[throw]`); + visitAstRecursive(np.argument); + } + + export function BreakStatement(np: t.BreakStatement) { + debugLog(`[break]`); + if (np.label) visitAstRecursive(np.label); + } + + export function ContinueStatement(np: t.ContinueStatement) { + debugLog(`[continue]`); + if (np.label) visitAstRecursive(np.label); + } + + export function LabeledStatement(np: t.LabeledStatement) { + debugLog(`[label]`); + visitAstRecursive(np.label); + visitAstRecursive(np.body); + } + + export function YieldExpression(np: t.YieldExpression) { + debugLog(`[yield] delegate ${np.delegate}`); + if (np.argument) visitAstRecursive(np.argument); + } + + export function AwaitExpression(np: t.AwaitExpression) { + debugLog(`[await]`); + visitAstRecursive(np.argument); + } + + export function IfStatement(np: t.IfStatement) { + debugLog(`[if]`); + visitAstRecursive(np.test); + visitAstRecursive(np.consequent); + if (np.alternate) { + visitAstRecursive(np.alternate); + } + } + export function DoWhileStatement(np: t.DoWhileStatement) { + debugLog(`[do while]`); + visitAstRecursive(np.body); + visitAstRecursive(np.test); + } + + export function WhileStatement(np: t.WhileStatement) { + debugLog(`[while]`); + visitAstRecursive(np.test); + visitAstRecursive(np.body); + } + + export function ForInStatement(np: t.ForInStatement) { + debugLog(`[for in]`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + visitAstRecursive(np.body); + } + + export function ForOfStatement(np: t.ForOfStatement) { + debugLog(`[for of]`); + visitAstRecursive(np.left); + visitAstRecursive(np.right); + visitAstRecursive(np.body); + } + + export function ForStatement(np: t.ForStatement) { + debugLog(`[for]`); + if (np.init) visitAstRecursive(np.init); + if (np.test) visitAstRecursive(np.test); + if (np.update) visitAstRecursive(np.update); + visitAstRecursive(np.body); + } + + export function ReturnStatement(np: t.ReturnStatement) { + debugLog(`[return]`); + if (np.argument) { + visitAstRecursive(np.argument); + } + } + + export function TSTypeParameterDeclaration(np: t.TSTypeParameterDeclaration) { + debugLog(`[parameter decl]`); + for (const p of np.params) { + visitAstRecursive(p); + } + } + + export function TSTypeParameter(np: t.TSTypeParameter) { + debugLog(`[type parameter] ${np.name}, const ${np.const}, in: ${np.in}, out: ${np.out}`); + if (np.constraint) visitAstRecursive(np.constraint); + if (np.default) visitAstRecursive(np.default); + } + + export function TSNonNullExpression(np: t.TSNonNullExpression) { + debugLog(`[non-null]`); + visitAstRecursive(np.expression); + } + + export function FunctionDeclaration(np: t.FunctionDeclaration) { + debugLog(`[function-decl]`); + if (np.id) visitAstRecursive(np.id); + for (const p of np.params) { + visitAstRecursive(p); + } + + visitAstRecursive(np.body); + if (np.returnType) { + visitAstRecursive(np.returnType); + } + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + + export function TSAsExpression(np: t.TSAsExpression) { + debugLog(`[as]`); + visitAstRecursive(np.expression); + visitAstRecursive(np.typeAnnotation); + } + + export function TSTypeAnnotation(np: t.TSTypeAnnotation) { + debugLog(`[typeAnnotation]`); + visitAstRecursive(np.typeAnnotation); + } + + export function TSTypeParameterInstantiation(np: t.TSTypeParameterInstantiation) { + debugLog(`[type-instantiation]`); + for (const t of np.params) { + visitAstRecursive(t); + } + } + + export function TSType(np: t.TSType) { + + } + export function TSAnyKeyword(np: t.TSAnyKeyword) { + debugLog(`[TSType] any`); + } + + export function TSBooleanKeyword(np: t.TSBooleanKeyword) { + debugLog(`[TSType] boolean`); + } + + export function TSBigIntKeyword(np: t.TSBigIntKeyword) { + debugLog(`[TSType] BigInt`); + } + export function TSIntrinsicKeyword(np: t.TSIntrinsicKeyword) { + debugLog(`[TSType] instrinsic`); + } + export function TSNeverKeyword(np: t.TSNeverKeyword) { + debugLog(`[TSType] never`); + } + export function TSNullKeyword(np: t.TSNullKeyword) { + debugLog(`[TSType] null`); + } + export function TSNumberKeyword(np: t.TSNumberKeyword) { + debugLog(`[TSType] number`); + } + export function TSObjectKeyword(np: t.TSObjectKeyword) { + debugLog(`[TSType] object`); + } + export function TSStringKeyword(np: t.TSStringKeyword) { + debugLog(`[TSType] string`); + } + export function TSSymbolKeyword(np: t.TSSymbolKeyword) { + debugLog(`[TSType] symbol`); + } + export function TSUndefinedKeyword(np: t.TSUndefinedKeyword) { + debugLog(`[TSType] undefined`); + } + export function TSUnknownKeyword(np: t.TSUnknownKeyword) { + debugLog(`[TSType] unknown`); + } + export function TSVoidKeyword(np: t.TSVoidKeyword) { + debugLog(`[TSType] void`); + } + export function TSThisType(np: t.TSThisType) { + debugLog(`[TSType] this`); + } + export function TSFunctionType(np: t.TSFunctionType) { + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + for (const p of np.parameters) { + visitAstRecursive(p); + } + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + } + + export function TSConstructorType(np: t.TSConstructorType) { + console.error(`[TSType] constructor not allowed`); + } + + export function TSTypeReference(np: t.TSTypeReference) { + visitAstRecursive(np.typeName); + if (np.typeName.type === 'Identifier') { + context.addType(np.typeName.name); + } + } + + export function TSTypePredicate(np: t.TSTypePredicate) { + visitAstRecursive(np.parameterName); + if (np.typeAnnotation) visitAstRecursive(np.typeAnnotation); + } + export function TSTypeQuery(np: t.TSTypeQuery) { + visitAstRecursive(np.exprName); + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + export function TemplateLiteral(np: t.TemplateLiteral) { + debugLog(`[Template literal]`); + for (const e of np.quasis) { + visitAstRecursive(e); + } + for (const e of np.expressions) { + visitAstRecursive(e); + } + } + + export function TemplateElement(np: t.TemplateElement) { + debugLog(`[templ element] raw: ${np.value.raw}, cooked: ${np.value.cooked}, tail: ${np.tail}`); + } + + export function TSTypeLiteral(np: t.TSTypeLiteral) { + debugLog(`[TSType] type literal`); + for (const p of np.members) { + visitAstRecursive(p); + } + } + + export function TSArrayType(np: t.TSArrayType) { + debugLog(`[TSType] array`); + visitAstRecursive(np.elementType); + } + + export function TSTupleType(np: t.TSTupleType) { + debugLog(`[TSType] tuple`); + for (const p of np.elementTypes) { + visitAstRecursive(p); + } + } + + export function TSOptionalType(np: t.TSOptionalType) { + debugLog(`[TSType] optional`); + visitAstRecursive(np.typeAnnotation); + } + export function TSRestType(np: t.TSRestType) { + debugLog(`[TSType] rest`); + visitAstRecursive(np.typeAnnotation); + } + export function TSUnionType(np: t.TSUnionType) { + debugLog(`[TSType] union`); + for (const p of np.types) { + visitAstRecursive(p); + } + } + export function TSIntersectionType(np: t.TSIntersectionType) { + debugLog(`[TSType] intersection`); + for (const p of np.types) { + visitAstRecursive(p); + } + } + + export function TSConditionalType(np: t.TSConditionalType) { + debugLog(`[TSType] conditonal`); + visitAstRecursive(np.checkType); + visitAstRecursive(np.extendsType); + visitAstRecursive(np.trueType); + visitAstRecursive(np.falseType); + } + export function TSInferType(np: t.TSInferType) { + debugLog(`[TSType] infer`); + visitAstRecursive(np.typeParameter); + } + export function TSParenthesizedType(np: t.TSParenthesizedType) { + debugLog(`[TSType] parenthesized`); + visitAstRecursive(np.typeAnnotation); + } + export function TSTypeOperator(np: t.TSTypeOperator) { + debugLog(`[TSType] operator ${np.operator}`); + visitAstRecursive(np.typeAnnotation); + } + export function TSIndexedAccessType(np: t.TSIndexedAccessType) { + debugLog(`[TSType] index access`); + visitAstRecursive(np.objectType); + visitAstRecursive(np.indexType); + } + export function TSMappedType(np: t.TSMappedType) { + debugLog(`[TSType] mapped`); + visitAstRecursive(np.typeParameter); + if (np.typeAnnotation) { + visitAstRecursive(np.typeAnnotation); + } + if (np.nameType) { + visitAstRecursive(np.nameType); + } + } + export function TSLiteralType(np: t.TSLiteralType) { + debugLog(`[TSType] literal`); + visitAstRecursive(np.literal); + } + export function TSExpressionWithTypeArguments(np: t.TSExpressionWithTypeArguments) { + debugLog(`[TSType] expression with type arguments`); + visitAstRecursive(np.expression); + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + } + export function TSImportType(np: t.TSImportType) { + console.error(`[TSType ] should skip import`); + } + export function BooleanLiteral(np: t.BooleanLiteral) { + debugLog(`[bool] ${np.value}`); + } + export function NumericLiteral(np: t.NumericLiteral) { + debugLog(`[numberic] ${np.value}`); + } + export function NullLiteral(np: t.NullLiteral) { + debugLog(`[null]`); + } + export function RegExpLiteral(np: t.RegExpLiteral) { + debugLog(`[regexp] ${np.pattern} / ${np.flags}`); + } + + export function UnaryExpression(np: t.UnaryExpression) { + debugLog(`[unary] ${np.operator}, prefix: ${np.prefix}`); + visitAstRecursive(np.argument); + } + + export function Directive(np: t.Directive) { + debugLog(`[directive] ${np.value}`); + } + + export function DirectiveLiteral(np: t.DirectiveLiteral) { + debugLog(`[directive literal] ${np.value}`); + } + + export function EmptyStatement(np: t.EmptyStatement) { + debugLog(`[empty]`); + } + + export function TSTypeAliasDeclaration(np: t.TSTypeAliasDeclaration) { + debugLog(`[type alias] declare ${np.declare}`); + visitAstRecursive(np.id); + if (np.typeParameters) visitAstRecursive(np.typeParameters); + visitAstRecursive(np.typeAnnotation); + } + + export function TSInterfaceDeclaration(np: t.TSInterfaceDeclaration) { + debugLog(`[ts interface declaration]`); + visitAstRecursive(np.id); + if (np.typeParameters) { + visitAstRecursive(np.typeParameters); + } + visitAstRecursive(np.body); + if (np.extends) { + for (const p of np.extends) { + visitAstRecursive(p); + } + } + } +} + +function visitAstRecursive(ast: any) { + const node = ast.node ? ast.node : ast; + const nodeVisitor = (p as any)[node.type]; + if (nodeVisitor) { + try { + nodeVisitor(node); + } catch (e) { + console.error(e); + } + } else { + console.error(`Unsupported node type: ${node.type}`); + } +} + +function visitAst(ast: babel.Node) { + context.reset(); + visitAstRecursive(ast); + return context; +} diff --git a/scripts/build-engine/src/index.ts b/scripts/build-engine/src/index.ts index bc03cbd75b..bd9c5817f4 100644 --- a/scripts/build-engine/src/index.ts +++ b/scripts/build-engine/src/index.ts @@ -31,12 +31,14 @@ import { codeAsset } from './rollup-plugins/code-asset'; import { ModeType, PlatformType } from './constant-manager'; import { assetUrl } from './rollup-plugins/asset-url'; +import * as decoratorRecorder from './babel-plugins/decorator-parser'; + export { IOptimizeDecorators } from './config-interface'; export { ModeType, PlatformType, FlagType, ConstantOptions, BuildTimeConstants, CCEnvConstants } from './constant-manager'; export { StatsQuery }; export { ModuleOption, enumerateModuleOptionReps, parseModuleOption }; -function equalPathIgnoreDriverLetterCase (lhs: string, rhs: string) { +function equalPathIgnoreDriverLetterCase(lhs: string, rhs: string) { if (lhs.length !== rhs.length) { return false; } @@ -53,11 +55,11 @@ const equalPath = process.platform === 'win32' ? equalPathIgnoreDriverLetterCase : (lhs: string, rhs: string) => lhs === rhs; -function makePathEqualityKey (path: string) { +function makePathEqualityKey(path: string) { return process.platform === 'win32' ? path.toLocaleLowerCase() : path; } -async function build (options: build.Options) { +async function build(options: build.Options) { console.debug(`Build-engine options: ${JSON.stringify(options, undefined, 2)}`); return doBuild({ options, @@ -163,6 +165,11 @@ namespace build { }; buildTimeConstants: IBuildTimeConstants; + + /** + * Generate cocos/native-binding/decorators.ts for native platforms + */ + generateDecoratorsForJSB?: boolean; } export interface Result { @@ -187,7 +194,7 @@ namespace build { hasCriticalWarns: boolean; } - export async function transform (code: string, moduleOption: ModuleOption, loose?: boolean) { + export async function transform(code: string, moduleOption: ModuleOption, loose?: boolean) { const babelFormat = moduleOptionsToBabelEnvModules(moduleOption); const babelFileResult = await babel.transformAsync(code, { presets: [[babelPresetEnv, { modules: babelFormat, loose: loose ?? true } as babelPresetEnv.Options]], @@ -203,7 +210,7 @@ namespace build { export { build }; -async function doBuild ({ +async function doBuild({ options, }: { options: build.Options; @@ -304,7 +311,7 @@ async function doBuild ({ } const rpVirtualOptions: Record = {}; - + const vmInternalConstants = statsQuery.constantManager.exportStaticConstants({ platform, mode, @@ -404,6 +411,10 @@ async function doBuild ({ } as babelPresetCC.Options], ], }; + + if (options.generateDecoratorsForJSB) { + babelOptions.presets?.push([() => ({ plugins: [[decoratorRecorder]] })]); + } const rollupPlugins: rollup.Plugin[] = []; @@ -432,14 +443,14 @@ async function doBuild ({ { name: '@cocos/build-engine|module-overrides', - resolveId (source, importer) { + resolveId(source, importer) { if (moduleOverrides[source]) { return source; } else { return null; } }, - load (this, id: string) { + load(this, id: string) { const key = makePathEqualityKey(id); if (!(key in moduleOverrides)) { return null; @@ -466,6 +477,7 @@ async function doBuild ({ preferConst: true, }), + commonjs({ include: [ /node_modules[/\\]/, @@ -665,7 +677,7 @@ export default Bullet; return result; - async function nodeResolveAsync (specifier: string) { + async function nodeResolveAsync(specifier: string) { return new Promise((r, reject) => { nodeResolve(specifier, { basedir: engineRoot, @@ -680,35 +692,35 @@ export default Bullet; } } -function moduleOptionsToRollupFormat (moduleOptions: ModuleOption): rollup.ModuleFormat { +function moduleOptionsToRollupFormat(moduleOptions: ModuleOption): rollup.ModuleFormat { switch (moduleOptions) { - case ModuleOption.cjs: return 'cjs'; - case ModuleOption.esm: return 'esm'; - case ModuleOption.system: return 'system'; - case ModuleOption.iife: return 'iife'; - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - default: throw new Error(`Unknown module format ${moduleOptions}`); + case ModuleOption.cjs: return 'cjs'; + case ModuleOption.esm: return 'esm'; + case ModuleOption.system: return 'system'; + case ModuleOption.iife: return 'iife'; + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + default: throw new Error(`Unknown module format ${moduleOptions}`); } } -function moduleOptionsToBabelEnvModules (moduleOptions: ModuleOption): -| false -| 'commonjs' -| 'amd' -| 'umd' -| 'systemjs' -| 'auto' { +function moduleOptionsToBabelEnvModules(moduleOptions: ModuleOption): + | false + | 'commonjs' + | 'amd' + | 'umd' + | 'systemjs' + | 'auto' { switch (moduleOptions) { - case ModuleOption.cjs: return 'commonjs'; - case ModuleOption.system: return 'systemjs'; - case ModuleOption.iife: - case ModuleOption.esm: return false; - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - default: throw new Error(`Unknown module format ${moduleOptions}`); + case ModuleOption.cjs: return 'commonjs'; + case ModuleOption.system: return 'systemjs'; + case ModuleOption.iife: + case ModuleOption.esm: return false; + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + default: throw new Error(`Unknown module format ${moduleOptions}`); } } -export async function isSourceChanged (incrementalFile: string) { +export async function isSourceChanged(incrementalFile: string) { let record: Record; try { record = await fs.readJSON(incrementalFile); @@ -733,7 +745,7 @@ export async function isSourceChanged (incrementalFile: string) { return false; } -async function getDefaultModuleEntries (engine: string) { +async function getDefaultModuleEntries(engine: string) { type ModuleDivision = any; // import('../../scripts/module-division/tools/division-config').ModuleDivision; type GroupItem = any; // import('../../scripts/module-division/tools/division-config').GroupItem; type Item = any; // import('../../scripts/module-division/tools/division-config').Item;