Repository: godotengine/godot
File: editor/editor_properties.cpp (C++)

Code before:
	}

	static const char *desc[4] = { "x", "y", "z", "d" };
	for (int i = 0; i < 4; i++) {
		spin[i] = memnew(EditorSpinSlider);
		spin[i]->set_flat(true);
		spin[i]->set_label(desc[i]);
		bc->add_child(spin[i]);
		add_focusable(spin[i]);
		spin[i]->connect("value_changed", callable_mp(this, &EditorPropertyPlane::_value_changed), varray(desc[i]));
		if (horizontal) {
			spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
		}
	}

	if (!horizontal) {
		set_label_reference(spin[0]); //show text and buttons around this
	}
	setting = false;
}

///////////////////// QUATERNION /////////////////////////

void EditorPropertyQuaternion::_value_changed(double val, const String &p_name) {
	if (setting) {
		return;
	}

	Quaternion p;
	p.x = spin[0]->get_value();
	p.y = spin[1]->get_value();
	p.z = spin[2]->get_value();
	p.w = spin[3]->get_value();
	emit_changed(get_edited_property(), p, p_name);
}

void EditorPropertyQuaternion::update_property() {
	Quaternion val = get_edited_object()->get(get_edited_property());
	setting = true;
	spin[0]->set_value(val.x);
	spin[1]->set_value(val.y);
	spin[2]->set_value(val.z);
	spin[3]->set_value(val.w);
	setting = false;
}

void EditorPropertyQuaternion::_notification(int p_what) {
	if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
		Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
		for (int i = 0; i < 3; i++) {
			Color c = base;

Review comment (suggestion):
Shouldn't we use `Array()`/`PackedStringArray()` instead of C-style arrays created with `new` and `delete`?

Alternatively, you can remove the editor setting since it's disabled by default. I wouldn't add an editor setting for something that doesn't have significant demand (i.e. don't future-proof settings).

Code after:

	if (!horizontal) {
		set_label_reference(spin[0]); //show text and buttons around this
	}
	setting = false;
}

///////////////////// QUATERNION /////////////////////////

void EditorPropertyQuaternion::_value_changed(double val, const String &p_name) {
	if (setting) {
		return;
	}

	Quaternion p;
	p.x = spin[0]->get_value();
	p.y = spin[1]->get_value();
	p.z = spin[2]->get_value();
	p.w = spin[3]->get_value();
	emit_changed(get_edited_property(), p, p_name);
}

void EditorPropertyQuaternion::update_property() {
	Quaternion val = get_edited_object()->get(get_edited_property());
	setting = true;
	spin[0]->set_value(val.x);
	spin[1]->set_value(val.y);
	spin[2]->set_value(val.z);
	spin[3]->set_value(val.w);
	setting = false;
}

void EditorPropertyQuaternion::_notification(int p_what) {
	if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
		const Color *colors = _get_property_colors();
		for (int i = 0; i < 4; i++) {
			spin[i]->set_custom_label_color(true, colors[i]);
		}
	}
}

void EditorPropertyQuaternion::_bind_methods() {
}

void EditorPropertyQuaternion::setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix) {
	for (int i = 0; i < 4; i++) {
		spin[i]->set_min(p_min);
		spin[i]->set_max(p_max);
		spin[i]->set_step(p_step);
		spin[i]->set_hide_slider(p_no_slider);
		spin[i]->set_allow_greater(true);