Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
WhalesState committed Oct 3, 2024
1 parent fa57fca commit b4ef290
Show file tree
Hide file tree
Showing 27 changed files with 363 additions and 726 deletions.
1 change: 1 addition & 0 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,7 @@ void ClassDB::get_argument_options(const StringName &p_function, int p_idx, List
}
#endif


void ClassDB::_bind_methods() {
::ClassDB::bind_method(D_METHOD("get_class_list"), &ClassDB::get_class_list);
::ClassDB::bind_method(D_METHOD("get_inheriters_from_class", "class"), &ClassDB::get_inheriters_from_class);
Expand Down
4 changes: 4 additions & 0 deletions modules/gdscript/tests/scripts/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*]
charset = utf-8
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,6 @@ func test():
prints(x or false)
prints(x or true)

# TYPE_TRANSFORM3D
x = Transform3D.IDENTITY
prints("TYPE_TRANSFORM3D")
prints(not x)
prints(x and false)
prints(x and true)
prints(x or false)
prints(x or true)

# TYPE_PROJECTION
x = Projection.IDENTITY
prints("TYPE_PROJECTION")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ false
false
false
true
TYPE_TRANSFORM3D
true
false
false
false
true
TYPE_PROJECTION
true
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ func test():
array2[0][0].x = 6
var array3: Array[Array] = [[Vector2()]]
array3[0][0].x = 7
var transform = Transform3D()
transform.basis.x = Vector3(8.0, 9.0, 7.0)
print(dictionary1)
print(dictionary2)
print(array1)
print(array2)
print(array3)
print(transform)
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func test():
value = Basis()
print(value == null)

# Transform3D
value = Transform3D()
print(value == null)

# Projection
value = Projection()
print(value == null)
Expand Down Expand Up @@ -136,7 +132,3 @@ func test():
# PackedColorArray
value = PackedColorArray()
print(value == null)

# PackedVector4Array
value = PackedVector4Array()
print(value == null)
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func test():
value = Basis()
print(value != null)

# Transform3D
value = Transform3D()
print(value != null)

# Projection
value = Projection()
print(value != null)
Expand Down Expand Up @@ -136,7 +132,3 @@ func test():
# PackedColorArray
value = PackedColorArray()
print(value != null)

# PackedVector4Array
value = PackedVector4Array()
print(value != null)
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func test():
value = Basis()
print(null == value)

# Transform3D
value = Transform3D()
print(null == value)

# Color
value = Color()
print(null == value)
Expand Down Expand Up @@ -132,7 +128,3 @@ func test():
# PackedColorArray
value = PackedColorArray()
print(null == value)

# PackedVector4Array
value = PackedVector4Array()
print(null == value)
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func test():
value = Basis()
print(null != value)

# Transform3D
value = Transform3D()
print(null != value)

# Color
value = Color()
print(null != value)
Expand Down Expand Up @@ -132,7 +128,3 @@ func test():
# PackedColorArray
value = PackedColorArray()
print(null != value)

# PackedVector4Array
value = PackedVector4Array()
print(null != value)
2 changes: 0 additions & 2 deletions modules/gdscript/tests/scripts/runtime/features/stringify.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func test():
print(Plane(1, 2, 3, 4))
print(AABB(Vector3.ZERO, Vector3.ONE))
print(Basis.from_euler(Vector3(0, 0, 0)))
print(Transform3D.IDENTITY)

