SpriteFramesEditor Show AtlasTexture's source texture path in the frame's tooltip
This commit is contained in:
parent
baac3f5ed3
commit
c635ab914d
@ -821,19 +821,30 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
|
|||||||
|
|
||||||
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
|
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
|
||||||
String name;
|
String name;
|
||||||
Ref<Texture2D> icon;
|
Ref<Texture> frame = frames->get_frame(edited_anim, i);
|
||||||
|
|
||||||
if (frames->get_frame(edited_anim, i).is_null()) {
|
if (frame.is_null()) {
|
||||||
name = itos(i) + ": " + TTR("(empty)");
|
name = itos(i) + ": " + TTR("(empty)");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
name = itos(i) + ": " + frames->get_frame(edited_anim, i)->get_name();
|
name = itos(i) + ": " + frame->get_name();
|
||||||
icon = frames->get_frame(edited_anim, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tree->add_item(name, icon);
|
tree->add_item(name, frame);
|
||||||
if (frames->get_frame(edited_anim, i).is_valid()) {
|
if (frame.is_valid()) {
|
||||||
tree->set_item_tooltip(tree->get_item_count() - 1, frames->get_frame(edited_anim, i)->get_path());
|
String tooltip = frame->get_path();
|
||||||
|
|
||||||
|
// Frame is often saved as an AtlasTexture subresource within a scene/resource file,
|
||||||
|
// thus its path might be not what the user is looking for. So we're also showing
|
||||||
|
// subsequent source texture paths.
|
||||||
|
String prefix = String::utf8("┖╴");
|
||||||
|
Ref<AtlasTexture> at = frame;
|
||||||
|
while (at.is_valid() && at->get_atlas().is_valid()) {
|
||||||
|
tooltip += "\n" + prefix + at->get_atlas()->get_path();
|
||||||
|
prefix = " " + prefix;
|
||||||
|
at = at->get_atlas();
|
||||||
|
}
|
||||||
|
|
||||||
|
tree->set_item_tooltip(tree->get_item_count() - 1, tooltip);
|
||||||
}
|
}
|
||||||
if (sel == i) {
|
if (sel == i) {
|
||||||
tree->select(tree->get_item_count() - 1);
|
tree->select(tree->get_item_count() - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user