Commit Graph

152 Commits

Author SHA1 Message Date
hyde zhou 5bcfb9fa04 Revert "Feat/plugin support, allow third_party feat(spine) to create plugin f…" (#403)
This reverts commit a56706c9ad.
2026-11-10 17:04:32 +08:00
Tianze-Chen a56706c9ad Feat/plugin support, allow third_party feat(spine) to create plugin for creator. (#306)
* Add UIMesh component for custom 2D mesh rendering

- Add UIMesh component consuming pre-baked vertex/index/segment data, enabling custom renderers (e.g. spine plugin) to batch through the 2D batcher.
- Export UIMesh from the 2d components index.
- Validate setMeshData input at the boundary (stride, buffer lengths, index values, segment ranges, accessor caps) via engine-standard errorIDs 9010-9017, documented in EngineErrorMap.md.
- Expose StaticVBAccessor per-chunk caps as maxVertexCount/maxIndexCount getters and clamp the 10% reserve to them, so meshes that fit (e.g. 30000 vertices) allocate instead of silently failing.
- Add tests/ui/ui-mesh.test.ts covering the 32767 cap boundary, setMeshData validation, and accessor lifetime.

Also takes over node transform and cascaded opacity: vertices are now always
node-local — UIMesh applies the node's world matrix (unbatched via the
per-draw GPU transform the 2D batcher already maintains for middleware,
batched by baking into the shared chunk copy so draws still merge) and folds
the cascaded UIOpacity into the copied vertex colors itself. The legacy
switches (USE_LOCAL / useLocalData / RenderEntity.setUseLocal) are all derived
internally; consumers never touch them. A JSB staleness poll re-prepares the
native draw infos in the same frame on transform/opacity changes, and a
premultipliedAlpha format declaration drives the opacity fold and the builtin
material's blend factors.

Follow-ups folded in: the opacity fold reads the light color at byte offset 20
(the pos*3f + uv*2f header is 20 bytes), not 16; and UIMesh notifies data
producers through the new onPremultipliedAlphaChanged() hook so subclasses
(e.g. the spine plugin) forward the declared format to their baker instead of
redeclaring the field.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Disable built-in spine by default; minor editor/build fixes

- Default the built-in Spine feature (spine-3.8) to off in feature cropping, so it is only included when enabled in the editor.
- Recognize scale as a valid spine atlas page attribute in the texture inspector.
- Skip incomplete platform dirs when bundling runtime adapters.

Co-Authored-By: Claude <noreply@anthropic.com>
(cherry picked from commit 7f7922aaf42ff1857f0a6d38970a75d303032f57)

* Export WebAssembly interface under cc.wasm namespace

- Add exports/webassembly.ts re-exporting pal/wasm (instantiateWasm, fetchBuffer, fetchUrl, ensureWasmModuleReady) as the public cc.wasm namespace, so extensions/game code can load their own .wasm files through the engine's platform-adaptive path.
- Expose it as a croppable feature rather than an unconditional export from exports/base.ts: cc.config.json declares a `webassembly` feature and editor/engine-features/render-config.json adds the panel entry (default on, required), so it appears under Project Settings -> Feature Cropping. The label/description are plain text on purpose — i18n:ENGINE.* keys live in the editor package and a custom engine cannot add them.

(cherry picked from commit 92003ab4a21b6ee753cf3ba2ca0f4767658e9cdc)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(simulator): generic native plugin discovery opt-in

The generic plugin discovery chain (cc_gen_plugin_cmake_hook ->
plugins_parser.js -> Pre-AutoLoadPlulgins.cmake -> find_package ->
plugin_registry) already exists and is what native device builds use; the
simulator never invoked it. Wire it in behind an opt-in cache variable, with
no plugin names or plugin logic in the engine — the plugin set is always just
the scan result:

- templates/cmake/common.cmake: cc_gen_plugin_cmake_hook()'s scan roots
  (CC_PLUGIN_PATH) may now be pre-set by the caller; the native-build
  project-layout defaults are unchanged when nobody pre-defines it
- simulator runtime-src CMakeLists.txt: -DSIMULATOR_PLUGIN_SCAN_DIRS="<dir>
  [;<dir>]" scans those roots for cc_plugin.json through the same chain as
  device builds (CC_PROJECT_DIR points into the build tree so the generated
  hook lands there, satisfying the parser's output-dir invariant); unset
  keeps the stock plugin-less simulator, and a cache variable means plain
  `cmake --build` reuses the configured scan
- simulator Game.cpp: call cc_load_all_plugins() after init, mirroring
  BaseGame::init(), so registered plugins' JSB bindings exist before any
  script runs (no-op when no plugins are linked)
- libsimulator protobuf config.h: skip the <hash_map>/<hash_set> defines on
  MSVC >= 1950 (headers removed); stubs fall back to the std::map emulation
  path

Verified end-to-end: a project extensions/ tree scanned at configure time
produces a simulator exe whose plugins register their JSB bindings at startup
(observed live in the simulator's JS context).

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Developer <developer@cocos.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Engineer <engineer@cocos.com>
2026-11-04 16:41:54 +08:00
James Chen 832f7ad6ee Simulator needs to be built with physics-2d-box2d-jsb feature (#18469) 2025-03-17 15:02:53 +08:00
Y-way 19c19c595d Fix building error for simulator. (#16612)
* Update .cocos-project.json

* Fix build error
2023-12-18 11:49:02 +08:00
mmyduckx 67341c0866 fix simulator restart bug (#14962)
* fix simulator restart bug

* fix close simulator crash due to se destroy
2023-05-08 10:23:55 +08:00
mmyduckx 46da89a5f7 fix editor simulator resize and change landscape not work (#14908)
* fix editor simulator resize
2023-04-25 17:12:19 +08:00
timlyeee cb51f8d569 Dev simulator (#13469)
* Fix simulator start error
2022-11-23 15:28:59 +08:00
江战 280fd976bc Add EventTarget & EventBus (#13100) 2022-10-28 15:44:33 +08:00
minggo e0bfd1d380 Merge branch 'v3.6.0' into merge_v3.6 2022-07-26 12:01:26 +08:00
timlyeee dd25eee8ba disable debug renderer for v3.6 to ignore feature cropping (#12181) 2022-07-25 17:45:30 +08:00
minggo d40b8739bc Merge branch 'v3.6.0' into develop_merge_v3.6 2022-07-18 10:38:14 +08:00
timlyeee d19aa952a3 [Bug fix] copy v8 dlls for unit test and simulator (#11918) 2022-07-11 11:28:56 +08:00
bofeng-song 113fad0259 refine: rename windowHanler to windowHandle, rename onDestory to onDestroy (#11907) 2022-07-09 13:54:18 +08:00
Santy-Wang 6e995a866c adjust decorator execute order (#11794)
fix mesh error
2022-07-01 10:16:11 +08:00
mmyduckx 4b7294a503 fix mac SimulatorApp not init fileUtils when used. (#11743) 2022-06-29 11:28:48 +08:00
timlyeee f8df5aa13a Fix simulator broken (#11679) 2022-06-23 18:37:52 +08:00
minggo 3e818c45c9 Change macro name (#11528)
* CC_PLATFORM_MAC_IOS -> CC_PLATFORM_IOS

* CC_PLATFORM_MAC_OSX -> CC_PLATFORM_MACOS

* add codes to keep compatible
2022-06-16 14:05:16 +08:00
PP 1bd1bf1c57 rename adapters (#11401)
* rename adapters

update

* update adapter require
2022-06-08 14:59:31 +08:00
minggo cc9664405a use c++ 17 (#11389)
* use c++ 17
2022-06-08 10:19:35 +08:00
minggo 84c27e7f71 Merge branch 'v3.5.0' into v3.6.0_merge_v3.5 2022-04-24 13:41:27 +08:00
timlyeee 48e0b18920 add main.mm back while main function is needed for simulator (#10577) (#10697)
* add main.mm back while main function is needed for simulator

* add license
2022-04-08 14:57:18 +08:00
Cocos Robot 307eb701a1 [ci skip][AUTO]: Automated clang-format update: 48787d3a22ada5d0a8220075ac7859eaf8bcba44 (#10655) (#10660)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-04-06 10:28:01 +08:00
timlyeee d0195edb4f set V3.5.0 simulator window position to center (#10655)
* set simulator window position to center.

* add mac support
2022-04-06 09:59:36 +08:00
timlyeee 61988646c1 add main.mm back while main function is needed for simulator (#10577)
* add main.mm back while main function is needed for simulator

* add license
2022-03-29 20:17:03 +08:00
minggo a6bf766170 Merge branch 'v3.5.0' into v3.6_merge_v3.5 2022-03-29 18:26:40 +08:00
qiuguohua 9a5f43d80c Modify the application interface name and remove the js keyword (#10556)
* Modify the application interface name and remove the js keyword
2022-03-29 15:08:49 +08:00
Cocos Robot c62f828551 [ci skip][AUTO]: Automated clang-format update: bdf9ae46e7c60cfc50876fff03424edccb4646e8 (#10543) (#10548)
Co-authored-by: cocos-robot <cocos-robot@cocos.com>
2022-03-28 18:12:33 +08:00
qiuguohua 051e034f3f Put main.cpp in the template (#10543)
* Put main.cpp in the template
2022-03-28 18:03:51 +08:00
timlyeee 7d7f32e24e rename windows process name (#10422)
* remove file description in game.rc, the process name  will keep the same as project name
* add macro definition GAME_NAME for creating window, as no other way to read it.
2022-03-22 10:29:25 +08:00
timlyeee 8f53542267 fix win64 restart crash (#10233)
* fix win64 restart crash

* supply restart fix from v3.4.2/v3.5(supply a default context)
* temp hack for v8::Arraybuffer(abi conflict).
* remove use of windows dll for x86
2022-03-09 16:07:24 +08:00
timlyeee 83734a835c Fix android and ohos load library bug (#4240) 2022-02-08 17:29:41 +08:00
timlyeee abd84ac0e1 rename cocos2d to cocos (#4158)
* Rename cocos2d to cocos
2022-02-08 14:27:42 +08:00
minggo 5410a48a58 Implement more logic in native (#4131)
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com>
Co-authored-by: dumganhar <dumganhar@gmail.com>
Co-authored-by: mmyduckx <308303735@qq.com>
Co-authored-by: Patrice Jiang <397136899@qq.com>
Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
2022-01-07 18:39:40 +08:00
qiuguohua eeb9d5c689 Merge the code of v3.3.1 platform adaptation layer into the development branch (#3958)
* 1、Merge platform adaptation layer code into the development branch
2、It passed the test in windows and ohos system

* 1、Merge platform adaptation layer code into the development branch
2、It passed the test in windows and ohos system

* 1、Fix github compile windows error

* 1、Fix github compile windows error

* 1. Adjust the code format;
2. Fix js automatic generation binding
3. Adjust github CI compilation

* 1. Adjust the code format;
2. Fix js automatic generation binding
3. Adjust github CI compilation

* Solve mac and ios compilation failure

* Fix the problem of compilation of Windows-side simulator

* 1. Adapt the simulator to a new adaptation layer;
2. Fix the compilation warning of ios, and the implicit conversion failed;
3. Fix the mac compilation error, due to the problem of adding the link identification -all_load;

* 1.Add the isDisplayStats and setDisplayStats method to the screen interface

* Fix clang-tidy compilation warning

* Fix clang-tidy compilation warning

* Repair the emulator, compatible with mac and win

* 1、Repair detailed errors, including name modification and calling method modification
2、Delete redundant files in the template directory
3、Change the vibrate interface to vibrator
4、Fix word spelling errors

* Rename interfaces to modules

* Replace CC_ASSERT with CCASSERT

* Replace CC_ASSERT with CCASSERT

Co-authored-by: qiuguohua <>
2021-10-27 10:51:02 +08:00
timlyeee ad048dff55 Change Windows Simulator from X86 to X64 (#3866)
* change simulator version from x86 to x64
* Fix some bugs for x64 version simulator
2021-09-07 09:58:52 +08:00
mmyduckx ae02dfc02e remove old icon format in cmake (#3856)
* remove icon in cmake

* add camke config for AppIcon
2021-09-01 15:20:02 +08:00
mmyduckx f049a58ae2 update icon for all platforms and Appsimulator (#3853) 2021-08-31 19:46:25 +08:00
minggo d261e62ecc merge v3.3.0 and fix conflict 2021-08-13 22:28:13 +08:00
timlyeee 8fa3d5b8d6 Fix simulator restart issue (#3814)
* Fix simulator restart issue
* fix conversion error
2021-08-10 13:52:02 +08:00
timlyeee b9ed0af4fa Fix glslang errors and Edit-box errors (#3802)
* Update cmake list for dynamic library update

* as glslang and tbb become dynamic library, the cmake should copy dll from glslang folder too.
* "gulp gen simulator" command will automatically generate by user's comupter so sometime it will generate x64 version's simulator. no it's update to  generate Win32 version
* Edit-Box was using wrong parameters GWL_WNDPROC, so x64 version will hit an error. details below:https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra

* small optimize gulp

* change config

* Update cmake list for dynamic library update

* as glslang and tbb become dynamic library, the cmake should copy dll from glslang folder too.
* "gulp gen simulator" command will automatically generate by user's comupter so sometime it will generate x64 version's simulator. no it's update to  generate Win32 version
* Edit-Box was using wrong parameters GWL_WNDPROC, so x64 version will hit an error. details below:https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra

* add glslang header

* Revert "Update cmake list for dynamic library update"

This reverts commit 5eceb132c2411d7e479f6744e33048fabaafe780.

* fix rebase error
2021-08-05 17:22:46 +08:00
mmyduckx 7686705eeb remove jsb_module-register.cpp from native (#3776) 2021-08-05 16:14:53 +08:00
mmyduckx 9e9c1a2b3e Fix appSimulator crash when closing on mac (#3787) 2021-07-30 11:59:29 +08:00
Yun Hsiao Wu 1ebe420662 structure adjustments (#3532) 2021-06-02 09:39:13 +08:00
mmyduckx 76d15cafa4 send close event to JS (#3527) 2021-05-21 11:37:13 +08:00
jiaxin.lai d23e039d2c native physx (#3409) 2021-04-20 12:51:52 +08:00
PP c2d51e9507 fix simulator compiling on Win32 (#3397) 2021-04-14 15:39:38 +08:00
PP a9f42d9c1f fix simulator compiling (#3373) 2021-04-02 09:59:06 +08:00
PP 7b2ef5d882 remove header cocos2d-x.h on win32 (#3259) 2021-01-28 15:02:19 +08:00
江战 9d2a984777 remove header cocos2d.h (#3257) 2021-01-28 10:46:12 +08:00
PP e90d0957f3 support spine && dragonBone on simulator (#3171) 2020-12-30 20:02:08 +08:00