Skip to content

Commit

Permalink
removed unused skeleton functions and unused physics variables
Browse files Browse the repository at this point in the history
  • Loading branch information
benbot committed Aug 24, 2022
1 parent 34aa6b0 commit b775f37
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 73 deletions.
26 changes: 0 additions & 26 deletions doc/classes/Skeleton3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
Adds a bone, with name [param name]. [method get_bone_count] will become the bone index.
</description>
</method>
<method name="add_bone_child">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="child_bone_idx" type="int" />
<description>
Takes the given bone pose/transform and converts it to a world transform, relative to the [Skeleton3D] node.
This is useful for using the bone transform in calculations with transforms from [Node3D]-based nodes.
</description>
</method>
<method name="clear_bones">
<return type="void" />
<description>
Expand Down Expand Up @@ -272,15 +263,6 @@
Binds the given Skin to the Skeleton.
</description>
</method>
<method name="remove_bone_child">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="child_bone_idx" type="int" />
<description>
Removes the passed in child bone index, [param child_bone_idx], from the passed-in bone, [param bone_idx], if it exists.
[b]Note:[/b] This does not remove the child bone, but instead it removes the connection it has to the parent bone.
</description>
</method>
<method name="reset_bone_pose">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
Expand All @@ -294,14 +276,6 @@
Sets all bone poses to rests.
</description>
</method>
<method name="set_bone_children">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="bone_children" type="PackedInt32Array" />
<description>
Sets the children for the passed in bone, [param bone_idx], to the passed-in array of bone indexes, [param bone_children].
</description>
</method>
<method name="set_bone_enabled">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
Expand Down
9 changes: 1 addition & 8 deletions scene/3d/physics_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ void RigidDynamicBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state)
set_ignore_transform_notification(true);
set_global_transform(p_state->get_transform());

linear_velocity = p_state->get_linear_velocity();
angular_velocity = p_state->get_angular_velocity();

inverse_inertia_tensor = p_state->get_inverse_inertia_tensor();

if (sleeping != p_state->is_sleeping()) {
sleeping = p_state->is_sleeping();
emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed);
Expand All @@ -525,7 +520,7 @@ void RigidDynamicBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state)
}

_RigidDynamicBodyInOut *toadd = (_RigidDynamicBodyInOut *)alloca(p_state->get_contact_count() * sizeof(_RigidDynamicBodyInOut));
int toadd_count = 0; //state->get_contact_count();
int toadd_count = 0;
RigidDynamicBody3D_RemoveAction *toremove = (RigidDynamicBody3D_RemoveAction *)alloca(rc * sizeof(RigidDynamicBody3D_RemoveAction));
int toremove_count = 0;

Expand All @@ -537,8 +532,6 @@ void RigidDynamicBody3D::_body_state_changed(PhysicsDirectBodyState3D *p_state)
int local_shape = p_state->get_contact_local_shape(i);
int shape = p_state->get_contact_collider_shape(i);

//bool found=false;

HashMap<ObjectID, BodyState>::Iterator E = contact_monitor->body_map.find(obj);
if (!E) {
toadd[toadd_count].rid = rid;
Expand Down
39 changes: 0 additions & 39 deletions scene/3d/skeleton_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,42 +613,6 @@ Vector<int> Skeleton3D::get_bone_children(int p_bone) {
return bones[p_bone].child_bones;
}

void Skeleton3D::set_bone_children(int p_bone, Vector<int> p_children) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);
bones.write[p_bone].child_bones = p_children;

process_order_dirty = true;
rest_dirty = true;
_make_dirty();
}

void Skeleton3D::add_bone_child(int p_bone, int p_child) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);
bones.write[p_bone].child_bones.push_back(p_child);

process_order_dirty = true;
rest_dirty = true;
_make_dirty();
}

void Skeleton3D::remove_bone_child(int p_bone, int p_child) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);

int child_idx = bones[p_bone].child_bones.find(p_child);
if (child_idx >= 0) {
bones.write[p_bone].child_bones.remove_at(child_idx);
} else {
WARN_PRINT("Cannot remove child bone: Child bone not found.");
}

process_order_dirty = true;
rest_dirty = true;
_make_dirty();
}

Vector<int> Skeleton3D::get_parentless_bones() {
_update_process_order();
return parentless_bones;
Expand Down Expand Up @@ -1238,9 +1202,6 @@ void Skeleton3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("unparent_bone_and_rest", "bone_idx"), &Skeleton3D::unparent_bone_and_rest);

ClassDB::bind_method(D_METHOD("get_bone_children", "bone_idx"), &Skeleton3D::get_bone_children);
ClassDB::bind_method(D_METHOD("set_bone_children", "bone_idx", "bone_children"), &Skeleton3D::set_bone_children);
ClassDB::bind_method(D_METHOD("add_bone_child", "bone_idx", "child_bone_idx"), &Skeleton3D::add_bone_child);
ClassDB::bind_method(D_METHOD("remove_bone_child", "bone_idx", "child_bone_idx"), &Skeleton3D::remove_bone_child);

ClassDB::bind_method(D_METHOD("get_parentless_bones"), &Skeleton3D::get_parentless_bones);

Expand Down

0 comments on commit b775f37

Please sign in to comment.