Clean up and fix issues after merging #21701 , closes #21104

This commit is contained in:
Juan Linietsky 2019-01-18 13:01:24 -03:00
parent 580bebda52
commit 541422a4a2
11 changed files with 71 additions and 62 deletions

View file

@ -80,6 +80,11 @@ Size2 EditorProperty::get_minimum_size() const {
return ms; return ms;
} }
void EditorProperty::emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field, bool p_changing) {
emit_signal("property_changed", p_property, p_value, p_field, p_changing);
}
void EditorProperty::_notification(int p_what) { void EditorProperty::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) { if (p_what == NOTIFICATION_SORT_CHILDREN) {
@ -634,7 +639,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("property_keyed", property, use_keying_next()); emit_signal("property_keyed", property, use_keying_next());
if (use_keying_next()) { if (use_keying_next()) {
call_deferred("emit_signal", "property_changed", property, object->get(property).operator int64_t() + 1); call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false);
call_deferred("update_property"); call_deferred("update_property");
} }
} }
@ -646,14 +651,14 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
Node *node = Object::cast_to<Node>(object); Node *node = Object::cast_to<Node>(object);
if (node && EditorPropertyRevert::may_node_be_in_instance(node) && EditorPropertyRevert::get_instanced_node_original_property(node, property, vorig)) { if (node && EditorPropertyRevert::may_node_be_in_instance(node) && EditorPropertyRevert::get_instanced_node_original_property(node, property, vorig)) {
emit_signal("property_changed", property, vorig.duplicate(true)); emit_changed(property, vorig.duplicate(true));
update_property(); update_property();
return; return;
} }
if (object->call("property_can_revert", property).operator bool()) { if (object->call("property_can_revert", property).operator bool()) {
Variant rev = object->call("property_get_revert", property); Variant rev = object->call("property_get_revert", property);
emit_signal("property_changed", property, rev); emit_changed(property, rev);
update_property(); update_property();
return; return;
} }
@ -662,7 +667,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
Ref<Script> scr = object->get_script(); Ref<Script> scr = object->get_script();
Variant orig_value; Variant orig_value;
if (scr->get_property_default_value(property, orig_value)) { if (scr->get_property_default_value(property, orig_value)) {
emit_signal("property_changed", property, orig_value); emit_changed(property, orig_value);
update_property(); update_property();
return; return;
} }
@ -670,7 +675,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
Variant default_value = ClassDB::class_get_default_property_value(object->get_class_name(), property); Variant default_value = ClassDB::class_get_default_property_value(object->get_class_name(), property);
if (default_value != Variant()) { if (default_value != Variant()) {
emit_signal("property_changed", property, default_value); emit_changed(property, default_value);
update_property(); update_property();
return; return;
} }
@ -792,6 +797,8 @@ void EditorProperty::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text); ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text);
ClassDB::bind_method(D_METHOD("emit_changed", "property", "value", "field", "changing"), &EditorProperty::emit_changed, DEFVAL(StringName()), DEFVAL(false));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checkable"), "set_checkable", "is_checkable"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checkable"), "set_checkable", "is_checkable");

View file

@ -102,6 +102,8 @@ protected:
void _gui_input(const Ref<InputEvent> &p_event); void _gui_input(const Ref<InputEvent> &p_event);
public: public:
void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false);
virtual Size2 get_minimum_size() const; virtual Size2 get_minimum_size() const;
void set_label(const String &p_label); void set_label(const String &p_label);

View file

