mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
Added back set_bone_pose to Skeleton, as I don't see any reason not to have it. Also improved it it.
This commit is contained in:
parent
6d293dc7a3
commit
27aaa70037
@ -190,6 +190,14 @@
|
|||||||
[b]Note:[/b] [code]parent_idx[/code] must be less than [code]bone_idx[/code].
|
[b]Note:[/b] [code]parent_idx[/code] must be less than [code]bone_idx[/code].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="set_bone_pose">
|
||||||
|
<return type="void" />
|
||||||
|
<argument index="0" name="bone_idx" type="int" />
|
||||||
|
<argument index="1" name="pose" type="Transform" />
|
||||||
|
<description>
|
||||||
|
Sets the pose transform for bone [code]bone_idx[/code]. Prefer set_bone_pose_position, set_bone_pose_rotation, or set_bone_pose_scale instead.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="set_bone_pose_position">
|
<method name="set_bone_pose_position">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<argument index="0" name="bone_idx" type="int" />
|
<argument index="0" name="bone_idx" type="int" />
|
||||||
|
@ -571,6 +571,19 @@ void Skeleton::clear_bones() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// posing api
|
// posing api
|
||||||
|
void Skeleton::set_bone_pose(int p_bone, const Transform &p_pose) {
|
||||||
|
const int bone_size = bones.size();
|
||||||
|
ERR_FAIL_INDEX(p_bone, bone_size);
|
||||||
|
|
||||||
|
bones.write[p_bone].pose_position = p_pose.origin;
|
||||||
|
bones.write[p_bone].pose_rotation = p_pose.basis.get_rotation_quat();
|
||||||
|
bones.write[p_bone].pose_scale = p_pose.basis.get_scale();
|
||||||
|
bones.write[p_bone].pose_cache_dirty = true;
|
||||||
|
|
||||||
|
if (is_inside_tree()) {
|
||||||
|
_make_dirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Skeleton::set_bone_pose_position(int p_bone, const Vector3 &p_position) {
|
void Skeleton::set_bone_pose_position(int p_bone, const Vector3 &p_position) {
|
||||||
const int bone_size = bones.size();
|
const int bone_size = bones.size();
|
||||||
@ -983,6 +996,7 @@ void Skeleton::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("clear_bones"), &Skeleton::clear_bones);
|
ClassDB::bind_method(D_METHOD("clear_bones"), &Skeleton::clear_bones);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_bone_pose", "bone_idx", "pose"), &Skeleton::set_bone_pose);
|
||||||
ClassDB::bind_method(D_METHOD("set_bone_pose_position", "bone_idx", "position"), &Skeleton::set_bone_pose_position);
|
ClassDB::bind_method(D_METHOD("set_bone_pose_position", "bone_idx", "position"), &Skeleton::set_bone_pose_position);
|
||||||
ClassDB::bind_method(D_METHOD("set_bone_pose_rotation", "bone_idx", "rotation"), &Skeleton::set_bone_pose_rotation);
|
ClassDB::bind_method(D_METHOD("set_bone_pose_rotation", "bone_idx", "rotation"), &Skeleton::set_bone_pose_rotation);
|
||||||
ClassDB::bind_method(D_METHOD("set_bone_pose_scale", "bone_idx", "scale"), &Skeleton::set_bone_pose_scale);
|
ClassDB::bind_method(D_METHOD("set_bone_pose_scale", "bone_idx", "scale"), &Skeleton::set_bone_pose_scale);
|
||||||
|
@ -206,7 +206,7 @@ public:
|
|||||||
void clear_bones();
|
void clear_bones();
|
||||||
|
|
||||||
// posing api
|
// posing api
|
||||||
|
void set_bone_pose(int p_bone, const Transform &p_pose);
|
||||||
void set_bone_pose_position(int p_bone, const Vector3 &p_position);
|
void set_bone_pose_position(int p_bone, const Vector3 &p_position);
|
||||||
void set_bone_pose_rotation(int p_bone, const Quat &p_rotation);
|
void set_bone_pose_rotation(int p_bone, const Quat &p_rotation);
|
||||||
void set_bone_pose_scale(int p_bone, const Vector3 &p_scale);
|
void set_bone_pose_scale(int p_bone, const Vector3 &p_scale);
|
||||||
|
Loading…
Reference in New Issue
Block a user