summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/collision_polygon_2d.cpp2
-rw-r--r--scene/2d/collision_shape_2d.cpp2
-rw-r--r--scene/2d/node_2d.cpp22
-rw-r--r--scene/2d/node_2d.h6
-rw-r--r--scene/2d/tile_map.cpp2
-rw-r--r--scene/3d/skeleton.cpp4
-rw-r--r--scene/gui/color_picker.cpp1
-rw-r--r--scene/gui/rich_text_label.cpp10
-rw-r--r--scene/gui/text_edit.cpp24
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/resources/environment.cpp2
11 files changed, 43 insertions, 34 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index e46bf3c77d..8c6b25f296 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -131,7 +131,7 @@ void CollisionPolygon2D::_notification(int p_what) {
/*if (Engine::get_singleton()->is_editor_hint()) {
//display above all else
set_z_as_relative(false);
- set_z(VS::CANVAS_ITEM_Z_MAX - 1);
+ set_z_index(VS::CANVAS_ITEM_Z_MAX - 1);
}*/
} break;
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 135ede829d..1956e23421 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -64,7 +64,7 @@ void CollisionShape2D::_notification(int p_what) {
/*if (Engine::get_singleton()->is_editor_hint()) {
//display above all else
set_z_as_relative(false);
- set_z(VS::CANVAS_ITEM_Z_MAX - 1);
+ set_z_index(VS::CANVAS_ITEM_Z_MAX - 1);
}*/
} break;
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 2a305512af..e133f86ef7 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -329,13 +329,13 @@ void Node2D::set_global_transform(const Transform2D &p_transform) {
set_transform(p_transform);
}
-void Node2D::set_z(int p_z) {
+void Node2D::set_z_index(int p_z) {
ERR_FAIL_COND(p_z < VS::CANVAS_ITEM_Z_MIN);
ERR_FAIL_COND(p_z > VS::CANVAS_ITEM_Z_MAX);
- z = p_z;
- VS::get_singleton()->canvas_item_set_z(get_canvas_item(), z);
- _change_notify("z");
+ z_index = p_z;
+ VS::get_singleton()->canvas_item_set_z_index(get_canvas_item(), z_index);
+ _change_notify("z_index");
}
void Node2D::set_z_as_relative(bool p_enabled) {
@@ -351,9 +351,9 @@ bool Node2D::is_z_relative() const {
return z_relative;
}
-int Node2D::get_z() const {
+int Node2D::get_z_index() const {
- return z;
+ return z_index;
}
Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const {
@@ -427,8 +427,8 @@ void Node2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Node2D::to_local);
ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Node2D::to_global);
- ClassDB::bind_method(D_METHOD("set_z", "z"), &Node2D::set_z);
- ClassDB::bind_method(D_METHOD("get_z"), &Node2D::get_z);
+ ClassDB::bind_method(D_METHOD("set_z_index", "z_index"), &Node2D::set_z_index);
+ ClassDB::bind_method(D_METHOD("get_z_index"), &Node2D::get_z_index);
ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative);
ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative);
@@ -448,8 +448,8 @@ void Node2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_scale", PROPERTY_HINT_NONE, "", 0), "set_global_scale", "get_global_scale");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform");
- ADD_GROUP("Z", "");
- ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "z", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z", "get_z");
+ ADD_GROUP("Z Index", "");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative");
}
@@ -458,6 +458,6 @@ Node2D::Node2D() {
angle = 0;
_scale = Vector2(1, 1);
_xform_dirty = false;
- z = 0;
+ z_index = 0;
z_relative = true;
}
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index 7d2e5aa00c..321021a748 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -39,7 +39,7 @@ class Node2D : public CanvasItem {
Point2 pos;
float angle;
Size2 _scale;
- int z;
+ int z_index;
bool z_relative;
Transform2D _mat;
@@ -96,8 +96,8 @@ public:
void set_global_rotation_degrees(float p_degrees);
void set_global_scale(const Size2 &p_scale);
- void set_z(int p_z);
- int get_z() const;
+ void set_z_index(int p_z);
+ int get_z_index() const;
void look_at(const Vector2 &p_pos);
float get_angle_to(const Vector2 &p_pos) const;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 73fce4be75..8bd5676bc7 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -336,7 +336,7 @@ void TileMap::_update_dirty_quadrants() {
debug_canvas_item = vs->canvas_item_create();
vs->canvas_item_set_parent(debug_canvas_item, canvas_item);
vs->canvas_item_set_z_as_relative_to_parent(debug_canvas_item, false);
- vs->canvas_item_set_z(debug_canvas_item, VS::CANVAS_ITEM_Z_MAX - 1);
+ vs->canvas_item_set_z_index(debug_canvas_item, VS::CANVAS_ITEM_Z_MAX - 1);
q.canvas_items.push_back(debug_canvas_item);
prev_debug_canvas_item = debug_canvas_item;
}
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index ef60a2151d..aaa378bb68 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -160,14 +160,14 @@ void Skeleton::_notification(int p_what) {
//if moved, just update transforms
VisualServer *vs = VisualServer::get_singleton();
- Bone *bonesptr = &bones[0];
+ const Bone *bonesptr = bones.ptr();
int len = bones.size();
Transform global_transform = get_global_transform();
Transform global_transform_inverse = global_transform.affine_inverse();
for (int i = 0; i < len; i++) {
- Bone &b = bonesptr[i];
+ const Bone &b = bonesptr[i];
vs->skeleton_bone_set_transform(skeleton, i, global_transform * (b.transform_final * global_transform_inverse));
}
} break;
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 95298f5a18..63478886c6 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -209,6 +209,7 @@ Color ColorPicker::get_pick_color() const {
}
void ColorPicker::add_preset(const Color &p_color) {
+
if (presets.find(p_color)) {
presets.move_to_back(presets.find(p_color));
} else {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 4f2cfccd4a..37c7c34432 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -451,6 +451,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
table->columns[i].width = 0;
}
//compute minimum width for each cell
+ const int available_width = p_width - hseparation * (table->columns.size() - 1) - wofs;
+
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
ERR_CONTINUE(E->get()->type != ITEM_FRAME); //children should all be frames
ItemFrame *frame = static_cast<ItemFrame *>(E->get());
@@ -461,7 +463,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
for (int i = 0; i < frame->lines.size(); i++) {
- _process_line(frame, Point2(), ly, p_width, i, PROCESS_CACHE, cfont, Color());
+ _process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color());
table->columns[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].minimum_width);
}
idx++;
@@ -470,11 +472,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
//compute available width and total ratio (for expanders)
int total_ratio = 0;
- int available_width = p_width - hseparation * (table->columns.size() - 1);
+ int remaining_width = available_width;
table->total_width = hseparation;
for (int i = 0; i < table->columns.size(); i++) {
- available_width -= table->columns[i].min_width;
+ remaining_width -= table->columns[i].min_width;
if (table->columns[i].expand)
total_ratio += table->columns[i].expand_ratio;
}
@@ -484,7 +486,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
for (int i = 0; i < table->columns.size(); i++) {
table->columns[i].width = table->columns[i].min_width;
if (table->columns[i].expand)
- table->columns[i].width += table->columns[i].expand_ratio * available_width / total_ratio;
+ table->columns[i].width += table->columns[i].expand_ratio * remaining_width / total_ratio;
table->total_width += table->columns[i].width + hseparation;
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 5fbc0c9064..87043c65eb 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1498,7 +1498,7 @@ void TextEdit::_notification(int p_what) {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect());
if (raised_from_completion) {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1);
}
} break;
@@ -1512,7 +1512,7 @@ void TextEdit::_notification(int p_what) {
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->hide_virtual_keyboard();
if (raised_from_completion) {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0);
}
} break;
}
@@ -1822,10 +1822,18 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->is_pressed()) {
if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) {
- _scroll_up(3 * mb->get_factor());
+ if (mb->get_shift()) {
+ h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
+ } else {
+ _scroll_up(3 * mb->get_factor());
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) {
- _scroll_down(3 * mb->get_factor());
+ if (mb->get_shift()) {
+ h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor()));
+ } else {
+ _scroll_down(3 * mb->get_factor());
+ }
}
if (mb->get_button_index() == BUTTON_WHEEL_LEFT) {
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
@@ -5054,7 +5062,7 @@ void TextEdit::_confirm_completion() {
void TextEdit::_cancel_code_hint() {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0);
raised_from_completion = false;
completion_hint = "";
update();
@@ -5062,7 +5070,7 @@ void TextEdit::_cancel_code_hint() {
void TextEdit::_cancel_completion() {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0);
raised_from_completion = false;
if (!completion_active)
return;
@@ -5237,7 +5245,7 @@ void TextEdit::query_code_comple() {
void TextEdit::set_code_hint(const String &p_hint) {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1);
raised_from_completion = true;
completion_hint = p_hint;
completion_hint_offset = -0xFFFF;
@@ -5246,7 +5254,7 @@ void TextEdit::set_code_hint(const String &p_hint) {
void TextEdit::code_complete(const Vector<String> &p_strings, bool p_forced) {
- VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1);
+ VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1);
raised_from_completion = true;
completion_strings = p_strings;
completion_active = true;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 696649f463..b1a421c24f 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2368,8 +2368,6 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
last_keypress = 0;
}
} break;
-
- last_keypress = 0;
}
}
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 6216893667..b2c91f90eb 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1218,7 +1218,7 @@ Environment::Environment() {
ssao_radius2 = 0;
ssao_intensity2 = 1;
ssao_bias = 0.01;
- ssao_direct_light_affect = false;
+ ssao_direct_light_affect = 0.0;
ssao_blur = SSAO_BLUR_3x3;
set_ssao_edge_sharpness(4);
set_ssao_quality(SSAO_QUALITY_LOW);