summaryrefslogtreecommitdiff
path: root/editor/editor_properties.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r--editor/editor_properties.cpp72
1 files changed, 24 insertions, 48 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index e5d64c41bb..c3fd46c511 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -167,8 +167,7 @@ void EditorPropertyMultilineText::update_property() {
void EditorPropertyMultilineText::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_THEME_CHANGED:
- case NOTIFICATION_ENTER_TREE: {
+ case NOTIFICATION_THEME_CHANGED: {
Ref<Texture2D> df = get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons"));
open_big_text->set_icon(df);
@@ -322,7 +321,6 @@ void EditorPropertyTextEnum::_bind_methods() {
void EditorPropertyTextEnum::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons")));
@@ -396,7 +394,7 @@ void EditorPropertyLocale::_locale_pressed() {
void EditorPropertyLocale::update_property() {
String locale_code = get_edited_object()->get(get_edited_property());
locale->set_text(locale_code);
- locale->set_tooltip(locale_code);
+ locale->set_tooltip_text(locale_code);
}
void EditorPropertyLocale::setup(const String &p_hint_text) {
@@ -404,7 +402,6 @@ void EditorPropertyLocale::setup(const String &p_hint_text) {
void EditorPropertyLocale::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons")));
} break;
@@ -485,7 +482,7 @@ void EditorPropertyPath::_path_pressed() {
void EditorPropertyPath::update_property() {
String full_path = get_edited_object()->get(get_edited_property());
path->set_text(full_path);
- path->set_tooltip(full_path);
+ path->set_tooltip_text(full_path);
}
void EditorPropertyPath::setup(const Vector<String> &p_extensions, bool p_folder, bool p_global) {
@@ -500,7 +497,6 @@ void EditorPropertyPath::set_save_mode() {
void EditorPropertyPath::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
} break;
@@ -1153,7 +1149,6 @@ void EditorPropertyLayersGrid::_bind_methods() {
void EditorPropertyLayers::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
button->set_normal_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
button->set_pressed_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
@@ -1462,7 +1457,7 @@ void EditorPropertyFloat::_value_changed(double val) {
}
if (angle_in_radians) {
- val = Math::deg2rad(val);
+ val = Math::deg_to_rad(val);
}
emit_changed(get_edited_property(), val);
}
@@ -1470,7 +1465,7 @@ void EditorPropertyFloat::_value_changed(double val) {
void EditorPropertyFloat::update_property() {
double val = get_edited_object()->get(get_edited_property());
if (angle_in_radians) {
- val = Math::rad2deg(val);
+ val = Math::rad_to_deg(val);
}
setting = true;
spin->set_value(val);
@@ -1677,8 +1672,7 @@ void EditorPropertyEasing::setup(bool p_positive_only, bool p_flip) {
void EditorPropertyEasing::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_THEME_CHANGED:
- case NOTIFICATION_ENTER_TREE: {
+ case NOTIFICATION_THEME_CHANGED: {
preset->clear();
preset->add_icon_item(get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons")), "Linear", EASING_LINEAR);
preset->add_icon_item(get_theme_icon(SNAME("CurveIn"), SNAME("EditorIcons")), "Ease In", EASING_IN);
@@ -1775,7 +1769,6 @@ void EditorPropertyVector2::_update_ratio() {
void EditorPropertyVector2::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
@@ -1885,7 +1878,6 @@ void EditorPropertyRect2::update_property() {
void EditorPropertyRect2::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -1992,9 +1984,9 @@ void EditorPropertyVector3::_value_changed(double val, const String &p_name) {
v3.y = spin[1]->get_value();
v3.z = spin[2]->get_value();
if (angle_in_radians) {
- v3.x = Math::deg2rad(v3.x);
- v3.y = Math::deg2rad(v3.y);
- v3.z = Math::deg2rad(v3.z);
+ v3.x = Math::deg_to_rad(v3.x);
+ v3.y = Math::deg_to_rad(v3.y);
+ v3.z = Math::deg_to_rad(v3.z);
}
emit_changed(get_edited_property(), v3, p_name);
}
@@ -2026,9 +2018,9 @@ void EditorPropertyVector3::_update_ratio() {
void EditorPropertyVector3::update_using_vector(Vector3 p_vector) {
if (angle_in_radians) {
- p_vector.x = Math::rad2deg(p_vector.x);
- p_vector.y = Math::rad2deg(p_vector.y);
- p_vector.z = Math::rad2deg(p_vector.z);
+ p_vector.x = Math::rad_to_deg(p_vector.x);
+ p_vector.y = Math::rad_to_deg(p_vector.y);
+ p_vector.z = Math::rad_to_deg(p_vector.z);
}
setting = true;
spin[0]->set_value(p_vector.x);
@@ -2043,9 +2035,9 @@ Vector3 EditorPropertyVector3::get_vector() {
v3.y = spin[1]->get_value();
v3.z = spin[2]->get_value();
if (angle_in_radians) {
- v3.x = Math::deg2rad(v3.x);
- v3.y = Math::deg2rad(v3.y);
- v3.z = Math::deg2rad(v3.z);
+ v3.x = Math::deg_to_rad(v3.x);
+ v3.y = Math::deg_to_rad(v3.y);
+ v3.z = Math::deg_to_rad(v3.z);
}
return v3;
@@ -2053,7 +2045,6 @@ Vector3 EditorPropertyVector3::get_vector() {
void EditorPropertyVector3::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
@@ -2188,7 +2179,6 @@ void EditorPropertyVector2i::_update_ratio() {
void EditorPropertyVector2i::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
@@ -2298,7 +2288,6 @@ void EditorPropertyRect2i::update_property() {
void EditorPropertyRect2i::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -2439,7 +2428,6 @@ void EditorPropertyVector3i::_update_ratio() {
void EditorPropertyVector3i::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons")));
linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")));
@@ -2551,7 +2539,6 @@ void EditorPropertyPlane::update_property() {
void EditorPropertyPlane::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -2647,9 +2634,9 @@ void EditorPropertyQuaternion::_custom_value_changed(double val) {
edit_euler.z = euler[2]->get_value();
Vector3 v;
- v.x = Math::deg2rad(edit_euler.x);
- v.y = Math::deg2rad(edit_euler.y);
- v.z = Math::deg2rad(edit_euler.z);
+ v.x = Math::deg_to_rad(edit_euler.x);
+ v.y = Math::deg_to_rad(edit_euler.y);
+ v.z = Math::deg_to_rad(edit_euler.z);
Quaternion temp_q = Quaternion(v);
spin[0]->set_value(temp_q.x);
@@ -2689,9 +2676,9 @@ void EditorPropertyQuaternion::update_property() {
spin[3]->set_value(val.w);
if (!is_grabbing_euler()) {
Vector3 v = val.normalized().get_euler_yxz();
- edit_euler.x = Math::rad2deg(v.x);
- edit_euler.y = Math::rad2deg(v.y);
- edit_euler.z = Math::rad2deg(v.z);
+ edit_euler.x = Math::rad_to_deg(v.x);
+ edit_euler.y = Math::rad_to_deg(v.y);
+ edit_euler.z = Math::rad_to_deg(v.z);
euler[0]->set_value(edit_euler.x);
euler[1]->set_value(edit_euler.y);
euler[2]->set_value(edit_euler.z);
@@ -2705,7 +2692,6 @@ void EditorPropertyQuaternion::_warning_pressed() {
void EditorPropertyQuaternion::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -2860,7 +2846,6 @@ void EditorPropertyVector4::update_property() {
void EditorPropertyVector4::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -2952,7 +2937,6 @@ void EditorPropertyVector4i::update_property() {
void EditorPropertyVector4i::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
@@ -3047,7 +3031,6 @@ void EditorPropertyAABB::update_property() {
void EditorPropertyAABB::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
@@ -3130,7 +3113,6 @@ void EditorPropertyTransform2D::update_property() {
void EditorPropertyTransform2D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
@@ -3227,7 +3209,6 @@ void EditorPropertyBasis::update_property() {
void EditorPropertyBasis::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 9; i++) {
@@ -3325,7 +3306,6 @@ void EditorPropertyTransform3D::update_using_transform(Transform3D p_transform)
void EditorPropertyTransform3D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 12; i++) {
@@ -3431,7 +3411,6 @@ void EditorPropertyProjection::update_using_transform(Projection p_transform) {
void EditorPropertyProjection::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 16; i++) {
@@ -3502,7 +3481,6 @@ void EditorPropertyColor::_picker_opening() {
void EditorPropertyColor::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
picker->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor"))));
} break;
@@ -3515,14 +3493,14 @@ void EditorPropertyColor::update_property() {
// Add a tooltip to display each channel's values without having to click the ColorPickerButton
if (picker->is_editing_alpha()) {
- picker->set_tooltip(vformat(
+ picker->set_tooltip_text(vformat(
"R: %s\nG: %s\nB: %s\nA: %s",
rtos(color.r).pad_decimals(2),
rtos(color.g).pad_decimals(2),
rtos(color.b).pad_decimals(2),
rtos(color.a).pad_decimals(2)));
} else {
- picker->set_tooltip(vformat(
+ picker->set_tooltip_text(vformat(
"R: %s\nG: %s\nB: %s",
rtos(color.r).pad_decimals(2),
rtos(color.g).pad_decimals(2),
@@ -3680,7 +3658,7 @@ void EditorPropertyNodePath::update_property() {
p = get_edited_object()->get(get_edited_property());
}
- assign->set_tooltip(p);
+ assign->set_tooltip_text(p);
if (p == NodePath()) {
assign->set_icon(Ref<Texture2D>());
assign->set_text(TTR("Assign..."));
@@ -3726,7 +3704,6 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam
void EditorPropertyNodePath::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"));
clear->set_icon(t);
@@ -4138,7 +4115,6 @@ void EditorPropertyResource::set_use_sub_inspector(bool p_enable) {
void EditorPropertyResource::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
if (!updating_theme) {
_update_property_bg();