Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragged nodes have no icon size limit in script editor #79255

Closed
KoBeWi opened this issue Jul 9, 2023 · 1 comment · Fixed by #79283
Closed

Dragged nodes have no icon size limit in script editor #79255

KoBeWi opened this issue Jul 9, 2023 · 1 comment · Fixed by #79283

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Jul 9, 2023

Godot version

4.1

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

godot_WLmiQBv0SM.mp4

We correctly clamp the size to 16x16 everywhere except here (probably).

Steps to reproduce

  1. Add a class with custom icon, e.g.
@icon("res://icon.svg")
extends Node
class_name Icon
  1. Add it to scene
  2. Open Script Editor and drag the node to script editor

Minimal reproduction project

N/A

@YuriSizov
Copy link
Contributor

YuriSizov commented Jul 10, 2023

Relevant part is here:

VBoxContainer *vb = memnew(VBoxContainer);
Array objs;
int list_max = 10;
float opacity_step = 1.0f / list_max;
float opacity_item = 1.0f;
for (int i = 0; i < selected_nodes.size(); i++) {
if (i < list_max) {
HBoxContainer *hb = memnew(HBoxContainer);
TextureRect *tf = memnew(TextureRect);
tf->set_texture(icons[i]);
tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hb->add_child(tf);
Label *label = memnew(Label(selected_nodes[i]->get_name()));
hb->add_child(label);
vb->add_child(hb);
hb->set_modulate(Color(1, 1, 1, opacity_item));
opacity_item -= opacity_step;
}
NodePath p = selected_nodes[i]->get_path();
objs.push_back(p);
}
set_drag_preview(vb);

Related to the second commit in #75472.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants