mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-20 14:44:21 +01:00
Make sure Skeletons set up their initial pose.
This commit is contained in:
parent
986565b0b4
commit
727826efba
@ -32,12 +32,12 @@
|
||||
|
||||
#include "core/object/message_queue.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "physical_bone.h"
|
||||
#include "../resources/skeleton_modification_3d.h"
|
||||
#include "../resources/skeleton_modification_stack_3d.h"
|
||||
#include "../resources/skin.h"
|
||||
#include "core/config/engine.h"
|
||||
#include "core/config/project_settings.h"
|
||||
#include "physical_bone.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
@ -375,6 +375,8 @@ void Skeleton::_notification(int p_what) {
|
||||
if (modification_stack.is_valid()) {
|
||||
set_modification_stack(modification_stack);
|
||||
}
|
||||
|
||||
init_pose();
|
||||
} break;
|
||||
#endif
|
||||
}
|
||||
@ -1077,6 +1079,20 @@ Ref<SkinReference> Skeleton::register_skin(const Ref<Skin> &p_skin) {
|
||||
return skin_ref;
|
||||
}
|
||||
|
||||
void Skeleton::init_pose() {
|
||||
const int bone_len = get_bone_count();
|
||||
if (!bone_len) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < bone_len; i++) {
|
||||
Transform rest = get_bone_rest(i);
|
||||
set_bone_pose_position(i, rest.origin);
|
||||
set_bone_pose_rotation(i, rest.basis.get_rotation_quaternion());
|
||||
set_bone_pose_scale(i, rest.basis.get_scale());
|
||||
}
|
||||
}
|
||||
|
||||
void Skeleton::force_update_all_dirty_bones() {
|
||||
if (dirty && updating == 0) {
|
||||
const_cast<Skeleton *>(this)->notification(NOTIFICATION_UPDATE_SKELETON);
|
||||
|
@ -248,6 +248,8 @@ public:
|
||||
|
||||
Ref<SkinReference> register_skin(const Ref<Skin> &p_skin);
|
||||
|
||||
void init_pose();
|
||||
|
||||
void force_update_all_dirty_bones();
|
||||
void force_update_all_bone_transforms();
|
||||
void force_update_bone_children_transforms(int bone_idx);
|
||||
|
Loading…
Reference in New Issue
Block a user