summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/TextEdit.xml2
-rw-r--r--editor/editor_properties.cpp38
-rw-r--r--modules/gridmap/grid_map.cpp80
-rw-r--r--modules/gridmap/grid_map.h19
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp57
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h2
-rw-r--r--scene/gui/base_button.cpp5
-rw-r--r--scene/gui/graph_node.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--servers/physics_2d/body_pair_2d_sw.cpp6
10 files changed, 122 insertions, 93 deletions
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 0c6615c53b..d72d684ebc 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -48,6 +48,7 @@
<return type="void">
</return>
<description>
+ Centers the viewport on the line the editing cursor is at. This also resets the [member scroll_horizontal] value to [code]0[/code].
</description>
</method>
<method name="clear_colors">
@@ -458,6 +459,7 @@
<member name="selecting_enabled" type="bool" setter="set_selecting_enabled" getter="is_selecting_enabled" default="true">
</member>
<member name="shortcut_keys_enabled" type="bool" setter="set_shortcut_keys_enabled" getter="is_shortcut_keys_enabled" default="true">
+ If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled.
</member>
<member name="show_line_numbers" type="bool" setter="set_show_line_numbers" getter="is_show_line_numbers_enabled" default="false">
If [code]true[/code], line numbers are displayed to the left of the text.
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 23db6ebb4e..8f9c92ea15 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2983,8 +2983,16 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const
String allowed_type = base_type;
Dictionary drag_data = p_drag_data;
- if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
- Ref<Resource> res = drag_data["resource"];
+
+ Ref<Resource> res;
+ if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]);
+ res = se->get_edited_resource();
+ } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ res = drag_data["resource"];
+ }
+
+ if (res.is_valid()) {
for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
String at = allowed_type.get_slice(",", i).strip_edges();
if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
@@ -3022,13 +3030,19 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
ERR_FAIL_COND(!_is_drop_valid(p_data));
Dictionary drag_data = p_data;
- if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
- Ref<Resource> res = drag_data["resource"];
- if (res.is_valid()) {
- emit_changed(get_edited_property(), res);
- update_property();
- return;
- }
+
+ Ref<Resource> res;
+ if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]);
+ res = se->get_edited_resource();
+ } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ res = drag_data["resource"];
+ }
+
+ if (res.is_valid()) {
+ emit_changed(get_edited_property(), res);
+ update_property();
+ return;
}
if (drag_data.has("type") && String(drag_data["type"]) == "files") {
@@ -3036,9 +3050,9 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &
if (files.size() == 1) {
String file = files[0];
- RES res = ResourceLoader::load(file);
- if (res.is_valid()) {
- emit_changed(get_edited_property(), res);
+ RES file_res = ResourceLoader::load(file);
+ if (file_res.is_valid()) {
+ emit_changed(get_edited_property(), file_res);
update_property();
return;
}
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 2975a97bfe..ccf1e49693 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -244,26 +244,26 @@ bool GridMap::get_center_z() const {
return center_z;
}
-void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) {
+void GridMap::set_cell_item(const Vector3i &p_position, int p_item, int p_rot) {
if (baked_meshes.size() && !recreating_octants) {
//if you set a cell item, baked meshes go good bye
clear_baked_meshes();
_recreate_octant_data();
}
- ERR_FAIL_INDEX(ABS(p_x), 1 << 20);
- ERR_FAIL_INDEX(ABS(p_y), 1 << 20);
- ERR_FAIL_INDEX(ABS(p_z), 1 << 20);
+ ERR_FAIL_INDEX(ABS(p_position.x), 1 << 20);
+ ERR_FAIL_INDEX(ABS(p_position.y), 1 << 20);
+ ERR_FAIL_INDEX(ABS(p_position.z), 1 << 20);
IndexKey key;
- key.x = p_x;
- key.y = p_y;
- key.z = p_z;
+ key.x = p_position.x;
+ key.y = p_position.y;
+ key.z = p_position.z;
OctantKey ok;
- ok.x = p_x / octant_size;
- ok.y = p_y / octant_size;
- ok.z = p_z / octant_size;
+ ok.x = p_position.x / octant_size;
+ ok.y = p_position.y / octant_size;
+ ok.z = p_position.z / octant_size;
if (p_item < 0) {
//erase
@@ -318,15 +318,15 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) {
cell_map[key] = c;
}
-int GridMap::get_cell_item(int p_x, int p_y, int p_z) const {
- ERR_FAIL_INDEX_V(ABS(p_x), 1 << 20, INVALID_CELL_ITEM);
- ERR_FAIL_INDEX_V(ABS(p_y), 1 << 20, INVALID_CELL_ITEM);
- ERR_FAIL_INDEX_V(ABS(p_z), 1 << 20, INVALID_CELL_ITEM);
+int GridMap::get_cell_item(const Vector3i &p_position) const {
+ ERR_FAIL_INDEX_V(ABS(p_position.x), 1 << 20, INVALID_CELL_ITEM);
+ ERR_FAIL_INDEX_V(ABS(p_position.y), 1 << 20, INVALID_CELL_ITEM);
+ ERR_FAIL_INDEX_V(ABS(p_position.z), 1 << 20, INVALID_CELL_ITEM);
IndexKey key;
- key.x = p_x;
- key.y = p_y;
- key.z = p_z;
+ key.x = p_position.x;
+ key.y = p_position.y;
+ key.z = p_position.z;
if (!cell_map.has(key)) {
return INVALID_CELL_ITEM;
@@ -334,15 +334,15 @@ int GridMap::get_cell_item(int p_x, int p_y, int p_z) const {
return cell_map[key].item;
}
-int GridMap::get_cell_item_orientation(int p_x, int p_y, int p_z) const {
- ERR_FAIL_INDEX_V(ABS(p_x), 1 << 20, -1);
- ERR_FAIL_INDEX_V(ABS(p_y), 1 << 20, -1);
- ERR_FAIL_INDEX_V(ABS(p_z), 1 << 20, -1);
+int GridMap::get_cell_item_orientation(const Vector3i &p_position) const {
+ ERR_FAIL_INDEX_V(ABS(p_position.x), 1 << 20, -1);
+ ERR_FAIL_INDEX_V(ABS(p_position.y), 1 << 20, -1);
+ ERR_FAIL_INDEX_V(ABS(p_position.z), 1 << 20, -1);
IndexKey key;
- key.x = p_x;
- key.y = p_y;
- key.z = p_z;
+ key.x = p_position.x;
+ key.y = p_position.y;
+ key.z = p_position.z;
if (!cell_map.has(key)) {
return -1;
@@ -350,20 +350,20 @@ int GridMap::get_cell_item_orientation(int p_x, int p_y, int p_z) const {
return cell_map[key].rot;
}
-Vector3 GridMap::world_to_map(const Vector3 &p_world_pos) const {
- Vector3 map_pos = p_world_pos / cell_size;
- map_pos.x = floor(map_pos.x);
- map_pos.y = floor(map_pos.y);
- map_pos.z = floor(map_pos.z);
- return map_pos;
+Vector3i GridMap::world_to_map(const Vector3 &p_world_position) const {
+ Vector3 map_position = p_world_position / cell_size;
+ map_position.x = floor(map_position.x);
+ map_position.y = floor(map_position.y);
+ map_position.z = floor(map_position.z);
+ return Vector3i(map_position);
}
-Vector3 GridMap::map_to_world(int p_x, int p_y, int p_z) const {
+Vector3 GridMap::map_to_world(const Vector3i &p_map_position) const {
Vector3 offset = _get_offset();
Vector3 world_pos(
- p_x * cell_size.x + offset.x,
- p_y * cell_size.y + offset.y,
- p_z * cell_size.z + offset.z);
+ p_map_position.x * cell_size.x + offset.x,
+ p_map_position.y * cell_size.y + offset.y,
+ p_map_position.z * cell_size.z + offset.z);
return world_pos;
}
@@ -725,7 +725,7 @@ void GridMap::_recreate_octant_data() {
Map<IndexKey, Cell> cell_copy = cell_map;
_clear_internal();
for (Map<IndexKey, Cell>::Element *E = cell_copy.front(); E; E = E->next()) {
- set_cell_item(E->key().x, E->key().y, E->key().z, E->get().item, E->get().rot);
+ set_cell_item(Vector3i(E->key()), E->get().item, E->get().rot);
}
recreating_octants = false;
}
@@ -799,12 +799,12 @@ void GridMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_octant_size", "size"), &GridMap::set_octant_size);
ClassDB::bind_method(D_METHOD("get_octant_size"), &GridMap::get_octant_size);
- ClassDB::bind_method(D_METHOD("set_cell_item", "x", "y", "z", "item", "orientation"), &GridMap::set_cell_item, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("get_cell_item", "x", "y", "z"), &GridMap::get_cell_item);
- ClassDB::bind_method(D_METHOD("get_cell_item_orientation", "x", "y", "z"), &GridMap::get_cell_item_orientation);
+ ClassDB::bind_method(D_METHOD("set_cell_item", "position", "item", "orientation"), &GridMap::set_cell_item, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("get_cell_item", "position"), &GridMap::get_cell_item);
+ ClassDB::bind_method(D_METHOD("get_cell_item_orientation", "position"), &GridMap::get_cell_item_orientation);
- ClassDB::bind_method(D_METHOD("world_to_map", "pos"), &GridMap::world_to_map);
- ClassDB::bind_method(D_METHOD("map_to_world", "x", "y", "z"), &GridMap::map_to_world);
+ ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &GridMap::world_to_map);
+ ClassDB::bind_method(D_METHOD("map_to_world", "map_position"), &GridMap::map_to_world);
ClassDB::bind_method(D_METHOD("_update_octants_callback"), &GridMap::_update_octants_callback);
ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &GridMap::resource_changed);
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 9eb9aee7d1..ca7429ea26 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -59,6 +59,15 @@ class GridMap : public Node3D {
return key < p_key.key;
}
+ _FORCE_INLINE_ operator Vector3i() const {
+ return Vector3i(x, y, z);
+ }
+
+ IndexKey(Vector3i p_vector) {
+ x = (int16_t)p_vector.x;
+ y = (int16_t)p_vector.y;
+ z = (int16_t)p_vector.z;
+ }
IndexKey() { key = 0; }
};
@@ -234,12 +243,12 @@ public:
void set_center_z(bool p_enable);
bool get_center_z() const;
- void set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot = 0);
- int get_cell_item(int p_x, int p_y, int p_z) const;
- int get_cell_item_orientation(int p_x, int p_y, int p_z) const;
+ void set_cell_item(const Vector3i &p_position, int p_item, int p_rot = 0);
+ int get_cell_item(const Vector3i &p_position) const;
+ int get_cell_item_orientation(const Vector3i &p_position) const;
- Vector3 world_to_map(const Vector3 &p_world_pos) const;
- Vector3 map_to_world(int p_x, int p_y, int p_z) const;
+ Vector3i world_to_map(const Vector3 &p_world_position) const;
+ Vector3 map_to_world(const Vector3i &p_map_position) const;
void set_clip(bool p_enabled, bool p_clip_above = true, int p_floor = 0, Vector3::Axis p_axis = Vector3::AXIS_X);
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 1b7ce98721..0e6ec7f520 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -291,15 +291,15 @@ void GridMapEditor::_update_selection_transform() {
} else {
Vector3 scale = (selection.end - selection.begin + Vector3(1, 1, 1));
scale[edit_axis] = 1.0;
- Vector3 pos = selection.begin;
- pos[edit_axis] = edit_floor[edit_axis];
+ Vector3 position = selection.begin;
+ position[edit_axis] = edit_floor[edit_axis];
scale *= node->get_cell_size();
- pos *= node->get_cell_size();
+ position *= node->get_cell_size();
Transform xf2;
xf2.basis.scale(scale);
- xf2.origin = pos;
+ xf2.origin = position;
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2);
}
@@ -414,11 +414,11 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
}
if (input_action == INPUT_PASTE) {
- paste_indicator.current = Vector3(cell[0], cell[1], cell[2]);
+ paste_indicator.current = Vector3i(cell[0], cell[1], cell[2]);
_update_paste_indicator();
} else if (input_action == INPUT_SELECT) {
- selection.current = Vector3(cell[0], cell[1], cell[2]);
+ selection.current = Vector3i(cell[0], cell[1], cell[2]);
if (p_click) {
selection.click = selection.current;
}
@@ -427,7 +427,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
return true;
} else if (input_action == INPUT_PICK) {
- int item = node->get_cell_item(cell[0], cell[1], cell[2]);
+ int item = node->get_cell_item(Vector3i(cell[0], cell[1], cell[2]));
if (item >= 0) {
selected_palette = item;
mesh_library_palette->set_current(item);
@@ -438,23 +438,23 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
}
if (input_action == INPUT_PAINT) {
SetItem si;
- si.pos = Vector3(cell[0], cell[1], cell[2]);
+ si.position = Vector3i(cell[0], cell[1], cell[2]);
si.new_value = selected_palette;
si.new_orientation = cursor_rot;
- si.old_value = node->get_cell_item(cell[0], cell[1], cell[2]);
- si.old_orientation = node->get_cell_item_orientation(cell[0], cell[1], cell[2]);
+ si.old_value = node->get_cell_item(Vector3i(cell[0], cell[1], cell[2]));
+ si.old_orientation = node->get_cell_item_orientation(Vector3i(cell[0], cell[1], cell[2]));
set_items.push_back(si);
- node->set_cell_item(cell[0], cell[1], cell[2], selected_palette, cursor_rot);
+ node->set_cell_item(Vector3i(cell[0], cell[1], cell[2]), selected_palette, cursor_rot);
return true;
} else if (input_action == INPUT_ERASE) {
SetItem si;
- si.pos = Vector3(cell[0], cell[1], cell[2]);
+ si.position = Vector3i(cell[0], cell[1], cell[2]);
si.new_value = -1;
si.new_orientation = 0;
- si.old_value = node->get_cell_item(cell[0], cell[1], cell[2]);
- si.old_orientation = node->get_cell_item_orientation(cell[0], cell[1], cell[2]);
+ si.old_value = node->get_cell_item(Vector3i(cell[0], cell[1], cell[2]));
+ si.old_orientation = node->get_cell_item_orientation(Vector3i(cell[0], cell[1], cell[2]));
set_items.push_back(si);
- node->set_cell_item(cell[0], cell[1], cell[2], -1);
+ node->set_cell_item(Vector3i(cell[0], cell[1], cell[2]), -1);
return true;
}
@@ -470,8 +470,9 @@ void GridMapEditor::_delete_selection() {
for (int i = selection.begin.x; i <= selection.end.x; i++) {
for (int j = selection.begin.y; j <= selection.end.y; j++) {
for (int k = selection.begin.z; k <= selection.end.z; k++) {
- undo_redo->add_do_method(node, "set_cell_item", i, j, k, GridMap::INVALID_CELL_ITEM);
- undo_redo->add_undo_method(node, "set_cell_item", i, j, k, node->get_cell_item(i, j, k), node->get_cell_item_orientation(i, j, k));
+ Vector3i selected = Vector3i(i, j, k);
+ undo_redo->add_do_method(node, "set_cell_item", selected, GridMap::INVALID_CELL_ITEM);
+ undo_redo->add_undo_method(node, "set_cell_item", selected, node->get_cell_item(selected), node->get_cell_item_orientation(selected));
}
}
}
@@ -489,8 +490,9 @@ void GridMapEditor::_fill_selection() {
for (int i = selection.begin.x; i <= selection.end.x; i++) {
for (int j = selection.begin.y; j <= selection.end.y; j++) {
for (int k = selection.begin.z; k <= selection.end.z; k++) {
- undo_redo->add_do_method(node, "set_cell_item", i, j, k, selected_palette, cursor_rot);
- undo_redo->add_undo_method(node, "set_cell_item", i, j, k, node->get_cell_item(i, j, k), node->get_cell_item_orientation(i, j, k));
+ Vector3i selected = Vector3i(i, j, k);
+ undo_redo->add_do_method(node, "set_cell_item", selected, selected_palette, cursor_rot);
+ undo_redo->add_undo_method(node, "set_cell_item", selected, node->get_cell_item(selected), node->get_cell_item_orientation(selected));
}
}
}
@@ -515,7 +517,8 @@ void GridMapEditor::_set_clipboard_data() {
for (int i = selection.begin.x; i <= selection.end.x; i++) {
for (int j = selection.begin.y; j <= selection.end.y; j++) {
for (int k = selection.begin.z; k <= selection.end.z; k++) {
- int itm = node->get_cell_item(i, j, k);
+ Vector3i selected = Vector3i(i, j, k);
+ int itm = node->get_cell_item(selected);
if (itm == GridMap::INVALID_CELL_ITEM) {
continue;
}
@@ -524,8 +527,8 @@ void GridMapEditor::_set_clipboard_data() {
ClipboardItem item;
item.cell_item = itm;
- item.grid_offset = Vector3(i, j, k) - selection.begin;
- item.orientation = node->get_cell_item_orientation(i, j, k);
+ item.grid_offset = Vector3(selected) - selection.begin;
+ item.orientation = node->get_cell_item_orientation(selected);
item.instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world_3d()->get_scenario());
clipboard_items.push_back(item);
@@ -583,14 +586,14 @@ void GridMapEditor::_do_paste() {
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
ClipboardItem &item = E->get();
- Vector3 pos = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
+ Vector3 position = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
Basis orm;
orm.set_orthogonal_index(item.orientation);
orm = rot * orm;
- undo_redo->add_do_method(node, "set_cell_item", pos.x, pos.y, pos.z, item.cell_item, orm.get_orthogonal_index());
- undo_redo->add_undo_method(node, "set_cell_item", pos.x, pos.y, pos.z, node->get_cell_item(pos.x, pos.y, pos.z), node->get_cell_item_orientation(pos.x, pos.y, pos.z));
+ undo_redo->add_do_method(node, "set_cell_item", position, item.cell_item, orm.get_orthogonal_index());
+ undo_redo->add_undo_method(node, "set_cell_item", position, node->get_cell_item(position), node->get_cell_item_orientation(position));
}
if (reselect) {
@@ -667,11 +670,11 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
undo_redo->create_action(TTR("GridMap Paint"));
for (List<SetItem>::Element *E = set_items.front(); E; E = E->next()) {
const SetItem &si = E->get();
- undo_redo->add_do_method(node, "set_cell_item", si.pos.x, si.pos.y, si.pos.z, si.new_value, si.new_orientation);
+ undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation);
}
for (List<SetItem>::Element *E = set_items.back(); E; E = E->prev()) {
const SetItem &si = E->get();
- undo_redo->add_undo_method(node, "set_cell_item", si.pos.x, si.pos.y, si.pos.z, si.old_value, si.old_orientation);
+ undo_redo->add_undo_method(node, "set_cell_item", si.position, si.old_value, si.old_orientation);
}
undo_redo->commit_action();
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 31a01cdc91..84b68ba6e7 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -84,7 +84,7 @@ class GridMapEditor : public VBoxContainer {
Label *spin_box_label;
struct SetItem {
- Vector3 pos;
+ Vector3i position;
int new_value;
int new_orientation;
int old_value;
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index d8229b5f43..6fef44481a 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -271,6 +271,11 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
}
void BaseButton::set_toggle_mode(bool p_on) {
+ // Make sure to set 'pressed' to false if we are not in toggle mode
+ if (!p_on) {
+ set_pressed(false);
+ }
+
toggle_mode = p_on;
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index b6a96238dc..01b54ddaa8 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -503,9 +503,7 @@ void GraphNode::_connpos_update() {
}
}
- if (vofs > 0) {
- vofs += sep;
- }
+ vofs += sep;
vofs += size.y;
idx++;
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 5ae27081ea..22e5bd55f3 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -256,7 +256,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
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_DRAW) { \
+ if ((p_mode == PROCESS_DRAW) && (align != ALIGN_FILL)) { \
if (line < l.offset_caches.size()) { \
wofs = l.offset_caches[line]; \
} \
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp
index 258979ff22..5997959432 100644
--- a/servers/physics_2d/body_pair_2d_sw.cpp
+++ b/servers/physics_2d/body_pair_2d_sw.cpp
@@ -255,9 +255,8 @@ bool BodyPair2DSW::setup(real_t p_step) {
if (B->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_SHAPE) {
motion_B = B->get_motion();
}
- //faster to set than to check..
- //bool prev_collided=collided;
+ bool prev_collided = collided;
collided = CollisionSolver2DSW::solve(shape_A_ptr, xform_A, motion_A, shape_B_ptr, xform_B, motion_B, _add_contact, this, &sep_axis);
if (!collided) {
@@ -285,8 +284,7 @@ bool BodyPair2DSW::setup(real_t p_step) {
return false;
}
- //if (!prev_collided) {
- {
+ if (!prev_collided) {
if (A->is_shape_set_as_one_way_collision(shape_A)) {
Vector2 direction = xform_A.get_axis(1).normalized();
bool valid = false;