print(Color(1, 2, 3, 4))
print(StringName("hello"))
Expand All @@ -39,4 +38,3 @@ func test():
print(PackedVector2Array([Vector2.ONE, Vector2.ZERO]))
print(PackedVector3Array([Vector3.ONE, Vector3.ZERO]))
print(PackedColorArray([Color.RED, Color.BLUE, Color.GREEN]))
print(PackedVector4Array([Vector4.ONE, Vector4.ZERO]))
2 changes: 2 additions & 0 deletions scene/gui/line_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void LineEdit::edit() {

if (!has_focus()) {
grab_focus();
return;
}

if (!editable || editing) {
Expand Down Expand Up @@ -564,6 +565,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
if (editable && !editing && k->is_action_pressed("ui_text_submit", false)) {
edit();
emit_signal(SNAME("editing_toggled"), true);
accept_event();
return;
}

Expand Down
11 changes: 5 additions & 6 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3069,8 +3069,8 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
return CURSOR_ARROW;
}

int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT);
if (draw_minimap && p_pos.x > xmargin_end - minimap_width && p_pos.x <= xmargin_end) {
int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT) - (v_scroll->is_visible_in_tree() ? v_scroll->get_combined_minimum_size().width : 0);
if (draw_minimap && p_pos.x >= xmargin_end - minimap_width && p_pos.x <= xmargin_end) {
return CURSOR_ARROW;
}
return get_default_cursor_shape();
Expand Down Expand Up @@ -4428,7 +4428,6 @@ Rect2i TextEdit::get_rect_at_line_column(int p_line, int p_column) const {

int TextEdit::get_minimap_line_at_pos(const Point2i &p_pos) const {
float rows = p_pos.y;
rows -= theme_cache.style_normal->get_margin(SIDE_TOP);
rows /= (minimap_char_size.y + minimap_line_spacing);
rows += _get_v_scroll_offset();

Expand Down Expand Up @@ -8111,9 +8110,9 @@ void TextEdit::_scroll_lines_down() {
void TextEdit::_update_minimap_hover() {
const Point2 mp = get_local_mouse_pos();
Ref<StyleBox> style = editable ? theme_cache.style_normal : theme_cache.style_readonly;
const int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT);
const int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT) - (v_scroll->is_visible_in_tree() ? v_scroll->get_combined_minimum_size().width : 0);

bool hovering_sidebar = mp.x > xmargin_end - minimap_width && mp.x < xmargin_end;
bool hovering_sidebar = mp.x >= xmargin_end - minimap_width && mp.x <= xmargin_end;
if (!hovering_sidebar) {
if (hovering_minimap) {
// Only redraw if the hovering status changed.
Expand All @@ -8139,7 +8138,7 @@ void TextEdit::_update_minimap_click() {
Point2 mp = get_local_mouse_pos();
Ref<StyleBox> style = editable ? theme_cache.style_normal : theme_cache.style_readonly;

int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT);
int xmargin_end = get_size().width - style->get_margin(SIDE_RIGHT) - (v_scroll->is_visible_in_tree() ? v_scroll->get_combined_minimum_size().width : 0);
if (!dragging_minimap && (mp.x < xmargin_end - minimap_width || mp.x > xmargin_end)) {
minimap_clicked = false;
return;
Expand Down
23 changes: 11 additions & 12 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,19 +1505,18 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {

// If the tooltip timer isn't running, start it.
// Otherwise, only reset the timer if the mouse has moved more than 5 pixels.
if (!is_tooltip_shown && over->can_process() &&
(gui.tooltip_timer.is_null() ||
Math::is_zero_approx(gui.tooltip_timer->get_time_left()) ||
mm->get_relative().length() > 5.0)) {
if (gui.tooltip_timer.is_valid()) {
gui.tooltip_timer->release_connections();
gui.tooltip_timer = Ref<SceneTreeTimer>();
if (!is_tooltip_shown && over->can_process()) {
Vector2 new_tooltip_pos = over->get_screen_transform().xform(pos);
if (gui.tooltip_pos.distance_squared_to(new_tooltip_pos) > 25) {
if (gui.tooltip_timer.is_valid()) {
gui.tooltip_timer->release_connections();
}
gui.tooltip_control = over;
gui.tooltip_pos = new_tooltip_pos;
gui.tooltip_timer = get_tree()->create_timer(gui.tooltip_delay);
gui.tooltip_timer->set_ignore_time_scale(true);
gui.tooltip_timer->connect("timeout", callable_mp(this, &Viewport::_gui_show_tooltip));
}
gui.tooltip_control = over;
gui.tooltip_pos = over->get_screen_transform().xform(pos);
gui.tooltip_timer = get_tree()->create_timer(gui.tooltip_delay);
gui.tooltip_timer->set_ignore_time_scale(true);
gui.tooltip_timer->connect("timeout", callable_mp(this, &Viewport::_gui_show_tooltip));
}
}

Expand Down
1 change: 0 additions & 1 deletion tests/core/object/test_class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var
p_arg_type.name == p_context.names_cache.node_path_type;
case Variant::NODE_PATH:
return p_arg_type.name == p_context.names_cache.node_path_type;
case Variant::TRANSFORM3D:
case Variant::TRANSFORM2D:
case Variant::BASIS:
case Variant::PLANE:
Expand Down
3 changes: 0 additions & 3 deletions tests/core/object/test_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ class _MockScriptInstance : public ScriptInstance {
Ref<Script> get_script() const override {
return Ref<Script>();
}
const Variant get_rpc_config() const override {
return Variant();
}
ScriptLanguage *get_language() override {
return nullptr;
}
Expand Down
48 changes: 0 additions & 48 deletions tests/core/templates/test_command_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,6 @@ class SharedThreadState {

int func1_count = 0;

void func1(Transform3D t) {
func1_count++;
}
void func2(Transform3D t, float f) {
func1_count++;
}
void func3(Transform3D t1, Transform3D t2, Transform3D t3, Transform3D t4, Transform3D t5, Transform3D t6) {
func1_count++;
}
Transform3D func1r(Transform3D t) {
func1_count++;
return t;
}
Transform3D func2r(Transform3D t, float f) {
func1_count++;
return t;
}

void add_msg_to_write(TestMsgType type) {
message_types_to_write.push_back(type);
}
Expand Down Expand Up @@ -178,38 +160,8 @@ class SharedThreadState {
during_writing = false;
writer_threadwork.thread_wait_for_work();
while (!exit_threads) {
Transform3D tr;
Transform3D otr;
float f = 1;
during_writing = true;
for (int i = 0; i < message_types_to_write.size(); i++) {
TestMsgType msg_type = message_types_to_write[i];
switch (msg_type) {
case TEST_MSG_FUNC1_TRANSFORM:
command_queue.push(this, &SharedThreadState::func1, tr);
break;
case TEST_MSG_FUNC2_TRANSFORM_FLOAT:
command_queue.push(this, &SharedThreadState::func2, tr, f);
break;
case TEST_MSG_FUNC3_TRANSFORMx6:
command_queue.push(this, &SharedThreadState::func3, tr, tr, tr, tr, tr, tr);
break;
case TEST_MSGSYNC_FUNC1_TRANSFORM:
command_queue.push_and_sync(this, &SharedThreadState::func1, tr);
break;
case TEST_MSGSYNC_FUNC2_TRANSFORM_FLOAT:
command_queue.push_and_sync(this, &SharedThreadState::func2, tr, f);
break;
case TEST_MSGRET_FUNC1_TRANSFORM:
command_queue.push_and_ret(this, &SharedThreadState::func1r, tr, &otr);
break;
case TEST_MSGRET_FUNC2_TRANSFORM_FLOAT:
command_queue.push_and_ret(this, &SharedThreadState::func2r, tr, f, &otr);
break;
default:
break;
}
}
message_types_to_write.clear();
during_writing = false;

Expand Down
Loading

0 comments on commit b4ef290

Please sign in to comment.