fixed tile map editor plugin, all previews are now the same size, closes #4983
This commit is contained in:
parent
4667f9e61e
commit
be223c91f9
2 changed files with 7 additions and 1 deletions
|
@ -729,7 +729,7 @@ static Rect2 _adjust_to_max_size(Size2 p_size, Size2 p_max_size) {
|
||||||
|
|
||||||
if (tex_width>size.width) {
|
if (tex_width>size.width) {
|
||||||
tex_width=size.width;
|
tex_width=size.width;
|
||||||
tex_height=p_size.height * tex_width / p_size.height;
|
tex_height=p_size.height * tex_width / p_size.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ofs_x=(size.width - tex_width)/2;
|
int ofs_x=(size.width - tex_width)/2;
|
||||||
|
|
|
@ -208,9 +208,14 @@ void TileMapEditor::_update_palette() {
|
||||||
|
|
||||||
palette->set_max_columns(0);
|
palette->set_max_columns(0);
|
||||||
palette->add_constant_override("hseparation", 6);
|
palette->add_constant_override("hseparation", 6);
|
||||||
|
|
||||||
|
float min_size = EDITOR_DEF("tile_map/preview_size",64);
|
||||||
|
palette->set_fixed_icon_size(Size2(min_size, min_size));
|
||||||
|
palette->set_fixed_column_width(min_size*3/2);
|
||||||
palette->set_icon_mode(ItemList::ICON_MODE_TOP);
|
palette->set_icon_mode(ItemList::ICON_MODE_TOP);
|
||||||
palette->set_max_text_lines(2);
|
palette->set_max_text_lines(2);
|
||||||
|
|
||||||
|
|
||||||
String filter = search_box->get_text().strip_edges();
|
String filter = search_box->get_text().strip_edges();
|
||||||
|
|
||||||
for (List<int>::Element *E=tiles.front();E;E=E->next()) {
|
for (List<int>::Element *E=tiles.front();E;E=E->next()) {
|
||||||
|
@ -1434,6 +1439,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
|
||||||
|
|
||||||
TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
|
TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
|
||||||
|
|
||||||
|
EDITOR_DEF("tile_map/preview_size",64);
|
||||||
tile_map_editor = memnew( TileMapEditor(p_node) );
|
tile_map_editor = memnew( TileMapEditor(p_node) );
|
||||||
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);
|
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);
|
||||||
tile_map_editor->hide();
|
tile_map_editor->hide();
|
||||||
|
|
Loading…
Reference in a new issue