diff --git a/spine-godot/spine_godot/SpineBone.cpp b/spine-godot/spine_godot/SpineBone.cpp index 7c17cb12c..1f4777d15 100644 --- a/spine-godot/spine_godot/SpineBone.cpp +++ b/spine-godot/spine_godot/SpineBone.cpp @@ -91,7 +91,6 @@ void SpineBone::_bind_methods() { ClassDB::bind_method(D_METHOD("get_world_scale_y"), &SpineBone::get_world_scale_y); 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("apply_world_transform_2d", "node2d"), &SpineBone::apply_world_transform_2d); 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); @@ -408,26 +407,6 @@ void SpineBone::set_active(bool v) { get_spine_object()->setActive(v); } -// External feature functions -void SpineBone::apply_world_transform_2d(const Variant &o) { - SPINE_CHECK(get_spine_object(), ) - if (o.get_type() == Variant::OBJECT) { - auto node2d = Object::cast_to(o.operator Object *()); - if (node2d) { - // In godot the y-axis is nag to spine - node2d->set_transform(Transform2D( - get_a(), get_c(), - get_b(), get_d(), - get_world_x(), -get_world_y())); - // Fix the rotation - auto pos = node2d->get_position(); - node2d->translate(-pos); - node2d->set_rotation(-node2d->get_rotation()); - node2d->translate(pos); - } - } -} - Transform2D SpineBone::get_transform() { SPINE_CHECK(get_spine_object(), Transform2D()) Transform2D transform; diff --git a/spine-godot/spine_godot/docs/SpineAnimationTrack.xml b/spine-godot/spine_godot/docs/SpineAnimationTrack.xml index cb27ba716..bfc606f75 100644 --- a/spine-godot/spine_godot/docs/SpineAnimationTrack.xml +++ b/spine-godot/spine_godot/docs/SpineAnimationTrack.xml @@ -1,8 +1,10 @@ + Internal class to allow composing animations on [code]SpineSprite[/code] instances via Godot's animation player and animation editor. + Internal class to allow composing animations on [code]SpineSprite[/code] instances via Godot's animation player and animation editor. diff --git a/spine-godot/spine_godot/docs/SpineAtlasResource.xml b/spine-godot/spine_godot/docs/SpineAtlasResource.xml index 7e46042af..6cbdc689e 100644 --- a/spine-godot/spine_godot/docs/SpineAtlasResource.xml +++ b/spine-godot/spine_godot/docs/SpineAtlasResource.xml @@ -1,8 +1,10 @@ + A Godot resource encapsulating a Spine atlas and its atlas page images. + A Godot resource encapsulating a Spine atlas and its atlas page images. diff --git a/spine-godot/spine_godot/docs/SpineAttachment.xml b/spine-godot/spine_godot/docs/SpineAttachment.xml index 6a9b01667..8ec6728d8 100644 --- a/spine-godot/spine_godot/docs/SpineAttachment.xml +++ b/spine-godot/spine_godot/docs/SpineAttachment.xml @@ -1,8 +1,12 @@ + Represents an attachment in a Spine skeleton's skin. + Represents an attachment in a Spine skeleton's skin. See [link]http://en.esotericsoftware.com/spine-runtime-skins[/link]. + + Attachments can only be queried for their name and can not be manipulated. diff --git a/spine-godot/spine_godot/docs/SpineBone.xml b/spine-godot/spine_godot/docs/SpineBone.xml index b8f5f5cf6..8e743ef3d 100644 --- a/spine-godot/spine_godot/docs/SpineBone.xml +++ b/spine-godot/spine_godot/docs/SpineBone.xml @@ -1,194 +1,236 @@ + A bone of a Spine skeleton, storing its current pose. + A bone of a Spine skeleton, storing its current pose. + + A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a + local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a + constraint or application code modifies the world transform after it was computed from the local transform. + + The bone's world transform is relative to the skeleton's coordinate system origin. Use [code]set_global_transform()[/code] + and [code]get_global_transform()[/code] to convert from and to Godot's Canvas coordinate system. - - - - - - + Part of the world transform matrix for the X axis. If changed, [code]update_applied_transform[/code] should be called. + The local scaleX. + The local scaleY. + The local shearX. + The local shearY. + The applied local x translation. + The applied local y translation. + The applied local rotation in degrees, counter clockwise. + Part of the world transform matrix for the Y axis. If changed, [code]update_applied_transform()[/code] should be called. + Part of the world transform matrix for the X axis. If changed, [code]update_applied_transform()[/code] should be called. + The immediate children of this bone. Modifications of the array have no effect. + Part of the world transform matrix for the Y axis. If changed, [code]update_applied_transform()[/code] should be called. + The bone's setup pose data. + Returns the bone transform as a [code]Transform2D[/code] relative to Godot's global canvas coordinate space. Shear is not encoded in the transform. + The parent bone, or null if this is the root bone. + The local rotation in degrees, counter clockwise. + The local scaleX. + The local scaleY. + The local shearX. + The local shearY. + Returns the bone transform as a [code]Transform2D[/code] relative to the [code]SpineSprite[/code] node representing the skeleton. Shear is not encoded in the transform. + The world rotation for the X axis in degrees, calculated using a and c of the transform. The rotation is relative to the [code]SpineSprite[/code]. + The world rotation for the X axis in degrees, calculated using b and d of the transform. The rotation is relative to the [code]SpineSprite[/code]. + The magnitude (always positive) of the world scale X, calculated using a and c. The scale is relative to the [code]SpineSprite[/code]. + The magnitude (always positive) of the world scale X, calculated using b and d. The scale is relative to the [code]SpineSprite[/code]. + Transforms a world rotation to a local rotation. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space. + Transforms a world rotation to a local rotation. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space. + The world X position. If changed, [code]update_applied_transform()[/code] should be called. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space. + The world Y position. If changed, [code]update_applied_transform()[/code] should be called. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space. + The local x translation. + The local y translation. + Returns false when the bone has not been computed because [code]BoneData.get_skin_required()[/code] is true and the + active skin does not contain this bone. + Transforms a point from the bone's local coordinates to world coordinates. The world coordinate space equals the coordinate space of the [code]SpineSprite[/code]. + Transforms a local rotation to a world rotation. The world coordinate space equals the coordinate space of the [code]SpineSprite[/code]. + Rotates the world transform the specified amount. + + After changes are made to the world transform, [code]update_applied_transform[/code] should be called and [code]update()[/code] will + need to be called on any child bones, recursively. @@ -267,6 +309,7 @@ + Sets the bone's transform to the global Godot [code]Transform2D[/code]. @@ -302,12 +345,14 @@ + Sets this bone's local transform to the setup pose. + Sets the bone transform to the Godot [code]Transform2D[/code]. @@ -337,18 +382,21 @@ + Computes the world transform using the parent bone and this bone's local transform. + Transforms a point from world coordinates to the bone's local coordinates. The world coordinate space is equal to the [code]SpineSprite[/code] coordinate space. + Transforms a world rotation to a local rotation. The world coordinate space is equal to the [code]SpineSprite[/code] coordinate space.