This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/editors/space_file/file_utils.c
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00

42 lines
1.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup spfile
*/
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BKE_context.h"
#include "BLO_readfile.h"
#include "ED_fileselect.h"
#include "ED_screen.h"
#include "WM_types.h"
#include "file_intern.h"
void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds)
{
int xmin, ymax;
ED_fileselect_layout_tilepos(layout, file, &xmin, &ymax);
ymax = (int)region->v2d.tot.ymax - ymax; /* real, view space ymax */
BLI_rcti_init(r_bounds,
xmin,
xmin + layout->tile_w + layout->tile_border_x,
ymax - layout->tile_h - layout->tile_border_y,
ymax);
}
void file_path_to_ui_path(const char *path, char *r_path, int max_size)
{
char tmp_path[PATH_MAX];
BLI_strncpy(tmp_path, path, sizeof(tmp_path));
BLI_path_slash_rstrip(tmp_path);
BLI_strncpy(r_path, BLO_has_bfile_extension(tmp_path) ? tmp_path : path, max_size);
}