Fix capsule height/radius setters with linked properties

Capsule height and radius setters can modify each other, rather than
using clamping, to avoid cases where values are not set correctly when
loading a scene (depending on the order of properties).

Inspector undo/redo:
Added the possibility to link properties together in the editor, so
they can be undone together, for cases where a property can modify
another one.

Gizmo undo/redo:
Capsule handles pass both radius and height values so they can be undone
together.
This commit is contained in:
PouleyKetchoupp 2021-08-12 11:26:47 -07:00
parent 93dac1c7db
commit 645bc94bfc
8 changed files with 55 additions and 24 deletions

View file

@ -2243,6 +2243,13 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
undo_redo->add_do_property(object, p_name, p_value);
undo_redo->add_undo_property(object, p_name, object->get(p_name));
PropertyInfo prop_info;
if (ClassDB::get_property_info(object->get_class_name(), p_name, &prop_info)) {
for (const String &linked_prop : prop_info.linked_properties) {
undo_redo->add_undo_property(object, linked_prop, object->get(linked_prop));
}
}
Variant v_undo_redo = (Object *)undo_redo;
Variant v_object = object;
Variant v_name = p_name;