[godot] Add missing methods

This commit is contained in:
Mario Zechner 2025-10-01 15:24:00 +02:00
parent 93399d104a
commit e5e319a4a7
7 changed files with 326 additions and 0 deletions

View File

@ -0,0 +1,270 @@
# Spine Runtime Changelog Generation
## Output File
Add changes to `/spine-runtimes/CHANGELOG.md` at the TOP of the file, under the current version heading (e.g., `# 4.3`).
Each language gets a `##` section, each engine integration gets a `###` subsection under its language.
**CRITICAL**: If entries already exist for the current version:
- **PRESERVE all existing human-written entries** - they may contain important manual additions
- **ADD new entries** to the appropriate sections
- **MOVE entries** if needed to maintain correct ordering, but NEVER delete or modify existing text
- **MERGE** your generated entries with existing ones, don't replace
## Step 1: Determine Comparison Branch
```bash
cd /spine-runtimes
git branch -r | grep origin | grep -E "^ origin/[0-9]\.[0-9]" | sort -V
```
Ask user: "Which branch to compare against? (typically the previous version, e.g., 4.2 for 4.3 changes)"
## Step 2: Analyze Java Reference Implementation
```bash
git diff COMPARE_BRANCH..CURRENT_BRANCH -- spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/
```
### What to Look For:
- **Public API changes** (public/protected methods, fields, classes)
- **Ignore**: private methods, internal implementation, formatting, comments
- **New files**: Check if they contain public classes
- **Deleted files**: Note if public classes were removed
- **Method signature changes**: Parameters added/removed/changed
## Step 3: Generate Changelog Entries
### Process Order:
1. Start with Java reference implementation changes
2. Port these to all language runtimes (with language-specific syntax)
3. Add language runtime specific changes
4. Add engine-specific changes
5. **Check off each item in the checklist as you complete it**
### Runtime Checklist (follows changelog.md structure):
- [ ] **C** (`spine-c/`) - C wrapper around C++ runtime
- [ ] **SFML** (`spine-sfml/c/`)
- [ ] **SDL** (`spine-sdl/`)
- [ ] **GLFW** (`spine-glfw/`)
- [ ] **C++** (`spine-cpp/`) - Check `src/spine/*.cpp` and `include/spine/*.h`
- [ ] **Cocos2d-x** (in examples if present)
- [ ] **SFML** (`spine-sfml/cpp/`)
- [ ] **UE** (`spine-ue/`)
- [ ] **Godot** (`spine-godot/`)
- [ ] **C#** (`spine-csharp/src/`) - Check all `.cs` files
- [ ] **Unity** (`spine-unity/`)
- [ ] **MonoGame** (`spine-monogame/`)
- [ ] **XNA** (`spine-xna/`)
- [ ] **Dart** (`spine-flutter/src/`) - Dart runtime
- [ ] **Flutter** (`spine-flutter/`) - Flutter-specific integration
- [ ] **Haxe** (`spine-haxe/spine-haxe/`) - Check all `.hx` files
- [ ] **Java** (`spine-libgdx/spine-libgdx/src/`) - Reference implementation
- [ ] **libGDX** (`spine-libgdx/`) - libGDX-specific integration
- [ ] **Android** (`spine-android/`)
- [ ] **Swift** (`spine-ios/spine-ios/`) - Swift/Objective-C runtime
- [ ] **iOS** (`spine-ios/`) - iOS-specific integration
- [ ] **TypeScript/JavaScript** (`spine-ts/spine-core/src/`) - Check all `.ts` files
- [ ] **WebGL backend** (`spine-ts/spine-webgl/`)
- [ ] **Canvas backend** (`spine-ts/spine-canvas/`)
- [ ] **CanvasKit backend** (`spine-ts/spine-canvaskit/`)
- [ ] **Three.js backend** (`spine-ts/spine-threejs/`)
- [ ] **Player** (`spine-ts/spine-player/`)
- [ ] **Pixi v7** (`spine-ts/spine-pixi-v7/`)
- [ ] **Pixi v8** (`spine-ts/spine-pixi-v8/`)
- [ ] **Phaser v3** (`spine-ts/spine-phaser-v3/`)
- [ ] **Phaser v4** (`spine-ts/spine-phaser-v4/`)
- [ ] **Web Components** (`spine-ts/spine-webcomponents/`)
## Entry Format Hierarchy
The changelog has a **strict two-level hierarchy**:
1. **Top level**: Language runtime (## C, ## C++, ## C#, ## Dart, ## Haxe, ## Java, ## Swift, ## TypeScript/JavaScript)
- Contains changes to the core runtime implementation
- All public API changes from Java reference must be ported here
2. **Second level**: Engine/platform integrations under their language (### Unity, ### libGDX, ### Godot)
- Contains ONLY engine-specific changes
- Does NOT repeat language runtime changes
### Example Structure:
```markdown
## C
- **Additions**
- Added `spSkeleton_findSlider()` to query sliders by name (ported from Java)
- Added `spSlider` and `spSliderData` types (ported from Java)
- **Breaking changes**
- `spSkeleton_updateWorldTransform()` now requires `spPhysics` parameter (ported from Java)
- Renamed `spTransformMode` to `spInherit` and all `SP_TRANSFORMMODE_*` to `SP_INHERIT_*`
- **Changes of default values**
- Changed default mix duration from 0 to 0.2 seconds
- **Deprecated**
- Deprecated `spBone_worldToLocalRotationX()` and `spBone_worldToLocalRotationY()`
- **Restructuring (Non-Breaking)**
- Moved internal math utilities to separate module
### SFML
- **Additions**
- Added example showing physics integration
- New rendering optimization for batched sprites
### SDL
- **Additions**
- Added SDL3 support
- **Breaking changes**
- Removed SDL1 support
## C++
- **Additions**
- Added `Skeleton::findSlider()` to query sliders by name (ported from Java)
- Added `Slider` and `SliderData` classes (ported from Java)
- **Breaking changes**
- `Skeleton::updateWorldTransform()` now requires `Physics` parameter (ported from Java)
- Renamed `TransformMode` to `Inherit` and all `TransformMode_*` to `Inherit_*`
- **Deprecated**
- Deprecated `Bone::worldToLocalRotationX()` and `Bone::worldToLocalRotationY()`
### UE
- **Additions**
- Added Blueprint node for physics constraints
- Compatible with Unreal Engine 5.4
- **Breaking changes**
- Minimum Unreal Engine version is now 5.2
## C#
- **Additions**
- Added `Skeleton.FindSlider()` to query sliders by name (ported from Java)
- Added `Slider` and `SliderData` classes (ported from Java)
- **Breaking changes**
- `Skeleton.UpdateWorldTransform()` now requires `Physics` parameter (ported from Java)
- Renamed `TrackEntry.AttachmentThreshold` to `TrackEntry.MixAttachmentThreshold`
- **Changes of default values**
- Changed default `SkeletonGraphic.MeshScale` from 1.0 to calculated value
- **Deprecated**
- Deprecated `Bone.WorldToLocalRotationX` and `Bone.WorldToLocalRotationY`
- **Restructuring (Non-Breaking)**
- Reorganized shader files into subdirectories
### Unity
- **Additions**
- Added URP 2D shader variant
- New Inspector property `Layout Scale Mode` for SkeletonGraphic
- **Breaking changes**
- Changed default materials to have `CanvasGroup Compatible` disabled
- **Changes of default values**
- Changed default atlas texture workflow from PMA to straight alpha textures
### MonoGame
- **Additions**
- Updated to MonoGame 3.8.2
- **Restructuring (Non-Breaking)**
- Updated project structure to use .NET 6
```
## Language-Specific Naming
### Java (Reference)
- Instance method: `Skeleton#updateWorldTransform()`
- Static method: `Skeleton.someStaticMethod()`
- Field: `skeleton.time`
### C
- Function: `spSkeleton_updateWorldTransform()`
- Type: `spPhysics`
- Enum: `SP_PHYSICS_UPDATE`
### C++
- Method: `Skeleton::updateWorldTransform()`
- Namespace: `spine::`
- Enum: `Physics::Update`
### C#
- Method: `Skeleton.UpdateWorldTransform()`
- Property: `Skeleton.Time`
- Namespace: `Spine`
### TypeScript/JavaScript
- Method: `skeleton.updateWorldTransform()`
- Property: `skeleton.time`
- Enum: `Physics.update`
### Dart
- Method: `skeleton.updateWorldTransform()`
- Property: `skeleton.time`
- Class: `Skeleton`
### Haxe
- Method: `skeleton.updateWorldTransform()`
- Property: `skeleton.time`
- Package: `spine`
### Swift
- Method: `skeleton.updateWorldTransform()`
- Property: `skeleton.time`
- Class: `Skeleton`
### Godot (GDScript)
- Method: `skeleton.update_world_transform()`
- Signal: `animation_completed`
- Property: `skeleton.time`
## Key Rules
1. **Only document public API changes** - ignore private/internal
2. **One line per change** - be concise
3. **Group related changes** with sub-bullets
4. **Omit empty categories**
5. **Use backticks** for all code references
6. **Check existing entries** in CHANGELOG.md for style reference
## Complete Execution Workflow
1. **Setup**:
- Navigate to `/spine-runtimes/`
- Determine current branch: `git branch --show-current`
- List available branches: `git branch -r | grep origin | grep -E "^ origin/[0-9]\.[0-9]" | sort -V`
- Ask user which branch to compare against
- **Check CHANGELOG.md for existing entries under current version** - these must be preserved
- Load checklist state from this document
2. **Check Java Reference Status**:
- If **Java** is unchecked in the checklist:
- **MUST process Java first** - it's the reference implementation
- Run: `git diff COMPARE_BRANCH..CURRENT_BRANCH -- spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/`
- Document public API changes in Java section
- Check off Java in checklist
- If Java is already checked, proceed to step 3
3. **Select Runtime to Process**:
- Show user all **unchecked items** from the checklist
- Ask: "Which runtime would you like to process? Options:"
- List all unchecked language runtimes
- List all unchecked engine integrations (grouped by language)
- User selects one or multiple runtimes to process
4. **Process Selected Runtime(s)**:
- For **language runtime**:
- Port Java reference changes with language-specific syntax
- Check for additional language-specific changes
- Write entries under `## LanguageName` in CHANGELOG.md
- For **engine integration**:
- Check for engine-specific changes ONLY
- Write entries under `### EngineName` in CHANGELOG.md
- Check off processed items in checklist
5. **Repeat or Finalize**:
- If unchecked items remain, ask if user wants to continue
- If yes, return to step 3
- If no or all complete, save CHANGELOG.md and updated checklist

View File

@ -48,6 +48,7 @@ void SpineBone::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_applied_pose"), &SpineBone::get_applied_pose);
ClassDB::bind_method(D_METHOD("is_active"), &SpineBone::is_active);
ClassDB::bind_method(D_METHOD("set_active", "v"), &SpineBone::set_active);
ClassDB::bind_method(D_METHOD("update", "skeleton", "physics"), &SpineBone::update);
ClassDB::bind_method(D_METHOD("get_transform"), &SpineBone::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "local_transform"), &SpineBone::set_transform);
ClassDB::bind_method(D_METHOD("get_global_transform"), &SpineBone::get_global_transform);
@ -218,3 +219,9 @@ void SpineBone::set_global_transform(Transform2D transform) {
get_spine_owner()->set_modified_bones();
}
void SpineBone::update(Ref<SpineSkeleton> skeleton, SpineConstant::Physics physics) {
SPINE_CHECK(get_spine_object(), )
SPINE_CHECK(skeleton.is_valid() && skeleton->get_spine_object(), )
get_spine_object()->update(*skeleton->get_spine_object(), (spine::Physics)physics);
}

View File

@ -79,6 +79,8 @@ public:
void set_active(bool v);
void update(Ref<SpineSkeleton> skeleton, SpineConstant::Physics physics);
// External feature functions
void apply_world_transform_2d(const Variant &o);

View File

@ -47,6 +47,11 @@ void SpineBoneLocal::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shear_y", "v"), &SpineBoneLocal::set_shear_y);
ClassDB::bind_method(D_METHOD("get_inherit"), &SpineBoneLocal::get_inherit);
ClassDB::bind_method(D_METHOD("set_inherit", "v"), &SpineBoneLocal::set_inherit);
// Convenience methods
ClassDB::bind_method(D_METHOD("set_position", "x", "y"), &SpineBoneLocal::set_position);
ClassDB::bind_method(D_METHOD("set_scale", "scale_x", "scale_y"), &SpineBoneLocal::set_scale);
ClassDB::bind_method(D_METHOD("set_scale_uniform", "scale"), &SpineBoneLocal::set_scale_uniform);
}
float SpineBoneLocal::get_x() {
@ -128,3 +133,18 @@ void SpineBoneLocal::set_inherit(SpineConstant::Inherit inherit) {
SPINE_CHECK(get_spine_object(), )
get_spine_object()->setInherit((spine::Inherit) inherit);
}
void SpineBoneLocal::set_position(float x, float y) {
SPINE_CHECK(get_spine_object(), )
get_spine_object()->setPosition(x, y);
}
void SpineBoneLocal::set_scale(float scale_x, float scale_y) {
SPINE_CHECK(get_spine_object(), )
get_spine_object()->setScale(scale_x, scale_y);
}
void SpineBoneLocal::set_scale_uniform(float scale) {
SPINE_CHECK(get_spine_object(), )
get_spine_object()->setScale(scale);
}

View File

@ -75,4 +75,9 @@ public:
SpineConstant::Inherit get_inherit();
void set_inherit(SpineConstant::Inherit inherit);
// Convenience methods
void set_position(float x, float y);
void set_scale(float scale_x, float scale_y);
void set_scale_uniform(float scale);
};

