-added icons for root node types on tabs

This commit is contained in:
Juan Linietsky 2015-07-24 14:18:02 -03:00
parent 257dba9a4a
commit d50ebbb441
4 changed files with 25 additions and 2 deletions

View File

@ -142,7 +142,7 @@ void Tabs::_notification(int p_what) {
Ref<Texture> icon;
if (tabs[i].icon.is_valid()) {
Ref<Texture> icon = tabs[i].icon;
icon = tabs[i].icon;
if (icon.is_valid()) {
lsize+=icon->get_width();
if (s!="")

View File

@ -507,6 +507,14 @@ uint64_t EditorData::get_scene_version(int p_idx) const{
return edited_scene[p_idx].version;
}
String EditorData::get_scene_type(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),String());
if (!edited_scene[p_idx].root)
return "";
return edited_scene[p_idx].root->get_type();
}
String EditorData::get_scene_title(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,edited_scene.size(),String());
if (!edited_scene[p_idx].root)

View File

@ -177,6 +177,7 @@ public:
int get_edited_scene_count() const;
String get_scene_title(int p_idx) const;
String get_scene_path(int p_idx) const;
String get_scene_type(int p_idx) const;
void set_edited_scene_version(uint64_t version);
uint64_t get_edited_scene_version() const;
uint64_t get_scene_version(int p_idx) const;

View File

@ -110,9 +110,23 @@ void EditorNode::_update_scene_tabs() {
scene_tabs->clear_tabs();
for(int i=0;i<editor_data.get_edited_scene_count();i++) {
String type=editor_data.get_scene_type(i);
Ref<Texture> icon;
if (type!=String()) {
if (!gui_base->has_icon(type,"EditorIcons")) {
type="Node";
}
icon=gui_base->get_icon(type,"EditorIcons");
}
int current = editor_data.get_edited_scene();
bool unsaved = (i==current)?saved_version!=editor_data.get_undo_redo().get_version():editor_data.get_scene_version(i)!=0;
scene_tabs->add_tab(editor_data.get_scene_title(i)+(unsaved?"(*)":""));
scene_tabs->add_tab(editor_data.get_scene_title(i)+(unsaved?"(*)":""),icon);
}
scene_tabs->set_current_tab(editor_data.get_edited_scene());