Repository: godotengine/godot
File: scene/3d/soft_body_3d.cpp (C++)

Code before:
		p_list->push_back(PropertyInfo(Variant::NODE_PATH, prefix + PNAME("spatial_attachment_path")));
		p_list->push_back(PropertyInfo(Variant::VECTOR3, prefix + PNAME("offset")));
	}
}

bool SoftBody3D::_set_property_pinned_points_indices(const Array &p_indices) {
	const int p_indices_size = p_indices.size();

	{ // Remove the pined points on physics server that will be removed by resize
		const PinnedPoint *r = pinned_points.ptr();
		if (p_indices_size < pinned_points.size()) {
			for (int i = pinned_points.size() - 1; i >= p_indices_size; --i) {
				pin_point(r[i].point_index, false);
			}
		}
	}

	pinned_points.resize(p_indices_size);

	PinnedPoint *w = pinned_points.ptrw();
	int point_index;
	for (int i = 0; i < p_indices_size; ++i) {
		point_index = p_indices.get(i);
		if (w[i].point_index != point_index) {
			if (-1 != w[i].point_index) {
				pin_point(w[i].point_index, false);
			}
			w[i].point_index = point_index;
			pin_point(w[i].point_index, true);
		}
	}
	return true;
}

bool SoftBody3D::_set_property_pinned_points_attachment(int p_item, const String &p_what, const Variant &p_value) {
	if (pinned_points.size() <= p_item) {
		return false;
	}

	if ("spatial_attachment_path" == p_what) {
		PinnedPoint *w = pinned_points.ptrw();

		if (is_inside_tree()) {
			callable_mp(this, &SoftBody3D::_pin_point_deferred).call_deferred(Variant(w[p_item].point_index), true, p_value);
		} else {
			pin_point(w[p_item].point_index, true, p_value);
			_make_cache_dirty();
		}
	} else if ("offset" == p_what) {
		PinnedPoint *w = pinned_points.ptrw();
		w[p_item].offset = p_value;

Review comment (suggestion):
```suggestion
			if (w[i].point_index != -1 && p_indices.find(w[i].point_index) == -1) {
```
Let's fix this weird syntax while we're here 

Code after:
		p_list->push_back(PropertyInfo(Variant::INT, prefix + PNAME("point_index")));
		p_list->push_back(PropertyInfo(Variant::NODE_PATH, prefix + PNAME("spatial_attachment_path")));
		p_list->push_back(PropertyInfo(Variant::VECTOR3, prefix + PNAME("offset")));
	}
}

bool SoftBody3D::_set_property_pinned_points_indices(const Array &p_indices) {
	const int p_indices_size = p_indices.size();

	{ // Remove the pined points on physics server that will be removed by resize
		const PinnedPoint *r = pinned_points.ptr();
		if (p_indices_size < pinned_points.size()) {
			for (int i = pinned_points.size() - 1; i >= p_indices_size; --i) {
				pin_point(r[i].point_index, false);
			}
		}
	}

	pinned_points.resize(p_indices_size);

	PinnedPoint *w = pinned_points.ptrw();
	int point_index;
	for (int i = 0; i < p_indices_size; ++i) {
		point_index = p_indices.get(i);
		if (w[i].point_index != point_index || pinned_points.size() < p_indices_size) {
			bool insert = false;
			if (w[i].point_index != -1 && p_indices.find(w[i].point_index) == -1) {
				pin_point(w[i].point_index, false);
				insert = true;
			}
			w[i].point_index = point_index;
			if (insert) {
				pin_point(w[i].point_index, true, NodePath(), i);
			} else {
				pin_point(w[i].point_index, true);
			}
		}
	}
	return true;
}

bool SoftBody3D::_set_property_pinned_points_attachment(int p_item, const String &p_what, const Variant &p_value) {
	if (pinned_points.size() <= p_item) {
		return false;
	}

	if ("spatial_attachment_path" == p_what) {
		PinnedPoint *w = pinned_points.ptrw();

		if (is_inside_tree()) {
			callable_mp(this, &SoftBody3D::_pin_point_deferred).call_deferred(Variant(w[p_item].point_index), true, p_value);