@ -61,7 +61,7 @@ void EditorPropertyText::_text_changed(const String &p_string) {
if (updating) if (updating)
return; return;
emit_signal("property_changed", get_edited_property(), p_string, "", true); emit_changed(get_edited_property(), p_string, "", true);
} }
void EditorPropertyText::update_property() { void EditorPropertyText::update_property() {
@ -96,11 +96,11 @@ EditorPropertyText::EditorPropertyText() {
void EditorPropertyMultilineText::_big_text_changed() { void EditorPropertyMultilineText::_big_text_changed() {
text->set_text(big_text->get_text()); text->set_text(big_text->get_text());
emit_signal("property_changed", get_edited_property(), big_text->get_text(), "", true); emit_changed(get_edited_property(), big_text->get_text(), "", true);
} }
void EditorPropertyMultilineText::_text_changed() { void EditorPropertyMultilineText::_text_changed() {
emit_signal("property_changed", get_edited_property(), text->get_text(), "", true); emit_changed(get_edited_property(), text->get_text(), "", true);
} }
void EditorPropertyMultilineText::_open_big_text() { void EditorPropertyMultilineText::_open_big_text() {
@ -168,7 +168,7 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() {
void EditorPropertyTextEnum::_option_selected(int p_which) { void EditorPropertyTextEnum::_option_selected(int p_which) {
emit_signal("property_changed", get_edited_property(), options->get_item_text(p_which)); emit_changed(get_edited_property(), options->get_item_text(p_which));
} }
void EditorPropertyTextEnum::update_property() { void EditorPropertyTextEnum::update_property() {
@ -207,7 +207,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() {
void EditorPropertyPath::_path_selected(const String &p_path) { void EditorPropertyPath::_path_selected(const String &p_path) {
emit_signal("property_changed", get_edited_property(), p_path); emit_changed(get_edited_property(), p_path);
update_property(); update_property();
} }
void EditorPropertyPath::_path_pressed() { void EditorPropertyPath::_path_pressed() {
@ -327,7 +327,7 @@ void EditorPropertyClassName::_property_selected() {
void EditorPropertyClassName::_dialog_created() { void EditorPropertyClassName::_dialog_created() {
selected_type = dialog->get_selected_type(); selected_type = dialog->get_selected_type();
emit_signal("property_changed", get_edited_property(), selected_type); emit_changed(get_edited_property(), selected_type);
update_property(); update_property();
} }
@ -353,7 +353,7 @@ EditorPropertyClassName::EditorPropertyClassName() {
void EditorPropertyMember::_property_selected(const String &p_selected) { void EditorPropertyMember::_property_selected(const String &p_selected) {
emit_signal("property_changed", get_edited_property(), p_selected); emit_changed(get_edited_property(), p_selected);
update_property(); update_property();
} }
@ -457,7 +457,7 @@ EditorPropertyMember::EditorPropertyMember() {
///////////////////// CHECK ///////////////////////// ///////////////////// CHECK /////////////////////////
void EditorPropertyCheck::_checkbox_pressed() { void EditorPropertyCheck::_checkbox_pressed() {
emit_signal("property_changed", get_edited_property(), checkbox->is_pressed()); emit_changed(get_edited_property(), checkbox->is_pressed());
} }
void EditorPropertyCheck::update_property() { void EditorPropertyCheck::update_property() {
@ -484,7 +484,7 @@ EditorPropertyCheck::EditorPropertyCheck() {
void EditorPropertyEnum::_option_selected(int p_which) { void EditorPropertyEnum::_option_selected(int p_which) {
int val = options->get_item_metadata(p_which); int val = options->get_item_metadata(p_which);
emit_signal("property_changed", get_edited_property(), val); emit_changed(get_edited_property(), val);
} }
void EditorPropertyEnum::update_property() { void EditorPropertyEnum::update_property() {
@ -543,7 +543,7 @@ void EditorPropertyFlags::_flag_toggled() {
} }
} }
emit_signal("property_changed", get_edited_property(), value); emit_changed(get_edited_property(), value);
} }
void EditorPropertyFlags::update_property() { void EditorPropertyFlags::update_property() {
@ -691,7 +691,7 @@ public:
}; };
void EditorPropertyLayers::_grid_changed(uint32_t p_grid) { void EditorPropertyLayers::_grid_changed(uint32_t p_grid) {
emit_signal("property_changed", get_edited_property(), p_grid); emit_changed(get_edited_property(), p_grid);
} }
void EditorPropertyLayers::update_property() { void EditorPropertyLayers::update_property() {
@ -801,7 +801,7 @@ EditorPropertyLayers::EditorPropertyLayers() {
void EditorPropertyInteger::_value_changed(double val) { void EditorPropertyInteger::_value_changed(double val) {
if (setting) if (setting)
return; return;
emit_signal("property_changed", get_edited_property(), int(val)); emit_changed(get_edited_property(), int(val));
} }
void EditorPropertyInteger::update_property() { void EditorPropertyInteger::update_property() {
@ -878,7 +878,7 @@ void EditorPropertyFloat::_value_changed(double val) {
if (setting) if (setting)
return; return;
emit_signal("property_changed", get_edited_property(), val); emit_changed(get_edited_property(), val);
} }
void EditorPropertyFloat::update_property() { void EditorPropertyFloat::update_property() {
@ -948,7 +948,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
if (sg) if (sg)
val = -val; val = -val;
emit_signal("property_changed", get_edited_property(), val); emit_changed(get_edited_property(), val);
easing_draw->update(); easing_draw->update();
} }
} }
@ -999,7 +999,7 @@ void EditorPropertyEasing::update_property() {
void EditorPropertyEasing::_set_preset(int p_preset) { void EditorPropertyEasing::_set_preset(int p_preset) {
static const float preset_value[EASING_MAX] = { 0.0, 1.0, 2.0, 0.5, -2.0, -0.5 }; static const float preset_value[EASING_MAX] = { 0.0, 1.0, 2.0, 0.5, -2.0, -0.5 };
emit_signal("property_changed", get_edited_property(), preset_value[p_preset]); emit_changed(get_edited_property(), preset_value[p_preset]);
easing_draw->update(); easing_draw->update();
} }
@ -1063,7 +1063,7 @@ void EditorPropertyVector2::_value_changed(double val, const String &p_name) {
Vector2 v2; Vector2 v2;
v2.x = spin[0]->get_value(); v2.x = spin[0]->get_value();
v2.y = spin[1]->get_value(); v2.y = spin[1]->get_value();
emit_signal("property_changed", get_edited_property(), v2, p_name); emit_changed(get_edited_property(), v2, p_name);
} }
void EditorPropertyVector2::update_property() { void EditorPropertyVector2::update_property() {
@ -1146,7 +1146,7 @@ void EditorPropertyRect2::_value_changed(double val, const String &p_name) {
r2.position.y = spin[1]->get_value(); r2.position.y = spin[1]->get_value();
r2.size.x = spin[2]->get_value(); r2.size.x = spin[2]->get_value();
r2.size.y = spin[3]->get_value(); r2.size.y = spin[3]->get_value();
emit_signal("property_changed", get_edited_property(), r2, p_name); emit_changed(get_edited_property(), r2, p_name);
} }
void EditorPropertyRect2::update_property() { void EditorPropertyRect2::update_property() {
@ -1229,7 +1229,7 @@ void EditorPropertyVector3::_value_changed(double val, const String &p_name) {
v3.x = spin[0]->get_value(); v3.x = spin[0]->get_value();
v3.y = spin[1]->get_value(); v3.y = spin[1]->get_value();
v3.z = spin[2]->get_value(); v3.z = spin[2]->get_value();
emit_signal("property_changed", get_edited_property(), v3, p_name); emit_changed(get_edited_property(), v3, p_name);
} }
void EditorPropertyVector3::update_property() { void EditorPropertyVector3::update_property() {
@ -1310,7 +1310,7 @@ void EditorPropertyPlane::_value_changed(double val, const String &p_name) {
p.normal.y = spin[1]->get_value(); p.normal.y = spin[1]->get_value();
p.normal.z = spin[2]->get_value(); p.normal.z = spin[2]->get_value();
p.d = spin[3]->get_value(); p.d = spin[3]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyPlane::update_property() { void EditorPropertyPlane::update_property() {
@ -1394,7 +1394,7 @@ void EditorPropertyQuat::_value_changed(double val, const String &p_name) {
p.y = spin[1]->get_value(); p.y = spin[1]->get_value();
p.z = spin[2]->get_value(); p.z = spin[2]->get_value();
p.w = spin[3]->get_value(); p.w = spin[3]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyQuat::update_property() { void EditorPropertyQuat::update_property() {
@ -1480,7 +1480,7 @@ void EditorPropertyAABB::_value_changed(double val, const String &p_name) {
p.size.y = spin[4]->get_value(); p.size.y = spin[4]->get_value();
p.size.z = spin[5]->get_value(); p.size.z = spin[5]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyAABB::update_property() { void EditorPropertyAABB::update_property() {
@ -1556,7 +1556,7 @@ void EditorPropertyTransform2D::_value_changed(double val, const String &p_name)
p[2][0] = spin[4]->get_value(); p[2][0] = spin[4]->get_value();
p[2][1] = spin[5]->get_value(); p[2][1] = spin[5]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyTransform2D::update_property() { void EditorPropertyTransform2D::update_property() {
@ -1634,7 +1634,7 @@ void EditorPropertyBasis::_value_changed(double val, const String &p_name) {
p[1][2] = spin[7]->get_value(); p[1][2] = spin[7]->get_value();
p[2][2] = spin[8]->get_value(); p[2][2] = spin[8]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyBasis::update_property() { void EditorPropertyBasis::update_property() {
@ -1718,7 +1718,7 @@ void EditorPropertyTransform::_value_changed(double val, const String &p_name) {
p.origin[1] = spin[10]->get_value(); p.origin[1] = spin[10]->get_value();
p.origin[2] = spin[11]->get_value(); p.origin[2] = spin[11]->get_value();
emit_signal("property_changed", get_edited_property(), p, p_name); emit_changed(get_edited_property(), p, p_name);
} }
void EditorPropertyTransform::update_property() { void EditorPropertyTransform::update_property() {
@ -1789,12 +1789,12 @@ EditorPropertyTransform::EditorPropertyTransform() {
void EditorPropertyColor::_color_changed(const Color &p_color) { void EditorPropertyColor::_color_changed(const Color &p_color) {
emit_signal("property_changed", get_edited_property(), p_color, "", true); emit_changed(get_edited_property(), p_color, "", true);
} }
void EditorPropertyColor::_popup_closed() { void EditorPropertyColor::_popup_closed() {
emit_signal("property_changed", get_edited_property(), picker->get_pick_color(), "", false); emit_changed(get_edited_property(), picker->get_pick_color(), "", false);
} }
void EditorPropertyColor::_bind_methods() { void EditorPropertyColor::_bind_methods() {
@ -1855,7 +1855,7 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
if (base_node) { // for AnimationTrackKeyEdit if (base_node) { // for AnimationTrackKeyEdit
path = base_node->get_path().rel_path_to(p_path); path = base_node->get_path().rel_path_to(p_path);
} }
emit_signal("property_changed", get_edited_property(), path); emit_changed(get_edited_property(), path);
update_property(); update_property();
} }
@ -1872,7 +1872,7 @@ void EditorPropertyNodePath::_node_assign() {
void EditorPropertyNodePath::_node_clear() { void EditorPropertyNodePath::_node_clear() {
emit_signal("property_changed", get_edited_property(), NodePath()); emit_changed(get_edited_property(), NodePath());
update_property(); update_property();
} }
@ -2005,7 +2005,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) {
EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match any type expected for this property (%s)."), res->get_class(), property_types)); EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match any type expected for this property (%s)."), res->get_class(), property_types));
} }
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
} }
@ -2054,7 +2054,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
} break; } break;
case OBJ_MENU_CLEAR: { case OBJ_MENU_CLEAR: {
emit_signal("property_changed", get_edited_property(), RES()); emit_changed(get_edited_property(), RES());
update_property(); update_property();
} break; } break;
@ -2096,7 +2096,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
res->set(p.first, p.second); res->set(p.first, p.second);
} }
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
} break; } break;
@ -2117,7 +2117,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
case OBJ_MENU_PASTE: { case OBJ_MENU_PASTE: {
RES res = EditorSettings::get_singleton()->get_resource_clipboard(); RES res = EditorSettings::get_singleton()->get_resource_clipboard();
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
} break; } break;
@ -2151,7 +2151,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
Ref<Resource> new_res = conversions[to_type]->convert(res); Ref<Resource> new_res = conversions[to_type]->convert(res);
emit_signal("property_changed", get_edited_property(), new_res); emit_changed(get_edited_property(), new_res);
update_property(); update_property();
break; break;
} }
@ -2202,7 +2202,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
} }
res = Ref<Resource>(resp); res = Ref<Resource>(resp);
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
} break; } break;
@ -2585,7 +2585,7 @@ void EditorPropertyResource::_viewport_selected(const NodePath &p_path) {
vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node)); vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node));
vt->setup_local_to_scene(); vt->setup_local_to_scene();
emit_signal("property_changed", get_edited_property(), vt); emit_changed(get_edited_property(), vt);
update_property(); update_property();
} }
@ -2671,7 +2671,7 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
if (drag_data.has("type") && String(drag_data["type"]) == "resource") { if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
Ref<Resource> res = drag_data["resource"]; Ref<Resource> res = drag_data["resource"];
if (res.is_valid()) { if (res.is_valid()) {
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
return; return;
} }
@ -2685,7 +2685,7 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
String file = files[0]; String file = files[0];
RES res = ResourceLoader::load(file); RES res = ResourceLoader::load(file);
if (res.is_valid()) { if (res.is_valid()) {
emit_signal("property_changed", get_edited_property(), res); emit_changed(get_edited_property(), res);
update_property(); update_property();
return; return;
} }

View file

@ -165,13 +165,13 @@ EditorPropertyDictionaryObject::EditorPropertyDictionaryObject() {
///////////////////// ARRAY /////////////////////////// ///////////////////// ARRAY ///////////////////////////
void EditorPropertyArray::_property_changed(const String &p_prop, Variant p_value, bool changing) { void EditorPropertyArray::_property_changed(const String &p_prop, Variant p_value, const String &p_name, bool changing) {
if (p_prop.begins_with("indices")) { if (p_prop.begins_with("indices")) {
int idx = p_prop.get_slice("/", 1).to_int(); int idx = p_prop.get_slice("/", 1).to_int();
Variant array = object->get_array(); Variant array = object->get_array();
array.set(idx, p_value); array.set(idx, p_value);
emit_signal("property_changed", get_edited_property(), array, true); emit_changed(get_edited_property(), array, "", true);
if (array.get_type() == Variant::ARRAY) { if (array.get_type() == Variant::ARRAY) {
array = array.call("duplicate"); //dupe, so undo/redo works better array = array.call("duplicate"); //dupe, so undo/redo works better
@ -199,7 +199,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
Variant array = object->get_array(); Variant array = object->get_array();
array.set(changing_type_idx, value); array.set(changing_type_idx, value);
emit_signal("property_changed", get_edited_property(), array); emit_changed(get_edited_property(), array, "", true);
if (array.get_type() == Variant::ARRAY) { if (array.get_type() == Variant::ARRAY) {
array = array.call("duplicate"); //dupe, so undo/redo works better array = array.call("duplicate"); //dupe, so undo/redo works better
@ -419,7 +419,7 @@ void EditorPropertyArray::_length_changed(double p_page) {
Variant array = object->get_array(); Variant array = object->get_array();
array.call("resize", int(p_page)); array.call("resize", int(p_page));
emit_signal("property_changed", get_edited_property(), array); emit_changed(get_edited_property(), array, "", false);
if (array.get_type() == Variant::ARRAY) { if (array.get_type() == Variant::ARRAY) {
if (subtype != Variant::NIL) { if (subtype != Variant::NIL) {
@ -461,7 +461,7 @@ void EditorPropertyArray::_bind_methods() {
ClassDB::bind_method("_edit_pressed", &EditorPropertyArray::_edit_pressed); ClassDB::bind_method("_edit_pressed", &EditorPropertyArray::_edit_pressed);
ClassDB::bind_method("_page_changed", &EditorPropertyArray::_page_changed); ClassDB::bind_method("_page_changed", &EditorPropertyArray::_page_changed);
ClassDB::bind_method("_length_changed", &EditorPropertyArray::_length_changed); ClassDB::bind_method("_length_changed", &EditorPropertyArray::_length_changed);
ClassDB::bind_method("_property_changed", &EditorPropertyArray::_property_changed, DEFVAL(false)); ClassDB::bind_method("_property_changed", &EditorPropertyArray::_property_changed, DEFVAL(String()), DEFVAL(false));
ClassDB::bind_method("_change_type", &EditorPropertyArray::_change_type); ClassDB::bind_method("_change_type", &EditorPropertyArray::_change_type);
ClassDB::bind_method("_change_type_menu", &EditorPropertyArray::_change_type_menu); ClassDB::bind_method("_change_type_menu", &EditorPropertyArray::_change_type_menu);
ClassDB::bind_method("_object_id_selected", &EditorPropertyArray::_object_id_selected); ClassDB::bind_method("_object_id_selected", &EditorPropertyArray::_object_id_selected);
@ -501,7 +501,7 @@ EditorPropertyArray::EditorPropertyArray() {
///////////////////// DICTIONARY /////////////////////////// ///////////////////// DICTIONARY ///////////////////////////
void EditorPropertyDictionary::_property_changed(const String &p_prop, Variant p_value, bool changing) { void EditorPropertyDictionary::_property_changed(const String &p_prop, Variant p_value, const String &p_name, bool changing) {
if (p_prop == "new_item_key") { if (p_prop == "new_item_key") {
@ -515,7 +515,7 @@ void EditorPropertyDictionary::_property_changed(const String &p_prop, Variant p
Variant key = dict.get_key_at_index(idx); Variant key = dict.get_key_at_index(idx);
dict[key] = p_value; dict[key] = p_value;
emit_signal("property_changed", get_edited_property(), dict, true); emit_changed(get_edited_property(), dict, "", true);
dict = dict.duplicate(); //dupe, so undo/redo works better dict = dict.duplicate(); //dupe, so undo/redo works better
object->set_dict(dict); object->set_dict(dict);
@ -546,7 +546,7 @@ void EditorPropertyDictionary::_add_key_value() {
object->set_new_item_key(Variant()); object->set_new_item_key(Variant());
object->set_new_item_value(Variant()); object->set_new_item_value(Variant());
emit_signal("property_changed", get_edited_property(), dict); emit_changed(get_edited_property(), dict, "", false);
dict = dict.duplicate(); //dupe, so undo/redo works better dict = dict.duplicate(); //dupe, so undo/redo works better
object->set_dict(dict); object->set_dict(dict);
@ -582,7 +582,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
dict.erase(key); dict.erase(key);
} }
emit_signal("property_changed", get_edited_property(), dict); emit_changed(get_edited_property(), dict, "", false);
dict = dict.duplicate(); //dupe, so undo/redo works better dict = dict.duplicate(); //dupe, so undo/redo works better
object->set_dict(dict); object->set_dict(dict);
@ -957,7 +957,7 @@ void EditorPropertyDictionary::_page_changed(double p_page) {
void EditorPropertyDictionary::_bind_methods() { void EditorPropertyDictionary::_bind_methods() {
ClassDB::bind_method("_edit_pressed", &EditorPropertyDictionary::_edit_pressed); ClassDB::bind_method("_edit_pressed", &EditorPropertyDictionary::_edit_pressed);
ClassDB::bind_method("_page_changed", &EditorPropertyDictionary::_page_changed); ClassDB::bind_method("_page_changed", &EditorPropertyDictionary::_page_changed);
ClassDB::bind_method("_property_changed", &EditorPropertyDictionary::_property_changed, DEFVAL(false)); ClassDB::bind_method("_property_changed", &EditorPropertyDictionary::_property_changed, DEFVAL(String()), DEFVAL(false));
ClassDB::bind_method("_change_type", &EditorPropertyDictionary::_change_type); ClassDB::bind_method("_change_type", &EditorPropertyDictionary::_change_type);
ClassDB::bind_method("_change_type_menu", &EditorPropertyDictionary::_change_type_menu); ClassDB::bind_method("_change_type_menu", &EditorPropertyDictionary::_change_type_menu);
ClassDB::bind_method("_add_key_value", &EditorPropertyDictionary::_add_key_value); ClassDB::bind_method("_add_key_value", &EditorPropertyDictionary::_add_key_value);

View file

@ -100,7 +100,7 @@ class EditorPropertyArray : public EditorProperty {
void _page_changed(double p_page); void _page_changed(double p_page);
void _length_changed(double p_page); void _length_changed(double p_page);
void _edit_pressed(); void _edit_pressed();
void _property_changed(const String &p_prop, Variant p_value, bool changing = false); void _property_changed(const String &p_prop, Variant p_value, const String &p_name = String(), bool changing = false);
void _change_type(Object *p_button, int p_index); void _change_type(Object *p_button, int p_index);
void _change_type_menu(int p_index); void _change_type_menu(int p_index);
@ -134,7 +134,7 @@ class EditorPropertyDictionary : public EditorProperty {
void _page_changed(double p_page); void _page_changed(double p_page);
void _edit_pressed(); void _edit_pressed();
void _property_changed(const String &p_prop, Variant p_value, bool changing = false); void _property_changed(const String &p_prop, Variant p_value, const String &p_name = String(), bool changing = false);
void _change_type(Object *p_button, int p_index); void _change_type(Object *p_button, int p_index);
void _change_type_menu(int p_index); void _change_type_menu(int p_index);

View file

@ -87,7 +87,7 @@ Size2 AnimationNodeBlendTreeEditor::get_minimum_size() const {
return Size2(10, 200); return Size2(10, 200);
} }
void AnimationNodeBlendTreeEditor::_property_changed(const StringName &p_property, const Variant &p_value) { void AnimationNodeBlendTreeEditor::_property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_tree(); AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_tree();
updating = true; updating = true;

View file

@ -104,7 +104,7 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
void _filter_toggled(); void _filter_toggled();
Ref<AnimationNode> _filter_edit; Ref<AnimationNode> _filter_edit;
void _property_changed(const StringName &p_property, const Variant &p_value); void _property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing);
void _removed_from_graph(); void _removed_from_graph();
EditorFileDialog *open_file; EditorFileDialog *open_file;

View file

@ -39,7 +39,7 @@ void EditorPropertyRootMotion::_confirmed() {
return; return;
NodePath path = ti->get_metadata(0); NodePath path = ti->get_metadata(0);
emit_signal("property_changed", get_edited_property(), path); emit_changed(get_edited_property(), path);
update_property(); update_property();
filter_dialog->hide(); //may come from activated filter_dialog->hide(); //may come from activated
} }
@ -195,7 +195,7 @@ void EditorPropertyRootMotion::_node_assign() {
void EditorPropertyRootMotion::_node_clear() { void EditorPropertyRootMotion::_node_clear() {
emit_signal("property_changed", get_edited_property(), NodePath()); emit_changed(get_edited_property(), NodePath());
update_property(); update_property();
} }

View file

@ -964,7 +964,7 @@ public:
class VisualShaderNodePluginDefaultEditor : public VBoxContainer { class VisualShaderNodePluginDefaultEditor : public VBoxContainer {
GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer) GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer)
public: public:
void _property_changed(const String &prop, const Variant &p_value, bool p_changing = false) { void _property_changed(const String &prop, const Variant &p_value, const String &p_field, bool p_changing = false) {
if (p_changing) if (p_changing)
return; return;
@ -1014,7 +1014,7 @@ public:
} }
static void _bind_methods() { static void _bind_methods() {
ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed, DEFVAL(false)); ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed, DEFVAL(String()), DEFVAL(false));
ClassDB::bind_method("_node_changed", &VisualShaderNodePluginDefaultEditor::_node_changed); ClassDB::bind_method("_node_changed", &VisualShaderNodePluginDefaultEditor::_node_changed);
ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request); ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request);
} }

View file

@ -512,7 +512,7 @@ Ref<EditorExportPreset> ProjectExportDialog::get_current_preset() const {
return EditorExport::get_singleton()->get_export_preset(presets->get_current()); return EditorExport::get_singleton()->get_export_preset(presets->get_current());
} }
void ProjectExportDialog::_export_path_changed(const StringName &p_property, const Variant &p_value) { void ProjectExportDialog::_export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
if (updating) if (updating)
return; return;

View file

@ -115,7 +115,7 @@ private:
void _runnable_pressed(); void _runnable_pressed();
void _update_parameters(const String &p_edited_property); void _update_parameters(const String &p_edited_property);
void _name_changed(const String &p_string); void _name_changed(const String &p_string);
void _export_path_changed(const StringName &p_property, const Variant &p_value); void _export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing);
void _add_preset(int p_platform); void _add_preset(int p_platform);
void _edit_preset(int p_index); void _edit_preset(int p_index);
void _duplicate_preset(); void _duplicate_preset();