View File

@ -29,6 +29,7 @@
#include "SpineBonePose.h"
#include "SpineCommon.h"
#include "SpineSkeleton.h"
void SpineBonePose::_bind_methods() {
// BoneLocal methods
@ -75,6 +76,10 @@ void SpineBonePose::_bind_methods() {
ClassDB::bind_method(D_METHOD("world_to_local_rotation", "world_rotation"), &SpineBonePose::world_to_local_rotation);
ClassDB::bind_method(D_METHOD("local_to_world_rotation", "local_rotation"), &SpineBonePose::local_to_world_rotation);
ClassDB::bind_method(D_METHOD("rotate_world", "degrees"), &SpineBonePose::rotate_world);
// Update methods
ClassDB::bind_method(D_METHOD("update_world_transform", "skeleton"), &SpineBonePose::update_world_transform);
ClassDB::bind_method(D_METHOD("update_local_transform", "skeleton"), &SpineBonePose::update_local_transform);
}
// BoneLocal properties
@ -282,3 +287,15 @@ void SpineBonePose::rotate_world(float degrees) {
SPINE_CHECK(get_spine_object(), )
get_spine_object()->rotateWorld(degrees);
}
void SpineBonePose::update_world_transform(Ref<SpineSkeleton> skeleton) {
SPINE_CHECK(get_spine_object(), )
SPINE_CHECK(skeleton.is_valid() && skeleton->get_spine_object(), )
get_spine_object()->updateWorldTransform(*skeleton->get_spine_object());
}
void SpineBonePose::update_local_transform(Ref<SpineSkeleton> skeleton) {
SPINE_CHECK(get_spine_object(), )
SPINE_CHECK(skeleton.is_valid() && skeleton->get_spine_object(), )
get_spine_object()->updateLocalTransform(*skeleton->get_spine_object());
}

View File

@ -34,6 +34,7 @@
#include <spine/BonePose.h>
class SpineSprite;
class SpineSkeleton;
class SpineBonePose : public SpineObjectWrapper {
GDCLASS(SpineBonePose, SpineObjectWrapper)
@ -107,4 +108,8 @@ public:
float world_to_local_rotation(float world_rotation);
float local_to_world_rotation(float local_rotation);
void rotate_world(float degrees);
// Update methods
void update_world_transform(Ref<SpineSkeleton> skeleton);
void update_local_transform(Ref<SpineSkeleton> skeleton);
};