@ -230,6 +230,13 @@ void GridMapEditor::_menu_option(int p_option) {
_delete_selection ( ) ;
} break ;
case MENU_OPTION_SELECTION_FILL : {
if ( ! selection . active )
return ;
_fill_selection ( ) ;
} break ;
case MENU_OPTION_GRIDMAP_SETTINGS : {
settings_dialog - > popup_centered ( settings_vbc - > get_combined_minimum_size ( ) + Size2 ( 50 , 50 ) * EDSCALE ) ;
@ -455,6 +462,29 @@ void GridMapEditor::_delete_selection() {
_validate_selection ( ) ;
}
void GridMapEditor : : _fill_selection ( ) {
if ( ! selection . active )
return ;
undo_redo - > create_action ( TTR ( " GridMap Fill Selection " ) ) ;
for ( int i = selection . begin . x ; i < = selection . end . x ; i + + ) {
for ( int j = selection . begin . y ; j < = selection . end . y ; j + + ) {
for ( int k = selection . begin . z ; k < = selection . end . z ; k + + ) {
undo_redo - > add_do_method ( node , " set_cell_item " , i , j , k , selected_pallete , cursor_rot ) ;
undo_redo - > add_undo_method ( node , " set_cell_item " , i , j , k , node - > get_cell_item ( i , j , k ) , node - > get_cell_item_orientation ( i , j , k ) ) ;
}
}
}
undo_redo - > commit_action ( ) ;
selection . active = false ;
_validate_selection ( ) ;
}
void GridMapEditor : : _update_duplicate_indicator ( ) {
if ( ! selection . active | | input_action ! = INPUT_DUPLICATE ) {
@ -1063,6 +1093,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
options - > get_popup ( ) - > add_separator ( ) ;
options - > get_popup ( ) - > add_item ( TTR ( " Duplicate Selection " ) , MENU_OPTION_SELECTION_DUPLICATE , KEY_MASK_SHIFT + KEY_C ) ;
options - > get_popup ( ) - > add_item ( TTR ( " Clear Selection " ) , MENU_OPTION_SELECTION_CLEAR , KEY_MASK_SHIFT + KEY_X ) ;
options - > get_popup ( ) - > add_item ( TTR ( " Fill Selection " ) , MENU_OPTION_SELECTION_FILL , KEY_MASK_SHIFT + KEY_F ) ;
options - > get_popup ( ) - > add_separator ( ) ;
options - > get_popup ( ) - > add_item ( TTR ( " Settings " ) , MENU_OPTION_GRIDMAP_SETTINGS ) ;