11#include <fmt/format.h>
53 char *path =
static_cast<char *
>(argN);
70 char version_str[128] = {0};
76 thumb->
metadata(),
"Thumb::Blender::Version", version_str,
sizeof(version_str));
84 SNPRINTF_UTF8(version_str,
"%d.%01d", version / 100, version % 100);
95 if (status.st_size > 0) {
99 fmt::format(fmt::runtime(
TIP_(
"Size: {}")), size),
106 const time_t ts_now = time(
nullptr);
117 fmt::format(fmt::runtime(
TIP_(
"Modified: {}")), modified_s),
138 image_data.ibuf = thumb;
139 image_data.width = short(
float(thumb->
x) *
scale);
140 image_data.height = short(
float(thumb->
y) *
scale);
141 image_data.border =
true;
143 image_data.premultiplied =
true;
156 const int project_rows)
162 if (shown.
size() >= project_rows) {
174 if (remaining <= 0) {
177 if (shown.
add(&recent)) {
213 .skip_overrides = false,
214 .canonicalize = true,
215 .strip_filename = true,
227 const float project_ratio)
234 return project->get_root_path();
237 const int project_rows = int(std::ceil(rows * project_ratio));
242 for (
const std::string &filepath :
list.project_files) {
248 for (
const std::string &filepath :
list.other_files) {
261 const char *path =
static_cast<const char *
>(argN);
286 const bool is_active = !active_path.empty() &&
291 is_active ? ICON_PROJECT : ICON_NONE,
File and directory operations.
#define SNPRINTF_UTF8(dst, format,...)
const char * dirname(char *path)
external readfile function prototypes.
bool contains(const Key &key) const
float3x3 scale(float3x3 mat, float2 scale)
std::string datetime(const std::tm &date_time, StringRef locale_iso={}, DateFormat date_format=DateFormat::Default, TimeFormat time_format=TimeFormat::H24, const std::tm *now=nullptr, StringRef today={}, StringRef yesterday={})
std::tm localtime_safe(time_t time)
std::string filename(const std::string_view &str, size_t pos)
static void template_recent_projects_tooltip_func(bContext &, TooltipData &tip, Button *, void *argN)
static void template_recent_file(Layout *layout, const std::string &filepath)
static void template_recent_files_tooltip_func(bContext &, TooltipData &tip, Button *, void *argN)
int template_recent_projects(Layout *layout, int rows)
int template_recent_files(Layout *layout, int rows, RecentFilesFilter filter=RecentFilesFilter::All, float project_ratio=0.5f)
static RecentFilesList recent_files_get(const std::optional< std::string > &project_root, const int rows, const int project_rows)
void button_func_tooltip_custom_set(Button *but, ButtonToolTipCustomFunc func, void *arg, FreeArgFunc free_arg)
void button_disable(Button *but, const char *disabled_hint)
void tooltip_image_field_add(TooltipData &data, const TooltipImage &image_data)
void tooltip_text_field_add(TooltipData &data, std::string text, std::string suffix, const TooltipStyle style, const TooltipColorID color_id, const bool is_pad=false)
Button * button_last(Block *block) ATTR_WARN_UNUSED_RESULT
Vector< RecentProject > BKE_blender_project_recent_get()
ImBuf * BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data)
short BLO_version_from_file(const char *filepath)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BlendThumbnail * BLO_thumbnail_from_file(const char *filepath)
ImBuf * IMB_thumb_read(const char *file_or_lib_path, ThumbSize size)
auto BKE_blender_project_read_callback(const Main *bmain, Fn lambda)
eFileAttributes BLI_file_attributes(const char *path)
void MEM_delete_void(void *vmemh)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void IMB_freeImBuf(ImBuf *ibuf)
BMesh const char void * data
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_path_cmp_normalized(const char *p1, const char *p2) ATTR_NONNULL(1
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
bool BKE_autoexec_default_trust_source(const char *path, const AutoExec_Params ¶ms)
bool BLI_path_contains(const char *container_path, const char *containee_path) ATTR_NONNULL(1
const char * BLT_lang_get()
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool IMB_metadata_get_field(const IDProperty *metadata, const char *key, char *value, size_t value_maxncpy)
bool BKE_blendfile_extension_check(const char *str)
bool BKE_blender_project_dir_is_project(StringRef path)
void BLI_filelist_entry_size_to_string(const struct stat *st, uint64_t st_size_fallback, bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN])
const IDProperty * metadata() const
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
Vector< std::string > project_files
Vector< std::string > other_files