| 1172 | } |
| 1173 | |
| 1174 | void Skeleton3D::_process_modifiers() { |
| 1175 | for (const ObjectID &oid : modifiers) { |
| 1176 | Object *t_obj = ObjectDB::get_instance(oid); |
| 1177 | if (!t_obj) { |
| 1178 | continue; |
| 1179 | } |
| 1180 | SkeletonModifier3D *mod = cast_to<SkeletonModifier3D>(t_obj); |
| 1181 | if (!mod) { |
| 1182 | continue; |
| 1183 | } |
| 1184 | #ifdef TOOLS_ENABLED |
| 1185 | if (saving && !mod->is_processed_on_saving()) { |
| 1186 | continue; |
| 1187 | } |
| 1188 | #endif // TOOLS_ENABLED |
| 1189 | real_t influence = mod->get_influence(); |
| 1190 | if (influence < 1.0) { |
| 1191 | LocalVector<Transform3D> old_poses; |
| 1192 | for (int i = 0; i < get_bone_count(); i++) { |
| 1193 | old_poses.push_back(get_bone_pose(i)); |
| 1194 | } |
| 1195 | mod->process_modification(update_delta); |
| 1196 | LocalVector<Transform3D> new_poses; |
| 1197 | for (int i = 0; i < get_bone_count(); i++) { |
| 1198 | new_poses.push_back(get_bone_pose(i)); |
| 1199 | } |
| 1200 | for (int i = 0; i < get_bone_count(); i++) { |
| 1201 | if (old_poses[i] == new_poses[i]) { |
| 1202 | continue; // Avoid unneeded calculation. |
| 1203 | } |
| 1204 | set_bone_pose(i, old_poses[i].interpolate_with(new_poses[i], influence)); |
| 1205 | } |
| 1206 | } else { |
| 1207 | mod->process_modification(update_delta); |
| 1208 | } |
| 1209 | force_update_all_dirty_bones(); |
| 1210 | } |
| 1211 | update_delta = 0; // Reset accumulated delta. |
| 1212 | } |
| 1213 | |
| 1214 | void Skeleton3D::add_child_notify(Node *p_child) { |
| 1215 | if (Object::cast_to<SkeletonModifier3D>(p_child)) { |
nothing calls this directly
no test coverage detected