summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/area_2d.cpp2
-rw-r--r--scene/2d/joints_2d.cpp3
-rw-r--r--scene/2d/line_builder.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/3d/physics_joint.cpp3
-rw-r--r--scene/gui/grid_container.cpp123
-rw-r--r--scene/gui/item_list.cpp22
-rw-r--r--scene/gui/item_list.h5
-rw-r--r--scene/gui/line_edit.cpp18
-rw-r--r--scene/gui/line_edit.h1
-rw-r--r--scene/gui/rich_text_label.cpp26
-rw-r--r--scene/gui/rich_text_label.h2
-rw-r--r--scene/gui/spin_box.cpp16
-rw-r--r--scene/gui/spin_box.h2
-rw-r--r--scene/gui/split_container.cpp134
-rw-r--r--scene/gui/split_container.h2
-rw-r--r--scene/gui/text_edit.cpp42
-rw-r--r--scene/gui/text_edit.h3
-rw-r--r--scene/gui/texture_button.cpp65
-rw-r--r--scene/gui/texture_button.h4
-rw-r--r--scene/gui/tree.cpp4
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/resources/color_ramp.cpp4
-rw-r--r--scene/resources/default_theme/default_theme.cpp6
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/primitive_meshes.cpp16
-rw-r--r--scene/resources/texture.cpp2
28 files changed, 305 insertions, 210 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 6fff7ac0a4..bb914b90fc 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -399,7 +399,7 @@ void Area2D::set_monitoring(bool p_enable) {
if (p_enable == monitoring)
return;
if (locked) {
- ERR_EXPLAIN("Function blocked during in/out signal. Use call_deferred(\"set_enable_monitoring\",true/false)");
+ ERR_EXPLAIN("Function blocked during in/out signal. Use call_deferred(\"set_monitoring\",true/false)");
}
ERR_FAIL_COND(locked);
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 7a96a54854..329382c034 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -75,8 +75,7 @@ void Joint2D::_update_joint(bool p_only_free) {
ba = body_a->get_rid();
bb = body_b->get_rid();
- if (exclude_from_collision)
- Physics2DServer::get_singleton()->body_add_collision_exception(body_a->get_rid(), body_b->get_rid());
+ Physics2DServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
void Joint2D::set_node_a(const NodePath &p_node_a) {
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index e78d2e9c34..b1a072729f 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -347,7 +347,7 @@ void LineBuilder::build() {
}
if (intersection_result != SEGMENT_INTERSECT)
- // In this case the joint is too fucked up to be re-used,
+ // In this case the joint is too corrputed to be re-used,
// start again the strip with fallback points
strip_begin(pos_up0, pos_down0, color1, uvx1);
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index cc99ce5f49..9908907ee9 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -372,9 +372,7 @@ bool RigidBody2D::_test_motion(const Vector2 &p_motion, float p_margin, const Re
void RigidBody2D::_direct_state_changed(Object *p_state) {
-//eh.. fuck
#ifdef DEBUG_ENABLED
-
state = Object::cast_to<Physics2DDirectBodyState>(p_state);
#else
state = (Physics2DDirectBodyState *)p_state; //trust it
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 25acd6deb0..5c814312dd 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -370,9 +370,7 @@ struct _RigidBodyInOut {
void RigidBody::_direct_state_changed(Object *p_state) {
-//eh.. fuck
#ifdef DEBUG_ENABLED
-
state = Object::cast_to<PhysicsDirectBodyState>(p_state);
#else
state = (PhysicsDirectBodyState *)p_state; //trust it
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index fed6d76f65..2e9f1a241a 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -71,8 +71,7 @@ void Joint::_update_joint(bool p_only_free) {
ba = body_a->get_rid();
bb = body_b->get_rid();
- if (exclude_from_collision)
- PhysicsServer::get_singleton()->body_add_collision_exception(body_a->get_rid(), body_b->get_rid());
+ PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
void Joint::set_node_a(const NodePath &p_node_a) {
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index 8c3f835be3..c2b8a7dfab 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -43,107 +43,118 @@ void GridContainer::_notification(int p_what) {
int hsep = get_constant("hseparation");
int vsep = get_constant("vseparation");
+ int max_col = MIN(get_child_count(), columns);
+ int max_row = get_child_count() / columns;
- int idx = 0;
- int max_row = 0;
- int max_col = 0;
-
- Size2 size = get_size();
-
+ // Compute the per-column/per-row data
for (int i = 0; i < get_child_count(); i++) {
-
Control *c = Object::cast_to<Control>(get_child(i));
if (!c || !c->is_visible_in_tree())
continue;
- int row = idx / columns;
- int col = idx % columns;
+ int row = i / columns;
+ int col = i % columns;
Size2i ms = c->get_combined_minimum_size();
if (col_minw.has(col))
col_minw[col] = MAX(col_minw[col], ms.width);
else
col_minw[col] = ms.width;
-
if (row_minh.has(row))
row_minh[row] = MAX(row_minh[row], ms.height);
else
row_minh[row] = ms.height;
- //print_line("store row "+itos(row)+" mw "+itos(ms.height));
-
- if (c->get_h_size_flags() & SIZE_EXPAND)
+ if (c->get_h_size_flags() & SIZE_EXPAND) {
col_expanded.insert(col);
- if (c->get_v_size_flags() & SIZE_EXPAND)
+ }
+ if (c->get_v_size_flags() & SIZE_EXPAND) {
row_expanded.insert(row);
-
- max_col = MAX(col, max_col);
- max_row = MAX(row, max_row);
- idx++;
+ }
}
- Size2 ms;
- int expand_rows = 0;
- int expand_cols = 0;
-
+ // Evaluate the remaining space for expanded columns/rows
+ Size2 remaining_space = get_size();
for (Map<int, int>::Element *E = col_minw.front(); E; E = E->next()) {
- ms.width += E->get();
- if (col_expanded.has(E->key()))
- expand_cols++;
+ if (!col_expanded.has(E->key()))
+ remaining_space.width -= E->get();
}
for (Map<int, int>::Element *E = row_minh.front(); E; E = E->next()) {
- ms.height += E->get();
- if (row_expanded.has(E->key()))
- expand_rows++;
+ if (!row_expanded.has(E->key()))
+ remaining_space.height -= E->get();
+ }
+ remaining_space.height -= vsep * (max_row - 1);
+ remaining_space.width -= hsep * (max_col - 1);
+
+ bool can_fit = false;
+ while (!can_fit) {
+ // Check if all minwidth constraints are ok if we use the remaining space
+ can_fit = true;
+ int max_index = 0;
+ for (Set<int>::Element *E = col_expanded.front(); E; E = E->next()) {
+ if (col_minw[E->get()] > col_minw[max_index]) {
+ max_index = col_minw[E->get()];
+ }
+ if (can_fit && (remaining_space.width / col_expanded.size()) < col_minw[E->get()]) {
+ can_fit = false;
+ }
+ }
+
+ // If not, the column with maximum minwidth is not expanded
+ if (!can_fit) {
+ col_expanded.erase(max_index);
+ remaining_space.width -= col_minw[max_index];
+ }
}
- ms.height += vsep * max_row;
- ms.width += hsep * max_col;
+ can_fit = false;
+ while (!can_fit) {
+ // Check if all minwidth constraints are ok if we use the remaining space
+ can_fit = true;
+ int max_index = 0;
+ for (Set<int>::Element *E = row_expanded.front(); E; E = E->next()) {
+ if (row_minh[E->get()] > row_minh[max_index]) {
+ max_index = row_minh[E->get()];
+ }
+ if (can_fit && (remaining_space.height / row_expanded.size()) < row_minh[E->get()]) {
+ can_fit = false;
+ }
+ }
+
+ // If not, the row with maximum minwidth is not expanded
+ if (!can_fit) {
+ row_expanded.erase(max_index);
+ remaining_space.height -= row_minh[max_index];
+ }
+ }
- int row_expand = expand_rows ? (size.y - ms.y) / expand_rows : 0;
- int col_expand = expand_cols ? (size.x - ms.x) / expand_cols : 0;
+ // Finally, fit the nodes
+ int col_expand = remaining_space.width / col_expanded.size();
+ int row_expand = remaining_space.height / row_expanded.size();
int col_ofs = 0;
int row_ofs = 0;
- idx = 0;
for (int i = 0; i < get_child_count(); i++) {
-
Control *c = Object::cast_to<Control>(get_child(i));
if (!c || !c->is_visible_in_tree())
continue;
- int row = idx / columns;
- int col = idx % columns;
+ int row = i / columns;
+ int col = i % columns;
if (col == 0) {
col_ofs = 0;
- if (row > 0 && row_minh.has(row - 1))
- row_ofs += row_minh[row - 1] + vsep + (row_expanded.has(row - 1) ? row_expand : 0);
+ if (row > 0)
+ row_ofs += ((row_expanded.has(row - 1)) ? row_expand : row_minh[row - 1]) + vsep;
}
- Size2 s;
- if (col_minw.has(col))
- s.width = col_minw[col];
- if (row_minh.has(row))
- s.height = row_minh[row];
-
- if (row_expanded.has(row))
- s.height += row_expand;
- if (col_expanded.has(col))
- s.width += col_expand;
-
Point2 p(col_ofs, row_ofs);
+ Size2 s((col_expanded.has(col)) ? col_expand : col_minw[col], (row_expanded.has(row)) ? row_expand : row_minh[row]);
- //print_line("col: "+itos(col)+" row: "+itos(row)+" col_ofs: "+itos(col_ofs)+" row_ofs: "+itos(row_ofs));
fit_child_in_rect(c, Rect2(p, s));
- //print_line("col: "+itos(col)+" row: "+itos(row)+" rect: "+Rect2(p,s));
-
- if (col_minw.has(col)) {
- col_ofs += col_minw[col] + hsep + (col_expanded.has(col) ? col_expand : 0);
- }
- idx++;
+ col_ofs += s.width + hsep;
}
} break;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 77d3a34c66..fe85d04003 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -517,11 +517,11 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("item_rmb_selected", i, get_local_mouse_position());
} else {
- bool selected = !items[i].selected;
+ bool selected = items[i].selected;
select(i, select_mode == SELECT_SINGLE || !mb->get_command());
- if (selected) {
+ if (!selected || allow_reselect) {
if (select_mode == SELECT_SINGLE) {
emit_signal("item_selected", i);
} else
@@ -1241,6 +1241,7 @@ int ItemList::find_metadata(const Variant &p_metadata) const {
}
void ItemList::set_allow_rmb_select(bool p_allow) {
+
allow_rmb_select = p_allow;
}
@@ -1249,6 +1250,16 @@ bool ItemList::get_allow_rmb_select() const {
return allow_rmb_select;
}
+void ItemList::set_allow_reselect(bool p_allow) {
+
+ allow_reselect = p_allow;
+}
+
+bool ItemList::get_allow_reselect() const {
+
+ return allow_reselect;
+}
+
void ItemList::set_icon_scale(real_t p_scale) {
icon_scale = p_scale;
}
@@ -1404,6 +1415,9 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &ItemList::set_allow_rmb_select);
ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &ItemList::get_allow_rmb_select);
+ ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &ItemList::set_allow_reselect);
+ ClassDB::bind_method(D_METHOD("get_allow_reselect"), &ItemList::get_allow_reselect);
+
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
@@ -1422,6 +1436,7 @@ void ItemList::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_text_lines"), "set_max_text_lines", "get_max_text_lines");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height");
@@ -1432,7 +1447,7 @@ void ItemList::_bind_methods() {
ADD_GROUP("Icon", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_mode", PROPERTY_HINT_ENUM, "Top,Left"), "set_icon_mode", "get_icon_mode");
ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "icon_scale"), "set_icon_scale", "get_icon_scale");
- ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size");
+ ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size");
BIND_ENUM_CONSTANT(ICON_MODE_TOP);
BIND_ENUM_CONSTANT(ICON_MODE_LEFT);
@@ -1476,6 +1491,7 @@ ItemList::ItemList() {
ensure_selected_visible = false;
defer_select_single = -1;
allow_rmb_select = false;
+ allow_reselect = false;
do_autoscroll_to_bottom = false;
icon_scale = 1.0f;
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 24e9498044..7f34a250bd 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -106,6 +106,8 @@ private:
bool allow_rmb_select;
+ bool allow_reselect;
+
real_t icon_scale;
bool do_autoscroll_to_bottom;
@@ -198,6 +200,9 @@ public:
void set_allow_rmb_select(bool p_allow);
bool get_allow_rmb_select() const;
+ void set_allow_reselect(bool p_allow);
+ bool get_allow_reselect() const;
+
void ensure_current_is_visible();
void sort_items_by_text();
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 524a68a116..03dc6686b8 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -30,6 +30,7 @@
#include "line_edit.h"
#include "label.h"
+#include "message_queue.h"
#include "os/keyboard.h"
#include "os/os.h"
#include "print_string.h"
@@ -800,7 +801,12 @@ void LineEdit::paste_text() {
if (selection.enabled) selection_delete();
append_at_cursor(paste_buffer);
- _text_changed();
+ if (!text_changed_dirty) {
+ if (is_inside_tree()) {
+ MessageQueue::get_singleton()->push_call(this, "_text_changed");
+ }
+ text_changed_dirty = true;
+ }
}
}
@@ -974,7 +980,12 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
window_pos = cursor_pos;
}
- _text_changed();
+ if (!text_changed_dirty) {
+ if (is_inside_tree()) {
+ MessageQueue::get_singleton()->push_call(this, "_text_changed");
+ }
+ text_changed_dirty = true;
+ }
}
void LineEdit::set_text(String p_text) {
@@ -1341,6 +1352,7 @@ void LineEdit::_text_changed() {
void LineEdit::_emit_text_change() {
emit_signal("text_changed", text);
_change_notify("text");
+ text_changed_dirty = false;
}
void LineEdit::_clear_redo() {
@@ -1373,6 +1385,7 @@ void LineEdit::_create_undo_state() {
void LineEdit::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret);
#ifdef TOOLS_ENABLED
@@ -1458,6 +1471,7 @@ LineEdit::LineEdit() {
window_has_focus = true;
max_length = 0;
pass = false;
+ text_changed_dirty = false;
placeholder_alpha = 0.6;
deselect();
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index e15980d3c4..e3ad3b17f1 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -67,6 +67,7 @@ private:
bool editable;
bool pass;
+ bool text_changed_dirty;
String undo_text;
String text;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index a7419519ae..381c6c75a5 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -121,6 +121,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (p_mode == PROCESS_CACHE) {
l.offset_caches.clear();
l.height_caches.clear();
+ l.ascent_caches.clear();
+ l.descent_caches.clear();
l.char_count = 0;
l.minimum_width = 0;
}
@@ -140,6 +142,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
//line height should be the font height for the first time, this ensures that an empty line will never have zero height and successive newlines are displayed
int line_height = cfont->get_height();
+ int line_ascent = cfont->get_ascent();
+ int line_descent = cfont->get_descent();
int nonblank_line_count = 0; //number of nonblank lines as counted during PROCESS_DRAW
@@ -169,16 +173,22 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
case ALIGN_FILL: l.offset_caches.push_back((p_width - margin) - used /*+spaces_size*/); break; \
} \
l.height_caches.push_back(line_height); \
+ l.ascent_caches.push_back(line_ascent); \
+ l.descent_caches.push_back(line_descent); \
l.space_caches.push_back(spaces); \
} \
y += line_height + get_constant(SceneStringNames::get_singleton()->line_separation); \
line_height = 0; \
+ line_ascent = 0; \
+ line_descent = 0; \
spaces = 0; \
spaces_size = 0; \
wofs = begin; \
align_ofs = 0; \
if (p_mode != PROCESS_CACHE) { \
lh = line < l.height_caches.size() ? l.height_caches[line] : 1; \
+ line_ascent = line < l.ascent_caches.size() ? l.ascent_caches[line] : 1; \
+ line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1; \
} \
if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && p_click_pos.x < p_ofs.x + wofs) { \
if (r_outside) *r_outside = true; \
@@ -254,6 +264,12 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
const CharType *cf = c;
int fh = font->get_height();
int ascent = font->get_ascent();
+ int descent = font->get_descent();
+
+ line_ascent = MAX(line_ascent, ascent);
+ line_descent = MAX(line_descent, descent);
+ fh = MAX(fh, line_ascent + line_descent); // various fonts!
+
Color color;
bool underline = false;
@@ -280,6 +296,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
lh = 0;
if (p_mode != PROCESS_CACHE) {
lh = line < l.height_caches.size() ? l.height_caches[line] : 1;
+ line_ascent = line < l.ascent_caches.size() ? l.ascent_caches[line] : 1;
+ line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1;
}
while (c[end] != 0 && !(end && c[end - 1] == ' ' && c[end] != ' ')) {
@@ -348,7 +366,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
int cw = 0;
- bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - (fh - 0 * ascent), fh); //getting rid of ascent seems to work??
+ bool visible = visible_characters < 0 || p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - line_descent - line_ascent, line_ascent + line_descent);
if (visible)
line_is_blank = false;
@@ -360,11 +378,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
cw = font->get_char_size(c[i], c[i + 1]).x;
draw_rect(Rect2(p_ofs.x + pofs, p_ofs.y + y, cw, lh), selection_bg);
if (visible)
- font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - (fh - ascent)), c[i], c[i + 1], override_selected_font_color ? selection_fg : color);
+ font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], override_selected_font_color ? selection_fg : color);
} else {
if (visible)
- cw = font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - (fh - ascent)), c[i], c[i + 1], color);
+ cw = font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], color);
}
p_char_count++;
@@ -379,7 +397,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (underline) {
Color uc = color;
uc.a *= 0.5;
- int uy = y + lh - fh + ascent + 2;
+ int uy = y + lh - line_descent + 2;
float underline_width = 1.0;
#ifdef TOOLS_ENABLED
underline_width *= EDSCALE;
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 48f746e28d..e7d5e6bb1b 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -80,6 +80,8 @@ private:
Item *from;
Vector<int> offset_caches;
Vector<int> height_caches;
+ Vector<int> ascent_caches;
+ Vector<int> descent_caches;
Vector<int> space_caches;
int height_cache;
int height_accum_cache;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3c5d524d80..145981d498 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -185,17 +185,22 @@ void SpinBox::_line_edit_focus_exit() {
_text_entered(line_edit->get_text());
}
+inline void SpinBox::_adjust_width_for_icon(const Ref<Texture> icon) {
+
+ int w = icon->get_width();
+ if (w != last_w) {
+ line_edit->set_margin(MARGIN_RIGHT, -w);
+ last_w = w;
+ }
+}
+
void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
Ref<Texture> updown = get_icon("updown");
- int w = updown->get_width();
- if (w != last_w) {
- line_edit->set_margin(MARGIN_RIGHT, -w);
- last_w = w;
- }
+ _adjust_width_for_icon(updown);
RID ci = get_canvas_item();
Size2i size = get_size();
@@ -207,6 +212,7 @@ void SpinBox::_notification(int p_what) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
+ _adjust_width_for_icon(get_icon("updown"));
_value_changed(0);
}
}
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index b8565ec082..8863f44bef 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -62,6 +62,8 @@ class SpinBox : public Range {
void _line_edit_focus_exit();
+ inline void _adjust_width_for_icon(const Ref<Texture> icon);
+
protected:
void _gui_input(const Ref<InputEvent> &p_event);
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index e1d49019b3..bf7033e8ba 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -61,127 +61,69 @@ Control *SplitContainer::_getch(int p_idx) const {
}
void SplitContainer::_resort() {
-
- /* First pass, determine minimum size AND amount of stretchable elements */
-
int axis = vertical ? 1 : 0;
- bool has_first = _getch(0);
- bool has_second = _getch(1);
+ Control *first = _getch(0);
+ Control *second = _getch(1);
- if (!has_first && !has_second) {
- return;
- } else if (!(has_first && has_second)) {
- if (has_first)
+ // If we have only one element
+ if (!first || !second) {
+ if (first) {
fit_child_in_rect(_getch(0), Rect2(Point2(), get_size()));
- else
+ } else if (second) {
fit_child_in_rect(_getch(1), Rect2(Point2(), get_size()));
-
+ }
return;
}
- Control *first = _getch(0);
- Control *second = _getch(1);
-
- bool ratiomode = false;
- bool expand_first_mode = false;
-
+ // Determine expanded children
+ bool first_expanded = false;
+ bool second_expanded = false;
if (vertical) {
-
- ratiomode = first->get_v_size_flags() & SIZE_EXPAND && second->get_v_size_flags() & SIZE_EXPAND;
- expand_first_mode = first->get_v_size_flags() & SIZE_EXPAND && !(second->get_v_size_flags() & SIZE_EXPAND);
+ first_expanded = first->get_v_size_flags() & SIZE_EXPAND;
+ second_expanded = second->get_v_size_flags() & SIZE_EXPAND;
} else {
-
- ratiomode = first->get_h_size_flags() & SIZE_EXPAND && second->get_h_size_flags() & SIZE_EXPAND;
- expand_first_mode = first->get_h_size_flags() & SIZE_EXPAND && !(second->get_h_size_flags() & SIZE_EXPAND);
+ first_expanded = first->get_h_size_flags() & SIZE_EXPAND;
+ second_expanded = second->get_h_size_flags() & SIZE_EXPAND;
}
- int sep = get_constant("separation");
+ // Determine the separation between items
Ref<Texture> g = get_icon("grabber");
-
+ int sep = get_constant("separation");
if (dragger_visibility == DRAGGER_HIDDEN_COLLAPSED) {
sep = 0;
} else {
sep = MAX(sep, vertical ? g->get_height() : g->get_width());
}
- int total = vertical ? get_size().height : get_size().width;
-
- total -= sep;
-
- int minimum = 0;
-
+ // Compute the minimum size
Size2 ms_first = first->get_combined_minimum_size();
Size2 ms_second = second->get_combined_minimum_size();
- if (vertical) {
- minimum = ms_first.height + ms_second.height;
- } else {
- minimum = ms_first.width + ms_second.width;
- }
-
- int available = total - minimum;
- if (available < 0)
- available = 0;
-
- middle_sep = 0;
-
- if (collapsed) {
-
- if (ratiomode) {
-
- int first_ratio = first->get_stretch_ratio();
- int second_ratio = second->get_stretch_ratio();
-
- float ratio = float(first_ratio) / (first_ratio + second_ratio);
-
- middle_sep = ms_first[axis] + available * ratio;
-
- } else if (expand_first_mode) {
-
- middle_sep = get_size()[axis] - ms_second[axis] - sep;
- } else {
-
- middle_sep = ms_first[axis];
- }
- } else if (ratiomode) {
-
- int first_ratio = first->get_stretch_ratio();
- int second_ratio = second->get_stretch_ratio();
-
- float ratio = float(first_ratio) / (first_ratio + second_ratio);
-
- if (expand_ofs < -(available * ratio))
- expand_ofs = -(available * ratio);
- else if (expand_ofs > (available * (1.0 - ratio)))
- expand_ofs = (available * (1.0 - ratio));
-
- middle_sep = ms_first[axis] + available * ratio + expand_ofs;
- } else if (expand_first_mode) {
+ float ratio = first->get_stretch_ratio() / (first->get_stretch_ratio() + second->get_stretch_ratio());
- if (expand_ofs > 0)
- expand_ofs = 0;
- else if (expand_ofs < -available)
- expand_ofs = -available;
-
- middle_sep = get_size()[axis] - ms_second[axis] - sep + expand_ofs;
+ int no_offset_middle_sep = 0;
+ if (first_expanded && second_expanded) {
+ no_offset_middle_sep = get_size()[axis] * ratio - sep / 2;
+ } else if (first_expanded) {
+ no_offset_middle_sep = get_size()[axis] - ms_second[axis] - sep;
} else {
+ no_offset_middle_sep = ms_first[axis];
+ }
- if (expand_ofs < 0)
- expand_ofs = 0;
- else if (expand_ofs > available)
- expand_ofs = available;
-
- middle_sep = ms_first[axis] + expand_ofs;
+ middle_sep = no_offset_middle_sep;
+ middle_sep += (collapsed) ? 0 : split_offset;
+ middle_sep = MIN(middle_sep, get_size()[axis] - ms_second[axis] - sep);
+ middle_sep = MAX(middle_sep, ms_first[axis]);
+ if (!collapsed) {
+ split_offset = middle_sep - no_offset_middle_sep;
}
if (vertical) {
-
fit_child_in_rect(first, Rect2(Point2(0, 0), Size2(get_size().width, middle_sep)));
int sofs = middle_sep + sep;
fit_child_in_rect(second, Rect2(Point2(0, sofs), Size2(get_size().width, get_size().height - sofs)));
} else {
-
fit_child_in_rect(first, Rect2(Point2(0, 0), Size2(middle_sep, get_size().height)));
int sofs = middle_sep + sep;
fit_child_in_rect(second, Rect2(Point2(sofs, 0), Size2(get_size().width - sofs, get_size().height)));
@@ -290,7 +232,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
dragging = true;
drag_from = mb->get_position().y;
- drag_ofs = expand_ofs;
+ drag_ofs = split_offset;
}
} else {
@@ -298,7 +240,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
dragging = true;
drag_from = mb->get_position().x;
- drag_ofs = expand_ofs;
+ drag_ofs = split_offset;
}
}
} else {
@@ -312,7 +254,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid() && dragging) {
- expand_ofs = drag_ofs + ((vertical ? mm->get_position().y : mm->get_position().x) - drag_from);
+ split_offset = drag_ofs + ((vertical ? mm->get_position().y : mm->get_position().x) - drag_from);
queue_sort();
emit_signal("dragged", get_split_offset());
}
@@ -343,16 +285,16 @@ Control::CursorShape SplitContainer::get_cursor_shape(const Point2 &p_pos) const
void SplitContainer::set_split_offset(int p_offset) {
- if (expand_ofs == p_offset)
+ if (split_offset == p_offset)
return;
- expand_ofs = p_offset;
+ split_offset = p_offset;
queue_sort();
}
int SplitContainer::get_split_offset() const {
- return expand_ofs;
+ return split_offset;
}
void SplitContainer::set_collapsed(bool p_collapsed) {
@@ -407,7 +349,7 @@ void SplitContainer::_bind_methods() {
SplitContainer::SplitContainer(bool p_vertical) {
mouse_inside = false;
- expand_ofs = 0;
+ split_offset = 0;
middle_sep = 0;
vertical = p_vertical;
dragging = false;
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index a31dc766d2..321f7fd3b7 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -46,7 +46,7 @@ public:
private:
bool vertical;
- int expand_ofs;
+ int split_offset;
int middle_sep;
bool dragging;
int drag_from;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index f728490136..e8454e021f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -217,7 +217,7 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
}
}
-const Map<int, TextEdit::Text::ColorRegionInfo> &TextEdit::Text::get_color_region_info(int p_line) {
+const Map<int, TextEdit::Text::ColorRegionInfo> &TextEdit::Text::get_color_region_info(int p_line) const {
static Map<int, ColorRegionInfo> cri;
ERR_FAIL_INDEX_V(p_line, text.size(), cri);
@@ -4710,8 +4710,6 @@ int TextEdit::get_indent_level(int p_line) const {
tab_count++;
} else if (text[p_line][i] == ' ') {
whitespace_count++;
- } else if (text[p_line][i] == '#') {
- break;
} else {
break;
}
@@ -4719,6 +4717,31 @@ int TextEdit::get_indent_level(int p_line) const {
return tab_count + whitespace_count / indent_size;
}
+bool TextEdit::is_line_comment(int p_line) const {
+
+ // checks to see if this line is the start of a comment
+ ERR_FAIL_INDEX_V(p_line, text.size(), false);
+
+ const Map<int, Text::ColorRegionInfo> &cri_map = text.get_color_region_info(p_line);
+
+ int line_length = text[p_line].size();
+ for (int i = 0; i < line_length - 1; i++) {
+ if (_is_symbol(text[p_line][i]) && cri_map.has(i)) {
+ const Text::ColorRegionInfo &cri = cri_map[i];
+ if (color_regions[cri.region].begin_key == "#" || color_regions[cri.region].begin_key == "//") {
+ return true;
+ } else {
+ return false;
+ }
+ } else if (_is_whitespace(text[p_line][i])) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ return false;
+}
+
bool TextEdit::can_fold(int p_line) const {
ERR_FAIL_INDEX_V(p_line, text.size(), false);
@@ -4732,6 +4755,8 @@ bool TextEdit::can_fold(int p_line) const {
return false;
if (is_line_hidden(p_line))
return false;
+ if (is_line_comment(p_line))
+ return false;
int start_indent = get_indent_level(p_line);
@@ -4739,10 +4764,13 @@ bool TextEdit::can_fold(int p_line) const {
if (text[i].size() == 0)
continue;
int next_indent = get_indent_level(i);
- if (next_indent > start_indent)
+ if (is_line_comment(i)) {
+ continue;
+ } else if (next_indent > start_indent) {
return true;
- else
+ } else {
return false;
+ }
}
return false;
@@ -4771,7 +4799,9 @@ void TextEdit::fold_line(int p_line) {
int last_line = start_indent;
for (int i = p_line + 1; i < text.size(); i++) {
if (text[i].strip_edges().size() != 0) {
- if (get_indent_level(i) > start_indent) {
+ if (is_line_comment(i)) {
+ continue;
+ } else if (get_indent_level(i) > start_indent) {
last_line = i;
} else {
break;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index acbf41aa81..8ac3b9fce6 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -162,7 +162,7 @@ class TextEdit : public Control {
void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
int get_line_width(int p_line) const;
int get_max_width(bool p_exclude_hidden = false) const;
- const Map<int, ColorRegionInfo> &get_color_region_info(int p_line);
+ const Map<int, ColorRegionInfo> &get_color_region_info(int p_line) const;
void set(int p_line, const String &p_text);
void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; }
bool is_marked(int p_line) const { return text[p_line].marked; }
@@ -450,6 +450,7 @@ public:
void indent_left();
void indent_right();
int get_indent_level(int p_line) const;
+ bool is_line_comment(int p_line) const;
inline void set_scroll_pass_end_of_file(bool p_enabled) {
scroll_past_end_of_file_enabled = p_enabled;
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 07c9894611..6bd3b26280 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "texture_button.h"
+#include "core/typedefs.h"
+#include <stdlib.h>
Size2 TextureButton::get_minimum_size() const {
@@ -58,10 +60,50 @@ bool TextureButton::has_point(const Point2 &p_point) const {
if (click_mask.is_valid()) {
- Point2i p = p_point;
- if (p.x < 0 || p.x >= click_mask->get_size().width || p.y < 0 || p.y >= click_mask->get_size().height)
+ Point2 point = p_point;
+ Rect2 rect = Rect2();
+ Size2 mask_size = click_mask->get_size();
+
+ if (_tile) {
+ // if the stretch mode is tile we offset the point to keep it inside the mask size
+ rect.size = mask_size;
+ if (_position_rect.has_point(point)) {
+ int cols = (int)Math::ceil(_position_rect.size.x / mask_size.x);
+ int rows = (int)Math::ceil(_position_rect.size.y / mask_size.y);
+ int col = (int)(point.x / mask_size.x) % cols;
+ int row = (int)(point.y / mask_size.y) % rows;
+ point.x -= mask_size.x * col;
+ point.y -= mask_size.y * row;
+ }
+ } else {
+ // we need to transform the point from our scaled / translated image back to our mask image
+ Point2 ofs = _position_rect.position;
+ Size2 scale = mask_size / _position_rect.size;
+
+ switch (stretch_mode) {
+ case STRETCH_KEEP_ASPECT_COVERED: {
+ // if the stretch mode is aspect covered the image uses a texture region so we need to take that into account
+ float min = MIN(scale.x, scale.y);
+ scale.x = min;
+ scale.y = min;
+ ofs -= _texture_region.position / min;
+ } break;
+ }
+
+ // offset and scale the new point position to adjust it to the bitmask size
+ point -= ofs;
+ point *= scale;
+
+ // finally, we need to check if the point is inside a rectangle with a position >= 0,0 and a size <= mask_size
+ rect.position = Point2(MAX(0, _texture_region.position.x), MAX(0, _texture_region.position.y));
+ rect.size = Size2(MIN(mask_size.x, _texture_region.size.x), MIN(mask_size.y, _texture_region.size.y));
+ }
+
+ if (!rect.has_point(point)) {
return false;
+ }
+ Point2i p = point;
return click_mask->get_bit(p);
}
@@ -118,8 +160,8 @@ void TextureButton::_notification(int p_what) {
if (texdraw.is_valid()) {
Point2 ofs;
Size2 size = texdraw->get_size();
- Rect2 tex_regin = Rect2(Point2(), texdraw->get_size());
- bool tile = false;
+ _texture_region = Rect2(Point2(), texdraw->get_size());
+ _tile = false;
if (expand) {
switch (stretch_mode) {
case STRETCH_KEEP:
@@ -130,7 +172,7 @@ void TextureButton::_notification(int p_what) {
break;
case STRETCH_TILE:
size = get_size();
- tile = true;
+ _tile = true;
break;
case STRETCH_KEEP_CENTERED:
ofs = (get_size() - texdraw->get_size()) / 2;
@@ -161,14 +203,15 @@ void TextureButton::_notification(int p_what) {
float scale = scaleSize.width > scaleSize.height ? scaleSize.width : scaleSize.height;
Size2 scaledTexSize = tex_size * scale;
Point2 ofs = ((scaledTexSize - size) / scale).abs() / 2.0f;
- tex_regin = Rect2(ofs, size / scale);
+ _texture_region = Rect2(ofs, size / scale);
} break;
}
}
- if (tile)
- draw_texture_rect(texdraw, Rect2(ofs, size), tile);
+ _position_rect = Rect2(ofs, size);
+ if (_tile)
+ draw_texture_rect(texdraw, _position_rect, _tile);
else
- draw_texture_rect_region(texdraw, Rect2(ofs, size), tex_regin);
+ draw_texture_rect_region(texdraw, _position_rect, _texture_region);
}
if (has_focus() && focused.is_valid()) {
@@ -299,4 +342,8 @@ TextureButton::StretchMode TextureButton::get_stretch_mode() const {
TextureButton::TextureButton() {
expand = false;
stretch_mode = STRETCH_SCALE;
+
+ _texture_region = Rect2();
+ _position_rect = Rect2();
+ _tile = false;
}
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index 1cf4b66413..d42df390e8 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -58,6 +58,10 @@ private:
bool expand;
StretchMode stretch_mode;
+ Rect2 _texture_region;
+ Rect2 _position_rect;
+ bool _tile;
+
protected:
virtual Size2 get_minimum_size() const;
virtual bool has_point(const Point2 &p_point) const;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index e12044fca2..cdbdc9b0d7 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2384,7 +2384,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
- if (cache.font.is_null()) // avoid a strange case that may fuckup stuff
+ if (cache.font.is_null()) // avoid a strange case that may corrupt stuff
update_cache();
Ref<StyleBox> bg = cache.bg;
@@ -2483,7 +2483,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
- if (cache.font.is_null()) // avoid a strange case that may fuckup stuff
+ if (cache.font.is_null()) // avoid a strange case that may corrupt stuff
update_cache();
if (!b->is_pressed()) {
diff --git a/scene/main/node.h b/scene/main/node.h
index dc6bda4621..4655071228 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -364,7 +364,7 @@ public:
void queue_delete();
- //shitty hacks for speed
+ //hacks for speed
static void set_human_readable_collision_renaming(bool p_enabled);
static void init_node_hrcr();
diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp
index 8c09130873..b2f586d02d 100644
--- a/scene/resources/color_ramp.cpp
+++ b/scene/resources/color_ramp.cpp
@@ -71,8 +71,8 @@ void Gradient::_bind_methods() {
ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &Gradient::set_colors);
ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &Gradient::get_colors);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
}
Vector<float> Gradient::get_offsets() const {
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index a4049e4461..3e244aa8f8 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -448,10 +448,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// TextEdit
- theme->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
+ theme->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3, 0, 0, 0, 0));
theme->set_stylebox("focus", "TextEdit", focus);
- theme->set_stylebox("read_only", "TextEdit", make_stylebox(tree_bg_disabled_png, 4, 4, 4, 4));
- theme->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3));
+ theme->set_stylebox("read_only", "TextEdit", make_stylebox(tree_bg_disabled_png, 4, 4, 4, 4, 0, 0, 0, 0));
+ theme->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3, 0, 0, 0, 0));
theme->set_icon("tab", "TextEdit", make_icon(tab_png));
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index d59390e1b8..949ba12a4c 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1267,6 +1267,8 @@ void ArrayMesh::_bind_methods() {
ClassDB::set_method_flags(get_class_static(), _scs_create("center_geometry"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("regen_normalmaps"), &ArrayMesh::regen_normalmaps);
ClassDB::set_method_flags(get_class_static(), _scs_create("regen_normalmaps"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
+ ClassDB::bind_method(D_METHOD("lightmap_unwrap"), &ArrayMesh::lightmap_unwrap);
+ ClassDB::set_method_flags(get_class_static(), _scs_create("lightmap_unwrap"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("get_faces"), &ArrayMesh::get_faces);
ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &ArrayMesh::generate_triangle_mesh);
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 94ce3590d7..94c54c91d3 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -361,8 +361,8 @@ void CapsuleMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CapsuleMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CapsuleMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "mid_height", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_mid_height", "get_mid_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "mid_height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_mid_height", "get_mid_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
}
@@ -823,9 +823,9 @@ void CylinderMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CylinderMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CylinderMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "top_radius", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_top_radius", "get_top_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bottom_radius", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_bottom_radius", "get_bottom_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "top_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_top_radius", "get_top_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "bottom_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_bottom_radius", "get_bottom_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
}
@@ -1224,7 +1224,7 @@ void PrismMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_subdivide_depth"), &PrismMesh::get_subdivide_depth);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "left_to_right", PROPERTY_HINT_RANGE, "-2.0,2.0,0.1"), "set_left_to_right", "get_left_to_right");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_width", "get_subdivide_width");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_height", "get_subdivide_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_depth", "get_subdivide_depth");
@@ -1441,8 +1441,8 @@ void SphereMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_is_hemisphere", "is_hemisphere"), &SphereMesh::set_is_hemisphere);
ClassDB::bind_method(D_METHOD("get_is_hemisphere"), &SphereMesh::get_is_hemisphere);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.1,100.0,0.1"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_height", "get_height");
ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_hemisphere"), "set_is_hemisphere", "get_is_hemisphere");
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 067d123b83..c0f6756fd1 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -76,7 +76,7 @@ void Texture::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Ansiotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags");
BIND_ENUM_CONSTANT(FLAGS_DEFAULT);
BIND_ENUM_CONSTANT(FLAG_MIPMAPS);