Преглед на файлове

Merge pull request #104167 from TokageItLab/spring-inside-tree

Add `is_inside_tree()` check to SpringBoneSimulator3D
Thaddeus Crews преди 4 месеца
родител
ревизия
6ef89f12bc
променени са 1 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. 10 0
      scene/3d/spring_bone_simulator_3d.cpp

+ 10 - 0
scene/3d/spring_bone_simulator_3d.cpp

@@ -1371,6 +1371,9 @@ void SpringBoneSimulator3D::_find_collisions() {
 }
 
 void SpringBoneSimulator3D::_process_collisions() {
+	if (!is_inside_tree()) {
+		return;
+	}
 	for (const ObjectID &oid : collisions) {
 		Object *t_obj = ObjectDB::get_instance(oid);
 		if (!t_obj) {
@@ -1494,6 +1497,10 @@ void SpringBoneSimulator3D::_set_active(bool p_active) {
 }
 
 void SpringBoneSimulator3D::_process_modification() {
+	if (!is_inside_tree()) {
+		return;
+	}
+
 	Skeleton3D *skeleton = get_skeleton();
 	if (!skeleton) {
 		return;
@@ -1515,6 +1522,9 @@ void SpringBoneSimulator3D::_process_modification() {
 }
 
 void SpringBoneSimulator3D::reset() {
+	if (!is_inside_tree()) {
+		return;
+	}
 	Skeleton3D *skeleton = get_skeleton();
 	if (!skeleton) {
 		return;