You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Small fixes for Grid/Tile map editor palette
This commit is contained in:
@@ -738,7 +738,7 @@ void GridMapEditor::update_pallete() {
|
|||||||
|
|
||||||
float min_size = EDITOR_DEF("grid_map/preview_size",64);
|
float min_size = EDITOR_DEF("grid_map/preview_size",64);
|
||||||
theme_pallete->set_min_icon_size(Size2(min_size, min_size));
|
theme_pallete->set_min_icon_size(Size2(min_size, min_size));
|
||||||
theme_pallete->set_fixed_column_width(min_size + 4);
|
theme_pallete->set_fixed_column_width(min_size*3/2);
|
||||||
theme_pallete->set_max_text_lines(2);
|
theme_pallete->set_max_text_lines(2);
|
||||||
|
|
||||||
Ref<MeshLibrary> theme = node->get_theme();
|
Ref<MeshLibrary> theme = node->get_theme();
|
||||||
|
|||||||
@@ -170,16 +170,16 @@ void TileMapEditor::_update_palette() {
|
|||||||
if (tex.is_valid()) {
|
if (tex.is_valid()) {
|
||||||
Rect2 region = tileset->tile_get_region(E->get());
|
Rect2 region = tileset->tile_get_region(E->get());
|
||||||
|
|
||||||
if (region==Rect2()) {
|
if (!region.has_no_area()) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Image data = VS::get_singleton()->texture_get_data(tex->get_rid());
|
Image data = VS::get_singleton()->texture_get_data(tex->get_rid());
|
||||||
|
|
||||||
Ref<ImageTexture> img = memnew( ImageTexture );
|
Ref<ImageTexture> img = memnew( ImageTexture );
|
||||||
img->create_from_image(data.get_rect(region));
|
img->create_from_image(data.get_rect(region));
|
||||||
|
|
||||||
palette->set_item_icon(palette->get_item_count()-1, img);
|
palette->set_item_icon(palette->get_item_count()-1, img);
|
||||||
|
} else {
|
||||||
|
palette->set_item_icon(palette->get_item_count()-1,tex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileset->tile_get_name(E->get())!="") {
|
if (tileset->tile_get_name(E->get())!="") {
|
||||||
@@ -187,6 +187,7 @@ void TileMapEditor::_update_palette() {
|
|||||||
} else {
|
} else {
|
||||||
palette->set_item_text(palette->get_item_count()-1, "#"+itos(E->get()));
|
palette->set_item_text(palette->get_item_count()-1, "#"+itos(E->get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
palette->set_item_metadata(palette->get_item_count()-1, E->get());
|
palette->set_item_metadata(palette->get_item_count()-1, E->get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user