mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
Support spine version 4.2 (#18325)
This commit is contained in:
@@ -44,8 +44,6 @@ jobs:
|
||||
echo "set(CC_USE_GLES3 ON)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(CC_USE_VULKAN ON)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(CC_USE_GLES2 ON)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(USE_SPINE OFF)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(USE_DRAGONBONES OFF)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(USE_WEBSOCKET_SERVER ON)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-win64/proj/cfg.cmake
|
||||
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-win64/proj/cfg.cmake
|
||||
@@ -193,6 +191,8 @@ jobs:
|
||||
echo "set(USE_BOX2D_JSB ON)" >> build-android/proj/cfg.cmake
|
||||
echo "set(USE_WEBSOCKET_SERVER ON)" >> build-android/proj/cfg.cmake
|
||||
echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-android/proj/cfg.cmake
|
||||
echo "set(USE_SPINE_3_8 OFF)" >> build-android/proj/cfg.cmake
|
||||
echo "set(USE_SPINE_4_2 ON)" >> build-android/proj/cfg.cmake
|
||||
echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-android/proj/cfg.cmake
|
||||
echo "set(CC_EXECUTABLE_NAME \"\")" >> build-android/proj/cfg.cmake
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ if (args.length == 0) {
|
||||
console.error('Please specify the engine root path');
|
||||
process.exit(1);
|
||||
}
|
||||
const engineRoot = args[0];
|
||||
|
||||
const engineRoot = args[0];
|
||||
console.log(`Engine root: ${engineRoot}`);
|
||||
|
||||
const features2DCommon = [
|
||||
@@ -30,7 +30,8 @@ const features2DCommon = [
|
||||
"physics-2d-box2d-wasm",
|
||||
"profiler",
|
||||
"rich-text",
|
||||
"spine",
|
||||
"spine", // Old version uses 'spine' feature
|
||||
"spine-3.8", // New version uses 'spine-xxx' feature
|
||||
"tiled-map",
|
||||
"tween",
|
||||
"ui",
|
||||
@@ -115,13 +116,24 @@ async function buildEngineForFeatures(options) {
|
||||
const excludeFeatures = [
|
||||
'vendor-google',
|
||||
'xr',
|
||||
'spine-3.8',
|
||||
'spine-4.2',
|
||||
];
|
||||
|
||||
const allFeatures = statsQuery.getFeatures().filter(feature => !excludeFeatures.includes(feature));
|
||||
console.log(`all features: [ ${allFeatures.join(', ')} ]`);
|
||||
const allFeaturesForWeChat = [...allFeatures, 'spine-3.8'];
|
||||
let allFeaturesForWeb = [...allFeatures, 'spine-4.2'];
|
||||
|
||||
if (!fs.pathExistsSync(ps.join(engineRoot, 'cocos', 'spine', 'lib', 'spine-version-4.2.ts'))) {
|
||||
console.log(`Doesn't found spine-version-4.2.ts`);
|
||||
allFeaturesForWeb = allFeaturesForWeChat;
|
||||
} else {
|
||||
console.log(`Found spine-version-4.2.ts`);
|
||||
}
|
||||
|
||||
await buildEngineForFeatures({
|
||||
features: allFeatures,
|
||||
features: allFeaturesForWeChat,
|
||||
outDir: ps.join(engineRoot, 'build-cc-out-all'),
|
||||
noDeprecatedFeatures: false,
|
||||
platform: "WECHAT",
|
||||
@@ -130,7 +142,7 @@ async function buildEngineForFeatures(options) {
|
||||
});
|
||||
|
||||
await buildEngineForFeatures({
|
||||
features: allFeatures,
|
||||
features: allFeaturesForWeb,
|
||||
outDir: ps.join(engineRoot, 'build-cc-out-all-web'),
|
||||
noDeprecatedFeatures: false,
|
||||
platform: "HTML5",
|
||||
|
||||
@@ -96,6 +96,17 @@ jobs:
|
||||
echo "HEAD LOG:"
|
||||
git --no-pager log -3
|
||||
|
||||
- name: Check for SPINE_VERSION in CMakeLists.txt (BASE)
|
||||
run: |
|
||||
cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
if grep -q "SPINE_VERSION" CMakeLists.txt; then
|
||||
echo "FOUND_SPINE_VERSION_BASE=true"
|
||||
echo "FOUND_SPINE_VERSION_BASE=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "FOUND_SPINE_VERSION_BASE=false"
|
||||
echo "FOUND_SPINE_VERSION_BASE=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- run: |
|
||||
echo "EXT_VERSION=$(node ./engine/.github/workflows/get-native-external-version.js)" >> $GITHUB_ENV
|
||||
|
||||
@@ -116,41 +127,94 @@ jobs:
|
||||
echo "--------------------------------- Apply patches DONE! ---------------------------------"
|
||||
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
|
||||
|
||||
- name: Build Spine WASM (BASE)
|
||||
run: |
|
||||
cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
mkdir build-wasm
|
||||
cd build-wasm
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
# - name: Build Spine 3.8 WASM (BASE)
|
||||
# run: |
|
||||
# cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
# rm -rf build-wasm
|
||||
# mkdir build-wasm
|
||||
# cd build-wasm
|
||||
# emcmake cmake .. -GNinja
|
||||
# ninja
|
||||
# ls -l
|
||||
|
||||
- name: Build Spine ASMJS (BASE)
|
||||
run: |
|
||||
cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
mkdir build-asmjs
|
||||
cd build-asmjs
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
# - name: Build Spine 3.8 ASMJS (BASE)
|
||||
# run: |
|
||||
# cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
# sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
# rm -rf build-asmjs
|
||||
# mkdir build-asmjs
|
||||
# cd build-asmjs
|
||||
# emcmake cmake .. -GNinja
|
||||
# ninja
|
||||
# ls -l
|
||||
|
||||
- name: Copy files to external directory (BASE)
|
||||
run: |
|
||||
rm -rf dist
|
||||
mkdir dist
|
||||
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
|
||||
cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
|
||||
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
|
||||
cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
|
||||
echo "-------- Before replace spine wasm -----------"
|
||||
ls -l ./engine/native/external/emscripten/spine/
|
||||
cp -f ./dist/* ./engine/native/external/emscripten/spine/
|
||||
echo "-------- After replace spine wasm ------------"
|
||||
ls -l ./engine/native/external/emscripten/spine/
|
||||
echo "-----------------------------------------------"
|
||||
cd ./engine/native/external
|
||||
git status
|
||||
# - name: Copy Spine 3.8 files to external directory (BASE)
|
||||
# run: |
|
||||
# if [[ $FOUND_SPINE_VERSION_BASE ]]; then
|
||||
# SPINE_VERSION="3.8"
|
||||
# fi
|
||||
# DIST_PATH="dist/3.8"
|
||||
# rm -rf $DIST_PATH
|
||||
# mkdir -p $DIST_PATH
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
# mkdir -p ./engine/native/external/emscripten/spine/$SPINE_VERSION
|
||||
# echo "-------- Before replace spine wasm -----------"
|
||||
# ls -l ./engine/native/external/emscripten/spine/$SPINE_VERSION
|
||||
# cp -f ./$DIST_PATH/* ./engine/native/external/emscripten/spine/$SPINE_VERSION
|
||||
# echo "-------- After replace spine wasm ------------"
|
||||
# ls -l ./engine/native/external/emscripten/spine/$SPINE_VERSION
|
||||
# echo "-----------------------------------------------"
|
||||
# cd ./engine/native/external
|
||||
# git status
|
||||
|
||||
# - name: Build Spine 4.2 WASM (BASE)
|
||||
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
|
||||
# run: |
|
||||
# cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
# sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
|
||||
# sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
# rm -rf build-wasm
|
||||
# mkdir build-wasm
|
||||
# cd build-wasm
|
||||
# emcmake cmake .. -GNinja
|
||||
# ninja
|
||||
# ls -l
|
||||
|
||||
# - name: Build Spine 4.2 ASMJS (BASE)
|
||||
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
|
||||
# run: |
|
||||
# cd ./engine/native/cocos/editor-support/spine-wasm
|
||||
# sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
# sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
# rm -rf build-asmjs
|
||||
# mkdir build-asmjs
|
||||
# cd build-asmjs
|
||||
# emcmake cmake .. -GNinja
|
||||
# ninja
|
||||
# ls -l
|
||||
|
||||
# - name: Copy Spine 4.2 files to external directory (BASE)
|
||||
# if: env.FOUND_SPINE_VERSION_BASE == 'true'
|
||||
# run: |
|
||||
# DIST_PATH="dist/4.2"
|
||||
# rm -rf $DIST_PATH
|
||||
# mkdir -p $DIST_PATH
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
# cp ./engine/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
# mkdir -p ./engine/native/external/emscripten/spine/4.2/
|
||||
# echo "-------- Before replace spine wasm -----------"
|
||||
# ls -l ./engine/native/external/emscripten/spine/4.2/
|
||||
# cp -f ./$DIST_PATH/* ./engine/native/external/emscripten/spine/4.2/
|
||||
# echo "-------- After replace spine wasm ------------"
|
||||
# ls -l ./engine/native/external/emscripten/spine/4.2/
|
||||
# echo "-----------------------------------------------"
|
||||
# cd ./engine/native/external
|
||||
# git status
|
||||
|
||||
- name: Build Base Declarations
|
||||
working-directory: .
|
||||
@@ -195,7 +259,7 @@ jobs:
|
||||
echo "--------------------------------- Apply patches DONE! ---------------------------------"
|
||||
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
|
||||
|
||||
- name: Build Spine WASM (HEAD)
|
||||
- name: Build Spine 3.8 WASM (HEAD)
|
||||
run: |
|
||||
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
|
||||
mkdir build-wasm
|
||||
@@ -204,7 +268,7 @@ jobs:
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Build Spine ASMJS (HEAD)
|
||||
- name: Build Spine 3.8 ASMJS (HEAD)
|
||||
run: |
|
||||
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
@@ -214,19 +278,64 @@ jobs:
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Copy files to external directory (HEAD)
|
||||
- name: Copy Spine 3.8 files to external directory (HEAD)
|
||||
run: |
|
||||
rm -rf dist
|
||||
mkdir dist
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
|
||||
DIST_PATH="dist/3.8"
|
||||
rm -rf $DIST_PATH
|
||||
mkdir -p $DIST_PATH
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
echo "-------- Before replace spine wasm -----------"
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/
|
||||
cp -f ./dist/* ./engine-HEAD/native/external/emscripten/spine/
|
||||
mkdir -p ./engine-HEAD/native/external/emscripten/spine/3.8
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/3.8
|
||||
cp -f ./$DIST_PATH/* ./engine-HEAD/native/external/emscripten/spine/3.8
|
||||
echo "-------- After replace spine wasm ------------"
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/3.8
|
||||
echo "-----------------------------------------------"
|
||||
cd ./engine-HEAD/native/external
|
||||
git status
|
||||
|
||||
- name: Build Spine 4.2 WASM (HEAD)
|
||||
run: |
|
||||
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
|
||||
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
rm -rf build-wasm
|
||||
mkdir build-wasm
|
||||
cd build-wasm
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Build Spine 4.2 ASMJS (HEAD)
|
||||
run: |
|
||||
cd ./engine-HEAD/native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
rm -rf build-asmjs
|
||||
mkdir build-asmjs
|
||||
cd build-asmjs
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Copy Spine 4.2 files to external directory (HEAD)
|
||||
run: |
|
||||
DIST_PATH="dist/4.2"
|
||||
rm -rf $DIST_PATH
|
||||
mkdir -p $DIST_PATH
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
cp ./engine-HEAD/native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
echo "-------- Before replace spine wasm -----------"
|
||||
mkdir -p ./engine-HEAD/native/external/emscripten/spine/4.2/
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/4.2/
|
||||
cp -f ./$DIST_PATH/* ./engine-HEAD/native/external/emscripten/spine/4.2/
|
||||
echo "-------- After replace spine wasm ------------"
|
||||
ls -l ./engine-HEAD/native/external/emscripten/spine/4.2/
|
||||
echo "-----------------------------------------------"
|
||||
cd ./engine-HEAD/native/external
|
||||
git status
|
||||
|
||||
@@ -18,12 +18,127 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18.x'
|
||||
|
||||
- name: Setup emsdk
|
||||
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
|
||||
with:
|
||||
version: 3.1.41
|
||||
actions-cache-folder: 'emsdk-cache-3.1.41'
|
||||
|
||||
- name: Verify
|
||||
run: |
|
||||
which emcc
|
||||
emcc -v
|
||||
|
||||
- name: Install ninja
|
||||
run: |
|
||||
if ! command -v ninja &> /dev/null; then
|
||||
echo "Ninja not found, installing..."
|
||||
# sudo apt update
|
||||
sudo apt install ninja-build
|
||||
else
|
||||
echo "Ninja is already installed."
|
||||
fi
|
||||
which ninja
|
||||
|
||||
- name: Download external
|
||||
run: |
|
||||
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
|
||||
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
|
||||
|
||||
- name: Apply emscripten patches
|
||||
run: |
|
||||
echo "--------------------------------- Save bind.cpp ---------------------------------"
|
||||
cp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak
|
||||
echo "--------------------------------- Apply embind bind.cpp patches ---------------------------------"
|
||||
cp -f ./.github/workflows/emscripten-patches/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/
|
||||
echo "--------------------------------- Apply patches DONE! ---------------------------------"
|
||||
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
|
||||
|
||||
- name: Build Spine 3.8 WASM
|
||||
run: |
|
||||
cd ./native/cocos/editor-support/spine-wasm
|
||||
rm -rf build-wasm
|
||||
mkdir build-wasm
|
||||
cd build-wasm
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Build Spine 3.8 ASMJS
|
||||
run: |
|
||||
cd ./native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
rm -rf build-asmjs
|
||||
mkdir build-asmjs
|
||||
cd build-asmjs
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Copy Spine 3.8 files to external directory
|
||||
run: |
|
||||
SPINE_VERSION="3.8"
|
||||
DIST_PATH="dist/3.8"
|
||||
rm -rf $DIST_PATH
|
||||
mkdir -p $DIST_PATH
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
mkdir -p ./native/external/emscripten/spine/$SPINE_VERSION
|
||||
echo "-------- Before replace spine wasm -----------"
|
||||
ls -l ./native/external/emscripten/spine/$SPINE_VERSION
|
||||
cp -f ./$DIST_PATH/* ./native/external/emscripten/spine/$SPINE_VERSION
|
||||
echo "-------- After replace spine wasm ------------"
|
||||
ls -l ./native/external/emscripten/spine/$SPINE_VERSION
|
||||
echo "-----------------------------------------------"
|
||||
cd ./native/external
|
||||
git status
|
||||
|
||||
- name: Build Spine 4.2 WASM
|
||||
run: |
|
||||
cd ./native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
|
||||
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
rm -rf build-wasm
|
||||
mkdir build-wasm
|
||||
cd build-wasm
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Build Spine 4.2 ASMJS
|
||||
run: |
|
||||
cd ./native/cocos/editor-support/spine-wasm
|
||||
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
|
||||
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
|
||||
rm -rf build-asmjs
|
||||
mkdir build-asmjs
|
||||
cd build-asmjs
|
||||
emcmake cmake .. -GNinja
|
||||
ninja
|
||||
ls -l
|
||||
|
||||
- name: Copy Spine 4.2 files to external directory
|
||||
run: |
|
||||
DIST_PATH="dist/4.2"
|
||||
rm -rf $DIST_PATH
|
||||
mkdir -p $DIST_PATH
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
|
||||
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
|
||||
mkdir -p ./native/external/emscripten/spine/4.2/
|
||||
echo "-------- Before replace spine wasm -----------"
|
||||
ls -l ./native/external/emscripten/spine/4.2/
|
||||
cp -f ./$DIST_PATH/* ./native/external/emscripten/spine/4.2/
|
||||
echo "-------- After replace spine wasm ------------"
|
||||
ls -l ./native/external/emscripten/spine/4.2/
|
||||
echo "-----------------------------------------------"
|
||||
cd ./native/external
|
||||
git status
|
||||
|
||||
- name: npm install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
Vendored
+13
-1
@@ -19,7 +19,19 @@
|
||||
"source.fixAll": "explicit",
|
||||
},
|
||||
"files.associations": {
|
||||
"iterator": "cpp"
|
||||
"*.cmake": "makefile",
|
||||
"iterator": "cpp",
|
||||
"*.ipp": "cpp",
|
||||
"filesystem": "cpp",
|
||||
"chrono": "cpp",
|
||||
"random": "cpp",
|
||||
"string": "cpp",
|
||||
"regex": "cpp",
|
||||
"xlocale": "cpp",
|
||||
"xstring": "cpp",
|
||||
"tuple": "cpp",
|
||||
"vector": "cpp",
|
||||
"istream": "c"
|
||||
},
|
||||
"cmake.configureOnOpen": false,
|
||||
}
|
||||
|
||||
+48
-4
@@ -277,7 +277,7 @@ Failed to initialize render pipeline.
|
||||
|
||||
### 1223
|
||||
|
||||
Custom pipeline and legacy pipeline are all culled.
|
||||
Custom pipeline and legacy pipeline are all culled.
|
||||
|
||||
### 1300
|
||||
|
||||
@@ -3471,7 +3471,7 @@ The shadow visible distance is so small that CSM stratification is not effective
|
||||
|
||||
### 15004
|
||||
|
||||
The native folder may be generated from older versions, please refer https://docs.cocos.com/creator/manual/en/release-notes/ to upgrade.
|
||||
The native folder may be generated from older versions, please refer <https://docs.cocos.com/creator/manual/en/release-notes/> to upgrade.
|
||||
|
||||
### 15100
|
||||
|
||||
@@ -3495,11 +3495,11 @@ Camera '%s' clear flag is skybox, but skybox is disabled, may cause strange bac
|
||||
|
||||
### 16101
|
||||
|
||||
The effect('%s') you are looking for does not exist, please confirm the effect name in the editor. NOTE: Since 3.6, the name of the built-in effect has been changed to its name in the editor, please check it out. More information please refer to https://docs.cocos.com/creator/manual/en/shader/effect-inspector.html
|
||||
The effect('%s') you are looking for does not exist, please confirm the effect name in the editor. NOTE: Since 3.6, the name of the built-in effect has been changed to its name in the editor, please check it out. More information please refer to <https://docs.cocos.com/creator/manual/en/shader/effect-inspector.html>
|
||||
|
||||
### 16201
|
||||
|
||||
The asset replacing failed, can not found override asset('%s') for '%s'
|
||||
The asset replacing failed, can not found override asset('%s') for '%s'
|
||||
|
||||
### 16301
|
||||
|
||||
@@ -3932,3 +3932,47 @@ Spline error: invalid mode
|
||||
### 16408
|
||||
|
||||
[Physics2D] b2PolygonShape failed to decompose polygon into convex polygons, node name: %s
|
||||
|
||||
### 16409
|
||||
|
||||
setVertexEffectDelegate is deprecated since spine 4.2.
|
||||
|
||||
### 16410
|
||||
|
||||
Debug bones or slots is invalid in cached mode.
|
||||
|
||||
### 16411
|
||||
|
||||
Slots visible range can not be modified in cached mode.
|
||||
|
||||
### 16412
|
||||
|
||||
Track index can not greater than 0 in cached mode.
|
||||
|
||||
### 16413
|
||||
|
||||
Track index can not greater than 0 in cached mode.
|
||||
|
||||
### 16414
|
||||
|
||||
'getCurrent' interface can not be invoked in cached mode.
|
||||
|
||||
### 16415
|
||||
|
||||
cached mode not support setMix!!!
|
||||
|
||||
### 16416
|
||||
|
||||
'clearTracks' interface can not be invoked in cached mode.
|
||||
|
||||
### 16417
|
||||
|
||||
'clearTrack' interface can not be invoked in cached mode.
|
||||
|
||||
### 16418
|
||||
|
||||
Debug bones or slots is invalid in cached mode.
|
||||
|
||||
### 16419
|
||||
|
||||
Spine version not supported.
|
||||
|
||||
+32
-2
@@ -193,13 +193,27 @@
|
||||
"vendor-google": {
|
||||
"modules": ["vendor-google"]
|
||||
},
|
||||
"spine": {
|
||||
"spine-3.8": {
|
||||
"modules": ["spine"],
|
||||
"dependentAssets": [
|
||||
"c27215d8-6835-4b68-bfbb-bdeac6100c04",
|
||||
"b5d6115f-0370-4d7c-aad3-c194cc71cf98"
|
||||
],
|
||||
"dependentModules": ["2d"]
|
||||
"dependentModules": ["2d"],
|
||||
"intrinsicFlags": {
|
||||
"SPINE_3_8": true
|
||||
}
|
||||
},
|
||||
"spine-4.2": {
|
||||
"modules": ["spine"],
|
||||
"dependentAssets": [
|
||||
"c27215d8-6835-4b68-bfbb-bdeac6100c04",
|
||||
"b5d6115f-0370-4d7c-aad3-c194cc71cf98"
|
||||
],
|
||||
"dependentModules": ["2d"],
|
||||
"intrinsicFlags": {
|
||||
"SPINE_4_2": true
|
||||
}
|
||||
},
|
||||
"dragon-bones": {
|
||||
"modules": ["dragon-bones"],
|
||||
@@ -429,6 +443,22 @@
|
||||
"overrides": {
|
||||
"cocos/animation/marionette/pose-graph/runtime-exports.ts": "cocos/animation/marionette/pose-graph/runtime-exports-empty.ts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"test": "context.buildTimeConstants.SPINE_3_8",
|
||||
"isVirtualModule": false,
|
||||
"overrides": {
|
||||
"cocos/spine/lib/spine-version.ts": "cocos/spine/lib/spine-version-3.8.ts",
|
||||
"cocos/spine/lib/spine-instantiate.ts": "cocos/spine/lib/spine-instantiate-3.8.ts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"test": "context.buildTimeConstants.SPINE_4_2",
|
||||
"isVirtualModule": false,
|
||||
"overrides": {
|
||||
"cocos/spine/lib/spine-version.ts": "cocos/spine/lib/spine-version-4.2.ts",
|
||||
"cocos/spine/lib/spine-instantiate.ts": "cocos/spine/lib/spine-instantiate-4.2.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"includes": [
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import { ccenum } from '../core';
|
||||
import { legacyCC } from '../core/global-exports';
|
||||
import spineLib from './lib/spine-core';
|
||||
import { SPINE_VERSION } from './lib/spine-version';
|
||||
|
||||
/**
|
||||
* @en
|
||||
@@ -47,6 +48,7 @@ import spineLib from './lib/spine-core';
|
||||
export * from './skeleton';
|
||||
export * from './skeleton-data';
|
||||
export * from './assembler';
|
||||
export * from './lib/spine-version';
|
||||
|
||||
export const spine = globalThis.spine;
|
||||
spine.EventType = spineLib.EventType
|
||||
@@ -111,6 +113,7 @@ export enum AnimationEventType {
|
||||
ccenum(AnimationEventType);
|
||||
|
||||
legacyCC.internal.SpineAnimationEventType = AnimationEventType;
|
||||
legacyCC.internal.SPINE_VERSION = SPINE_VERSION;
|
||||
|
||||
export function loadWasmModuleSpine (): Promise<void> {
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -49,6 +49,7 @@ export * from './skeleton';
|
||||
export * from './skeleton-data';
|
||||
export * from './vertex-effect-delegate';
|
||||
export * from './assembler';
|
||||
export * from './lib/spine-version';
|
||||
|
||||
export { spine };
|
||||
|
||||
|
||||
@@ -22,108 +22,15 @@
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { instantiateWasm, fetchBuffer, ensureWasmModuleReady } from 'pal/wasm';
|
||||
import { BUILD, JSB, LOAD_SPINE_MANUALLY, NATIVE_CODE_BUNDLE_MODE } from 'internal:constants';
|
||||
import { BUILD, JSB, LOAD_SPINE_MANUALLY } from 'internal:constants';
|
||||
import { game } from '../../game';
|
||||
import { error, sys } from '../../core';
|
||||
import { NativeCodeBundleMode } from '../../misc/webassembly-support';
|
||||
import { overrideSpineDefine } from './spine-define';
|
||||
|
||||
const PAGESIZE = 65536; // 64KiB
|
||||
|
||||
// How many pages of the wasm memory
|
||||
// TODO: let this can be canfiguable by user.
|
||||
const PAGECOUNT = 32 * 16;
|
||||
|
||||
// How mush memory size of the wasm memory
|
||||
const MEMORYSIZE = PAGESIZE * PAGECOUNT; // 32 MiB
|
||||
|
||||
let wasmInstance: SpineWasm.instance = null!;
|
||||
const registerList: any[] = [];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function initWasm (wasmFactory, wasmUrl: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const errorMessage = (err: any): string => `[Spine]: Spine wasm load failed: ${err}`;
|
||||
wasmFactory({
|
||||
instantiateWasm (
|
||||
importObject: WebAssembly.Imports,
|
||||
receiveInstance: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void,
|
||||
) {
|
||||
// NOTE: the Promise return by instantiateWasm hook can't be caught.
|
||||
instantiateWasm(wasmUrl, importObject).then((result) => {
|
||||
receiveInstance(result.instance, result.module);
|
||||
}).catch((err) => reject(errorMessage(err)));
|
||||
},
|
||||
}).then((Instance: any) => {
|
||||
wasmInstance = Instance;
|
||||
registerList.forEach((cb) => {
|
||||
cb(wasmInstance);
|
||||
});
|
||||
}).then(resolve).catch((err: any) => reject(errorMessage(err)));
|
||||
});
|
||||
}
|
||||
|
||||
function initAsmJS (asmFactory, asmJsMemUrl: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
fetchBuffer(asmJsMemUrl).then((arrayBuffer) => {
|
||||
const wasmMemory: any = {};
|
||||
wasmMemory.buffer = new ArrayBuffer(MEMORYSIZE);
|
||||
const module = {
|
||||
wasmMemory,
|
||||
memoryInitializerRequest: {
|
||||
response: arrayBuffer,
|
||||
status: 200,
|
||||
} as Partial<XMLHttpRequest>,
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return asmFactory(module).then((instance: any) => {
|
||||
wasmInstance = instance;
|
||||
registerList.forEach((cb) => {
|
||||
cb(wasmInstance);
|
||||
});
|
||||
});
|
||||
}).then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
function shouldUseWasmModule (): boolean {
|
||||
if (NATIVE_CODE_BUNDLE_MODE === (NativeCodeBundleMode.BOTH as number)) {
|
||||
return sys.hasFeature(sys.Feature.WASM);
|
||||
} else if (NATIVE_CODE_BUNDLE_MODE === (NativeCodeBundleMode.WASM as number)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function waitForSpineWasmInstantiation (): Promise<void> {
|
||||
const errorReport = (msg: any): void => { error(msg); };
|
||||
return ensureWasmModuleReady().then(() => {
|
||||
if (shouldUseWasmModule()) {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/spine.wasm.js'),
|
||||
import('external:emscripten/spine/spine.wasm'),
|
||||
]).then(([
|
||||
{ default: wasmFactory },
|
||||
{ default: spineWasmUrl },
|
||||
]) => initWasm(wasmFactory, spineWasmUrl));
|
||||
} else {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/spine.asm.js'),
|
||||
import('external:emscripten/spine/spine.js.mem'),
|
||||
]).then(([
|
||||
{ default: asmFactory },
|
||||
{ default: asmJsMemUrl },
|
||||
]) => initAsmJS(asmFactory, asmJsMemUrl));
|
||||
}
|
||||
}).catch(errorReport);
|
||||
}
|
||||
import './spine-define'; // Make spine._overrideSpineDefine take effect.
|
||||
import { waitForSpineWasmInstantiation } from './spine-instantiate';
|
||||
|
||||
if (!JSB && (!BUILD || !LOAD_SPINE_MANUALLY)) {
|
||||
game.onPostInfrastructureInitDelegate.add(waitForSpineWasmInstantiation);
|
||||
}
|
||||
|
||||
registerList.push(overrideSpineDefine);
|
||||
export { waitForSpineWasmInstantiation };
|
||||
|
||||
export const SPINE_WASM = 1;
|
||||
|
||||
Vendored
+140
-1
@@ -50,10 +50,35 @@ declare namespace spine {
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
hasTimeline(id: number): boolean;
|
||||
}
|
||||
interface Timeline {
|
||||
|
||||
abstract class Timeline {
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
frames: ArrayLike<number>;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getPropertyIds(): ArrayLike<number>;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
getPropertyId(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameCount(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameEntries(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getDuration(): number;
|
||||
}
|
||||
|
||||
enum MixBlend {
|
||||
setup = 0,
|
||||
first = 1,
|
||||
@@ -86,9 +111,28 @@ declare namespace spine {
|
||||
static readonly STEPPED: number;
|
||||
static readonly BEZIER: number;
|
||||
static readonly BEZIER_SIZE: number;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
abstract getPropertyId(): number;
|
||||
constructor(frameCount: number);
|
||||
getFrameCount(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
frames: ArrayLike<number>;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getPropertyIds(): ArrayLike<number>;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameEntries(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getDuration(): number;
|
||||
setLinear(frameIndex: number): void;
|
||||
setStepped(frameIndex: number): void;
|
||||
getCurveType(frameIndex: number): number;
|
||||
@@ -102,16 +146,28 @@ declare namespace spine {
|
||||
static PREV_ROTATION: number;
|
||||
static ROTATION: number;
|
||||
boneIndex: number;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
frames: ArrayLike<number>;
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
getPropertyId(): number;
|
||||
setFrame(frameIndex: number, time: number, degrees: number): void;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
}
|
||||
class TranslateTimeline extends CurveTimeline {
|
||||
static readonly ENTRIES: number;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
frames: ArrayLike<number>;
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
getPropertyId(): number;
|
||||
setFrame(frameIndex: number, time: number, x: number, y: number): void;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
@@ -123,9 +179,16 @@ declare namespace spine {
|
||||
}
|
||||
class ShearTimeline extends TranslateTimeline {
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
getPropertyId(): number;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
class ColorTimeline extends CurveTimeline {
|
||||
static ENTRIES: number;
|
||||
slotIndex: number;
|
||||
@@ -137,6 +200,10 @@ declare namespace spine {
|
||||
setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
class TwoColorTimeline extends CurveTimeline {
|
||||
static readonly ENTRIES: number;
|
||||
slotIndex: number;
|
||||
@@ -148,11 +215,38 @@ declare namespace spine {
|
||||
setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number, r2: number, g2: number, b2: number): void;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
class RGBATimeline extends CurveTimeline {
|
||||
static ENTRIES: number;
|
||||
slotIndex: number;
|
||||
constructor(frameCount: number, bezierCount: number, slotIndex: number);
|
||||
getSlotIndex(): number;
|
||||
getPropertyId(): number;
|
||||
setSlotIndex(inValue: number): void;
|
||||
setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
|
||||
apply(skeleton: Skeleton, lastTime: number, time: number, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||
}
|
||||
|
||||
class AttachmentTimeline implements Timeline {
|
||||
slotIndex: number;
|
||||
frames: ArrayLike<number>;
|
||||
attachmentNames: Array<string>;
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getPropertyIds(): ArrayLike<number>;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameEntries(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getDuration(): number;
|
||||
getPropertyId(): number;
|
||||
getFrameCount(): number;
|
||||
getSlotIndex(): number;
|
||||
@@ -175,6 +269,18 @@ declare namespace spine {
|
||||
frames: ArrayLike<number>;
|
||||
events: Array<Event>;
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getPropertyIds(): ArrayLike<number>;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameEntries(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getDuration(): number;
|
||||
getPropertyId(): number;
|
||||
getFrameCount(): number;
|
||||
setFrame(frameIndex: number, event: Event): void;
|
||||
@@ -184,6 +290,18 @@ declare namespace spine {
|
||||
frames: ArrayLike<number>;
|
||||
drawOrders: Array<Array<number>>;
|
||||
constructor(frameCount: number);
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getPropertyIds(): ArrayLike<number>;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getFrameEntries(): number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
getDuration(): number;
|
||||
getPropertyId(): number;
|
||||
getFrameCount(): number;
|
||||
setFrame(frameIndex: number, time: number, drawOrder: Array<number>): void;
|
||||
@@ -528,8 +646,26 @@ declare namespace spine {
|
||||
offsetRotation: number;
|
||||
position: number;
|
||||
spacing: number;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
rotateMix: number;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
translateMix: number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
mixRotate: number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
mixX: number;
|
||||
/**
|
||||
* @version 4.2
|
||||
*/
|
||||
mixY: number;
|
||||
constructor(name: string);
|
||||
}
|
||||
enum PositionMode {
|
||||
@@ -688,6 +824,9 @@ declare namespace spine {
|
||||
findBone(boneName: string): BoneData;
|
||||
findBoneIndex(boneName: string): number;
|
||||
findSlot(slotName: string): SlotData;
|
||||
/**
|
||||
* @version 3.8, deprecated in 4.2
|
||||
*/
|
||||
findSlotIndex(slotName: string): number;
|
||||
findSkin(skinName: string): Skin;
|
||||
findEvent(eventDataName: string): EventData;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
/* eslint @typescript-eslint/no-unsafe-argument: "off" */
|
||||
|
||||
import spine from './spine-core';
|
||||
import { SPINE_VERSION } from './spine-version';
|
||||
import { js } from '../../core';
|
||||
|
||||
function resizeArray (array: any[], newSize: number): any[] {
|
||||
@@ -272,9 +273,16 @@ function overrideProperty_ColorTimeline (): void {
|
||||
overrideDefineArrayProp(prototype, prototype.getFrames, 'frames');
|
||||
}
|
||||
|
||||
function overrideProperty_Timeline (): void {
|
||||
const prototype = spine.Timeline.prototype as any;
|
||||
overrideDefineArrayProp(prototype, prototype.getFrames, 'frames');
|
||||
}
|
||||
|
||||
function overrideProperty_AttachmentTimeline (): void {
|
||||
const prototype = spine.AttachmentTimeline.prototype as any;
|
||||
overrideDefineArrayProp(prototype, prototype.getFrames, 'frames');
|
||||
if (SPINE_VERSION === '3.8') {
|
||||
overrideDefineArrayProp(prototype, prototype.getFrames, 'frames');
|
||||
}
|
||||
overrideDefineArrayProp(prototype, prototype.getAttachmentNames, 'attachmentNames');
|
||||
}
|
||||
|
||||
@@ -335,7 +343,11 @@ export function overrideSpineDefine (wasm): void {
|
||||
overrideProperty_SkinEntry();
|
||||
overrideProperty_SkeletonData();
|
||||
overrideProperty_RotateTimeline();
|
||||
overrideProperty_ColorTimeline();
|
||||
if (SPINE_VERSION === '3.8') {
|
||||
overrideProperty_ColorTimeline();
|
||||
} else if (SPINE_VERSION === '4.2') {
|
||||
overrideProperty_Timeline();
|
||||
}
|
||||
overrideProperty_AttachmentTimeline();
|
||||
overrideProperty_DeformTimeline();
|
||||
overrideProperty_EventTimeline();
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
import { ensureWasmModuleReady } from 'pal/wasm';
|
||||
import { error } from '../../core';
|
||||
import { shouldUseWasmModule, initWasm, initAsmJS } from './spine-wasm-utils';
|
||||
|
||||
export function waitForSpineWasmInstantiation (): Promise<void> {
|
||||
const errorReport = (msg: any): void => { error(msg); };
|
||||
return ensureWasmModuleReady().then((): Promise<void> => {
|
||||
//We should use static code here, import operation will cause file copy to cache folder.
|
||||
if (shouldUseWasmModule()) {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/3.8/spine.wasm.js'),
|
||||
import('external:emscripten/spine/3.8/spine.wasm'),
|
||||
]).then(([
|
||||
{ default: wasmFactory },
|
||||
{ default: spineWasmUrl },
|
||||
]) => initWasm(wasmFactory, spineWasmUrl));
|
||||
} else {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/3.8/spine.asm.js'),
|
||||
import('external:emscripten/spine/3.8/spine.js.mem'),
|
||||
]).then(([
|
||||
{ default: asmFactory },
|
||||
{ default: asmJsMemUrl },
|
||||
]) => initAsmJS(asmFactory, asmJsMemUrl));
|
||||
}
|
||||
}).catch(errorReport);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { ensureWasmModuleReady } from 'pal/wasm';
|
||||
import { error } from '../../core';
|
||||
import { shouldUseWasmModule, initWasm, initAsmJS } from './spine-wasm-utils';
|
||||
|
||||
export function waitForSpineWasmInstantiation (): Promise<void> {
|
||||
const errorReport = (msg: any): void => { error(msg); };
|
||||
return ensureWasmModuleReady().then((): Promise<void> => {
|
||||
//We should use static code here, import operation will cause file copy to cache folder.
|
||||
if (shouldUseWasmModule()) {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/4.2/spine.wasm.js'),
|
||||
import('external:emscripten/spine/4.2/spine.wasm'),
|
||||
]).then(([
|
||||
{ default: wasmFactory },
|
||||
{ default: spineWasmUrl },
|
||||
]) => initWasm(wasmFactory, spineWasmUrl));
|
||||
} else {
|
||||
return Promise.all([
|
||||
import('external:emscripten/spine/4.2/spine.asm.js'),
|
||||
import('external:emscripten/spine/4.2/spine.js.mem'),
|
||||
]).then(([
|
||||
{ default: asmFactory },
|
||||
{ default: asmJsMemUrl },
|
||||
]) => initAsmJS(asmFactory, asmJsMemUrl));
|
||||
}
|
||||
}).catch(errorReport);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Defining the following import to make ts compiler know these files
|
||||
// spine-instantiate.ts will be overriden by spine-instantiate-3.8.ts or spine-instantiate-4.2.ts while building engine.
|
||||
// See 'moduleOverrides' section in cc.config.json.
|
||||
import './spine-instantiate-3.8';
|
||||
import './spine-instantiate-4.2';
|
||||
|
||||
export function waitForSpineWasmInstantiation (): Promise<void> {
|
||||
return null!;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
export const SPINE_VERSION = '3.8';
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
export const SPINE_VERSION = '4.2';
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (c) 2025 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
https://www.cocos.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
export const SPINE_VERSION = '3.8';
|
||||
@@ -0,0 +1,75 @@
|
||||
import { instantiateWasm, fetchBuffer } from 'pal/wasm';
|
||||
import { NATIVE_CODE_BUNDLE_MODE } from 'internal:constants';
|
||||
import { sys } from '../../core';
|
||||
import { NativeCodeBundleMode } from '../../misc/webassembly-support';
|
||||
import { overrideSpineDefine } from './spine-define';
|
||||
|
||||
const PAGESIZE = 65536; // 64KiB
|
||||
|
||||
// How many pages of the wasm memory
|
||||
// TODO: let this can be canfiguable by user.
|
||||
const PAGECOUNT = 32 * 16;
|
||||
|
||||
// How mush memory size of the wasm memory
|
||||
const MEMORYSIZE = PAGESIZE * PAGECOUNT; // 32 MiB
|
||||
|
||||
let wasmInstance: SpineWasm.instance = null!;
|
||||
const registerList: any[] = [];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export function initWasm (wasmFactory, wasmUrl: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const errorMessage = (err: any): string => `[Spine]: Spine wasm load failed: ${err}`;
|
||||
wasmFactory({
|
||||
instantiateWasm (
|
||||
importObject: WebAssembly.Imports,
|
||||
receiveInstance: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void,
|
||||
) {
|
||||
// NOTE: the Promise return by instantiateWasm hook can't be caught.
|
||||
instantiateWasm(wasmUrl, importObject).then((result) => {
|
||||
receiveInstance(result.instance, result.module);
|
||||
}).catch((err) => reject(errorMessage(err)));
|
||||
},
|
||||
}).then((Instance: any) => {
|
||||
wasmInstance = Instance;
|
||||
registerList.forEach((cb) => {
|
||||
cb(wasmInstance);
|
||||
});
|
||||
}).then(resolve).catch((err: any) => reject(errorMessage(err)));
|
||||
});
|
||||
}
|
||||
|
||||
export function initAsmJS (asmFactory, asmJsMemUrl: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
fetchBuffer(asmJsMemUrl).then((arrayBuffer) => {
|
||||
const wasmMemory: any = {};
|
||||
wasmMemory.buffer = new ArrayBuffer(MEMORYSIZE);
|
||||
const module = {
|
||||
wasmMemory,
|
||||
memoryInitializerRequest: {
|
||||
response: arrayBuffer,
|
||||
status: 200,
|
||||
} as Partial<XMLHttpRequest>,
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return asmFactory(module).then((instance: any) => {
|
||||
wasmInstance = instance;
|
||||
registerList.forEach((cb) => {
|
||||
cb(wasmInstance);
|
||||
});
|
||||
});
|
||||
}).then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
export function shouldUseWasmModule (): boolean {
|
||||
if (NATIVE_CODE_BUNDLE_MODE === (NativeCodeBundleMode.BOTH as number)) {
|
||||
return sys.hasFeature(sys.Feature.WASM);
|
||||
} else if (NATIVE_CODE_BUNDLE_MODE === (NativeCodeBundleMode.WASM as number)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
registerList.push(overrideSpineDefine);
|
||||
+22
-11
@@ -24,7 +24,7 @@
|
||||
import { EDITOR_NOT_IN_PREVIEW, JSB } from 'internal:constants';
|
||||
import { ccclass, executeInEditMode, help, menu, serializable, type, override, displayOrder, editable, visible } from 'cc.decorator';
|
||||
import { Material, Texture2D } from '../asset/assets';
|
||||
import { error, errorID, logID, warn } from '../core/platform/debug';
|
||||
import { error, errorID, logID, warnID } from '../core/platform/debug';
|
||||
import { Enum, EnumType, ccenum } from '../core/value-types/enum';
|
||||
import { Node, NodeEventType } from '../scene-graph';
|
||||
import { CCObjectFlags, Color, RecyclePool, js } from '../core';
|
||||
@@ -45,6 +45,7 @@ import SkeletonCache, { AnimationCache, AnimationFrame, SkeletonCacheItemInfo }
|
||||
import { TrackEntryListeners } from './track-entry-listeners';
|
||||
import { setPropertyEnumType } from '../core/internal-index';
|
||||
import { RenderData } from '../2d/renderer/render-data';
|
||||
import { SPINE_VERSION } from './lib/spine-version';
|
||||
|
||||
const CachedFrameTime = 1 / 60;
|
||||
|
||||
@@ -783,7 +784,12 @@ export class Skeleton extends UIRenderer {
|
||||
it will cause rendering issues when a prefab with Spine assets is added to the scene node tree.
|
||||
*/
|
||||
if (this.defaultSkin && this.defaultSkin !== '') this.setSkin(this.defaultSkin);
|
||||
if (this.defaultAnimation) this.animation = this.defaultAnimation.toString();
|
||||
if (this.defaultAnimation) {
|
||||
this.animation = this.defaultAnimation.toString();
|
||||
} else if (this._animationName) {
|
||||
this.animation = this._animationName;
|
||||
}
|
||||
|
||||
this._updateUseTint();
|
||||
this._indexBoneSockets();
|
||||
this._updateSocketBindings();
|
||||
@@ -821,7 +827,7 @@ export class Skeleton extends UIRenderer {
|
||||
}
|
||||
if (this.isAnimationCached()) {
|
||||
if (this.debugBones || this.debugSlots) {
|
||||
warn('Debug bones or slots is invalid in cached mode');
|
||||
warnID(16410);
|
||||
}
|
||||
const skeletonInfo = this._skeletonCache!.getSkeletonInfo(this._skeletonData!);
|
||||
if (this._skeletonInfo !== skeletonInfo) {
|
||||
@@ -848,7 +854,7 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public setSlotsRange (startSlotIndex: number, endSlotIndex: number): void {
|
||||
if (this.isAnimationCached()) {
|
||||
warn('Slots visible range can not be modified in cached mode.');
|
||||
warnID(16411);
|
||||
} else {
|
||||
this._startSlotIndex = startSlotIndex;
|
||||
this._endSlotIndex = endSlotIndex;
|
||||
@@ -928,7 +934,7 @@ export class Skeleton extends UIRenderer {
|
||||
this._playTimes = loop ? 0 : 1;
|
||||
if (this.isAnimationCached()) {
|
||||
if (trackIndex !== 0) {
|
||||
warn('Track index can not greater than 0 in cached mode.');
|
||||
warnID(16412);
|
||||
}
|
||||
if (!this._skeletonCache) return null;
|
||||
let cache = this._skeletonCache.getAnimationCache(this._skeletonData!.uuid, name);
|
||||
@@ -970,7 +976,7 @@ export class Skeleton extends UIRenderer {
|
||||
delay = delay || 0;
|
||||
if (this.isAnimationCached()) {
|
||||
if (trackIndex !== 0) {
|
||||
warn('Track index can not greater than 0 in cached mode.');
|
||||
warnID(16413);
|
||||
}
|
||||
this._animationQueue.push({ animationName: name, loop, delay });
|
||||
return null;
|
||||
@@ -1006,7 +1012,7 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public getCurrent (trackIndex: number): spine.TrackEntry | null {
|
||||
if (this.isAnimationCached()) {
|
||||
warn('\'getCurrent\' interface can not be invoked in cached mode.');
|
||||
warnID(16414);
|
||||
} else if (this._state) {
|
||||
return this._state.getCurrent(trackIndex);
|
||||
}
|
||||
@@ -1462,7 +1468,7 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public setMix (fromAnimation: string, toAnimation: string, duration: number): void {
|
||||
if (this.isAnimationCached()) {
|
||||
warn('cached mode not support setMix!!!');
|
||||
warnID(16415);
|
||||
return;
|
||||
}
|
||||
if (this._state) {
|
||||
@@ -1477,7 +1483,7 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public clearTracks (): void {
|
||||
if (this.isAnimationCached()) {
|
||||
warn('\'clearTracks\' interface can not be invoked in cached mode.');
|
||||
warnID(16416);
|
||||
} else if (this._state) {
|
||||
this._state.clearTracks();
|
||||
this.setToSetupPose();
|
||||
@@ -1491,7 +1497,7 @@ export class Skeleton extends UIRenderer {
|
||||
*/
|
||||
public clearTrack (trackIndex: number): void {
|
||||
if (this.isAnimationCached()) {
|
||||
warn('\'clearTrack\' interface can not be invoked in cached mode.');
|
||||
warnID(16417);
|
||||
} else if (this._state) {
|
||||
this._state.clearTrack(trackIndex);
|
||||
if (EDITOR_NOT_IN_PREVIEW) {
|
||||
@@ -1638,7 +1644,7 @@ export class Skeleton extends UIRenderer {
|
||||
}
|
||||
}
|
||||
if (this.isAnimationCached()) {
|
||||
warn('Debug bones or slots is invalid in cached mode');
|
||||
warnID(16418);
|
||||
} else if (!JSB) {
|
||||
this._instance!.setDebugMode(true);
|
||||
}
|
||||
@@ -1699,11 +1705,16 @@ export class Skeleton extends UIRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 3.8, deprecated since spine 4.2
|
||||
* @en Sets vertex effect delegate.
|
||||
* @zh 设置顶点特效动画代理。
|
||||
* @param effectDelegate @en Vertex effect delegate. @zh 顶点特效代理。
|
||||
*/
|
||||
public setVertexEffectDelegate (effectDelegate: VertexEffectDelegate | null | undefined): void {
|
||||
if (SPINE_VERSION !== '3.8') {
|
||||
warnID(16409);
|
||||
return;
|
||||
}
|
||||
if (!this._instance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -375,22 +375,42 @@
|
||||
"hidden": true
|
||||
},
|
||||
"spine": {
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.spine.label",
|
||||
"description": "i18n:ENGINE.features.spine.description",
|
||||
"cmakeConfig": "USE_SPINE",
|
||||
"isNativeModule": true,
|
||||
"enginePlugin": true,
|
||||
"enginePlugin": false,
|
||||
"category": "2d",
|
||||
"dependencies": [
|
||||
"2d"
|
||||
],
|
||||
"flags": {
|
||||
"LOAD_SPINE_MANUALLY": {
|
||||
"label": "i18n:ENGINE.features.flags.spine.loadManual.label",
|
||||
"description": "i18n:ENGINE.features.flags.spine.loadManual.description",
|
||||
"ui-type": "checkbox",
|
||||
"default": false
|
||||
"options": {
|
||||
"spine-3.8": {
|
||||
"cmakeConfig": "USE_SPINE_3_8",
|
||||
"default": true,
|
||||
"label": "i18n:ENGINE.features.spine_38.label",
|
||||
"description": "i18n:ENGINE.features.spine_38.description",
|
||||
"flags": {
|
||||
"LOAD_SPINE_MANUALLY": {
|
||||
"label": "i18n:ENGINE.features.flags.spine.loadManual.label",
|
||||
"description": "i18n:ENGINE.features.flags.spine.loadManual.description",
|
||||
"ui-type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"spine-4.2": {
|
||||
"cmakeConfig": "USE_SPINE_4_2",
|
||||
"default": false,
|
||||
"label": "i18n:ENGINE.features.spine_42.label",
|
||||
"description": "i18n:ENGINE.features.spine_42.description",
|
||||
"flags": {
|
||||
"LOAD_SPINE_MANUALLY": {
|
||||
"label": "i18n:ENGINE.features.flags.spine.loadManual.label",
|
||||
"description": "i18n:ENGINE.features.flags.spine.loadManual.description",
|
||||
"ui-type": "checkbox",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1075,6 +1075,14 @@ module.exports = link(mixin({
|
||||
label: "Spine Animation",
|
||||
description: "Spine Animation support.",
|
||||
},
|
||||
spine_38: {
|
||||
label: "Spine 3.8",
|
||||
description: "Spine 3.8",
|
||||
},
|
||||
spine_42: {
|
||||
label: "Spine 4.2",
|
||||
description: "Spine 4.2",
|
||||
},
|
||||
dragon_bones: {
|
||||
label: "Dragon Bones",
|
||||
description: "Dragon Bones support.",
|
||||
|
||||
@@ -1053,6 +1053,14 @@ module.exports = link(mixin({
|
||||
label: "Spine 动画",
|
||||
description: "Spine 动画支持。",
|
||||
},
|
||||
spine_38: {
|
||||
label: "Spine 3.8",
|
||||
description: "Spine 3.8",
|
||||
},
|
||||
spine_42: {
|
||||
label: "Spine 4.2",
|
||||
description: "Spine 4.2",
|
||||
},
|
||||
dragon_bones: {
|
||||
label: "Dragon Bones",
|
||||
description: "Dragon Bones 支持。",
|
||||
|
||||
+357
-168
@@ -28,6 +28,13 @@ cc_set_if_undefined(USE_VIDEO ON)
|
||||
cc_set_if_undefined(USE_WEBVIEW ON)
|
||||
cc_set_if_undefined(USE_MIDDLEWARE ON)
|
||||
cc_set_if_undefined(USE_DRAGONBONES ON)
|
||||
cc_set_if_undefined(USE_SPINE_3_8 ON)
|
||||
cc_set_if_undefined(USE_SPINE_4_2 OFF)
|
||||
if (USE_SPINE_3_8 OR USE_SPINE_4_2)
|
||||
cc_set_if_undefined(USE_SPINE ON)
|
||||
else()
|
||||
cc_set_if_undefined(USE_SPINE OFF)
|
||||
endif()
|
||||
cc_set_if_undefined(USE_SPINE ON)
|
||||
cc_set_if_undefined(USE_WEBSOCKET_SERVER OFF)
|
||||
cc_set_if_undefined(USE_JOB_SYSTEM_TASKFLOW OFF)
|
||||
@@ -222,7 +229,8 @@ cc_inspect_values(
|
||||
USE_WEBVIEW
|
||||
USE_MIDDLEWARE
|
||||
USE_DRAGONBONES
|
||||
USE_SPINE
|
||||
USE_SPINE_3_8
|
||||
USE_SPINE_4_2
|
||||
USE_WEBSOCKET_SERVER
|
||||
USE_PHYSICS_PHYSX
|
||||
USE_JOB_SYSTEM_TBB
|
||||
@@ -2316,184 +2324,363 @@ if(USE_MIDDLEWARE)
|
||||
${SWIG_OUTPUT}/jsb_editor_support_auto.h
|
||||
)
|
||||
|
||||
if(USE_SPINE)
|
||||
if(USE_SPINE_3_8)
|
||||
include_directories(${CWD}/cocos/editor-support/spine/3.8)
|
||||
cocos_source_files(
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/Animation.cpp
|
||||
cocos/editor-support/spine/Animation.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/AnimationState.cpp
|
||||
cocos/editor-support/spine/AnimationState.h
|
||||
NO_WERROR cocos/editor-support/spine/AnimationStateData.cpp
|
||||
cocos/editor-support/spine/AnimationStateData.h
|
||||
NO_WERROR cocos/editor-support/spine/Atlas.cpp
|
||||
cocos/editor-support/spine/Atlas.h
|
||||
NO_WERROR cocos/editor-support/spine/AtlasAttachmentLoader.cpp
|
||||
cocos/editor-support/spine/AtlasAttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/Attachment.cpp
|
||||
cocos/editor-support/spine/Attachment.h
|
||||
NO_WERROR cocos/editor-support/spine/AttachmentLoader.cpp
|
||||
cocos/editor-support/spine/AttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/AttachmentTimeline.cpp
|
||||
cocos/editor-support/spine/AttachmentTimeline.h
|
||||
cocos/editor-support/spine/AttachmentType.h
|
||||
cocos/editor-support/spine/BlendMode.h
|
||||
NO_WERROR cocos/editor-support/spine/Bone.cpp
|
||||
cocos/editor-support/spine/Bone.h
|
||||
NO_WERROR cocos/editor-support/spine/BoneData.cpp
|
||||
cocos/editor-support/spine/BoneData.h
|
||||
NO_WERROR cocos/editor-support/spine/BoundingBoxAttachment.cpp
|
||||
cocos/editor-support/spine/BoundingBoxAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/ClippingAttachment.cpp
|
||||
cocos/editor-support/spine/ClippingAttachment.h
|
||||
cocos/editor-support/spine/Color.h
|
||||
NO_WERROR cocos/editor-support/spine/ColorTimeline.cpp
|
||||
cocos/editor-support/spine/ColorTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Constraint.cpp
|
||||
cocos/editor-support/spine/Constraint.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/ConstraintData.cpp
|
||||
cocos/editor-support/spine/ConstraintData.h
|
||||
cocos/editor-support/spine/ContainerUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/CurveTimeline.cpp
|
||||
cocos/editor-support/spine/CurveTimeline.h
|
||||
cocos/editor-support/spine/Debug.h
|
||||
NO_WERROR cocos/editor-support/spine/DeformTimeline.cpp
|
||||
cocos/editor-support/spine/DeformTimeline.h
|
||||
cocos/editor-support/spine/dll.h
|
||||
NO_WERROR cocos/editor-support/spine/DrawOrderTimeline.cpp
|
||||
cocos/editor-support/spine/DrawOrderTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Event.cpp
|
||||
cocos/editor-support/spine/Event.h
|
||||
NO_WERROR cocos/editor-support/spine/EventData.cpp
|
||||
cocos/editor-support/spine/EventData.h
|
||||
NO_WERROR cocos/editor-support/spine/EventTimeline.cpp
|
||||
cocos/editor-support/spine/EventTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Extension.cpp
|
||||
cocos/editor-support/spine/Extension.h
|
||||
cocos/editor-support/spine/HashMap.h
|
||||
cocos/editor-support/spine/HasRendererObject.h
|
||||
NO_WERROR cocos/editor-support/spine/IkConstraint.cpp
|
||||
cocos/editor-support/spine/IkConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/IkConstraintData.cpp
|
||||
cocos/editor-support/spine/IkConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/IkConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/IkConstraintTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Json.cpp
|
||||
cocos/editor-support/spine/Json.h
|
||||
NO_WERROR cocos/editor-support/spine/LinkedMesh.cpp
|
||||
cocos/editor-support/spine/LinkedMesh.h
|
||||
NO_WERROR cocos/editor-support/spine/MathUtil.cpp
|
||||
cocos/editor-support/spine/MathUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/MeshAttachment.cpp
|
||||
cocos/editor-support/spine/MeshAttachment.h
|
||||
cocos/editor-support/spine/MixBlend.h
|
||||
cocos/editor-support/spine/MixDirection.h
|
||||
NO_WERROR cocos/editor-support/spine/PathAttachment.cpp
|
||||
cocos/editor-support/spine/PathAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/PathConstraint.cpp
|
||||
cocos/editor-support/spine/PathConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/PathConstraintData.cpp
|
||||
cocos/editor-support/spine/PathConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/PathConstraintMixTimeline.cpp
|
||||
cocos/editor-support/spine/PathConstraintMixTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/PathConstraintPositionTimeline.cpp
|
||||
cocos/editor-support/spine/PathConstraintPositionTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/PathConstraintSpacingTimeline.cpp
|
||||
cocos/editor-support/spine/PathConstraintSpacingTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/PointAttachment.cpp
|
||||
cocos/editor-support/spine/PointAttachment.h
|
||||
cocos/editor-support/spine/Pool.h
|
||||
cocos/editor-support/spine/PositionMode.h
|
||||
NO_WERROR cocos/editor-support/spine/RegionAttachment.cpp
|
||||
cocos/editor-support/spine/RegionAttachment.h
|
||||
cocos/editor-support/spine/RotateMode.h
|
||||
NO_WERROR cocos/editor-support/spine/RotateTimeline.cpp
|
||||
cocos/editor-support/spine/RotateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/RTTI.cpp
|
||||
cocos/editor-support/spine/RTTI.h
|
||||
NO_WERROR cocos/editor-support/spine/ScaleTimeline.cpp
|
||||
cocos/editor-support/spine/ScaleTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/ShearTimeline.cpp
|
||||
cocos/editor-support/spine/ShearTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Skeleton.cpp
|
||||
cocos/editor-support/spine/Skeleton.h
|
||||
NO_WERROR cocos/editor-support/spine/SkeletonBinary.cpp
|
||||
cocos/editor-support/spine/SkeletonBinary.h
|
||||
NO_WERROR cocos/editor-support/spine/SkeletonBounds.cpp
|
||||
cocos/editor-support/spine/SkeletonBounds.h
|
||||
NO_WERROR cocos/editor-support/spine/SkeletonClipping.cpp
|
||||
cocos/editor-support/spine/SkeletonClipping.h
|
||||
NO_WERROR cocos/editor-support/spine/SkeletonData.cpp
|
||||
cocos/editor-support/spine/SkeletonData.h
|
||||
NO_WERROR cocos/editor-support/spine/SkeletonJson.cpp
|
||||
cocos/editor-support/spine/SkeletonJson.h
|
||||
NO_WERROR cocos/editor-support/spine/Skin.cpp
|
||||
cocos/editor-support/spine/Skin.h
|
||||
NO_WERROR cocos/editor-support/spine/Slot.cpp
|
||||
cocos/editor-support/spine/Slot.h
|
||||
NO_WERROR cocos/editor-support/spine/SlotData.cpp
|
||||
cocos/editor-support/spine/SlotData.h
|
||||
cocos/editor-support/spine/SpacingMode.h
|
||||
cocos/editor-support/spine/spine.h
|
||||
NO_WERROR cocos/editor-support/spine/SpineObject.cpp
|
||||
cocos/editor-support/spine/SpineObject.h
|
||||
cocos/editor-support/spine/SpineString.cpp
|
||||
cocos/editor-support/spine/SpineString.h
|
||||
NO_WERROR cocos/editor-support/spine/TextureLoader.cpp
|
||||
cocos/editor-support/spine/TextureLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/Timeline.cpp
|
||||
cocos/editor-support/spine/Timeline.h
|
||||
cocos/editor-support/spine/TimelineType.h
|
||||
NO_WERROR cocos/editor-support/spine/TransformConstraint.cpp
|
||||
cocos/editor-support/spine/TransformConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/TransformConstraintData.cpp
|
||||
cocos/editor-support/spine/TransformConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/TransformConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/TransformConstraintTimeline.h
|
||||
cocos/editor-support/spine/TransformMode.h
|
||||
NO_WERROR cocos/editor-support/spine/TranslateTimeline.cpp
|
||||
cocos/editor-support/spine/TranslateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Triangulator.cpp
|
||||
cocos/editor-support/spine/Triangulator.h
|
||||
NO_WERROR cocos/editor-support/spine/TwoColorTimeline.cpp
|
||||
cocos/editor-support/spine/TwoColorTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/Updatable.cpp
|
||||
cocos/editor-support/spine/Updatable.h
|
||||
cocos/editor-support/spine/Vector.h
|
||||
NO_WERROR cocos/editor-support/spine/VertexAttachment.cpp
|
||||
cocos/editor-support/spine/VertexAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/VertexEffect.cpp
|
||||
cocos/editor-support/spine/VertexEffect.h
|
||||
cocos/editor-support/spine/Vertices.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/AttachmentVertices.cpp
|
||||
cocos/editor-support/spine-creator-support/AttachmentVertices.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonAnimation.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCache.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCache.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonDataMgr.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonRenderer.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp
|
||||
cocos/editor-support/spine-creator-support/spine-cocos2dx.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/3.8/spine/Animation.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Animation.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/3.8/spine/AnimationState.cpp
|
||||
cocos/editor-support/spine/3.8/spine/AnimationState.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/AnimationStateData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/AnimationStateData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Atlas.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Atlas.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/AtlasAttachmentLoader.cpp
|
||||
cocos/editor-support/spine/3.8/spine/AtlasAttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Attachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Attachment.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/AttachmentLoader.cpp
|
||||
cocos/editor-support/spine/3.8/spine/AttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/AttachmentTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/AttachmentTimeline.h
|
||||
cocos/editor-support/spine/3.8/spine/AttachmentType.h
|
||||
cocos/editor-support/spine/3.8/spine/BlendMode.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Bone.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Bone.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/BoneData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/BoneData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/BoundingBoxAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/BoundingBoxAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/ClippingAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/ClippingAttachment.h
|
||||
cocos/editor-support/spine/3.8/spine/Color.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/ColorTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/ColorTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Constraint.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Constraint.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/3.8/spine/ConstraintData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/ConstraintData.h
|
||||
cocos/editor-support/spine/3.8/spine/ContainerUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/CurveTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/CurveTimeline.h
|
||||
cocos/editor-support/spine/3.8/spine/Debug.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/DeformTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/DeformTimeline.h
|
||||
cocos/editor-support/spine/3.8/spine/dll.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/DrawOrderTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/DrawOrderTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Event.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Event.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/EventData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/EventData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/EventTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/EventTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Extension.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Extension.h
|
||||
cocos/editor-support/spine/3.8/spine/HashMap.h
|
||||
cocos/editor-support/spine/3.8/spine/HasRendererObject.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/IkConstraint.cpp
|
||||
cocos/editor-support/spine/3.8/spine/IkConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/IkConstraintData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/IkConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/IkConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/IkConstraintTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Json.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Json.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/LinkedMesh.cpp
|
||||
cocos/editor-support/spine/3.8/spine/LinkedMesh.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/MathUtil.cpp
|
||||
cocos/editor-support/spine/3.8/spine/MathUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/MeshAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/MeshAttachment.h
|
||||
cocos/editor-support/spine/3.8/spine/MixBlend.h
|
||||
cocos/editor-support/spine/3.8/spine/MixDirection.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathConstraint.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathConstraintData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathConstraintMixTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathConstraintMixTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathConstraintPositionTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathConstraintPositionTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PathConstraintSpacingTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PathConstraintSpacingTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/PointAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/PointAttachment.h
|
||||
cocos/editor-support/spine/3.8/spine/Pool.h
|
||||
cocos/editor-support/spine/3.8/spine/PositionMode.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/RegionAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/RegionAttachment.h
|
||||
cocos/editor-support/spine/3.8/spine/RotateMode.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/RotateTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/RotateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/RTTI.cpp
|
||||
cocos/editor-support/spine/3.8/spine/RTTI.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/ScaleTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/ScaleTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/ShearTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/ShearTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Skeleton.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Skeleton.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SkeletonBinary.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SkeletonBinary.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SkeletonBounds.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SkeletonBounds.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SkeletonClipping.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SkeletonClipping.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SkeletonData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SkeletonData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SkeletonJson.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SkeletonJson.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Skin.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Skin.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Slot.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Slot.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SlotData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SlotData.h
|
||||
cocos/editor-support/spine/3.8/spine/SpacingMode.h
|
||||
cocos/editor-support/spine/3.8/spine/spine.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/SpineObject.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SpineObject.h
|
||||
cocos/editor-support/spine/3.8/spine/SpineString.cpp
|
||||
cocos/editor-support/spine/3.8/spine/SpineString.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TextureLoader.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TextureLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Timeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Timeline.h
|
||||
cocos/editor-support/spine/3.8/spine/TimelineType.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TransformConstraint.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TransformConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TransformConstraintData.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TransformConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TransformConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TransformConstraintTimeline.h
|
||||
cocos/editor-support/spine/3.8/spine/TransformMode.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TranslateTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TranslateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Triangulator.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Triangulator.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/TwoColorTimeline.cpp
|
||||
cocos/editor-support/spine/3.8/spine/TwoColorTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/Updatable.cpp
|
||||
cocos/editor-support/spine/3.8/spine/Updatable.h
|
||||
cocos/editor-support/spine/3.8/spine/Vector.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/VertexAttachment.cpp
|
||||
cocos/editor-support/spine/3.8/spine/VertexAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/3.8/spine/VertexEffect.cpp
|
||||
cocos/editor-support/spine/3.8/spine/VertexEffect.h
|
||||
cocos/editor-support/spine/3.8/spine/Vertices.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/VertexEffectDelegate.cpp
|
||||
cocos/editor-support/spine-creator-support/VertexEffectDelegate.h
|
||||
cocos/editor-support/spine-creator-support/VertexEffectDelegate.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/Vector2.cpp
|
||||
cocos/editor-support/spine-creator-support/Vector2.h
|
||||
|
||||
)
|
||||
cocos_source_files(
|
||||
NO_WERROR ${SWIG_OUTPUT}/jsb_spine_auto.cpp
|
||||
${SWIG_OUTPUT}/jsb_spine_auto.h
|
||||
NO_WERROR ${SWIG_OUTPUT}/jsb_spine_3_8_auto.cpp
|
||||
${SWIG_OUTPUT}/jsb_spine_3_8_auto.h
|
||||
NO_WERROR cocos/bindings/manual/jsb_spine_manual.cpp
|
||||
cocos/bindings/manual/jsb_spine_manual.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_SPINE_4_2)
|
||||
include_directories(${CWD}/cocos/editor-support/spine/4.2)
|
||||
cocos_source_files(
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/4.2/spine/Animation.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Animation.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/4.2/spine/AnimationState.cpp
|
||||
cocos/editor-support/spine/4.2/spine/AnimationState.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/AnimationStateData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/AnimationStateData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Atlas.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Atlas.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/AtlasAttachmentLoader.cpp
|
||||
cocos/editor-support/spine/4.2/spine/AtlasAttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Attachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Attachment.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/AttachmentLoader.cpp
|
||||
cocos/editor-support/spine/4.2/spine/AttachmentLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/AttachmentTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/AttachmentTimeline.h
|
||||
cocos/editor-support/spine/4.2/spine/AttachmentType.h
|
||||
cocos/editor-support/spine/4.2/spine/BlendMode.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Bone.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Bone.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/BoneData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/BoneData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/BoundingBoxAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/BoundingBoxAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/ClippingAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/ClippingAttachment.h
|
||||
cocos/editor-support/spine/4.2/spine/Color.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/ColorTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/ColorTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Constraint.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Constraint.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine/4.2/spine/ConstraintData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/ConstraintData.h
|
||||
cocos/editor-support/spine/4.2/spine/ContainerUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/CurveTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/CurveTimeline.h
|
||||
cocos/editor-support/spine/4.2/spine/Debug.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/DeformTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/DeformTimeline.h
|
||||
cocos/editor-support/spine/4.2/spine/dll.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/DrawOrderTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/DrawOrderTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Event.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Event.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/EventData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/EventData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/EventTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/EventTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Extension.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Extension.h
|
||||
cocos/editor-support/spine/4.2/spine/HashMap.h
|
||||
cocos/editor-support/spine/4.2/spine/HasRendererObject.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/IkConstraint.cpp
|
||||
cocos/editor-support/spine/4.2/spine/IkConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/IkConstraintData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/IkConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/IkConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/IkConstraintTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Json.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Json.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/LinkedMesh.cpp
|
||||
cocos/editor-support/spine/4.2/spine/LinkedMesh.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/MathUtil.cpp
|
||||
cocos/editor-support/spine/4.2/spine/MathUtil.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/MeshAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/MeshAttachment.h
|
||||
cocos/editor-support/spine/4.2/spine/MixBlend.h
|
||||
cocos/editor-support/spine/4.2/spine/MixDirection.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathAttachment.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathConstraint.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathConstraintData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathConstraintMixTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathConstraintMixTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathConstraintPositionTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathConstraintPositionTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PathConstraintSpacingTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PathConstraintSpacingTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PointAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PointAttachment.h
|
||||
cocos/editor-support/spine/4.2/spine/Pool.h
|
||||
cocos/editor-support/spine/4.2/spine/Physics.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Sequence.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Sequence.h
|
||||
cocos/editor-support/spine/4.2/spine/SequenceTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SequenceTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TextureRegion.h
|
||||
cocos/editor-support/spine/4.2/spine/BlockAllocator.h
|
||||
cocos/editor-support/spine/4.2/spine/Inherit.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/InheritTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/InheritTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Log.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Log.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PhysicsConstraintData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PhysicsConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PhysicsConstraint.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PhysicsConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/PhysicsConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/PhysicsConstraintTimeline.h
|
||||
cocos/editor-support/spine/4.2/spine/Property.h
|
||||
cocos/editor-support/spine/4.2/spine/Version.h
|
||||
cocos/editor-support/spine/4.2/spine/PositionMode.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/RegionAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/RegionAttachment.h
|
||||
cocos/editor-support/spine/4.2/spine/RotateMode.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/RotateTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/RotateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/RTTI.cpp
|
||||
cocos/editor-support/spine/4.2/spine/RTTI.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/ScaleTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/ScaleTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/ShearTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/ShearTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Skeleton.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Skeleton.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonBinary.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonBinary.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonBounds.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonBounds.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonClipping.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonClipping.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonJson.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonJson.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SkeletonRenderer.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SkeletonRenderer.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Skin.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Skin.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Slot.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Slot.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SlotData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SlotData.h
|
||||
cocos/editor-support/spine/4.2/spine/SpacingMode.h
|
||||
cocos/editor-support/spine/4.2/spine/spine.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/SpineObject.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SpineObject.h
|
||||
cocos/editor-support/spine/4.2/spine/SpineString.cpp
|
||||
cocos/editor-support/spine/4.2/spine/SpineString.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/TextureLoader.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TextureLoader.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Timeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Timeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/TransformConstraint.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TransformConstraint.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/TransformConstraintData.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TransformConstraintData.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/TransformConstraintTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TransformConstraintTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/TranslateTimeline.cpp
|
||||
cocos/editor-support/spine/4.2/spine/TranslateTimeline.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Triangulator.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Triangulator.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/Updatable.cpp
|
||||
cocos/editor-support/spine/4.2/spine/Updatable.h
|
||||
cocos/editor-support/spine/4.2/spine/Vector.h
|
||||
NO_WERROR cocos/editor-support/spine/4.2/spine/VertexAttachment.cpp
|
||||
cocos/editor-support/spine/4.2/spine/VertexAttachment.h
|
||||
cocos/editor-support/spine/4.2/spine/Vertices.h
|
||||
|
||||
)
|
||||
cocos_source_files(
|
||||
NO_WERROR ${SWIG_OUTPUT}/jsb_spine_4_2_auto.cpp
|
||||
${SWIG_OUTPUT}/jsb_spine_4_2_auto.h
|
||||
NO_WERROR cocos/bindings/manual/jsb_spine_manual.cpp
|
||||
cocos/bindings/manual/jsb_spine_manual.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_SPINE)
|
||||
cocos_source_files(
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/AttachmentVertices.cpp
|
||||
cocos/editor-support/spine-creator-support/AttachmentVertices.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonAnimation.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonAnimation.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCache.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCache.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonCacheMgr.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonCacheMgr.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/SkeletonDataMgr.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonDataMgr.h
|
||||
NO_WERROR NO_UBUILD cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp
|
||||
cocos/editor-support/spine-creator-support/SkeletonRenderer.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp
|
||||
cocos/editor-support/spine-creator-support/spine-cocos2dx.h
|
||||
NO_WERROR cocos/editor-support/spine-creator-support/Vector2.cpp
|
||||
cocos/editor-support/spine-creator-support/Vector2.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_DRAGONBONES)
|
||||
cocos_source_files(
|
||||
cocos/editor-support/dragonbones/DragonBonesHeaders.h
|
||||
@@ -3169,6 +3356,8 @@ function(cc_apply_definations target)
|
||||
$<IF:$<AND:$<OR:$<CONFIG:Debug>,$<BOOL:${USE_V8_DEBUGGER_FORCE}>>,$<BOOL:${USE_V8_DEBUGGER}>>,USE_V8_DEBUGGER=1,USE_V8_DEBUGGER=0>
|
||||
$<IF:$<BOOL:${USE_MIDDLEWARE}>,CC_USE_MIDDLEWARE=1,CC_USE_MIDDLEWARE=0>
|
||||
$<IF:$<BOOL:${USE_SPINE}>,CC_USE_SPINE=1,CC_USE_SPINE=0>
|
||||
$<IF:$<BOOL:${USE_SPINE_3_8}>,CC_USE_SPINE_3_8=1,CC_USE_SPINE_3_8=0>
|
||||
$<IF:$<BOOL:${USE_SPINE_4_2}>,CC_USE_SPINE_4_2=1,CC_USE_SPINE_4_2=0>
|
||||
$<IF:$<BOOL:${USE_DRAGONBONES}>,CC_USE_DRAGONBONES=1,CC_USE_DRAGONBONES=0>
|
||||
$<IF:$<BOOL:${USE_JOB_SYSTEM_TBB}>,CC_USE_JOB_SYSTEM_TBB=1,CC_USE_JOB_SYSTEM_TBB=0>
|
||||
$<IF:$<BOOL:${USE_JOB_SYSTEM_TASKFLOW}>,CC_USE_JOB_SYSTEM_TASKFLOW=1,CC_USE_JOB_SYSTEM_TASKFLOW=0>
|
||||
|
||||
@@ -114,7 +114,12 @@
|
||||
#include "cocos/bindings/auto/jsb_editor_support_auto.h"
|
||||
|
||||
#if CC_USE_SPINE
|
||||
#include "cocos/bindings/auto/jsb_spine_auto.h"
|
||||
#if CC_USE_SPINE_3_8
|
||||
#include "cocos/bindings/auto/jsb_spine_3_8_auto.h"
|
||||
#elif CC_USE_SPINE_4_2
|
||||
#include "cocos/bindings/auto/jsb_spine_4_2_auto.h"
|
||||
#endif
|
||||
|
||||
#include "cocos/bindings/manual/jsb_spine_manual.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,13 +25,19 @@
|
||||
#include "jsb_spine_manual.h"
|
||||
#include "base/Data.h"
|
||||
#include "base/memory/Memory.h"
|
||||
#include "bindings/auto/jsb_spine_auto.h"
|
||||
|
||||
#include "bindings/jswrapper/SeApi.h"
|
||||
#include "bindings/manual/jsb_conversions.h"
|
||||
#include "bindings/manual/jsb_global.h"
|
||||
#include "bindings/manual/jsb_helper.h"
|
||||
#include "editor-support/spine-creator-support/spine-cocos2dx.h"
|
||||
#include "editor-support/spine/spine.h"
|
||||
#if CC_USE_SPINE_3_8
|
||||
#include "bindings/auto/jsb_spine_3_8_auto.h"
|
||||
#include "editor-support/spine/3.8/spine/spine.h"
|
||||
#else
|
||||
#include "bindings/auto/jsb_spine_4_2_auto.h"
|
||||
#include "editor-support/spine/4.2/spine/spine.h"
|
||||
#endif
|
||||
#include "middleware-adapter.h"
|
||||
#include "platform/FileUtils.h"
|
||||
#include "spine-creator-support/SkeletonDataMgr.h"
|
||||
@@ -41,7 +47,7 @@
|
||||
|
||||
using namespace cc;
|
||||
|
||||
static spine::Cocos2dTextureLoader textureLoader;
|
||||
static cc::Cocos2dTextureLoader textureLoader;
|
||||
static cc::RefMap<ccstd::string, middleware::Texture2D *> *_preloadedAtlasTextures = nullptr;
|
||||
static middleware::Texture2D *_getPreloadedAtlasTexture(const char *path) {
|
||||
CC_ASSERT(_preloadedAtlasTextures);
|
||||
@@ -62,7 +68,7 @@ static bool js_register_spine_initSkeletonData(se::State &s) {
|
||||
ok = sevalue_to_native(args[0], &uuid);
|
||||
SE_PRECONDITION2(ok, false, "Invalid uuid content!");
|
||||
|
||||
auto mgr = spine::SkeletonDataMgr::getInstance();
|
||||
auto mgr = SkeletonDataMgr::getInstance();
|
||||
bool hasSkeletonData = mgr->hasSkeletonData(uuid);
|
||||
if (hasSkeletonData) {
|
||||
spine::SkeletonData *skeletonData = mgr->retainByUUID(uuid);
|
||||
@@ -89,14 +95,14 @@ static bool js_register_spine_initSkeletonData(se::State &s) {
|
||||
// create atlas from preloaded texture
|
||||
|
||||
_preloadedAtlasTextures = &textures;
|
||||
spine::spAtlasPage_setCustomTextureLoader(_getPreloadedAtlasTexture);
|
||||
spAtlasPage_setCustomTextureLoader(_getPreloadedAtlasTexture);
|
||||
|
||||
spine::Atlas *atlas = ccnew_placement(__FILE__, __LINE__) spine::Atlas(atlasText.c_str(), (int)atlasText.size(), "", &textureLoader);
|
||||
|
||||
_preloadedAtlasTextures = nullptr;
|
||||
spine::spAtlasPage_setCustomTextureLoader(nullptr);
|
||||
spAtlasPage_setCustomTextureLoader(nullptr);
|
||||
|
||||
spine::AttachmentLoader *attachmentLoader = ccnew_placement(__FILE__, __LINE__) spine::Cocos2dAtlasAttachmentLoader(atlas);
|
||||
spine::AttachmentLoader *attachmentLoader = ccnew_placement(__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(atlas);
|
||||
spine::SkeletonData *skeletonData = nullptr;
|
||||
|
||||
std::size_t length = skeletonDataFile.length();
|
||||
@@ -113,13 +119,15 @@ static bool js_register_spine_initSkeletonData(se::State &s) {
|
||||
spine::SkeletonBinary binary(attachmentLoader);
|
||||
binary.setScale(scale);
|
||||
skeletonData = binary.readSkeletonData(cocos2dData.getBytes(), (int)cocos2dData.getSize());
|
||||
CC_ASSERT(skeletonData); // Can use binary.getError() to get error message.
|
||||
const auto &errorMsg = binary.getError();
|
||||
CC_ASSERTF(skeletonData, "Spine parse error: %s", errorMsg.buffer());
|
||||
}
|
||||
} else {
|
||||
spine::SkeletonJson json(attachmentLoader);
|
||||
json.setScale(scale);
|
||||
skeletonData = json.readSkeletonData(skeletonDataFile.c_str());
|
||||
CC_ASSERT(skeletonData); // Can use json.getError() to get error message.
|
||||
const auto &errorMsg = json.getError();
|
||||
CC_ASSERTF(skeletonData, "Spine parse error: %s", errorMsg.buffer());
|
||||
}
|
||||
|
||||
if (skeletonData) {
|
||||
@@ -156,7 +164,7 @@ static bool js_register_spine_disposeSkeletonData(se::State &s) {
|
||||
ok = sevalue_to_native(args[0], &uuid);
|
||||
SE_PRECONDITION2(ok, false, "Invalid uuid content!");
|
||||
|
||||
auto mgr = spine::SkeletonDataMgr::getInstance();
|
||||
auto mgr = SkeletonDataMgr::getInstance();
|
||||
bool hasSkeletonData = mgr->hasSkeletonData(uuid);
|
||||
if (!hasSkeletonData) return true;
|
||||
mgr->releaseByUUID(uuid);
|
||||
@@ -174,7 +182,7 @@ static bool js_register_spine_initSkeletonRenderer(se::State &s) {
|
||||
}
|
||||
bool ok = false;
|
||||
|
||||
spine::SkeletonRenderer *node = nullptr;
|
||||
cc::SkeletonRenderer *node = nullptr;
|
||||
ok = seval_to_native_ptr(args[0], &node);
|
||||
SE_PRECONDITION2(ok, false, "Converting SpineRenderer failed!");
|
||||
|
||||
@@ -182,7 +190,7 @@ static bool js_register_spine_initSkeletonRenderer(se::State &s) {
|
||||
ok = sevalue_to_native(args[1], &uuid);
|
||||
SE_PRECONDITION2(ok, false, "Invalid uuid content!");
|
||||
|
||||
auto mgr = spine::SkeletonDataMgr::getInstance();
|
||||
auto mgr = SkeletonDataMgr::getInstance();
|
||||
bool hasSkeletonData = mgr->hasSkeletonData(uuid);
|
||||
if (hasSkeletonData) {
|
||||
node->initWithUUID(uuid);
|
||||
@@ -204,7 +212,7 @@ static bool js_register_spine_retainSkeletonData(se::State &s) {
|
||||
ok = sevalue_to_native(args[0], &uuid);
|
||||
SE_PRECONDITION2(ok, false, "Invalid uuid content!");
|
||||
|
||||
auto mgr = spine::SkeletonDataMgr::getInstance();
|
||||
auto mgr = SkeletonDataMgr::getInstance();
|
||||
bool hasSkeletonData = mgr->hasSkeletonData(uuid);
|
||||
if (hasSkeletonData) {
|
||||
spine::SkeletonData *skeletonData = mgr->retainByUUID(uuid);
|
||||
@@ -270,12 +278,20 @@ static bool js_RegionAttachment_computeWorldVertices(se::State &s) {
|
||||
spine::RegionAttachment *regionAttachment = SE_THIS_OBJECT<spine::RegionAttachment>(s);
|
||||
if (nullptr == regionAttachment) return true;
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
spine::Bone *bone = nullptr;
|
||||
#else
|
||||
spine::Slot *slot = nullptr;
|
||||
#endif
|
||||
size_t offset = 0, stride = 0;
|
||||
se::Value worldVerticesVal;
|
||||
|
||||
bool ok = false;
|
||||
#if CC_USE_SPINE_3_8
|
||||
ok = sevalue_to_native(args[0], &bone, s.thisObject());
|
||||
#else
|
||||
ok = sevalue_to_native(args[0], &slot, s.thisObject());
|
||||
#endif
|
||||
SE_PRECONDITION2(ok, false, "Error processing arguments");
|
||||
|
||||
ok = sevalue_to_native(args[1], &worldVerticesVal, s.thisObject());
|
||||
@@ -291,12 +307,20 @@ static bool js_RegionAttachment_computeWorldVertices(se::State &s) {
|
||||
uint8_t* ptr = nullptr;
|
||||
size_t len = 0;
|
||||
worldVerticesVal.toObject()->getTypedArrayData(&ptr, &len);
|
||||
regionAttachment->computeWorldVertices(*bone, reinterpret_cast<float*>(ptr), offset, stride);
|
||||
#if CC_USE_SPINE_3_8
|
||||
regionAttachment->computeWorldVertices(*bone, reinterpret_cast<float *>(ptr), offset, stride);
|
||||
#else
|
||||
regionAttachment->computeWorldVertices(*slot, reinterpret_cast<float *>(ptr), offset, stride);
|
||||
#endif
|
||||
} else if (worldVerticesVal.toObject()->isArray()) {
|
||||
spine::Vector<float> worldVertices;
|
||||
int count = 8;
|
||||
worldVertices.ensureCapacity(count);
|
||||
#if CC_USE_SPINE_3_8
|
||||
regionAttachment->computeWorldVertices(*bone, worldVertices, 0);
|
||||
#else
|
||||
regionAttachment->computeWorldVertices(*slot, worldVertices, 0);
|
||||
#endif
|
||||
|
||||
int curr = offset;
|
||||
worldVerticesVal.toObject()->setArrayElement(curr, se::Value(worldVertices[0]));
|
||||
@@ -444,6 +468,7 @@ static bool js_Skin_findAttachmentsForSlot(se::State &s) {
|
||||
}
|
||||
SE_BIND_FUNC(js_Skin_findAttachmentsForSlot)
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
static bool js_VertexEffect_transform(se::State &s) {
|
||||
const auto &args = s.args();
|
||||
spine::VertexEffect* effect = SE_THIS_OBJECT<spine::VertexEffect>(s);
|
||||
@@ -485,6 +510,7 @@ static bool js_JitterVertexEffect_transform(se::State &s) {
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FUNC(js_JitterVertexEffect_transform)
|
||||
#endif
|
||||
|
||||
static bool js_spine_Skin_getAttachments(se::State& s) {
|
||||
CC_UNUSED bool ok = true;
|
||||
@@ -577,14 +603,16 @@ bool register_all_spine_manual(se::Object *obj) {
|
||||
__jsb_spine_Bone_proto->defineFunction("worldToLocal", _SE(js_Bone_worldToLocal));
|
||||
__jsb_spine_Bone_proto->defineFunction("localToWorld", _SE(js_Bone_localToWorld));
|
||||
__jsb_spine_PointAttachment_proto->defineFunction("computeWorldPosition", _SE(js_PointAttachment_computeWorldPosition));
|
||||
#if CC_USE_SPINE_3_8
|
||||
__jsb_spine_VertexEffect_proto->defineFunction("transform", _SE(js_VertexEffect_transform));
|
||||
__jsb_spine_SwirlVertexEffect_proto->defineFunction("transform", _SE(js_SwirlVertexEffect_transform));
|
||||
__jsb_spine_JitterVertexEffect_proto->defineFunction("transform", _SE(js_JitterVertexEffect_transform));
|
||||
#endif
|
||||
__jsb_spine_Skin_proto->defineFunction("getAttachments", _SE(js_spine_Skin_getAttachments));
|
||||
__jsb_spine_Slot_proto->defineFunction("setAttachment", _SE(js_spine_Slot_setAttachment));
|
||||
__jsb_spine_Slot_proto->defineFunction("getAttachment", _SE(js_spine_Slot_getAttachment));
|
||||
|
||||
spine::setSpineObjectDisposeCallback([](void *spineObj) {
|
||||
cc::setSpineObjectDisposeCallback([](void *spineObj) {
|
||||
if (!se::NativePtrToObjectMap::isValid()) {
|
||||
return;
|
||||
}
|
||||
@@ -600,7 +628,7 @@ bool register_all_spine_manual(se::Object *obj) {
|
||||
});
|
||||
|
||||
se::ScriptEngine::getInstance()->addBeforeCleanupHook([]() {
|
||||
spine::SkeletonDataMgr::destroyInstance();
|
||||
SkeletonDataMgr::destroyInstance();
|
||||
});
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
using namespace cc; // NOLINT(google-build-using-namespace)
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
AttachmentVertices::AttachmentVertices(middleware::Texture2D *texture, int verticesCount, uint16_t *triangles, int trianglesCount) {
|
||||
_texture = texture;
|
||||
@@ -55,4 +55,4 @@ AttachmentVertices *AttachmentVertices::copy() {
|
||||
return atv;
|
||||
}
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "base/Macros.h"
|
||||
#include "middleware-adapter.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
/**
|
||||
* Store attachment vertex and indice list
|
||||
*/
|
||||
@@ -45,4 +45,4 @@ public:
|
||||
cc::middleware::Texture2D *_texture = nullptr;
|
||||
cc::middleware::Triangles *_triangles = nullptr;
|
||||
};
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "spine-creator-support/spine-cocos2dx.h"
|
||||
#include "spine/Extension.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
struct TrackEntryListeners {
|
||||
StartListener startListener;
|
||||
@@ -53,7 +53,7 @@ void trackEntryCallback(AnimationState *state, EventType type, TrackEntry *entry
|
||||
(static_cast<SkeletonAnimation *>(state->getRendererObject()))->onTrackEntryEvent(entry, type, event);
|
||||
if (type == EventType_Dispose) {
|
||||
if (entry->getRendererObject()) {
|
||||
delete static_cast<spine::TrackEntryListeners *>(entry->getRendererObject());
|
||||
delete static_cast<TrackEntryListeners *>(entry->getRendererObject());
|
||||
entry->setRendererObject(nullptr);
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ void trackEntryCallback(AnimationState *state, EventType type, TrackEntry *entry
|
||||
|
||||
static TrackEntryListeners *getListeners(TrackEntry *entry) {
|
||||
if (!entry->getRendererObject()) {
|
||||
entry->setRendererObject(new spine::TrackEntryListeners());
|
||||
entry->setRendererObject(new TrackEntryListeners());
|
||||
entry->setListener(trackEntryCallback);
|
||||
}
|
||||
return static_cast<TrackEntryListeners *>(entry->getRendererObject());
|
||||
@@ -127,7 +127,11 @@ void SkeletonAnimation::update(float deltaTime) {
|
||||
if (_ownsSkeleton) _skeleton->update(deltaTime);
|
||||
_state->update(deltaTime);
|
||||
_state->apply(*_skeleton);
|
||||
#if CC_USE_SPINE_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Update);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,4 +327,4 @@ AnimationState *SkeletonAnimation::getState() const {
|
||||
return _state;
|
||||
}
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -31,37 +31,37 @@
|
||||
#include "spine-creator-support/SkeletonRenderer.h"
|
||||
#include "spine/spine.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
typedef std::function<void(TrackEntry *entry)> StartListener;
|
||||
typedef std::function<void(TrackEntry *entry)> InterruptListener;
|
||||
typedef std::function<void(TrackEntry *entry)> EndListener;
|
||||
typedef std::function<void(TrackEntry *entry)> DisposeListener;
|
||||
typedef std::function<void(TrackEntry *entry)> CompleteListener;
|
||||
typedef std::function<void(TrackEntry *entry, Event *event)> EventListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry)> StartListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry)> InterruptListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry)> EndListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry)> DisposeListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry)> CompleteListener;
|
||||
typedef std::function<void(spine::TrackEntry *entry, spine::Event *event)> EventListener;
|
||||
|
||||
/** Draws an animated skeleton, providing an AnimationState for applying one or more animations and queuing animations to be
|
||||
* played later. */
|
||||
class SkeletonAnimation : public SkeletonRenderer {
|
||||
class SkeletonAnimation : public cc::SkeletonRenderer {
|
||||
public:
|
||||
static SkeletonAnimation *create();
|
||||
static SkeletonAnimation *createWithData(SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
static SkeletonAnimation *createWithData(spine::SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
static SkeletonAnimation *createWithJsonFile(const std::string &skeletonJsonFile, const std::string &atlasFile, float scale = 1);
|
||||
static SkeletonAnimation *createWithBinaryFile(const std::string &skeletonBinaryFile, const std::string &atlasFile, float scale = 1);
|
||||
static void setGlobalTimeScale(float timeScale);
|
||||
|
||||
virtual void update(float deltaTime) override;
|
||||
|
||||
void setAnimationStateData(AnimationStateData *stateData);
|
||||
void setAnimationStateData(spine::AnimationStateData *stateData);
|
||||
void setMix(const std::string &fromAnimation, const std::string &toAnimation, float duration);
|
||||
|
||||
TrackEntry *setAnimation(int trackIndex, const std::string &name, bool loop);
|
||||
TrackEntry *addAnimation(int trackIndex, const std::string &name, bool loop, float delay = 0);
|
||||
TrackEntry *setEmptyAnimation(int trackIndex, float mixDuration);
|
||||
spine::TrackEntry *setAnimation(int trackIndex, const std::string &name, bool loop);
|
||||
spine::TrackEntry *addAnimation(int trackIndex, const std::string &name, bool loop, float delay = 0);
|
||||
spine::TrackEntry *setEmptyAnimation(int trackIndex, float mixDuration);
|
||||
void setEmptyAnimations(float mixDuration);
|
||||
TrackEntry *addEmptyAnimation(int trackIndex, float mixDuration, float delay = 0);
|
||||
Animation *findAnimation(const std::string &name) const;
|
||||
TrackEntry *getCurrent(int trackIndex = 0);
|
||||
spine::TrackEntry *addEmptyAnimation(int trackIndex, float mixDuration, float delay = 0);
|
||||
spine::Animation *findAnimation(const std::string &name) const;
|
||||
spine::TrackEntry *getCurrent(int trackIndex = 0);
|
||||
void clearTracks();
|
||||
void clearTrack(int trackIndex = 0);
|
||||
|
||||
@@ -72,17 +72,17 @@ public:
|
||||
void setCompleteListener(const CompleteListener &listener);
|
||||
void setEventListener(const EventListener &listener);
|
||||
|
||||
void setTrackStartListener(TrackEntry *entry, const StartListener &listener);
|
||||
void setTrackInterruptListener(TrackEntry *entry, const InterruptListener &listener);
|
||||
void setTrackEndListener(TrackEntry *entry, const EndListener &listener);
|
||||
void setTrackDisposeListener(TrackEntry *entry, const DisposeListener &listener);
|
||||
void setTrackCompleteListener(TrackEntry *entry, const CompleteListener &listener);
|
||||
void setTrackEventListener(TrackEntry *entry, const EventListener &listener);
|
||||
void setTrackStartListener(spine::TrackEntry *entry, const StartListener &listener);
|
||||
void setTrackInterruptListener(spine::TrackEntry *entry, const InterruptListener &listener);
|
||||
void setTrackEndListener(spine::TrackEntry *entry, const EndListener &listener);
|
||||
void setTrackDisposeListener(spine::TrackEntry *entry, const DisposeListener &listener);
|
||||
void setTrackCompleteListener(spine::TrackEntry *entry, const CompleteListener &listener);
|
||||
void setTrackEventListener(spine::TrackEntry *entry, const EventListener &listener);
|
||||
|
||||
virtual void onAnimationStateEvent(TrackEntry *entry, EventType type, Event *event);
|
||||
virtual void onTrackEntryEvent(TrackEntry *entry, EventType type, Event *event);
|
||||
virtual void onAnimationStateEvent(spine::TrackEntry *entry, spine::EventType type, spine::Event *event);
|
||||
virtual void onTrackEntryEvent(spine::TrackEntry *entry, spine::EventType type, spine::Event *event);
|
||||
|
||||
AnimationState *getState() const;
|
||||
spine::AnimationState *getState() const;
|
||||
|
||||
SkeletonAnimation();
|
||||
virtual ~SkeletonAnimation();
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
static float GlobalTimeScale;
|
||||
|
||||
protected:
|
||||
AnimationState *_state = nullptr;
|
||||
spine::AnimationState *_state = nullptr;
|
||||
bool _ownsAnimationStateData = false;
|
||||
StartListener _startListener = nullptr;
|
||||
InterruptListener _interruptListener = nullptr;
|
||||
@@ -102,7 +102,7 @@ protected:
|
||||
EventListener _eventListener = nullptr;
|
||||
|
||||
private:
|
||||
typedef SkeletonRenderer super;
|
||||
typedef cc::SkeletonRenderer super;
|
||||
};
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
USING_NS_MW; // NOLINT(google-build-using-namespace)
|
||||
using namespace cc; // NOLINT(google-build-using-namespace)
|
||||
|
||||
namespace spine {
|
||||
using namespace spine;
|
||||
namespace cc {
|
||||
|
||||
float SkeletonCache::FrameTime = 1.0F / 60.0F;
|
||||
float SkeletonCache::MaxCacheTime = 120.0F;
|
||||
@@ -192,7 +192,11 @@ void SkeletonCache::update(float deltaTime) {
|
||||
if (_ownsSkeleton) _skeleton->update(deltaTime);
|
||||
_state->update(deltaTime);
|
||||
_state->apply(*_skeleton);
|
||||
#if CC_USE_SPINE_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Update);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SkeletonCache::updateToFrame(const std::string &animationName, int toFrameIdx /*= -1*/) {
|
||||
@@ -325,7 +329,11 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
|
||||
spine::Color attachmentColor;
|
||||
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
auto *attachment = dynamic_cast<RegionAttachment *>(slot->getAttachment());
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
#else
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
// Early exit if attachment is invisible
|
||||
if (attachment->getColor().a == 0) {
|
||||
@@ -340,7 +348,11 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
|
||||
for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) {
|
||||
trianglesTwoColor.verts[ii].texCoord = attachmentVertices->_triangles->verts[ii].texCoord;
|
||||
}
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->computeWorldVertices(slot->getBone(), reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
|
||||
#else
|
||||
attachment->computeWorldVertices(*slot, reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
|
||||
#endif
|
||||
|
||||
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
|
||||
ibSize = static_cast<int32_t>(trianglesTwoColor.indexCount * sizeof(uint16_t));
|
||||
@@ -352,7 +364,11 @@ void SkeletonCache::renderAnimationFrame(AnimationData *animationData) {
|
||||
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto *attachment = dynamic_cast<MeshAttachment *>(slot->getAttachment());
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
#else
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
// Early exit if attachment is invisible
|
||||
if (attachment->getColor().a == 0) {
|
||||
@@ -543,4 +559,4 @@ void SkeletonCache::resetAnimationData(const std::string &animationName) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "SkeletonAnimation.h"
|
||||
#include "middleware-adapter.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
class SkeletonCache : public SkeletonAnimation {
|
||||
public:
|
||||
struct SegmentData {
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
virtual void stopSchedule() override {}
|
||||
virtual void update(float deltaTime) override;
|
||||
virtual void render(float deltaTime) override {}
|
||||
virtual void onAnimationStateEvent(TrackEntry *entry, EventType type, Event *event) override;
|
||||
virtual void onAnimationStateEvent(spine::TrackEntry *entry, spine::EventType type, spine::Event *event) override;
|
||||
|
||||
void updateToFrame(const std::string &animationName, int toFrameIdx = -1);
|
||||
// if animation data is empty, it will build new one.
|
||||
@@ -154,4 +154,4 @@ private:
|
||||
std::string _curAnimationName = "";
|
||||
std::map<std::string, AnimationData *> _animationCaches;
|
||||
};
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -43,10 +43,11 @@ USING_NS_MW; // NOLINT(google-build-using-namespace)
|
||||
|
||||
using namespace cc; // NOLINT(google-build-using-namespace)
|
||||
using namespace cc::gfx; // NOLINT(google-build-using-namespace)
|
||||
using namespace spine;
|
||||
static const std::string TECH_STAGE = "opaque";
|
||||
static const std::string TEXTURE_KEY = "texture";
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
SkeletonCacheAnimation::SkeletonCacheAnimation(const std::string &uuid, bool isShare) {
|
||||
if (isShare) {
|
||||
@@ -601,4 +602,4 @@ cc::Material *SkeletonCacheAnimation::requestMaterial(uint16_t blendSrc, uint16_
|
||||
return _materialCaches[key];
|
||||
}
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -41,7 +41,7 @@ class RenderDrawInfo;
|
||||
class Material;
|
||||
};
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
class SkeletonCacheAnimation : public cc::RefCounted, public cc::middleware::IMiddleware {
|
||||
public:
|
||||
@@ -51,20 +51,20 @@ public:
|
||||
void update(float dt) override;
|
||||
void render(float dt) override;
|
||||
|
||||
Skeleton *getSkeleton() const;
|
||||
spine::Skeleton *getSkeleton() const;
|
||||
|
||||
void setTimeScale(float scale);
|
||||
float getTimeScale() const;
|
||||
|
||||
void paused(bool value);
|
||||
|
||||
Bone *findBone(const std::string &boneName) const;
|
||||
Slot *findSlot(const std::string &slotName) const;
|
||||
spine::Bone *findBone(const std::string &boneName) const;
|
||||
spine::Slot *findSlot(const std::string &slotName) const;
|
||||
|
||||
void setSkin(const std::string &skinName);
|
||||
void setSkin(const char *skinName);
|
||||
|
||||
Attachment *getAttachment(const std::string &slotName, const std::string &attachmentName) const;
|
||||
spine::Attachment *getAttachment(const std::string &slotName, const std::string &attachmentName) const;
|
||||
bool setAttachment(const std::string &slotName, const std::string &attachmentName);
|
||||
bool setAttachment(const std::string &slotName, const char *attachmentName);
|
||||
void setColor(float r, float g, float b, float a);
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
void setAnimation(const std::string &name, bool loop);
|
||||
void addAnimation(const std::string &name, bool loop, float delay = 0);
|
||||
Animation *findAnimation(const std::string &name) const;
|
||||
spine::Animation *findAnimation(const std::string &name) const;
|
||||
|
||||
using CacheFrameEvent = std::function<void(std::string)>;
|
||||
void setStartListener(const CacheFrameEvent &listener);
|
||||
@@ -143,4 +143,4 @@ private:
|
||||
ccstd::unordered_map<uint32_t, cc::Material*> _materialCaches;
|
||||
bool _needClearMaterialCaches = false;
|
||||
};
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "SkeletonCacheMgr.h"
|
||||
#include "base/DeferredReleasePool.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
SkeletonCacheMgr *SkeletonCacheMgr::instance = nullptr;
|
||||
SkeletonCache *SkeletonCacheMgr::buildSkeletonCache(const std::string &uuid) {
|
||||
SkeletonCache *animation = _caches.at(uuid);
|
||||
@@ -50,4 +50,4 @@ void SkeletonCacheMgr::removeSkeletonCache(const std::string &uuid) {
|
||||
_caches.erase(it);
|
||||
}
|
||||
}
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "SkeletonCache.h"
|
||||
#include "base/RefMap.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
class SkeletonCacheMgr {
|
||||
public:
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
}
|
||||
|
||||
void removeSkeletonCache(const std::string &uuid);
|
||||
SkeletonCache *buildSkeletonCache(const std::string &uuid);
|
||||
cc::SkeletonCache *buildSkeletonCache(const std::string &uuid);
|
||||
|
||||
private:
|
||||
static SkeletonCacheMgr *instance;
|
||||
cc::RefMap<std::string, SkeletonCache *> _caches;
|
||||
};
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -32,8 +32,11 @@
|
||||
#include <vector>
|
||||
|
||||
using namespace spine; //NOLINT
|
||||
using namespace cc; //NOLINT
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
|
||||
class AttachmentVertices;
|
||||
|
||||
class SkeletonDataInfo {
|
||||
public:
|
||||
@@ -46,6 +49,17 @@ public:
|
||||
}
|
||||
|
||||
if (atlas) {
|
||||
#if CC_USE_SPINE_4_2
|
||||
auto ®ions = atlas->getRegions();
|
||||
int size = regions.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
auto *region = regions[i];
|
||||
if (region->rendererObject) {
|
||||
delete static_cast<AttachmentVertices *>(region->rendererObject);
|
||||
region->rendererObject = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
delete atlas;
|
||||
atlas = nullptr;
|
||||
}
|
||||
@@ -62,7 +76,7 @@ public:
|
||||
std::vector<int> texturesIndex;
|
||||
};
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
SkeletonDataMgr *SkeletonDataMgr::instance = nullptr;
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
#include "spine/SkeletonData.h"
|
||||
#include "spine/spine.h"
|
||||
|
||||
namespace spine {
|
||||
using namespace spine;
|
||||
namespace cc {
|
||||
|
||||
class SkeletonDataInfo;
|
||||
|
||||
@@ -81,4 +82,4 @@ private:
|
||||
std::map<std::string, SkeletonDataInfo *> _dataMap;
|
||||
};
|
||||
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
@@ -55,7 +55,7 @@ using std::min;
|
||||
static const std::string TECH_STAGE = "opaque";
|
||||
static const std::string TEXTURE_KEY = "texture";
|
||||
|
||||
static spine::Cocos2dTextureLoader textureLoader;
|
||||
static Cocos2dTextureLoader textureLoader;
|
||||
static std::vector<middleware::Texture2D *> _slotTextureSet{};
|
||||
|
||||
enum DebugType {
|
||||
@@ -64,6 +64,8 @@ enum DebugType {
|
||||
MESH,
|
||||
BONES
|
||||
};
|
||||
|
||||
namespace cc {
|
||||
SkeletonRenderer *SkeletonRenderer::create() {
|
||||
return new SkeletonRenderer();
|
||||
}
|
||||
@@ -91,7 +93,11 @@ void SkeletonRenderer::initialize() {
|
||||
}
|
||||
|
||||
_skeleton->setToSetupPose();
|
||||
#if CC_USE_SPINE_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(spine::Physics::Physics_Pose);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SkeletonRenderer::beginSchedule() {
|
||||
@@ -138,7 +144,9 @@ SkeletonRenderer::SkeletonRenderer(const std::string &skeletonDataFile, const st
|
||||
}
|
||||
|
||||
SkeletonRenderer::~SkeletonRenderer() {
|
||||
#if CC_USE_SPINE_3_8
|
||||
CC_SAFE_RELEASE(_effectDelegate);
|
||||
#endif
|
||||
if (_ownsSkeletonData) delete _skeleton->getData();
|
||||
if (_ownsSkeleton) delete _skeleton;
|
||||
if (_ownsAtlas && _atlas) delete _atlas;
|
||||
@@ -354,8 +362,8 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
}
|
||||
auto *material = requestMaterial(curBlendSrc, curBlendDst);
|
||||
curDrawInfo->setMaterial(material);
|
||||
gfx::Texture *texture = curTexture->getGFXTexture();
|
||||
gfx::Sampler *sampler = curTexture->getGFXSampler();
|
||||
gfx::Texture *texture = curTexture ? curTexture->getGFXTexture() : nullptr;
|
||||
gfx::Sampler *sampler = curTexture? curTexture->getGFXSampler() : nullptr;
|
||||
curDrawInfo->setTexture(texture);
|
||||
curDrawInfo->setSampler(sampler);
|
||||
auto *uiMeshBuffer = mb->getUIMeshBuffer();
|
||||
@@ -371,6 +379,7 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
materialLen++;
|
||||
};
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
VertexEffect *effect = nullptr;
|
||||
if (_effectDelegate) {
|
||||
effect = _effectDelegate->getVertexEffect();
|
||||
@@ -379,6 +388,9 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
if (effect) {
|
||||
effect->begin(*_skeleton);
|
||||
}
|
||||
#else
|
||||
void *effect = nullptr;
|
||||
#endif
|
||||
|
||||
auto &drawOrder = _skeleton->getDrawOrder();
|
||||
for (size_t i = 0, n = drawOrder.size(); i < n; ++i) {
|
||||
@@ -412,7 +424,11 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
|
||||
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
auto *attachment = dynamic_cast<RegionAttachment *>(slot->getAttachment());
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachmentVertices = reinterpret_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
#else
|
||||
attachmentVertices = reinterpret_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
// Early exit if attachment is invisible
|
||||
if (attachment->getColor().a == 0) {
|
||||
@@ -426,7 +442,11 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
isFull |= vb.checkSpace(vbSize, true);
|
||||
triangles.verts = reinterpret_cast<V3F_T2F_C4B *>(vb.getCurBuffer());
|
||||
memcpy(static_cast<void *>(triangles.verts), static_cast<void *>(attachmentVertices->_triangles->verts), vbSize);
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->computeWorldVertices(slot->getBone(), reinterpret_cast<float *>(triangles.verts), 0, vs1);
|
||||
#else
|
||||
attachment->computeWorldVertices(*slot, reinterpret_cast<float *>(triangles.verts), 0, vs1);
|
||||
#endif
|
||||
|
||||
triangles.indexCount = attachmentVertices->_triangles->indexCount;
|
||||
ibSize = triangles.indexCount * sizeof(uint16_t);
|
||||
@@ -441,7 +461,11 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
for (int ii = 0; ii < trianglesTwoColor.vertCount; ii++) {
|
||||
trianglesTwoColor.verts[ii].texCoord = attachmentVertices->_triangles->verts[ii].texCoord;
|
||||
}
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->computeWorldVertices(slot->getBone(), reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
|
||||
#else
|
||||
attachment->computeWorldVertices(*slot, reinterpret_cast<float *>(trianglesTwoColor.verts), 0, vs2);
|
||||
#endif
|
||||
|
||||
trianglesTwoColor.indexCount = attachmentVertices->_triangles->indexCount;
|
||||
ibSize = trianglesTwoColor.indexCount * sizeof(uint16_t);
|
||||
@@ -469,7 +493,11 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
}
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto *attachment = dynamic_cast<MeshAttachment *>(slot->getAttachment());
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
#else
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
// Early exit if attachment is invisible
|
||||
if (attachment->getColor().a == 0) {
|
||||
@@ -533,6 +561,17 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
}
|
||||
}
|
||||
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(PathAttachment::rtti)) {
|
||||
auto *pathAttachment = dynamic_cast<spine::PathAttachment *>(slot->getAttachment());
|
||||
#if CC_USE_SPINE_4_2
|
||||
if (pathAttachment->getColor().a == 0) {
|
||||
_clipper->clipEnd(*slot);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: implement PathAttachment
|
||||
//auto &transform = slot->getBone().getWorldTransform();
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(ClippingAttachment::rtti)) {
|
||||
auto *clip = dynamic_cast<ClippingAttachment *>(slot->getAttachment());
|
||||
_clipper->clipStart(*slot, clip);
|
||||
@@ -600,6 +639,7 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
float *uvs = _clipper->getClippedUVs().buffer();
|
||||
|
||||
if (effect) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv += 2) {
|
||||
V3F_T2F_C4B *vertex = triangles.verts + v;
|
||||
vertex->vertex.x = verts[vv];
|
||||
@@ -609,6 +649,7 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
effect->transform(vertex->vertex.x, vertex->vertex.y);
|
||||
vertex->color = light;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
for (int v = 0, vn = triangles.vertCount, vv = 0; v < vn; ++v, vv += 2) {
|
||||
V3F_T2F_C4B *vertex = triangles.verts + v;
|
||||
@@ -622,11 +663,13 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
// No cliping logic
|
||||
} else {
|
||||
if (effect) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
for (int v = 0, vn = triangles.vertCount; v < vn; ++v) {
|
||||
V3F_T2F_C4B *vertex = triangles.verts + v;
|
||||
effect->transform(vertex->vertex.x, vertex->vertex.y);
|
||||
vertex->color = light;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
for (int v = 0, vn = triangles.vertCount; v < vn; ++v) {
|
||||
V3F_T2F_C4B *vertex = triangles.verts + v;
|
||||
@@ -669,6 +712,7 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
float *uvs = _clipper->getClippedUVs().buffer();
|
||||
|
||||
if (effect) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
for (int v = 0, vn = trianglesTwoColor.vertCount, vv = 0; v < vn; ++v, vv += 2) {
|
||||
V3F_T2F_C4B_C4B *vertex = trianglesTwoColor.verts + v;
|
||||
vertex->vertex.x = verts[vv];
|
||||
@@ -679,6 +723,7 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
vertex->color = light;
|
||||
vertex->color2 = dark;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
for (int v = 0, vn = trianglesTwoColor.vertCount, vv = 0; v < vn; ++v, vv += 2) {
|
||||
V3F_T2F_C4B_C4B *vertex = trianglesTwoColor.verts + v;
|
||||
@@ -692,12 +737,14 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
}
|
||||
} else {
|
||||
if (effect) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
for (int v = 0, vn = trianglesTwoColor.vertCount; v < vn; ++v) {
|
||||
V3F_T2F_C4B_C4B *vertex = trianglesTwoColor.verts + v;
|
||||
effect->transform(vertex->vertex.x, vertex->vertex.y);
|
||||
vertex->color = light;
|
||||
vertex->color2 = dark;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
for (int v = 0, vn = trianglesTwoColor.vertCount; v < vn; ++v) {
|
||||
V3F_T2F_C4B_C4B *vertex = trianglesTwoColor.verts + v;
|
||||
@@ -708,7 +755,12 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
}
|
||||
}
|
||||
|
||||
curTexture = (cc::Texture2D *)attachmentVertices->_texture->getRealTexture();
|
||||
if (attachmentVertices) {
|
||||
curTexture = (cc::Texture2D *)attachmentVertices->_texture->getRealTexture();
|
||||
} else {
|
||||
curTexture = nullptr;
|
||||
}
|
||||
|
||||
// If texture or blendMode change,will change material.
|
||||
if (preTexture != curTexture || preBlendMode != slot->getData().getBlendMode() || isFull) {
|
||||
flush();
|
||||
@@ -742,7 +794,9 @@ void SkeletonRenderer::render(float /*deltaTime*/) {
|
||||
|
||||
_clipper->clipEnd();
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
if (effect) effect->end();
|
||||
#endif
|
||||
|
||||
if (curDrawInfo) curDrawInfo->setIbCount(curISegLen);
|
||||
|
||||
@@ -807,7 +861,11 @@ cc::Rect SkeletonRenderer::getBoundingBox() const {
|
||||
auto *attachment = dynamic_cast<RegionAttachment *>(slot->getAttachment());
|
||||
buffer.checkSpace(8 * sizeof(float));
|
||||
worldVertices = reinterpret_cast<float *>(buffer.getCurBuffer());
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->computeWorldVertices(slot->getBone(), worldVertices, 0, 2);
|
||||
#else
|
||||
attachment->computeWorldVertices(*slot, worldVertices, 0, 2);
|
||||
#endif
|
||||
verticesCount = 8;
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto *mesh = dynamic_cast<MeshAttachment *>(slot->getAttachment());
|
||||
@@ -833,7 +891,11 @@ cc::Rect SkeletonRenderer::getBoundingBox() const {
|
||||
|
||||
void SkeletonRenderer::updateWorldTransform() {
|
||||
if (_skeleton) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Update);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,6 +974,7 @@ void SkeletonRenderer::setUseTint(bool enabled) {
|
||||
_useTint = enabled;
|
||||
}
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
void SkeletonRenderer::setVertexEffectDelegate(VertexEffectDelegate *effectDelegate) {
|
||||
if (_effectDelegate == effectDelegate) {
|
||||
return;
|
||||
@@ -920,6 +983,7 @@ void SkeletonRenderer::setVertexEffectDelegate(VertexEffectDelegate *effectDeleg
|
||||
_effectDelegate = effectDelegate;
|
||||
CC_SAFE_ADD_REF(_effectDelegate);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) {
|
||||
this->_startSlotIndex = startSlotIndex;
|
||||
@@ -1059,6 +1123,7 @@ void SkeletonRenderer::setSlotTexture(const std::string &slotName, cc::Texture2D
|
||||
AttachmentVertices *attachmentVertices = nullptr;
|
||||
if (attachment->getRTTI().isExactly(spine::RegionAttachment::rtti)) {
|
||||
auto region = static_cast<RegionAttachment *>(attachment);
|
||||
#if CC_USE_SPINE_3_8
|
||||
region->setRegionWidth(width);
|
||||
region->setRegionHeight(height);
|
||||
region->setRegionOriginalWidth(width);
|
||||
@@ -1072,6 +1137,32 @@ void SkeletonRenderer::setSlotTexture(const std::string &slotName, cc::Texture2D
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
region->setRendererObject(attachmentVertices);
|
||||
}
|
||||
#else
|
||||
auto *textureRegion = region->getRegion();
|
||||
if (textureRegion) {
|
||||
textureRegion->width = width;
|
||||
textureRegion->height = height;
|
||||
textureRegion->originalWidth = width;
|
||||
textureRegion->originalHeight = height;
|
||||
}
|
||||
region->setWidth(width);
|
||||
region->setHeight(height);
|
||||
auto &uvs = region->getUVs();
|
||||
uvs[2] = 0;
|
||||
uvs[3] = 1;
|
||||
uvs[4] = 0;
|
||||
uvs[5] = 0;
|
||||
uvs[6] = 1;
|
||||
uvs[7] = 0;
|
||||
uvs[0] = 1;
|
||||
uvs[1] = 1;
|
||||
region->updateRegion();
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(textureRegion->rendererObject);
|
||||
if (createAttachment) {
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
textureRegion->rendererObject = attachmentVertices;
|
||||
}
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
const auto &UVs = region->getUVs();
|
||||
for (int i = 0, ii = 0; i < 4; ++i, ii += 2) {
|
||||
@@ -1080,6 +1171,7 @@ void SkeletonRenderer::setSlotTexture(const std::string &slotName, cc::Texture2D
|
||||
}
|
||||
} else if (attachment->getRTTI().isExactly(spine::MeshAttachment::rtti)) {
|
||||
auto mesh = static_cast<MeshAttachment *>(attachment);
|
||||
#if CC_USE_SPINE_3_8
|
||||
mesh->setRegionWidth(width);
|
||||
mesh->setRegionHeight(height);
|
||||
mesh->setRegionOriginalWidth(width);
|
||||
@@ -1098,6 +1190,28 @@ void SkeletonRenderer::setSlotTexture(const std::string &slotName, cc::Texture2D
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
mesh->setRendererObject(attachmentVertices);
|
||||
}
|
||||
#else
|
||||
auto *region = mesh->getRegion();
|
||||
if (region) {
|
||||
region->width = width;
|
||||
region->height = height;
|
||||
region->originalWidth = width;
|
||||
region->originalHeight = height;
|
||||
region->u = 0;
|
||||
region->v = 0;
|
||||
region->u2 = 1.0f;
|
||||
region->v2 = 1.0f;
|
||||
region->degrees = 0;
|
||||
}
|
||||
mesh->setWidth(width);
|
||||
mesh->setHeight(height);
|
||||
mesh->updateRegion();
|
||||
attachmentVertices = static_cast<AttachmentVertices *>(mesh->getRegion()->rendererObject);
|
||||
if (createAttachment) {
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
mesh->getRegion()->rendererObject = attachmentVertices;
|
||||
}
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
const auto &UVs = mesh->getUVs();
|
||||
for (size_t i = 0, ii = 0, nn = mesh->getWorldVerticesLength(); ii < nn; ++i, ii += 2) {
|
||||
@@ -1123,3 +1237,4 @@ void SkeletonRenderer::setSlotTexture(const std::string &slotName, cc::Texture2D
|
||||
}
|
||||
attachmentVertices->_texture = middlewareTexture;
|
||||
}
|
||||
} // namespace cc
|
||||
|
||||
@@ -38,16 +38,15 @@
|
||||
#include "base/RefMap.h"
|
||||
#include "core/assets/Texture2D.h"
|
||||
#include "middleware-adapter.h"
|
||||
#if CC_USE_SPINE_3_8
|
||||
#include "spine-creator-support/VertexEffectDelegate.h"
|
||||
#endif
|
||||
#include "spine/spine.h"
|
||||
|
||||
namespace cc {
|
||||
class RenderEntity;
|
||||
class RenderDrawInfo;
|
||||
class Material;
|
||||
}; // namespace cc
|
||||
|
||||
namespace spine {
|
||||
|
||||
class AttachmentVertices;
|
||||
|
||||
@@ -56,15 +55,15 @@ class AttachmentVertices;
|
||||
class SkeletonRenderer : public cc::RefCounted, public cc::middleware::IMiddleware {
|
||||
public:
|
||||
static SkeletonRenderer *create();
|
||||
static SkeletonRenderer *createWithSkeleton(Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false);
|
||||
static SkeletonRenderer *createWithData(SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
static SkeletonRenderer *createWithSkeleton(spine::Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false);
|
||||
static SkeletonRenderer *createWithData(spine::SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
static SkeletonRenderer *createWithFile(const std::string &skeletonDataFile, const std::string &atlasFile, float scale = 1);
|
||||
|
||||
void update(float deltaTime) override {}
|
||||
void render(float deltaTime) override;
|
||||
virtual cc::Rect getBoundingBox() const;
|
||||
|
||||
Skeleton *getSkeleton() const;
|
||||
spine::Skeleton *getSkeleton() const;
|
||||
|
||||
void setTimeScale(float scale);
|
||||
float getTimeScale() const;
|
||||
@@ -77,9 +76,9 @@ public:
|
||||
void paused(bool value);
|
||||
|
||||
/* Returns 0 if the bone was not found. */
|
||||
Bone *findBone(const std::string &boneName) const;
|
||||
spine::Bone *findBone(const std::string &boneName) const;
|
||||
/* Returns 0 if the slot was not found. */
|
||||
Slot *findSlot(const std::string &slotName) const;
|
||||
spine::Slot *findSlot(const std::string &slotName) const;
|
||||
|
||||
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
|
||||
* attached if the corresponding attachment from the old skin was attached.
|
||||
@@ -89,7 +88,7 @@ public:
|
||||
void setSkin(const char *skinName);
|
||||
|
||||
/* Returns 0 if the slot or attachment was not found. */
|
||||
Attachment *getAttachment(const std::string &slotName, const std::string &attachmentName) const;
|
||||
spine::Attachment *getAttachment(const std::string &slotName, const std::string &attachmentName) const;
|
||||
/* Returns false if the slot or attachment was not found.
|
||||
* @param attachmentName May be empty string ("") for no attachment. */
|
||||
bool setAttachment(const std::string &slotName, const std::string &attachmentName);
|
||||
@@ -98,9 +97,10 @@ public:
|
||||
|
||||
/* Enables/disables two color tinting for this instance. May break batching */
|
||||
void setUseTint(bool enabled);
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
/* Sets the vertex effect to be used, set to 0 to disable vertex effects */
|
||||
void setVertexEffectDelegate(VertexEffectDelegate *effectDelegate);
|
||||
#endif
|
||||
/* Sets the range of slots that should be rendered. Use -1, -1 to clear the range */
|
||||
void setSlotsRange(int startSlotIndex, int endSlotIndex);
|
||||
|
||||
@@ -131,18 +131,18 @@ public:
|
||||
void onDisable();
|
||||
|
||||
SkeletonRenderer();
|
||||
explicit SkeletonRenderer(Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
|
||||
explicit SkeletonRenderer(SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
explicit SkeletonRenderer(spine::Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
|
||||
explicit SkeletonRenderer(spine::SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
SkeletonRenderer(const std::string &skeletonDataFile, const std::string &atlasFile, float scale = 1);
|
||||
|
||||
~SkeletonRenderer() override;
|
||||
|
||||
void initWithUUID(const std::string &uuid);
|
||||
void initWithSkeleton(Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
|
||||
void initWithData(SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
void initWithJsonFile(const std::string &skeletonDataFile, Atlas *atlas, float scale = 1);
|
||||
void initWithSkeleton(spine::Skeleton *skeleton, bool ownsSkeleton = false, bool ownsSkeletonData = false, bool ownsAtlas = false);
|
||||
void initWithData(spine::SkeletonData *skeletonData, bool ownsSkeletonData = false);
|
||||
void initWithJsonFile(const std::string &skeletonDataFile, spine::Atlas *atlas, float scale = 1);
|
||||
void initWithJsonFile(const std::string &skeletonDataFile, const std::string &atlasFile, float scale = 1);
|
||||
void initWithBinaryFile(const std::string &skeletonDataFile, Atlas *atlas, float scale = 1);
|
||||
void initWithBinaryFile(const std::string &skeletonDataFile, spine::Atlas *atlas, float scale = 1);
|
||||
void initWithBinaryFile(const std::string &skeletonDataFile, const std::string &atlasFile, float scale = 1);
|
||||
|
||||
virtual void initialize();
|
||||
@@ -154,15 +154,17 @@ public:
|
||||
void setSlotTexture(const std::string &slotName, cc::Texture2D *tex2d, bool createAttachment);
|
||||
|
||||
protected:
|
||||
void setSkeletonData(SkeletonData *skeletonData, bool ownsSkeletonData);
|
||||
void setSkeletonData(spine::SkeletonData *skeletonData, bool ownsSkeletonData);
|
||||
|
||||
bool _ownsSkeletonData = false;
|
||||
bool _ownsSkeleton = false;
|
||||
bool _ownsAtlas = false;
|
||||
Atlas *_atlas = nullptr;
|
||||
AttachmentLoader *_attachmentLoader = nullptr;
|
||||
Skeleton *_skeleton = nullptr;
|
||||
spine::Atlas *_atlas = nullptr;
|
||||
spine::AttachmentLoader *_attachmentLoader = nullptr;
|
||||
spine::Skeleton *_skeleton = nullptr;
|
||||
#if CC_USE_SPINE_3_8
|
||||
VertexEffectDelegate *_effectDelegate = nullptr;
|
||||
#endif
|
||||
float _timeScale = 1;
|
||||
bool _paused = false;
|
||||
|
||||
@@ -172,7 +174,7 @@ protected:
|
||||
bool _debugBones = false;
|
||||
cc::middleware::Color4F _nodeColor = cc::middleware::Color4F::WHITE;
|
||||
bool _premultipliedAlpha = false;
|
||||
SkeletonClipping *_clipper = nullptr;
|
||||
spine::SkeletonClipping *_clipper = nullptr;
|
||||
bool _useTint = false;
|
||||
bool _enableBatch = false;
|
||||
std::string _uuid;
|
||||
@@ -189,5 +191,4 @@ protected:
|
||||
ccstd::unordered_map<uint32_t, cc::Material *> _materialCaches;
|
||||
bool _needClearMaterialCaches = false;
|
||||
};
|
||||
|
||||
} // namespace spine
|
||||
}; // namespace cc
|
||||
|
||||
@@ -1,84 +1,85 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "VertexEffectDelegate.h"
|
||||
namespace spine {
|
||||
|
||||
VertexEffectDelegate::VertexEffectDelegate() {
|
||||
}
|
||||
|
||||
VertexEffectDelegate::~VertexEffectDelegate() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void VertexEffectDelegate::clear() {
|
||||
if (_interpolation) {
|
||||
delete _interpolation;
|
||||
_interpolation = nullptr;
|
||||
}
|
||||
if (_vertexEffect) {
|
||||
delete _vertexEffect;
|
||||
_vertexEffect = nullptr;
|
||||
}
|
||||
_effectType = "none";
|
||||
}
|
||||
|
||||
JitterVertexEffect *VertexEffectDelegate::initJitter(float jitterX, float jitterY) {
|
||||
clear();
|
||||
_vertexEffect = new JitterVertexEffect(jitterX, jitterY);
|
||||
_effectType = "jitter";
|
||||
return (JitterVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::initSwirlWithPow(float radius, int power) {
|
||||
clear();
|
||||
_interpolation = new PowInterpolation(power);
|
||||
_vertexEffect = new SwirlVertexEffect(radius, *_interpolation);
|
||||
_effectType = "swirl";
|
||||
return (SwirlVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::initSwirlWithPowOut(float radius, int power) {
|
||||
clear();
|
||||
_interpolation = new PowOutInterpolation(power);
|
||||
_vertexEffect = new SwirlVertexEffect(radius, *_interpolation);
|
||||
_effectType = "swirl";
|
||||
return (SwirlVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
JitterVertexEffect *VertexEffectDelegate::getJitterVertexEffect() {
|
||||
JitterVertexEffect *jitter = dynamic_cast<JitterVertexEffect *>(_vertexEffect);
|
||||
return jitter;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::getSwirlVertexEffect() {
|
||||
SwirlVertexEffect *swirl = dynamic_cast<SwirlVertexEffect *>(_vertexEffect);
|
||||
return swirl;
|
||||
}
|
||||
} // namespace spine
|
||||
namespace cc {
|
||||
|
||||
VertexEffectDelegate::VertexEffectDelegate() {
|
||||
}
|
||||
|
||||
VertexEffectDelegate::~VertexEffectDelegate() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void VertexEffectDelegate::clear() {
|
||||
if (_interpolation) {
|
||||
delete _interpolation;
|
||||
_interpolation = nullptr;
|
||||
}
|
||||
if (_vertexEffect) {
|
||||
delete _vertexEffect;
|
||||
_vertexEffect = nullptr;
|
||||
}
|
||||
_effectType = "none";
|
||||
}
|
||||
|
||||
JitterVertexEffect *VertexEffectDelegate::initJitter(float jitterX, float jitterY) {
|
||||
clear();
|
||||
_vertexEffect = new spine::JitterVertexEffect(jitterX, jitterY);
|
||||
_effectType = "jitter";
|
||||
return (JitterVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::initSwirlWithPow(float radius, int power) {
|
||||
clear();
|
||||
_interpolation = new spine::PowInterpolation(power);
|
||||
_vertexEffect = new spine::SwirlVertexEffect(radius, *_interpolation);
|
||||
_effectType = "swirl";
|
||||
return (SwirlVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::initSwirlWithPowOut(float radius, int power) {
|
||||
clear();
|
||||
_interpolation = new spine::PowOutInterpolation(power);
|
||||
_vertexEffect = new spine::SwirlVertexEffect(radius, *_interpolation);
|
||||
_effectType = "swirl";
|
||||
return (SwirlVertexEffect *)_vertexEffect;
|
||||
}
|
||||
|
||||
JitterVertexEffect *VertexEffectDelegate::getJitterVertexEffect() {
|
||||
JitterVertexEffect *jitter = dynamic_cast<JitterVertexEffect *>(_vertexEffect);
|
||||
return jitter;
|
||||
}
|
||||
|
||||
SwirlVertexEffect *VertexEffectDelegate::getSwirlVertexEffect() {
|
||||
SwirlVertexEffect *swirl = dynamic_cast<SwirlVertexEffect *>(_vertexEffect);
|
||||
return swirl;
|
||||
}
|
||||
} // namespace cc
|
||||
|
||||
@@ -1,59 +1,60 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "base/RefCounted.h"
|
||||
#include "spine/spine.h"
|
||||
|
||||
namespace spine {
|
||||
class VertexEffectDelegate : public cc::RefCounted {
|
||||
public:
|
||||
VertexEffectDelegate();
|
||||
~VertexEffectDelegate() override;
|
||||
JitterVertexEffect *initJitter(float jitterX, float jitterY);
|
||||
SwirlVertexEffect *initSwirlWithPow(float radius, int power);
|
||||
SwirlVertexEffect *initSwirlWithPowOut(float radius, int power);
|
||||
VertexEffect *getVertexEffect() {
|
||||
return _vertexEffect;
|
||||
}
|
||||
JitterVertexEffect *getJitterVertexEffect();
|
||||
SwirlVertexEffect *getSwirlVertexEffect();
|
||||
const std::string &getEffectType() const {
|
||||
return _effectType;
|
||||
}
|
||||
void clear();
|
||||
|
||||
private:
|
||||
VertexEffect *_vertexEffect = nullptr;
|
||||
Interpolation *_interpolation = nullptr;
|
||||
std::string _effectType = "none";
|
||||
};
|
||||
} // namespace spine
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "base/RefCounted.h"
|
||||
#include "spine/spine.h"
|
||||
using namespace spine;
|
||||
namespace cc {
|
||||
|
||||
class VertexEffectDelegate : public cc::RefCounted {
|
||||
public:
|
||||
VertexEffectDelegate();
|
||||
~VertexEffectDelegate() override;
|
||||
JitterVertexEffect *initJitter(float jitterX, float jitterY);
|
||||
SwirlVertexEffect *initSwirlWithPow(float radius, int power);
|
||||
SwirlVertexEffect *initSwirlWithPowOut(float radius, int power);
|
||||
VertexEffect *getVertexEffect() {
|
||||
return _vertexEffect;
|
||||
}
|
||||
JitterVertexEffect *getJitterVertexEffect();
|
||||
SwirlVertexEffect *getSwirlVertexEffect();
|
||||
const std::string &getEffectType() const {
|
||||
return _effectType;
|
||||
}
|
||||
void clear();
|
||||
|
||||
private:
|
||||
VertexEffect *_vertexEffect = nullptr;
|
||||
Interpolation *_interpolation = nullptr;
|
||||
std::string _effectType = "none";
|
||||
};
|
||||
} // namespace cc
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "platform/FileUtils.h"
|
||||
#include "spine-creator-support/AttachmentVertices.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
static CustomTextureLoader customTextureLoader = nullptr;
|
||||
void spAtlasPage_setCustomTextureLoader(CustomTextureLoader texLoader) {
|
||||
customTextureLoader = texLoader;
|
||||
@@ -43,7 +43,7 @@ static SpineObjectDisposeCallback spineObjectDisposeCallback = nullptr;
|
||||
void setSpineObjectDisposeCallback(SpineObjectDisposeCallback callback) {
|
||||
spineObjectDisposeCallback = callback;
|
||||
}
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
USING_NS_MW; // NOLINT(google-build-using-namespace)
|
||||
using namespace cc; // NOLINT(google-build-using-namespace)
|
||||
@@ -56,26 +56,45 @@ static void deleteAttachmentVertices(void *vertices) {
|
||||
static uint16_t quadTriangles[6] = {0, 1, 2, 2, 3, 0};
|
||||
|
||||
static void setAttachmentVertices(RegionAttachment *attachment) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
auto *region = static_cast<AtlasRegion *>(attachment->getRendererObject());
|
||||
auto *attachmentVertices = new AttachmentVertices(static_cast<middleware::Texture2D *>(region->page->getRendererObject()), 4, quadTriangles, 6);
|
||||
#else
|
||||
auto *region = static_cast<AtlasRegion *>(attachment->getRegion());
|
||||
auto *attachmentVertices = new AttachmentVertices(static_cast<middleware::Texture2D *>(region->page->texture), 4, quadTriangles, 6);
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
for (int i = 0, ii = 0; i < 4; ++i, ii += 2) {
|
||||
vertices[i].texCoord.u = attachment->getUVs()[ii];
|
||||
vertices[i].texCoord.v = attachment->getUVs()[ii + 1];
|
||||
}
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->setRendererObject(attachmentVertices, deleteAttachmentVertices);
|
||||
#else
|
||||
attachment->getRegion()->rendererObject = attachmentVertices;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setAttachmentVertices(MeshAttachment *attachment) {
|
||||
#if CC_USE_SPINE_3_8
|
||||
auto *region = static_cast<AtlasRegion *>(attachment->getRendererObject());
|
||||
auto *attachmentVertices = new AttachmentVertices(static_cast<middleware::Texture2D *>(region->page->getRendererObject()),
|
||||
static_cast<int32_t>(attachment->getWorldVerticesLength() >> 1), attachment->getTriangles().buffer(), static_cast<int32_t>(attachment->getTriangles().size()));
|
||||
#else
|
||||
auto *region = static_cast<AtlasRegion *>(attachment->getRegion());
|
||||
auto *attachmentVertices = new AttachmentVertices(static_cast<middleware::Texture2D *>(region->page->texture),
|
||||
static_cast<int32_t>(attachment->getWorldVerticesLength() >> 1), attachment->getTriangles().buffer(), static_cast<int32_t>(attachment->getTriangles().size()));
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
for (size_t i = 0, ii = 0, nn = attachment->getWorldVerticesLength(); ii < nn; ++i, ii += 2) {
|
||||
vertices[i].texCoord.u = attachment->getUVs()[ii];
|
||||
vertices[i].texCoord.v = attachment->getUVs()[ii + 1];
|
||||
}
|
||||
#if CC_USE_SPINE_3_8
|
||||
attachment->setRendererObject(attachmentVertices, deleteAttachmentVertices);
|
||||
#else
|
||||
attachment->getRegion()->rendererObject = attachmentVertices;
|
||||
#endif
|
||||
}
|
||||
|
||||
Cocos2dAtlasAttachmentLoader::Cocos2dAtlasAttachmentLoader(Atlas *atlas) : AtlasAttachmentLoader(atlas) {
|
||||
@@ -104,8 +123,8 @@ Cocos2dTextureLoader::~Cocos2dTextureLoader() = default;
|
||||
|
||||
void Cocos2dTextureLoader::load(AtlasPage &page, const spine::String &path) {
|
||||
middleware::Texture2D *texture = nullptr;
|
||||
if (spine::customTextureLoader) {
|
||||
texture = spine::customTextureLoader(path.buffer());
|
||||
if (customTextureLoader) {
|
||||
texture = customTextureLoader(path.buffer());
|
||||
}
|
||||
CC_ASSERT_NOT_NULL(texture);
|
||||
|
||||
@@ -115,7 +134,11 @@ void Cocos2dTextureLoader::load(AtlasPage &page, const spine::String &path) {
|
||||
middleware::Texture2D::TexParams textureParams = {filter(page.minFilter), filter(page.magFilter), wrap(page.uWrap), wrap(page.vWrap)};
|
||||
texture->setTexParameters(textureParams);
|
||||
|
||||
#if CC_USE_SPINE_3_8
|
||||
page.setRendererObject(texture);
|
||||
#else
|
||||
page.texture = texture;
|
||||
#endif
|
||||
page.width = texture->getPixelsWide();
|
||||
page.height = texture->getPixelsHigh();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "spine-creator-support/SkeletonRenderer.h"
|
||||
#include "spine/spine.h"
|
||||
|
||||
namespace spine {
|
||||
namespace cc {
|
||||
typedef cc::middleware::Texture2D *(*CustomTextureLoader)(const char *path);
|
||||
// set custom texture loader for _spAtlasPage_createTexture
|
||||
void spAtlasPage_setCustomTextureLoader(CustomTextureLoader texLoader);
|
||||
@@ -74,4 +74,4 @@ protected:
|
||||
|
||||
typedef void (*SpineObjectDisposeCallback)(void *);
|
||||
void setSpineObjectDisposeCallback(SpineObjectDisposeCallback callback);
|
||||
} // namespace spine
|
||||
} // namespace cc
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
#include <emscripten/wire.h>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include "spine-skeleton-instance.h"
|
||||
#include "spine-wasm.h"
|
||||
#include "Vector2.h"
|
||||
#include "../spine-skeleton-instance.h"
|
||||
#include "../spine-wasm.h"
|
||||
#include "../Vector2.h"
|
||||
|
||||
using namespace spine;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,15 +3,26 @@
|
||||
//#include "LogUtil.h"
|
||||
using namespace spine;
|
||||
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/val.h>
|
||||
using namespace spine;
|
||||
|
||||
static void wasmLog(const char* message) {
|
||||
EM_ASM({
|
||||
console.log(UTF8ToString($0));
|
||||
}, message);
|
||||
}
|
||||
|
||||
|
||||
static uint16_t quadTriangles[6] = {0, 1, 2, 2, 3, 0};
|
||||
|
||||
AttachmentVertices::AttachmentVertices(int verticesCount, uint16_t *triangles, int trianglesCount, const spine::String& textureUUID) {
|
||||
AttachmentVertices::AttachmentVertices(int verticesCount, uint16_t *triangles, int trianglesCount, const spine::String& textureName) {
|
||||
_triangles = new Triangles();
|
||||
_triangles->verts = new V3F_T2F_C4B[verticesCount];
|
||||
_triangles->vertCount = verticesCount;
|
||||
_triangles->indices = triangles;
|
||||
_triangles->indexCount = trianglesCount;
|
||||
_textureId = textureUUID;
|
||||
_textureName = textureName;
|
||||
}
|
||||
|
||||
AttachmentVertices::~AttachmentVertices() {
|
||||
@@ -20,13 +31,16 @@ AttachmentVertices::~AttachmentVertices() {
|
||||
}
|
||||
|
||||
AttachmentVertices *AttachmentVertices::copy() {
|
||||
AttachmentVertices *atv = new AttachmentVertices(_triangles->vertCount, _triangles->indices, _triangles->indexCount, _textureId);
|
||||
AttachmentVertices *atv = new AttachmentVertices(_triangles->vertCount, _triangles->indices, _triangles->indexCount, _textureName);
|
||||
atv->_textureUUID = _textureUUID;
|
||||
return atv;
|
||||
}
|
||||
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
static void deleteAttachmentVertices(void *vertices) {
|
||||
delete static_cast<AttachmentVertices *>(vertices);
|
||||
}
|
||||
#endif
|
||||
|
||||
AtlasAttachmentLoaderExtension::AtlasAttachmentLoaderExtension(Atlas *atlas) : AtlasAttachmentLoader(atlas), _atlasCache(atlas) {
|
||||
}
|
||||
@@ -37,7 +51,11 @@ void AtlasAttachmentLoaderExtension::configureAttachment(Attachment *attachment)
|
||||
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
auto *regionAttachment = static_cast<RegionAttachment *>(attachment);
|
||||
auto &pages = _atlasCache->getPages();
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
auto *region = static_cast<AtlasRegion *>(regionAttachment->getRendererObject());
|
||||
#else
|
||||
auto *region = static_cast<AtlasRegion *>(regionAttachment->getRegion());
|
||||
#endif
|
||||
auto *attachmentVertices = new AttachmentVertices(4, quadTriangles, 6, region->page->name);
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
const auto &uvs = regionAttachment->getUVs();
|
||||
@@ -45,11 +63,19 @@ void AtlasAttachmentLoaderExtension::configureAttachment(Attachment *attachment)
|
||||
vertices[i].texCoord.u = uvs[ii];
|
||||
vertices[i].texCoord.v = uvs[ii + 1];
|
||||
}
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
regionAttachment->setRendererObject(attachmentVertices, deleteAttachmentVertices);
|
||||
#else
|
||||
regionAttachment->getRegion()->rendererObject = attachmentVertices;
|
||||
#endif
|
||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto *meshAttachment = static_cast<MeshAttachment *>(attachment);
|
||||
auto &pages = _atlasCache->getPages();
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
auto *region = static_cast<AtlasRegion *>(meshAttachment->getRendererObject());
|
||||
#else
|
||||
auto *region = static_cast<AtlasRegion *>(meshAttachment->getRegion());
|
||||
#endif
|
||||
auto *attachmentVertices = new AttachmentVertices(
|
||||
static_cast<int32_t>(meshAttachment->getWorldVerticesLength() >> 1), meshAttachment->getTriangles().buffer(), static_cast<int32_t>(meshAttachment->getTriangles().size()), region->page->name);
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
@@ -58,6 +84,12 @@ void AtlasAttachmentLoaderExtension::configureAttachment(Attachment *attachment)
|
||||
vertices[i].texCoord.u = uvs[ii];
|
||||
vertices[i].texCoord.v = uvs[ii + 1];
|
||||
}
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
meshAttachment->setRendererObject(attachmentVertices, deleteAttachmentVertices);
|
||||
#else
|
||||
meshAttachment->getRegion()->rendererObject = attachmentVertices;
|
||||
#endif
|
||||
} else {
|
||||
wasmLog(attachment->getName().buffer());
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,8 @@ public:
|
||||
virtual ~AttachmentVertices();
|
||||
AttachmentVertices *copy();
|
||||
Triangles *_triangles = nullptr;
|
||||
spine::String _textureId;
|
||||
spine::String _textureUUID;
|
||||
spine::String _textureName;
|
||||
};
|
||||
|
||||
class AtlasAttachmentLoaderExtension : public spine::AtlasAttachmentLoader {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set(APP_NAME "spine")
|
||||
set(SPINE_VERSION "3.8")
|
||||
# set(SPINE_VERSION "4.2")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -56,9 +58,28 @@ message(">>> CMAKE_C_COMPILE_FEATURES is ${CMAKE_C_COMPILE_FEATURES}")
|
||||
message(">>> CMAKE_CXX_COMPILE_FEATURES is ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
message(">>> --------------------------------------------------------------")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
file(GLOB SPINE_CORE_SRC "${CMAKE_CURRENT_LIST_DIR}/../spine/*.cpp")
|
||||
file(GLOB COCOS_ADAPTER_SRC "${CMAKE_CURRENT_LIST_DIR}/*.cpp")
|
||||
|
||||
|
||||
|
||||
if(SPINE_VERSION STREQUAL "3.8")
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../spine/3.8/)
|
||||
file(GLOB SPINE_CORE_SRC "${CMAKE_CURRENT_LIST_DIR}/../spine/3.8/spine/*.cpp")
|
||||
file(GLOB COCOS_ADAPTER_SRC
|
||||
"${CMAKE_CURRENT_LIST_DIR}/*.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/3.8/*.cpp"
|
||||
)
|
||||
add_definitions(-DCC_SPINE_VERSION_3_8)
|
||||
elseif(SPINE_VERSION STREQUAL "4.2")
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../spine/4.2/)
|
||||
file(GLOB SPINE_CORE_SRC "${CMAKE_CURRENT_LIST_DIR}/../spine/4.2/spine/*.cpp")
|
||||
file(GLOB COCOS_ADAPTER_SRC
|
||||
"${CMAKE_CURRENT_LIST_DIR}/*.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/4.2/*.cpp"
|
||||
)
|
||||
add_definitions(-DCC_SPINE_VERSION_4_2)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported SPINE_VERSION: ${SPINE_VERSION}")
|
||||
endif()
|
||||
|
||||
add_executable(${APP_NAME} ${SPINE_CORE_SRC} ${COCOS_ADAPTER_SRC})
|
||||
|
||||
|
||||
@@ -58,7 +58,11 @@ Skeleton *SpineSkeletonInstance::initSkeleton(SkeletonData *data) {
|
||||
_animState = new AnimationState(_animStateData);
|
||||
_clipper = new SkeletonClipping();
|
||||
_skeleton->setToSetupPose();
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Reset);
|
||||
#endif
|
||||
_animState->setRendererObject(this);
|
||||
_animState->setListener(animationCallback);
|
||||
return _skeleton;
|
||||
@@ -74,7 +78,11 @@ TrackEntry *SpineSkeletonInstance::setAnimation(float trackIndex, const spine::S
|
||||
}
|
||||
auto *trackEntry = _animState->setAnimation(trackIndex, animation, loop);
|
||||
_animState->apply(*_skeleton);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Update);
|
||||
#endif
|
||||
return trackEntry;
|
||||
}
|
||||
|
||||
@@ -96,7 +104,11 @@ SpineModel *SpineSkeletonInstance::updateRenderData() {
|
||||
if (_userData.debugMode) {
|
||||
_debugShapes.clear();
|
||||
}
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_skeleton->updateWorldTransform();
|
||||
#else
|
||||
_skeleton->updateWorldTransform(Physics::Physics_Update);
|
||||
#endif
|
||||
SpineMeshData::reset();
|
||||
_model->clearMeshes();
|
||||
if (_userData.useTint) {
|
||||
@@ -126,9 +138,13 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
DEBUG_SHAPE_TYPE debugShapeType = DEBUG_SHAPE_TYPE::DEBUG_REGION;
|
||||
|
||||
SlotMesh currMesh = globalMesh;
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
if (_effect) {
|
||||
_effect->begin(*_skeleton);
|
||||
}
|
||||
#else
|
||||
void* _effect = nullptr;
|
||||
#endif
|
||||
const Color& skeletonColor = _skeleton->getColor();
|
||||
for (uint32_t drawIdx = 0; drawIdx < slotCount; ++drawIdx) {
|
||||
auto* slot = slotArray[drawIdx];
|
||||
@@ -150,8 +166,12 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
if (attachmentRTTI.isExactly(spine::RegionAttachment::rtti)) {
|
||||
debugShapeType = DEBUG_SHAPE_TYPE::DEBUG_REGION;
|
||||
auto *attachment = static_cast<spine::RegionAttachment *>(attachmentSlot);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
auto *attachmentVertices = reinterpret_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
|
||||
#else
|
||||
auto *attachmentVertices = reinterpret_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
auto& triangles = attachmentVertices->_triangles;
|
||||
auto vertCount = triangles->vertCount;
|
||||
auto indexCount = triangles->indexCount;
|
||||
@@ -170,18 +190,26 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
}
|
||||
}
|
||||
memcpy(indices, triangles->indices, ibSize);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
attachment->computeWorldVertices(bone, (float *)vertices, 0, strideColor);
|
||||
#else
|
||||
attachment->computeWorldVertices(*slot, (float *)vertices, 0, strideColor);
|
||||
#endif
|
||||
currMesh.set((uint8_t *)vertices, indices, vertCount, indexCount);
|
||||
const Color& attachmentColor = attachment->getColor();
|
||||
color.r *= attachmentColor.r;
|
||||
color.g *= attachmentColor.g;
|
||||
color.b *= attachmentColor.b;
|
||||
color.a *= attachmentColor.a;
|
||||
currMesh.textureID = attachmentVertices->_textureId;
|
||||
currMesh.textureID = attachmentVertices->_textureUUID;
|
||||
} else if (attachmentRTTI.isExactly(spine::MeshAttachment::rtti)) {
|
||||
debugShapeType = DEBUG_SHAPE_TYPE::DEBUG_MESH;
|
||||
auto *attachment = static_cast<spine::MeshAttachment *>(attachmentSlot);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
auto *attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRendererObject());
|
||||
#else
|
||||
auto *attachmentVertices = static_cast<AttachmentVertices *>(attachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
|
||||
auto& triangles = attachmentVertices->_triangles;
|
||||
auto vertCount = triangles->vertCount;
|
||||
@@ -207,7 +235,7 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
color.g *= attachmentColor.g;
|
||||
color.b *= attachmentColor.b;
|
||||
color.a *= attachmentColor.a;
|
||||
currMesh.textureID = attachmentVertices->_textureId;
|
||||
currMesh.textureID = attachmentVertices->_textureUUID;
|
||||
} else if (attachmentRTTI.isExactly(spine::ClippingAttachment::rtti)) {
|
||||
auto *clip = static_cast<spine::ClippingAttachment *>(attachmentSlot);
|
||||
_clipper->clipStart(*slot, clip);
|
||||
@@ -264,7 +292,9 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
vertices[v].vertex.y = verts[vv + 1];
|
||||
vertices[v].texCoord.u = uvs[vv];
|
||||
vertices[v].texCoord.v = uvs[vv + 1];
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_effect->transform(vertices[v].vertex.x, vertices[v].vertex.y);
|
||||
#endif
|
||||
*((uint32_t *)&vertices[v].color) = light;
|
||||
}
|
||||
} else {
|
||||
@@ -281,7 +311,9 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
V3F_T2F_C4B *vertex = (V3F_T2F_C4B *)currMesh.vBuf;
|
||||
if (_effect) {
|
||||
for (int v = 0; v < vertCount; ++v) {
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_effect->transform(vertex[v].vertex.x, vertex[v].vertex.y);
|
||||
#endif
|
||||
*((uint32_t *)&vertex[v].color) = light;
|
||||
}
|
||||
} else {
|
||||
@@ -317,7 +349,9 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
vertices[v].vertex.y = verts[vv + 1];
|
||||
vertices[v].texCoord.u = uvs[vv];
|
||||
vertices[v].texCoord.v = uvs[vv + 1];
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_effect->transform(vertices[v].vertex.x, vertices[v].vertex.y);
|
||||
#endif
|
||||
*((uint32_t *)&vertices[v].color) = light;
|
||||
*((uint32_t *)&vertices[v].color2) = dark;
|
||||
}
|
||||
@@ -333,10 +367,12 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
}
|
||||
} else {
|
||||
auto vertCount = currMesh.vCount;
|
||||
V3F_T2F_C4B_C4B *vertex = (V3F_T2F_C4B_C4B *)currMesh.vBuf;
|
||||
V3F_T2F_C4B_C4B *vertex = (V3F_T2F_C4B_C4B *)currMesh.vBuf;
|
||||
if (_effect) {
|
||||
for (int v = 0; v < vertCount; ++v) {
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
_effect->transform(vertex[v].vertex.x, vertex[v].vertex.y);
|
||||
#endif
|
||||
*((uint32_t *)&vertex[v].color) = light;
|
||||
*((uint32_t *)&vertex[v].color2) = dark;
|
||||
}
|
||||
@@ -374,7 +410,9 @@ void SpineSkeletonInstance::collectMeshData() {
|
||||
}
|
||||
|
||||
_clipper->clipEnd();
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
if (_effect) _effect->end();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpineSkeletonInstance::setPremultipliedAlpha(bool val) {
|
||||
@@ -388,6 +426,7 @@ void SpineSkeletonInstance::setColor(float r, float g, float b, float a) {
|
||||
_userData.color.a = a;
|
||||
}
|
||||
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
void SpineSkeletonInstance::setJitterEffect(JitterVertexEffect *effect) {
|
||||
_effect = effect;
|
||||
}
|
||||
@@ -399,6 +438,7 @@ void SpineSkeletonInstance::setSwirlEffect(SwirlVertexEffect *effect) {
|
||||
void SpineSkeletonInstance::clearEffect() {
|
||||
_effect = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
AnimationState *SpineSkeletonInstance::getAnimationState() {
|
||||
return _animState;
|
||||
@@ -455,6 +495,7 @@ void SpineSkeletonInstance::resizeSlotRegion(const spine::String &slotName, uint
|
||||
}
|
||||
if (attachment->getRTTI().isExactly(spine::RegionAttachment::rtti)) {
|
||||
auto *region = static_cast<RegionAttachment *>(attachment);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
region->setRegionWidth(width);
|
||||
region->setRegionHeight(height);
|
||||
region->setRegionOriginalWidth(width);
|
||||
@@ -468,14 +509,41 @@ void SpineSkeletonInstance::resizeSlotRegion(const spine::String &slotName, uint
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
region->setRendererObject(attachmentVertices);
|
||||
}
|
||||
#else
|
||||
auto *textureRegion = region->getRegion();
|
||||
if (textureRegion) {
|
||||
textureRegion->width = width;
|
||||
textureRegion->height = height;
|
||||
textureRegion->originalWidth = width;
|
||||
textureRegion->originalHeight = height;
|
||||
}
|
||||
region->setWidth(width);
|
||||
region->setHeight(height);
|
||||
auto &uvs = region->getUVs();
|
||||
uvs[2] = 0;
|
||||
uvs[3] = 1;
|
||||
uvs[4] = 0;
|
||||
uvs[5] = 0;
|
||||
uvs[6] = 1;
|
||||
uvs[7] = 0;
|
||||
uvs[0] = 1;
|
||||
uvs[1] = 1;
|
||||
region->updateRegion();
|
||||
auto *attachmentVertices = static_cast<AttachmentVertices *>(region->getRegion()->rendererObject);
|
||||
if (createNew) {
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
region->getRegion()->rendererObject = attachmentVertices;
|
||||
}
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
const auto &UVs = region->getUVs();
|
||||
auto &UVs = region->getUVs();
|
||||
for (int i = 0, ii = 0; i < 4; ++i, ii += 2) {
|
||||
vertices[i].texCoord.u = UVs[ii];
|
||||
vertices[i].texCoord.v = UVs[ii + 1];
|
||||
}
|
||||
} else if (attachment->getRTTI().isExactly(spine::MeshAttachment::rtti)) {
|
||||
auto *mesh = static_cast<MeshAttachment *>(attachment);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
mesh->setRegionWidth(width);
|
||||
mesh->setRegionHeight(height);
|
||||
mesh->setRegionOriginalWidth(width);
|
||||
@@ -494,6 +562,28 @@ void SpineSkeletonInstance::resizeSlotRegion(const spine::String &slotName, uint
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
mesh->setRendererObject(attachmentVertices);
|
||||
}
|
||||
#else
|
||||
auto *region = mesh->getRegion();
|
||||
if (region) {
|
||||
region->width = width;
|
||||
region->height = height;
|
||||
region->originalWidth = width;
|
||||
region->originalHeight = height;
|
||||
region->u = 0;
|
||||
region->v = 0;
|
||||
region->u2 = 1.0f;
|
||||
region->v2 = 1.0f;
|
||||
region->degrees = 0;
|
||||
}
|
||||
mesh->setWidth(width);
|
||||
mesh->setHeight(height);
|
||||
mesh->updateRegion();
|
||||
auto *attachmentVertices = static_cast<AttachmentVertices *>(mesh->getRegion()->rendererObject);
|
||||
if (createNew) {
|
||||
attachmentVertices = attachmentVertices->copy();
|
||||
mesh->getRegion()->rendererObject = attachmentVertices;
|
||||
}
|
||||
#endif
|
||||
V3F_T2F_C4B *vertices = attachmentVertices->_triangles->verts;
|
||||
const auto &UVs = mesh->getUVs();
|
||||
for (size_t i = 0, ii = 0, nn = mesh->getWorldVerticesLength(); ii < nn; ++i, ii += 2) {
|
||||
|
||||
@@ -43,9 +43,11 @@ public:
|
||||
void setUseTint(bool useTint);
|
||||
void setDebugMode(bool debug);
|
||||
void setColor(float r, float g, float b, float a);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
void setJitterEffect(spine::JitterVertexEffect *effect);
|
||||
void setSwirlEffect(spine::SwirlVertexEffect *effect);
|
||||
void clearEffect();
|
||||
#endif
|
||||
spine::AnimationState *getAnimationState();
|
||||
void setMix(const spine::String &from, const spine::String &to, float duration);
|
||||
inline void setListener(uint32_t listenerID) { _eventListenerID = listenerID;}
|
||||
@@ -68,7 +70,9 @@ private:
|
||||
spine::AnimationStateData *_animStateData = nullptr;
|
||||
spine::AnimationState *_animState = nullptr;
|
||||
spine::SkeletonClipping *_clipper = nullptr;
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
spine::VertexEffect *_effect = nullptr;
|
||||
#endif
|
||||
SpineModel *_model = nullptr;
|
||||
uint32_t _eventListenerID = 0;
|
||||
uint32_t _trackEntryListenerID = 0;
|
||||
|
||||
@@ -37,18 +37,26 @@ namespace {
|
||||
AttachmentVertices* attachmentVertices;
|
||||
auto* attachment = entry._attachment;
|
||||
if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto* meshAttachment = static_cast<MeshAttachment *>(attachment);
|
||||
auto* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject());
|
||||
} else {
|
||||
auto* regionAttachment = static_cast<RegionAttachment *>(attachment);
|
||||
#else
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(meshAttachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
} else if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
auto* regionAttachment = static_cast<RegionAttachment*>(attachment);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(regionAttachment->getRendererObject());
|
||||
#else
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(regionAttachment->getRegion()->rendererObject);
|
||||
#endif
|
||||
}
|
||||
if (attachmentVertices) {
|
||||
auto& textureName = attachmentVertices->_textureId;
|
||||
auto& textureName = attachmentVertices->_textureName;
|
||||
if (textureMap.containsKey(textureName)) {
|
||||
attachmentVertices->_textureId = textureMap[textureName];
|
||||
attachmentVertices->_textureUUID = textureMap[textureName];
|
||||
} else {
|
||||
spine::String logInfo(attachment->getName());
|
||||
spine::String logInfo(textureName);
|
||||
logInfo.append(" attachment's texture doesn`t exist ");
|
||||
logInfo.append(textureName);
|
||||
logToConsole(logInfo.buffer());
|
||||
@@ -97,9 +105,17 @@ SkeletonData* SpineWasmUtil::createSpineSkeletonDataWithJson(const String& jsonS
|
||||
return nullptr;
|
||||
}
|
||||
AttachmentLoader* attachmentLoader = new AtlasAttachmentLoaderExtension(atlas);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
SkeletonJson json(attachmentLoader);
|
||||
#else
|
||||
SkeletonJson json(attachmentLoader, true);
|
||||
#endif
|
||||
json.setScale(1.0F);
|
||||
SkeletonData* skeletonData = json.readSkeletonData(jsonStr.buffer());
|
||||
auto& errorMsg = json.getError();
|
||||
if (!errorMsg.isEmpty()) {
|
||||
logToConsole(errorMsg.buffer());
|
||||
}
|
||||
|
||||
updateAttachmentVerticesTextureId(skeletonData, textureNames, textureUUIDs);
|
||||
|
||||
@@ -116,9 +132,17 @@ SkeletonData* SpineWasmUtil::createSpineSkeletonDataWithBinary(uint32_t byteSize
|
||||
return nullptr;
|
||||
}
|
||||
AttachmentLoader* attachmentLoader = new AtlasAttachmentLoaderExtension(atlas);
|
||||
#ifdef CC_SPINE_VERSION_3_8
|
||||
SkeletonBinary binary(attachmentLoader);
|
||||
#else
|
||||
SkeletonBinary binary(attachmentLoader, true);
|
||||
#endif
|
||||
binary.setScale(1.0F);
|
||||
SkeletonData* skeletonData = binary.readSkeletonData(s_mem, byteSize);
|
||||
auto& errorMsg = binary.getError();
|
||||
if (!errorMsg.isEmpty()) {
|
||||
logToConsole(errorMsg.buffer());
|
||||
}
|
||||
|
||||
updateAttachmentVerticesTextureId(skeletonData, textureNames, textureUUIDs);
|
||||
|
||||
@@ -137,6 +161,30 @@ void SpineWasmUtil::registerSpineSkeletonDataWithUUID(SkeletonData* data, const
|
||||
void SpineWasmUtil::destroySpineSkeletonDataWithUUID(const String& uuid) {
|
||||
if (skeletonDataMap.containsKey(uuid)) {
|
||||
auto* data = skeletonDataMap[uuid];
|
||||
#if CC_USE_SPINE_4_2
|
||||
auto& skins = data->getSkins();
|
||||
auto skinSize = skins.size();
|
||||
// release AttachmentVertices
|
||||
for (int i = 0; i < skinSize; ++i) {
|
||||
auto* skin = skins[i];
|
||||
auto entries = skin->getAttachments();
|
||||
while (entries.hasNext()) {
|
||||
Skin::AttachmentMap::Entry& entry = entries.next();
|
||||
AttachmentVertices* attachmentVertices;
|
||||
auto* attachment = entry._attachment;
|
||||
if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
auto* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(meshAttachment->getRegion()->rendererObject);
|
||||
} else if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
auto* regionAttachment = static_cast<RegionAttachment*>(attachment);
|
||||
attachmentVertices = static_cast<AttachmentVertices*>(regionAttachment->getRegion()->rendererObject);
|
||||
}
|
||||
if (attachmentVertices) {
|
||||
delete attachmentVertices;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
delete data;
|
||||
skeletonDataMap.remove(uuid);
|
||||
}
|
||||
|
||||
+75
-75
@@ -1,75 +1,75 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_AttachmentLoader_h
|
||||
#define Spine_AttachmentLoader_h
|
||||
|
||||
#include <spine/RTTI.h>
|
||||
#include <spine/SpineObject.h>
|
||||
#include <spine/SpineString.h>
|
||||
|
||||
namespace spine {
|
||||
class Skin;
|
||||
class Attachment;
|
||||
class RegionAttachment;
|
||||
class MeshAttachment;
|
||||
class BoundingBoxAttachment;
|
||||
class PathAttachment;
|
||||
class PointAttachment;
|
||||
class ClippingAttachment;
|
||||
|
||||
class SP_API AttachmentLoader : public SpineObject {
|
||||
public:
|
||||
RTTI_DECL
|
||||
|
||||
AttachmentLoader();
|
||||
|
||||
virtual ~AttachmentLoader();
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual MeshAttachment* newMeshAttachment(Skin& skin, const String& name, const String& path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual BoundingBoxAttachment* newBoundingBoxAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment
|
||||
virtual PathAttachment* newPathAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual PointAttachment* newPointAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual void configureAttachment(Attachment* attachment) = 0;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif /* Spine_AttachmentLoader_h */
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_AttachmentLoader_h
|
||||
#define Spine_AttachmentLoader_h
|
||||
|
||||
#include <spine/RTTI.h>
|
||||
#include <spine/SpineObject.h>
|
||||
#include <spine/SpineString.h>
|
||||
|
||||
namespace spine {
|
||||
class Skin;
|
||||
class Attachment;
|
||||
class RegionAttachment;
|
||||
class MeshAttachment;
|
||||
class BoundingBoxAttachment;
|
||||
class PathAttachment;
|
||||
class PointAttachment;
|
||||
class ClippingAttachment;
|
||||
|
||||
class SP_API AttachmentLoader : public SpineObject {
|
||||
public:
|
||||
RTTI_DECL
|
||||
|
||||
AttachmentLoader();
|
||||
|
||||
virtual ~AttachmentLoader();
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual MeshAttachment* newMeshAttachment(Skin& skin, const String& name, const String& path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual BoundingBoxAttachment* newBoundingBoxAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment
|
||||
virtual PathAttachment* newPathAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual PointAttachment* newPointAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name) = 0;
|
||||
|
||||
virtual void configureAttachment(Attachment* attachment) = 0;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif /* Spine_AttachmentLoader_h */
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_AttachmentType_h
|
||||
#define Spine_AttachmentType_h
|
||||
|
||||
namespace spine {
|
||||
enum AttachmentType {
|
||||
AttachmentType_Region,
|
||||
AttachmentType_Boundingbox,
|
||||
AttachmentType_Mesh,
|
||||
AttachmentType_Linkedmesh,
|
||||
AttachmentType_Path,
|
||||
AttachmentType_Point,
|
||||
AttachmentType_Clipping
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_AttachmentType_h */
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_AttachmentType_h
|
||||
#define Spine_AttachmentType_h
|
||||
|
||||
namespace spine {
|
||||
enum AttachmentType {
|
||||
AttachmentType_Region,
|
||||
AttachmentType_Boundingbox,
|
||||
AttachmentType_Mesh,
|
||||
AttachmentType_Linkedmesh,
|
||||
AttachmentType_Path,
|
||||
AttachmentType_Point,
|
||||
AttachmentType_Clipping
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_AttachmentType_h */
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_BlendMode_h
|
||||
#define Spine_BlendMode_h
|
||||
|
||||
namespace spine {
|
||||
enum BlendMode {
|
||||
BlendMode_Normal = 0,
|
||||
BlendMode_Additive,
|
||||
BlendMode_Multiply,
|
||||
BlendMode_Screen
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_BlendMode_h */
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_BlendMode_h
|
||||
#define Spine_BlendMode_h
|
||||
|
||||
namespace spine {
|
||||
enum BlendMode {
|
||||
BlendMode_Normal = 0,
|
||||
BlendMode_Additive,
|
||||
BlendMode_Multiply,
|
||||
BlendMode_Screen
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_BlendMode_h */
|
||||
+147
-147
@@ -1,147 +1,147 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
BoneData::BoneData(int index, const String &name, BoneData *parent) : _index(index),
|
||||
_name(name),
|
||||
_parent(parent),
|
||||
_length(0),
|
||||
_x(0),
|
||||
_y(0),
|
||||
_rotation(0),
|
||||
_scaleX(1),
|
||||
_scaleY(1),
|
||||
_shearX(0),
|
||||
_shearY(0),
|
||||
_transformMode(TransformMode_Normal),
|
||||
_skinRequired(false) {
|
||||
assert(index >= 0);
|
||||
assert(_name.length() > 0);
|
||||
}
|
||||
|
||||
int BoneData::getIndex() {
|
||||
return _index;
|
||||
}
|
||||
|
||||
const String &BoneData::getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
BoneData *BoneData::getParent() {
|
||||
return _parent;
|
||||
}
|
||||
|
||||
float BoneData::getLength() {
|
||||
return _length;
|
||||
}
|
||||
|
||||
void BoneData::setLength(float inValue) {
|
||||
_length = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getX() {
|
||||
return _x;
|
||||
}
|
||||
|
||||
void BoneData::setX(float inValue) {
|
||||
_x = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getY() {
|
||||
return _y;
|
||||
}
|
||||
|
||||
void BoneData::setY(float inValue) {
|
||||
_y = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getRotation() {
|
||||
return _rotation;
|
||||
}
|
||||
|
||||
void BoneData::setRotation(float inValue) {
|
||||
_rotation = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleX() {
|
||||
return _scaleX;
|
||||
}
|
||||
|
||||
void BoneData::setScaleX(float inValue) {
|
||||
_scaleX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleY() {
|
||||
return _scaleY;
|
||||
}
|
||||
|
||||
void BoneData::setScaleY(float inValue) {
|
||||
_scaleY = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearX() {
|
||||
return _shearX;
|
||||
}
|
||||
|
||||
void BoneData::setShearX(float inValue) {
|
||||
_shearX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearY() {
|
||||
return _shearY;
|
||||
}
|
||||
|
||||
void BoneData::setShearY(float inValue) {
|
||||
_shearY = inValue;
|
||||
}
|
||||
|
||||
TransformMode BoneData::getTransformMode() {
|
||||
return _transformMode;
|
||||
}
|
||||
|
||||
void BoneData::setTransformMode(TransformMode inValue) {
|
||||
_transformMode = inValue;
|
||||
}
|
||||
|
||||
bool BoneData::isSkinRequired() {
|
||||
return _skinRequired;
|
||||
}
|
||||
|
||||
void BoneData::setSkinRequired(bool inValue) {
|
||||
_skinRequired = inValue;
|
||||
}
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
BoneData::BoneData(int index, const String &name, BoneData *parent) : _index(index),
|
||||
_name(name),
|
||||
_parent(parent),
|
||||
_length(0),
|
||||
_x(0),
|
||||
_y(0),
|
||||
_rotation(0),
|
||||
_scaleX(1),
|
||||
_scaleY(1),
|
||||
_shearX(0),
|
||||
_shearY(0),
|
||||
_transformMode(TransformMode_Normal),
|
||||
_skinRequired(false) {
|
||||
assert(index >= 0);
|
||||
assert(_name.length() > 0);
|
||||
}
|
||||
|
||||
int BoneData::getIndex() {
|
||||
return _index;
|
||||
}
|
||||
|
||||
const String &BoneData::getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
BoneData *BoneData::getParent() {
|
||||
return _parent;
|
||||
}
|
||||
|
||||
float BoneData::getLength() {
|
||||
return _length;
|
||||
}
|
||||
|
||||
void BoneData::setLength(float inValue) {
|
||||
_length = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getX() {
|
||||
return _x;
|
||||
}
|
||||
|
||||
void BoneData::setX(float inValue) {
|
||||
_x = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getY() {
|
||||
return _y;
|
||||
}
|
||||
|
||||
void BoneData::setY(float inValue) {
|
||||
_y = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getRotation() {
|
||||
return _rotation;
|
||||
}
|
||||
|
||||
void BoneData::setRotation(float inValue) {
|
||||
_rotation = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleX() {
|
||||
return _scaleX;
|
||||
}
|
||||
|
||||
void BoneData::setScaleX(float inValue) {
|
||||
_scaleX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleY() {
|
||||
return _scaleY;
|
||||
}
|
||||
|
||||
void BoneData::setScaleY(float inValue) {
|
||||
_scaleY = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearX() {
|
||||
return _shearX;
|
||||
}
|
||||
|
||||
void BoneData::setShearX(float inValue) {
|
||||
_shearX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearY() {
|
||||
return _shearY;
|
||||
}
|
||||
|
||||
void BoneData::setShearY(float inValue) {
|
||||
_shearY = inValue;
|
||||
}
|
||||
|
||||
TransformMode BoneData::getTransformMode() {
|
||||
return _transformMode;
|
||||
}
|
||||
|
||||
void BoneData::setTransformMode(TransformMode inValue) {
|
||||
_transformMode = inValue;
|
||||
}
|
||||
|
||||
bool BoneData::isSkinRequired() {
|
||||
return _skinRequired;
|
||||
}
|
||||
|
||||
void BoneData::setSkinRequired(bool inValue) {
|
||||
_skinRequired = inValue;
|
||||
}
|
||||
+59
-59
@@ -1,59 +1,59 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_ClippingAttachment_h
|
||||
#define Spine_ClippingAttachment_h
|
||||
|
||||
#include <spine/VertexAttachment.h>
|
||||
|
||||
namespace spine {
|
||||
class SlotData;
|
||||
|
||||
class SP_API ClippingAttachment : public VertexAttachment {
|
||||
friend class SkeletonBinary;
|
||||
friend class SkeletonJson;
|
||||
|
||||
friend class SkeletonClipping;
|
||||
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
explicit ClippingAttachment(const String& name);
|
||||
|
||||
SlotData* getEndSlot();
|
||||
void setEndSlot(SlotData* inValue);
|
||||
|
||||
virtual Attachment* copy();
|
||||
|
||||
private:
|
||||
SlotData* _endSlot;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif /* Spine_ClippingAttachment_h */
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef Spine_ClippingAttachment_h
|
||||
#define Spine_ClippingAttachment_h
|
||||
|
||||
#include <spine/VertexAttachment.h>
|
||||
|
||||
namespace spine {
|
||||
class SlotData;
|
||||
|
||||
class SP_API ClippingAttachment : public VertexAttachment {
|
||||
friend class SkeletonBinary;
|
||||
friend class SkeletonJson;
|
||||
|
||||
friend class SkeletonClipping;
|
||||
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
explicit ClippingAttachment(const String& name);
|
||||
|
||||
SlotData* getEndSlot();
|
||||
void setEndSlot(SlotData* inValue);
|
||||
|
||||
virtual Attachment* copy();
|
||||
|
||||
private:
|
||||
SlotData* _endSlot;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif /* Spine_ClippingAttachment_h */
|
||||
@@ -0,0 +1,45 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes Software License v2.5
|
||||
*
|
||||
* Copyright (c) 2013-2016, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||
* non-transferable license to use, install, execute, and perform the Spine
|
||||
* Runtimes software and derivative works solely for personal or internal
|
||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||
* or other intellectual property or proprietary rights notices on or in the
|
||||
* Software, including any copy thereof. Redistributions in binary or source
|
||||
* form must include this license and terms.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/Constraint.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(Constraint, Updatable)
|
||||
|
||||
Constraint::Constraint() {
|
||||
}
|
||||
|
||||
Constraint::~Constraint() {
|
||||
}
|
||||
+127
-127
@@ -1,127 +1,127 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(CurveTimeline, Timeline)
|
||||
|
||||
const float CurveTimeline::LINEAR = 0;
|
||||
const float CurveTimeline::STEPPED = 1;
|
||||
const float CurveTimeline::BEZIER = 2;
|
||||
const int CurveTimeline::BEZIER_SIZE = 10 * 2 - 1;
|
||||
|
||||
CurveTimeline::CurveTimeline(int frameCount) {
|
||||
assert(frameCount > 0);
|
||||
|
||||
_curves.setSize((frameCount - 1) * BEZIER_SIZE, 0);
|
||||
}
|
||||
|
||||
CurveTimeline::~CurveTimeline() {
|
||||
}
|
||||
|
||||
size_t CurveTimeline::getFrameCount() {
|
||||
return _curves.size() / BEZIER_SIZE + 1;
|
||||
}
|
||||
|
||||
void CurveTimeline::setLinear(size_t frameIndex) {
|
||||
_curves[frameIndex * BEZIER_SIZE] = LINEAR;
|
||||
}
|
||||
|
||||
void CurveTimeline::setStepped(size_t frameIndex) {
|
||||
_curves[frameIndex * BEZIER_SIZE] = STEPPED;
|
||||
}
|
||||
|
||||
void CurveTimeline::setCurve(size_t frameIndex, float cx1, float cy1, float cx2, float cy2) {
|
||||
float tmpx = (-cx1 * 2 + cx2) * 0.03f, tmpy = (-cy1 * 2 + cy2) * 0.03f;
|
||||
float dddfx = ((cx1 - cx2) * 3 + 1) * 0.006f, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006f;
|
||||
float ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy;
|
||||
float dfx = cx1 * 0.3f + tmpx + dddfx * 0.16666667f, dfy = cy1 * 0.3f + tmpy + dddfy * 0.16666667f;
|
||||
|
||||
size_t i = frameIndex * BEZIER_SIZE;
|
||||
_curves[i++] = BEZIER;
|
||||
|
||||
float x = dfx, y = dfy;
|
||||
for (size_t n = i + BEZIER_SIZE - 1; i < n; i += 2) {
|
||||
_curves[i] = x;
|
||||
_curves[i + 1] = y;
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
x += dfx;
|
||||
y += dfy;
|
||||
}
|
||||
}
|
||||
|
||||
float CurveTimeline::getCurvePercent(size_t frameIndex, float percent) {
|
||||
percent = MathUtil::clamp(percent, 0, 1);
|
||||
size_t i = frameIndex * BEZIER_SIZE;
|
||||
float type = _curves[i];
|
||||
|
||||
if (type == LINEAR) {
|
||||
return percent;
|
||||
}
|
||||
|
||||
if (type == STEPPED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
i++;
|
||||
float x = 0;
|
||||
for (size_t start = i, n = i + BEZIER_SIZE - 1; i < n; i += 2) {
|
||||
x = _curves[i];
|
||||
if (x >= percent) {
|
||||
float prevX, prevY;
|
||||
if (i == start) {
|
||||
prevX = 0;
|
||||
prevY = 0;
|
||||
} else {
|
||||
prevX = _curves[i - 2];
|
||||
prevY = _curves[i - 1];
|
||||
}
|
||||
return prevY + (_curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);
|
||||
}
|
||||
}
|
||||
|
||||
float y = _curves[i - 1];
|
||||
|
||||
return y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.
|
||||
}
|
||||
|
||||
float CurveTimeline::getCurveType(size_t frameIndex) {
|
||||
return _curves[frameIndex * BEZIER_SIZE];
|
||||
}
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(CurveTimeline, Timeline)
|
||||
|
||||
const float CurveTimeline::LINEAR = 0;
|
||||
const float CurveTimeline::STEPPED = 1;
|
||||
const float CurveTimeline::BEZIER = 2;
|
||||
const int CurveTimeline::BEZIER_SIZE = 10 * 2 - 1;
|
||||
|
||||
CurveTimeline::CurveTimeline(int frameCount) {
|
||||
assert(frameCount > 0);
|
||||
|
||||
_curves.setSize((frameCount - 1) * BEZIER_SIZE, 0);
|
||||
}
|
||||
|
||||
CurveTimeline::~CurveTimeline() {
|
||||
}
|
||||
|
||||
size_t CurveTimeline::getFrameCount() {
|
||||
return _curves.size() / BEZIER_SIZE + 1;
|
||||
}
|
||||
|
||||
void CurveTimeline::setLinear(size_t frameIndex) {
|
||||
_curves[frameIndex * BEZIER_SIZE] = LINEAR;
|
||||
}
|
||||
|
||||
void CurveTimeline::setStepped(size_t frameIndex) {
|
||||
_curves[frameIndex * BEZIER_SIZE] = STEPPED;
|
||||
}
|
||||
|
||||
void CurveTimeline::setCurve(size_t frameIndex, float cx1, float cy1, float cx2, float cy2) {
|
||||
float tmpx = (-cx1 * 2 + cx2) * 0.03f, tmpy = (-cy1 * 2 + cy2) * 0.03f;
|
||||
float dddfx = ((cx1 - cx2) * 3 + 1) * 0.006f, dddfy = ((cy1 - cy2) * 3 + 1) * 0.006f;
|
||||
float ddfx = tmpx * 2 + dddfx, ddfy = tmpy * 2 + dddfy;
|
||||
float dfx = cx1 * 0.3f + tmpx + dddfx * 0.16666667f, dfy = cy1 * 0.3f + tmpy + dddfy * 0.16666667f;
|
||||
|
||||
size_t i = frameIndex * BEZIER_SIZE;
|
||||
_curves[i++] = BEZIER;
|
||||
|
||||
float x = dfx, y = dfy;
|
||||
for (size_t n = i + BEZIER_SIZE - 1; i < n; i += 2) {
|
||||
_curves[i] = x;
|
||||
_curves[i + 1] = y;
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
x += dfx;
|
||||
y += dfy;
|
||||
}
|
||||
}
|
||||
|
||||
float CurveTimeline::getCurvePercent(size_t frameIndex, float percent) {
|
||||
percent = MathUtil::clamp(percent, 0, 1);
|
||||
size_t i = frameIndex * BEZIER_SIZE;
|
||||
float type = _curves[i];
|
||||
|
||||
if (type == LINEAR) {
|
||||
return percent;
|
||||
}
|
||||
|
||||
if (type == STEPPED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
i++;
|
||||
float x = 0;
|
||||
for (size_t start = i, n = i + BEZIER_SIZE - 1; i < n; i += 2) {
|
||||
x = _curves[i];
|
||||
if (x >= percent) {
|
||||
float prevX, prevY;
|
||||
if (i == start) {
|
||||
prevX = 0;
|
||||
prevY = 0;
|
||||
} else {
|
||||
prevX = _curves[i - 2];
|
||||
prevY = _curves[i - 1];
|
||||
}
|
||||
return prevY + (_curves[i + 1] - prevY) * (percent - prevX) / (x - prevX);
|
||||
}
|
||||
}
|
||||
|
||||
float y = _curves[i - 1];
|
||||
|
||||
return y + (1 - y) * (percent - x) / (1 - x); // Last point is 1,1.
|
||||
}
|
||||
|
||||
float CurveTimeline::getCurveType(size_t frameIndex) {
|
||||
return _curves[frameIndex * BEZIER_SIZE];
|
||||
}
|
||||
+126
-126
@@ -1,126 +1,126 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_DEBUG_H
|
||||
#define SPINE_DEBUG_H
|
||||
|
||||
#include <spine/Extension.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace spine {
|
||||
class SP_API DebugExtension : public SpineExtension {
|
||||
struct Allocation {
|
||||
void *address;
|
||||
size_t size;
|
||||
const char *fileName;
|
||||
int line;
|
||||
|
||||
Allocation() : address(NULL), size(0), fileName(NULL), line(0) {
|
||||
}
|
||||
|
||||
Allocation(void *a, size_t s, const char *f, int l) : address(a), size(s), fileName(f), line(l) {
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
DebugExtension(SpineExtension *extension) : _extension(extension), _allocations(0), _reallocations(0), _frees(0) {
|
||||
}
|
||||
|
||||
void reportLeaks() {
|
||||
for (std::map<void *, Allocation>::iterator it = _allocated.begin(); it != _allocated.end(); it++) {
|
||||
printf("\"%s:%i (%zu bytes at %p)\n", it->second.fileName, it->second.line, it->second.size, it->second.address);
|
||||
}
|
||||
printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees);
|
||||
if (_allocated.empty()) printf("No leaks detected");
|
||||
}
|
||||
|
||||
void clearAllocations() {
|
||||
_allocated.clear();
|
||||
_usedMemory = 0;
|
||||
}
|
||||
|
||||
virtual void *_alloc(size_t size, const char *file, int line) {
|
||||
void *result = _extension->_alloc(size, file, line);
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_allocations++;
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void *_calloc(size_t size, const char *file, int line) {
|
||||
void *result = _extension->_calloc(size, file, line);
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_allocations++;
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void *_realloc(void *ptr, size_t size, const char *file, int line) {
|
||||
if (_allocated.count(ptr)) _usedMemory -= _allocated[ptr].size;
|
||||
_allocated.erase(ptr);
|
||||
void *result = _extension->_realloc(ptr, size, file, line);
|
||||
_reallocations++;
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void _free(void *mem, const char *file, int line) {
|
||||
if (_allocated.count(mem)) {
|
||||
_extension->_free(mem, file, line);
|
||||
_frees++;
|
||||
_usedMemory -= _allocated[mem].size;
|
||||
_allocated.erase(mem);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s:%i (address %p): Double free or not allocated through SpineExtension\n", file, line, mem);
|
||||
_extension->_free(mem, file, line);
|
||||
}
|
||||
|
||||
virtual char *_readFile(const String &path, int *length) {
|
||||
return _extension->_readFile(path, length);
|
||||
}
|
||||
|
||||
size_t getUsedMemory() {
|
||||
return _usedMemory;
|
||||
}
|
||||
|
||||
private:
|
||||
SpineExtension *_extension;
|
||||
std::map<void *, Allocation> _allocated;
|
||||
size_t _allocations;
|
||||
size_t _reallocations;
|
||||
size_t _frees;
|
||||
size_t _usedMemory;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif //SPINE_DEBUG_H
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_DEBUG_H
|
||||
#define SPINE_DEBUG_H
|
||||
|
||||
#include <spine/Extension.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace spine {
|
||||
class SP_API DebugExtension : public SpineExtension {
|
||||
struct Allocation {
|
||||
void *address;
|
||||
size_t size;
|
||||
const char *fileName;
|
||||
int line;
|
||||
|
||||
Allocation() : address(NULL), size(0), fileName(NULL), line(0) {
|
||||
}
|
||||
|
||||
Allocation(void *a, size_t s, const char *f, int l) : address(a), size(s), fileName(f), line(l) {
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
DebugExtension(SpineExtension *extension) : _extension(extension), _allocations(0), _reallocations(0), _frees(0) {
|
||||
}
|
||||
|
||||
void reportLeaks() {
|
||||
for (std::map<void *, Allocation>::iterator it = _allocated.begin(); it != _allocated.end(); it++) {
|
||||
printf("\"%s:%i (%zu bytes at %p)\n", it->second.fileName, it->second.line, it->second.size, it->second.address);
|
||||
}
|
||||
printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees);
|
||||
if (_allocated.empty()) printf("No leaks detected");
|
||||
}
|
||||
|
||||
void clearAllocations() {
|
||||
_allocated.clear();
|
||||
_usedMemory = 0;
|
||||
}
|
||||
|
||||
virtual void *_alloc(size_t size, const char *file, int line) {
|
||||
void *result = _extension->_alloc(size, file, line);
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_allocations++;
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void *_calloc(size_t size, const char *file, int line) {
|
||||
void *result = _extension->_calloc(size, file, line);
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_allocations++;
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void *_realloc(void *ptr, size_t size, const char *file, int line) {
|
||||
if (_allocated.count(ptr)) _usedMemory -= _allocated[ptr].size;
|
||||
_allocated.erase(ptr);
|
||||
void *result = _extension->_realloc(ptr, size, file, line);
|
||||
_reallocations++;
|
||||
_allocated[result] = Allocation(result, size, file, line);
|
||||
_usedMemory += size;
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void _free(void *mem, const char *file, int line) {
|
||||
if (_allocated.count(mem)) {
|
||||
_extension->_free(mem, file, line);
|
||||
_frees++;
|
||||
_usedMemory -= _allocated[mem].size;
|
||||
_allocated.erase(mem);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s:%i (address %p): Double free or not allocated through SpineExtension\n", file, line, mem);
|
||||
_extension->_free(mem, file, line);
|
||||
}
|
||||
|
||||
virtual char *_readFile(const String &path, int *length) {
|
||||
return _extension->_readFile(path, length);
|
||||
}
|
||||
|
||||
size_t getUsedMemory() {
|
||||
return _usedMemory;
|
||||
}
|
||||
|
||||
private:
|
||||
SpineExtension *_extension;
|
||||
std::map<void *, Allocation> _allocated;
|
||||
size_t _allocations;
|
||||
size_t _reallocations;
|
||||
size_t _frees;
|
||||
size_t _usedMemory;
|
||||
};
|
||||
} // namespace spine
|
||||
|
||||
#endif //SPINE_DEBUG_H
|
||||
+93
-93
@@ -1,93 +1,93 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/Event.h>
|
||||
|
||||
#include <spine/EventData.h>
|
||||
|
||||
spine::Event::Event(float time, const spine::EventData &data) : _data(data),
|
||||
_time(time),
|
||||
_intValue(0),
|
||||
_floatValue(0),
|
||||
_stringValue(),
|
||||
_volume(1),
|
||||
_balance(0) {
|
||||
}
|
||||
|
||||
const spine::EventData &spine::Event::getData() {
|
||||
return _data;
|
||||
}
|
||||
|
||||
float spine::Event::getTime() {
|
||||
return _time;
|
||||
}
|
||||
|
||||
int spine::Event::getIntValue() {
|
||||
return _intValue;
|
||||
}
|
||||
|
||||
void spine::Event::setIntValue(int inValue) {
|
||||
_intValue = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getFloatValue() {
|
||||
return _floatValue;
|
||||
}
|
||||
|
||||
void spine::Event::setFloatValue(float inValue) {
|
||||
_floatValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::Event::getStringValue() {
|
||||
return _stringValue;
|
||||
}
|
||||
|
||||
void spine::Event::setStringValue(const spine::String &inValue) {
|
||||
_stringValue = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getVolume() {
|
||||
return _volume;
|
||||
}
|
||||
|
||||
void spine::Event::setVolume(float inValue) {
|
||||
_volume = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getBalance() {
|
||||
return _balance;
|
||||
}
|
||||
|
||||
void spine::Event::setBalance(float inValue) {
|
||||
_balance = inValue;
|
||||
}
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/Event.h>
|
||||
|
||||
#include <spine/EventData.h>
|
||||
|
||||
spine::Event::Event(float time, const spine::EventData &data) : _data(data),
|
||||
_time(time),
|
||||
_intValue(0),
|
||||
_floatValue(0),
|
||||
_stringValue(),
|
||||
_volume(1),
|
||||
_balance(0) {
|
||||
}
|
||||
|
||||
const spine::EventData &spine::Event::getData() {
|
||||
return _data;
|
||||
}
|
||||
|
||||
float spine::Event::getTime() {
|
||||
return _time;
|
||||
}
|
||||
|
||||
int spine::Event::getIntValue() {
|
||||
return _intValue;
|
||||
}
|
||||
|
||||
void spine::Event::setIntValue(int inValue) {
|
||||
_intValue = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getFloatValue() {
|
||||
return _floatValue;
|
||||
}
|
||||
|
||||
void spine::Event::setFloatValue(float inValue) {
|
||||
_floatValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::Event::getStringValue() {
|
||||
return _stringValue;
|
||||
}
|
||||
|
||||
void spine::Event::setStringValue(const spine::String &inValue) {
|
||||
_stringValue = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getVolume() {
|
||||
return _volume;
|
||||
}
|
||||
|
||||
void spine::Event::setVolume(float inValue) {
|
||||
_volume = inValue;
|
||||
}
|
||||
|
||||
float spine::Event::getBalance() {
|
||||
return _balance;
|
||||
}
|
||||
|
||||
void spine::Event::setBalance(float inValue) {
|
||||
_balance = inValue;
|
||||
}
|
||||
+99
-99
@@ -1,99 +1,99 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/EventData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
spine::EventData::EventData(const spine::String &name) : _name(name),
|
||||
_intValue(0),
|
||||
_floatValue(0),
|
||||
_stringValue(),
|
||||
_audioPath(),
|
||||
_volume(1),
|
||||
_balance(0) {
|
||||
assert(_name.length() > 0);
|
||||
}
|
||||
|
||||
/// The name of the event, which is unique within the skeleton.
|
||||
const spine::String &spine::EventData::getName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
int spine::EventData::getIntValue() {
|
||||
return _intValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setIntValue(int inValue) {
|
||||
_intValue = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getFloatValue() {
|
||||
return _floatValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setFloatValue(float inValue) {
|
||||
_floatValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::EventData::getStringValue() {
|
||||
return _stringValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setStringValue(const spine::String &inValue) {
|
||||
this->_stringValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::EventData::getAudioPath() {
|
||||
return _audioPath;
|
||||
}
|
||||
|
||||
void spine::EventData::setAudioPath(const spine::String &inValue) {
|
||||
_audioPath = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getVolume() {
|
||||
return _volume;
|
||||
}
|
||||
|
||||
void spine::EventData::setVolume(float inValue) {
|
||||
_volume = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getBalance() {
|
||||
return _balance;
|
||||
}
|
||||
|
||||
void spine::EventData::setBalance(float inValue) {
|
||||
_balance = inValue;
|
||||
}
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated January 1, 2020. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef SPINE_UE4
|
||||
#include "SpinePluginPrivatePCH.h"
|
||||
#endif
|
||||
|
||||
#include <spine/EventData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
spine::EventData::EventData(const spine::String &name) : _name(name),
|
||||
_intValue(0),
|
||||
_floatValue(0),
|
||||
_stringValue(),
|
||||
_audioPath(),
|
||||
_volume(1),
|
||||
_balance(0) {
|
||||
assert(_name.length() > 0);
|
||||
}
|
||||
|
||||
/// The name of the event, which is unique within the skeleton.
|
||||
const spine::String &spine::EventData::getName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
int spine::EventData::getIntValue() {
|
||||
return _intValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setIntValue(int inValue) {
|
||||
_intValue = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getFloatValue() {
|
||||
return _floatValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setFloatValue(float inValue) {
|
||||
_floatValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::EventData::getStringValue() {
|
||||
return _stringValue;
|
||||
}
|
||||
|
||||
void spine::EventData::setStringValue(const spine::String &inValue) {
|
||||
this->_stringValue = inValue;
|
||||
}
|
||||
|
||||
const spine::String &spine::EventData::getAudioPath() {
|
||||
return _audioPath;
|
||||
}
|
||||
|
||||
void spine::EventData::setAudioPath(const spine::String &inValue) {
|
||||
_audioPath = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getVolume() {
|
||||
return _volume;
|
||||
}
|
||||
|
||||
void spine::EventData::setVolume(float inValue) {
|
||||
_volume = inValue;
|
||||
}
|
||||
|
||||
float spine::EventData::getBalance() {
|
||||
return _balance;
|
||||
}
|
||||
|
||||
void spine::EventData::setBalance(float inValue) {
|
||||
_balance = inValue;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user