Skeleton3D: Add SkeletonModifier / Deprecate Override / Separate PB

This commit is contained in:
Silc Lizard (Tokage) Renew 2024-01-28 09:11:43 +09:00
parent f6a78f83aa
commit 04dd299cba
42 changed files with 1530 additions and 681 deletions

View file

@ -850,7 +850,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
ti->set_text(0, F->get());
ti->set_selectable(0, false);
ti->set_editable(0, false);
ti->set_icon(0, get_editor_theme_icon(SNAME("BoneAttachment3D")));
ti->set_icon(0, get_editor_theme_icon(SNAME("Bone")));
} else {
ti = parenthood[accum];
}
@ -861,7 +861,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
ti->set_text(0, concat);
ti->set_checked(0, anode->is_path_filtered(path));
ti->set_icon(0, get_editor_theme_icon(SNAME("BoneAttachment3D")));
ti->set_icon(0, get_editor_theme_icon(SNAME("Bone")));
ti->set_metadata(0, path);
} else {

View file

@ -196,7 +196,7 @@ void BonePicker::create_bones_tree(Skeleton3D *p_skeleton) {
items.insert(-1, root);
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D"));
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone"));
Vector<int> bones_to_process = p_skeleton->get_parentless_bones();
bool is_first = true;

View file

@ -61,17 +61,17 @@ void PhysicalBone3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
return;
}
Skeleton3D *sk(physical_bone->find_skeleton_parent());
if (!sk) {
PhysicalBoneSimulator3D *sm(physical_bone->get_simulator());
if (!sm) {
return;
}
PhysicalBone3D *pb(sk->get_physical_bone(physical_bone->get_bone_id()));
PhysicalBone3D *pb(sm->get_physical_bone(physical_bone->get_bone_id()));
if (!pb) {
return;
}
PhysicalBone3D *pbp(sk->get_physical_bone_parent(physical_bone->get_bone_id()));
PhysicalBone3D *pbp(sm->get_physical_bone_parent(physical_bone->get_bone_id()));
if (!pbp) {
return;
}

View file

@ -129,7 +129,7 @@ void EditorPropertyRootMotion::_node_assign() {
if (skeleton) {
HashMap<int, TreeItem *> items;
items.insert(-1, ti);
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D"));
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone"));
Vector<int> bones_to_process = skeleton->get_parentless_bones();
while (bones_to_process.size() > 0) {
int current_bone_idx = bones_to_process[0];

View file

@ -377,6 +377,11 @@ void Skeleton3DEditor::create_physical_skeleton() {
bones_infos.resize(bone_count);
ur->create_action(TTR("Create physical bones"), UndoRedo::MERGE_ALL);
PhysicalBoneSimulator3D *simulator = memnew(PhysicalBoneSimulator3D);
ur->add_do_method(skeleton, "add_child", simulator);
ur->add_do_method(simulator, "set_owner", owner);
ur->add_do_method(simulator, "set_name", "PhysicalBoneSimulator3D");
for (int bone_id = 0; bone_count > bone_id; ++bone_id) {
const int parent = skeleton->get_bone_parent(bone_id);
@ -395,7 +400,7 @@ void Skeleton3DEditor::create_physical_skeleton() {
if (collision_shape) {
bones_infos.write[parent].physical_bone = physical_bone;
ur->add_do_method(skeleton, "add_child", physical_bone);
ur->add_do_method(simulator, "add_child", physical_bone);
ur->add_do_method(physical_bone, "set_owner", owner);
ur->add_do_method(collision_shape, "set_owner", owner);
ur->add_do_property(physical_bone, "bone_name", skeleton->get_bone_name(parent));
@ -409,12 +414,13 @@ void Skeleton3DEditor::create_physical_skeleton() {
ur->add_do_method(Node3DEditor::get_singleton(), SceneStringNames::get_singleton()->_request_gizmo, collision_shape);
ur->add_do_reference(physical_bone);
ur->add_undo_method(skeleton, "remove_child", physical_bone);
ur->add_undo_method(simulator, "remove_child", physical_bone);
}
}
}
}
}
ur->add_undo_method(skeleton, "remove_child", simulator);
ur->commit_action();
}
@ -670,7 +676,7 @@ void Skeleton3DEditor::update_joint_tree() {
items.insert(-1, root);
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("BoneAttachment3D"));
Ref<Texture> bone_icon = get_editor_theme_icon(SNAME("Bone"));
Vector<int> bones_to_process = skeleton->get_parentless_bones();
while (bones_to_process.size() > 0) {