mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 06:29:02 +08:00
[godot] More in-editor docs.
This commit is contained in:
parent
e31ae75c79
commit
dcfc3ef969
@ -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<Node2D>(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;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SpineAnimationTrack" inherits="Node" version="3.4">
|
||||
<brief_description>
|
||||
Internal class to allow composing animations on [code]SpineSprite[/code] instances via Godot's animation player and animation editor.
|
||||
</brief_description>
|
||||
<description>
|
||||
Internal class to allow composing animations on [code]SpineSprite[/code] instances via Godot's animation player and animation editor.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SpineAtlasResource" inherits="Resource" version="3.4">
|
||||
<brief_description>
|
||||
A Godot resource encapsulating a Spine atlas and its atlas page images.
|
||||
</brief_description>
|
||||
<description>
|
||||
A Godot resource encapsulating a Spine atlas and its atlas page images.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SpineAttachment" inherits="SpineObjectWrapper" version="3.4">
|
||||
<brief_description>
|
||||
Represents an attachment in a Spine skeleton's skin.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
||||
@ -1,194 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SpineBone" inherits="SpineObjectWrapper" version="3.4">
|
||||
<brief_description>
|
||||
A bone of a Spine skeleton, storing its current pose.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="apply_world_transform_2d">
|
||||
<return type="void" />
|
||||
<argument index="0" name="node2d" type="Variant" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Part of the world transform matrix for the X axis. If changed, [code]update_applied_transform[/code] should be called.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_scale_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local scaleX.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_scale_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local scaleY.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_shear_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local shearX.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_shear_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local shearY.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The applied local x translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_a_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The applied local y translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_applied_rotation">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The applied local rotation in degrees, counter clockwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_b">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Part of the world transform matrix for the Y axis. If changed, [code]update_applied_transform()[/code] should be called.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_c">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Part of the world transform matrix for the X axis. If changed, [code]update_applied_transform()[/code] should be called.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_children">
|
||||
<return type="Array" />
|
||||
<description>
|
||||
The immediate children of this bone. Modifications of the array have no effect.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_d">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Part of the world transform matrix for the Y axis. If changed, [code]update_applied_transform()[/code] should be called.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_data">
|
||||
<return type="SpineBoneData" />
|
||||
<description>
|
||||
The bone's setup pose data.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_global_transform">
|
||||
<return type="Transform2D" />
|
||||
<description>
|
||||
Returns the bone transform as a [code]Transform2D[/code] relative to Godot's global canvas coordinate space. Shear is not encoded in the transform.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_parent">
|
||||
<return type="SpineBone" />
|
||||
<description>
|
||||
The parent bone, or null if this is the root bone.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rotation">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local rotation in degrees, counter clockwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_scale_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local scaleX.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_scale_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local scaleY.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_shear_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local shearX.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_shear_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local shearY.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_transform">
|
||||
<return type="Transform2D" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_rotation_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_rotation_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_scale_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The magnitude (always positive) of the world scale X, calculated using a and c. The scale is relative to the [code]SpineSprite[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_scale_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The magnitude (always positive) of the world scale X, calculated using b and d. The scale is relative to the [code]SpineSprite[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_to_local_rotation_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Transforms a world rotation to a local rotation. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_to_local_rotation_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
Transforms a world rotation to a local rotation. The world coordinate system is equal to the [code]SpineSprite[/code] coordinate space.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_world_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_x">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local x translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_y">
|
||||
<return type="float" />
|
||||
<description>
|
||||
The local y translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_active">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="local_to_world">
|
||||
<return type="Vector2" />
|
||||
<argument index="0" name="local_position" type="Vector2" />
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="local_to_world_rotation">
|
||||
<return type="float" />
|
||||
<argument index="0" name="local_rotation" type="float" />
|
||||
<description>
|
||||
Transforms a local rotation to a world rotation. The world coordinate space equals the coordinate space of the [code]SpineSprite[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="rotate_world">
|
||||
<return type="void" />
|
||||
<argument index="0" name="arg0" type="float" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_a">
|
||||
@ -267,6 +309,7 @@
|
||||
<return type="void" />
|
||||
<argument index="0" name="global_transform" type="Transform2D" />
|
||||
<description>
|
||||
Sets the bone's transform to the global Godot [code]Transform2D[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_rotation">
|
||||
@ -302,12 +345,14 @@
|
||||
<method name="set_to_setup_pose">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Sets this bone's local transform to the setup pose.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_transform">
|
||||
<return type="void" />
|
||||
<argument index="0" name="local_transform" type="Transform2D" />
|
||||
<description>
|
||||
Sets the bone transform to the Godot [code]Transform2D[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_world_x">
|
||||
@ -337,18 +382,21 @@
|
||||
<method name="update_world_transform">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Computes the world transform using the parent bone and this bone's local transform.
|
||||
</description>
|
||||
</method>
|
||||
<method name="world_to_local">
|
||||
<return type="Vector2" />
|
||||
<argument index="0" name="world_position" type="Vector2" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="world_to_local_rotation">
|
||||
<return type="float" />
|
||||
<argument index="0" name="world_rotation" type="float" />
|
||||
<description>
|
||||
Transforms a world rotation to a local rotation. The world coordinate space is equal to the [code]SpineSprite[/code] coordinate space.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user