summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/portal.h3
-rw-r--r--scene/3d/room_instance.h2
-rw-r--r--scene/3d/voxel_light_baker.cpp21
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/line_edit.cpp33
-rw-r--r--scene/gui/line_edit.h5
-rw-r--r--scene/gui/text_edit.cpp10
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/resources/mesh.cpp7
-rw-r--r--scene/resources/room.h2
10 files changed, 29 insertions, 58 deletions
diff --git a/scene/3d/portal.h b/scene/3d/portal.h
index 4ea208a718..a3a7956286 100644
--- a/scene/3d/portal.h
+++ b/scene/3d/portal.h
@@ -39,7 +39,8 @@
If a portal is placed next (very close to) a similar, opposing portal, they automatically connect,
otherwise, a portal connects to the parent room
*/
-//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos
+// FIXME: This will be redone and replaced by area portals, left for reference
+// since a new class with this name will have to exist and want to reuse the gizmos
#if 0
class Portal : public VisualInstance {
diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h
index 3069ea2eba..2b2f80a0c6 100644
--- a/scene/3d/room_instance.h
+++ b/scene/3d/room_instance.h
@@ -44,7 +44,7 @@
*/
-//this will be removed, left for reference
+// FIXME: this will be removed, left for reference
#if 0
class Room : public VisualInstance {
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 032bccf1d3..39ff6fa35e 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -897,17 +897,7 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
-#if 0
- if (light_cache.type == VS::LIGHT_SPOT) {
-
- float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
- if (angle > light_cache.spot_angle)
- continue;
- float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
- att *= powf(1.0 - d, light_cache.spot_attenuation);
- }
-#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@@ -1041,17 +1031,7 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
-#if 0
- if (light_cache.type == VS::LIGHT_SPOT) {
-
- float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
- if (angle > light_cache.spot_angle)
- continue;
- float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
- att *= powf(1.0 - d, light_cache.spot_attenuation);
- }
-#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@@ -2016,6 +1996,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
}
}
+// Enable for debugging
#if 0
{
PoolVector<uint8_t> img;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 81d2b6731f..b34abf5a46 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2835,7 +2835,7 @@ void Control::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_degrees", "get_rotation_degrees");
ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "rect_scale"), "set_scale", "get_scale");
ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "rect_pivot_offset"), "set_pivot_offset", "get_pivot_offset");
- ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "rect_clip_content"), "set_clip_contents", "is_clipping_contents");
ADD_GROUP("Hint", "hint_");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 85ae6d6241..cebbb2193d 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -85,7 +85,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if ((cursor_pos < selection.begin) || (cursor_pos > selection.end) || !selection.enabled) {
- selection_clear();
+ deselect();
selection.cursor_start = cursor_pos;
selection.creating = true;
} else if (selection.enabled) {
@@ -99,7 +99,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} else {
if ((!selection.creating) && (!selection.doubleclick)) {
- selection_clear();
+ deselect();
}
selection.creating = false;
selection.doubleclick = false;
@@ -175,7 +175,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (editable) {
- selection_clear();
+ deselect();
text = text.substr(cursor_pos, text.length() - cursor_pos);
Ref<Font> font = get_font("font");
@@ -204,7 +204,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (editable) {
- selection_clear();
+ deselect();
text = text.substr(0, cursor_pos);
_text_changed();
}
@@ -827,7 +827,7 @@ void LineEdit::shift_selection_check_pre(bool p_shift) {
selection.cursor_start = cursor_pos;
}
if (!p_shift)
- selection_clear();
+ deselect();
}
void LineEdit::shift_selection_check_post(bool p_shift) {
@@ -880,13 +880,6 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
}
set_cursor_position(ofs);
-
- /*
- int new_cursor_pos=p_x;
- int charwidth=draw_area->get_font_char_width(' ',0);
- new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth );
- if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length();
- set_cursor_position(window_pos+new_cursor_pos); */
}
bool LineEdit::cursor_get_blink_enabled() const {
@@ -941,11 +934,6 @@ void LineEdit::delete_char() {
set_cursor_position(get_cursor_position() - 1);
- if (cursor_pos == window_pos) {
-
- //set_window_pos(cursor_pos-get_window_length());
- }
-
_text_changed();
}
@@ -1143,7 +1131,7 @@ Size2 LineEdit::get_minimum_size() const {
/* selection */
-void LineEdit::selection_clear() {
+void LineEdit::deselect() {
selection.begin = 0;
selection.end = 0;
@@ -1159,7 +1147,7 @@ void LineEdit::selection_delete() {
if (selection.enabled)
delete_text(selection.begin, selection.end);
- selection_clear();
+ deselect();
}
void LineEdit::set_max_length(int p_max_length) {
@@ -1224,7 +1212,7 @@ bool LineEdit::is_secret() const {
void LineEdit::select(int p_from, int p_to) {
if (p_from == 0 && p_to == 0) {
- selection_clear();
+ deselect();
return;
}
@@ -1383,7 +1371,9 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &LineEdit::_gui_input);
ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear);
+ ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all);
+ ClassDB::bind_method(D_METHOD("deselect"), &LineEdit::deselect);
ClassDB::bind_method(D_METHOD("set_text", "text"), &LineEdit::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &LineEdit::get_text);
ClassDB::bind_method(D_METHOD("set_placeholder", "text"), &LineEdit::set_placeholder);
@@ -1405,7 +1395,6 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable);
ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret);
ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret);
- ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option);
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
@@ -1457,7 +1446,7 @@ LineEdit::LineEdit() {
pass = false;
placeholder_alpha = 0.6;
- selection_clear();
+ deselect();
set_focus_mode(FOCUS_ALL);
editable = true;
set_default_cursor_shape(CURSOR_IBEAM);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index c3a299c2f5..5ca4ca15df 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -119,7 +119,6 @@ private:
void shift_selection_check_pre(bool);
void shift_selection_check_post(bool);
- void selection_clear();
void selection_fill_at_cursor();
void selection_delete();
void set_window_pos(int p_pos);
@@ -155,7 +154,9 @@ public:
bool is_context_menu_enabled();
PopupMenu *get_menu() const;
+ void select(int p_from = 0, int p_to = -1);
void select_all();
+ void deselect();
void delete_char();
void delete_text(int p_from_column, int p_to_column);
@@ -190,8 +191,6 @@ public:
void set_secret(bool p_secret);
bool is_secret() const;
- void select(int p_from = 0, int p_to = -1);
-
virtual Size2 get_minimum_size() const;
void set_expand_to_text_length(bool p_enabled);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 83aee5ca30..07f1bdf8e5 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4084,7 +4084,7 @@ void TextEdit::cut() {
backspace_at_cursor();
update();
cursor_set_line(cursor.line + 1);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
@@ -4098,7 +4098,7 @@ void TextEdit::cut() {
selection.active = false;
selection.selecting_mode = Selection::MODE_NONE;
update();
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4107,11 +4107,11 @@ void TextEdit::copy() {
if (!selection.active) {
String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = true;
+ cut_copy_line = clipboard;
} else {
String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
OS::get_singleton()->set_clipboard(clipboard);
- cut_copy_line = false;
+ cut_copy_line = "";
}
}
@@ -4127,7 +4127,7 @@ void TextEdit::paste() {
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
- } else if (cut_copy_line) {
+ } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) {
cursor_set_column(0);
String ins = "\n";
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index edef28cc25..836d5c7388 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -270,7 +270,7 @@ class TextEdit : public Control {
bool brace_matching_enabled;
bool highlight_current_line;
bool auto_indent;
- bool cut_copy_line;
+ String cut_copy_line;
bool insert_mode;
bool select_identifiers_enabled;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index bb33962be6..bf5f7bf039 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1111,13 +1111,14 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
for (int j = 0; j < vc; j++) {
Vector3 v = p_base_transform.xform(r[j]);
+ Vector3 n = p_base_transform.basis.xform(rn[j]).normalized();
vertices[(j + vertex_ofs) * 3 + 0] = v.x;
vertices[(j + vertex_ofs) * 3 + 1] = v.y;
vertices[(j + vertex_ofs) * 3 + 2] = v.z;
- normals[(j + vertex_ofs) * 3 + 0] = rn[j].x;
- normals[(j + vertex_ofs) * 3 + 1] = rn[j].y;
- normals[(j + vertex_ofs) * 3 + 2] = rn[j].z;
+ normals[(j + vertex_ofs) * 3 + 0] = n.x;
+ normals[(j + vertex_ofs) * 3 + 1] = n.y;
+ normals[(j + vertex_ofs) * 3 + 2] = n.z;
uv_index[j + vertex_ofs] = Pair<int, int>(i, j);
}
diff --git a/scene/resources/room.h b/scene/resources/room.h
index aadee858c2..0e021cfcf7 100644
--- a/scene/resources/room.h
+++ b/scene/resources/room.h
@@ -36,7 +36,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-//left for reference but will be removed when portals are reimplemented using Area
+// FIXME: left for reference but will be removed when portals are reimplemented using Area
#if 0
class RoomBounds : public Resource {