Commit Graph

18 Commits

Author SHA1 Message Date
James Chen e4cd83ec59 Fix potential crash in Node::isChildOf (#12493) 2022-08-22 09:54:42 +08:00
江战 f77b9e85b6 add Node.const reserveContentsForAllSyncablePrefabTag (#12317) 2022-08-03 18:12:56 +08:00
bofeng-song 0caad511d9 Add node's missing function attr (#12314) 2022-08-03 17:53:50 +08:00
James Chen 9f615e1fec fixed #11911: [v3.6][optimization] Use External ArrayBuffer to optimize the shared memory in Node (#11926) 2022-07-13 13:50:53 +08:00
James Chen a5cdfe2511 fixed #11692: [jsb] More SE_BIND_FUNC_FAST binding for Node transform relevant API (#11854)
* fixed #11692: [jsb] More SE_BIND_FUNC_FAST binding for Node transform relevant API

* Format code
2022-07-05 18:01:28 +08:00
James Chen e41ec8b765 Fix binding of Node.inverseTransformPoint. (#11845) 2022-07-05 13:33:25 +08:00
James Chen d5e1bfa1a1 Fix wrong logic in Camera::screenToWorld function and remove Node._xxxCache properties to keep the same logic as web (#11693)
* Fix wrong logic in Carmea::screenToWorld function.

* [jsb] Remove Node._xxxCache properties. Keep the same logic as web.

In camera-component.ts

    public screenToWorld (screenPos: Vec3, out?: Vec3) {
        if (!out) { out = this.node.getWorldPosition(); }  // if out is null, getWorldPosition will return _worldPositionCache object
        if (this._camera) { this._camera.screenToWorld(out, screenPos); }
        return out;
    }

In user code, there may be something like this:

	const target = cameraCom.screenToWorld(pos); // target is _worldPositionCache object
        const dir = Vec3.subtract(new Vec3(), target, this.node.worldPosition).normalize(); // this.node.worldPosition also returns _worldPositionCache object because we define _pos like the following:

// node.jsb.ts

Object.defineProperty(nodeProto, '_pos', {
    configurable: true,
    enumerable: true,
    get (): Readonly<Vec3> {
        return this.getWorldPosition();
    }
});

nodeProto.getWorldPosition = function (out?: Vec3): Vec3 {
    const r = oldGetWorldPosition.call(this);
    if (out) {
        return Vec3.copy(out, r);
    }
    return Vec3.copy(this._worldPositionCache, r); // node.getWorldPosition() will return _worldPositionCache tool.
};

So the code [[[[ const dir = Vec3.subtract(new Vec3(), target, this.node.worldPosition).normalize(); ]]]] will replace target value since this.node.worldPosition getter  overrides the target value.
2022-06-24 18:30:59 +08:00
minggo 18be330613 remove uitransformdirty (#11578)
* remove uitransformdirty
2022-06-17 18:34:27 +08:00
minggo ca9deefcf8 Fast define (#11391)
Use fast define to replace decorator codes.

Co-authored-by: santy-wang <wh19930829@qq.com>
2022-06-14 17:36:46 +08:00
PP 1c737b91fd optimize Constants in engine (#11464)
* publish build-engine 4.3.5

* update build-engine deps

* remove default-constants.ts

ds

remove de

* delete consts.d.ts

* support build-const workflow

* remove EXPORT_TO_GLOBAL

* update comment

* fix interface-check

* update comment
2022-06-14 16:14:34 +08:00
minggo 0443ec3227 sync logic of Node (#11431) 2022-06-09 14:34:10 +08:00
bofeng-song 57f031eb1e Fixing cc.js file that will have multiple copies of node.jsb.ts file … (#11155)
* Fixing cc.js file that will have multiple copies of node.jsb.ts file in them
2022-05-19 18:30:03 +08:00
James Chen 7203b63a50 fixed #3d-tasks/11110: [native] Avoid two implementation of CCObject (#11060)
* fixed #3d-tasks/11110: [native] Avoid two implementation of CCObject
* Add more comments in CCObject.cpp
2022-05-16 09:49:45 +08:00
James Chen 0200e65aae [JSB] Check whether node._children && node._children.length are valid in updateChildrenForDeserialize (#11012)
* [JSB] Check whether node._children && node._children.length are valid in updateChildrenForDeserialize

* [JSB] Optimize nodeProto._onBatchCreated, reduce the count of visiting properties.
2022-05-10 10:58:18 +08:00
James Chen bd54a082a3 Update Spidermonkey (97.0.1) backend for se (jswrapper) (#10170)
* Update spidermonkey backend for se.

* Update cmakelist

* Bug fix for se spidermonkey backend.

* Fix constructor binding for spidermonkey backend.

* Fix wrong syntax of calling native function in simple-texture.jsb.ts & builtin-res-mgr.jsb.ts

* Use jsb.createExternalArrayBuffer for caching since it will not be moved during GGC.

* Cleanup se spidermonkey backend

* Add Object::createExternalArrayBuffer for se v8 backend.

* Remove unused code in jsb_assets_manual.cpp

* Add jsb.createExternalArrayBuffer binding.

* Remove unused WebGLRenderingContext registeration.

* Remove unused code in jsb_global_init.cpp

* Add Root::setDevice.

* Invoke ScriptEngine::mainLoopUpdate in Engine.cpp.

* Update CMakeLists.txt

* Make missing return type as an error.

* Cleanup for sm/ScriptEngine.cpp

* prefine.cmake fix for vs.
2022-02-24 18:20:54 +08:00
zheng han bd4db672cb V3.6.0 scene view native (#10044)
* 1. export pipeline in native
2. remove some editor useless code

* Add Editor Camera native data synchronization

* fix crash: native model is destroyed but not removed from renderscene (#9543)

Co-authored-by: lijilin <jilin.li@cocos.com>
(cherry picked from commit 3d1ac52a26)

* refactor preview code

* fix model preview function

* fix deserialize bug

* fix JSB error

* change default value of HTML5

* fix jsb.CCObject problem

* fix ts error

* Fix eslint in misc

Co-authored-by: zhengxiangkui <476393671@qq.com>
Co-authored-by: 李吉林 <798080536@qq.com>
Co-authored-by: pandamicro <lphuabin@gmail.com>
2022-01-28 16:53:49 +08:00
bofeng-song 30493b40d4 implement node`s registerIfAttached (#10010)
* implement node`s registerIfAttached

* refine
2022-01-18 17:24:48 +08:00
minggo e80251eae6 Codes for native (#9920) 2022-01-11 17:30:18 +08:00