Blender V5.0
BKE_path_templates.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
65#pragma once
66
67#include <cmath>
68#include <optional>
69
70#include "BLI_map.hh"
71#include "BLI_path_utils.hh"
72#include "BLI_string.h"
73#include "BLI_string_ref.hh"
74#include "BLI_string_utils.hh"
75
76#include "BKE_report.hh"
77
78#include "DNA_node_types.h"
79#include "DNA_scene_types.h"
80
81struct bContext;
82struct PointerRNA;
83struct PropertyRNA;
84
86
116
117 public:
121 bool contains(blender::StringRef name) const;
122
130
141
152
163
173 bool add_float(blender::StringRef name, double value);
174
181 std::optional<blender::StringRefNull> get_string(blender::StringRef name) const;
182
189 std::optional<blender::StringRefNull> get_filepath(blender::StringRef name) const;
190
197 std::optional<int64_t> get_integer(blender::StringRef name) const;
198
205 std::optional<double> get_float(blender::StringRef name) const;
206
207 /* ------------------------------------------------------------------
208 * Convenience methods, to aid in consistency across different uses. */
209
226 blender::StringRefNull full_path,
227 blender::StringRef fallback);
228
245 blender::StringRefNull full_path,
246 blender::StringRef fallback);
247};
248
255
260
261bool operator==(const Error &left, const Error &right);
262
263} // namespace blender::bke::path_templates
264
277std::optional<blender::bke::path_templates::VariableMap> BKE_build_template_variables_for_prop(
278 const bContext *C, PointerRNA *ptr, PropertyRNA *prop);
279
295 const ID *path_owner_id);
296
314 blender::bke::path_templates::VariableMap &variables, const Scene &scene);
315
328 const bNode &owning_node);
329
341
354 blender::StringRef path, const blender::bke::path_templates::VariableMap &template_variables);
355
396 char *path,
397 int path_maxncpy,
398 const blender::bke::path_templates::VariableMap &template_variables);
403 blender::StringRef path);
404
410 eReportType report_type,
413
420std::optional<std::string> BKE_path_template_format_float(blender::StringRef format_specifier,
421 double value);
422
424std::optional<std::string> BKE_path_template_format_int(blender::StringRef format_specifier,
425 int64_t value);
void BKE_report_path_template_errors(ReportList *reports, eReportType report_type, blender::StringRef path, blender::Span< blender::bke::path_templates::Error > errors)
std::optional< blender::bke::path_templates::VariableMap > BKE_build_template_variables_for_prop(const bContext *C, PointerRNA *ptr, PropertyRNA *prop)
std::optional< std::string > BKE_path_template_format_int(blender::StringRef format_specifier, int64_t value)
std::optional< std::string > BKE_path_template_format_float(blender::StringRef format_specifier, double value)
std::string BKE_path_template_error_to_string(const blender::bke::path_templates::Error &error, blender::StringRef path)
void BKE_add_template_variables_for_render_path(blender::bke::path_templates::VariableMap &variables, const Scene &scene)
void BKE_add_template_variables_general(blender::bke::path_templates::VariableMap &variables, const ID *path_owner_id)
blender::Vector< blender::bke::path_templates::Error > BKE_path_validate_template(blender::StringRef path, const blender::bke::path_templates::VariableMap &template_variables)
void BKE_add_template_variables_for_node(blender::bke::path_templates::VariableMap &variables, const bNode &owning_node)
bool BKE_path_contains_template_syntax(blender::StringRef path)
blender::Vector< blender::bke::path_templates::Error > BKE_path_apply_template(char *path, int path_maxncpy, const blender::bke::path_templates::VariableMap &template_variables)
eReportType
Definition BKE_report.hh:33
#define C
Definition RandGen.cpp:29
long long int int64_t
bool add_path_up_to_file(blender::StringRef var_name, blender::StringRefNull full_path, blender::StringRef fallback)
std::optional< blender::StringRefNull > get_string(blender::StringRef name) const
bool add_filepath(blender::StringRef name, blender::StringRef value)
bool add_filename_only(blender::StringRef var_name, blender::StringRefNull full_path, blender::StringRef fallback)
std::optional< int64_t > get_integer(blender::StringRef name) const
bool add_string(blender::StringRef name, blender::StringRef value)
std::optional< blender::StringRefNull > get_filepath(blender::StringRef name) const
bool contains(blender::StringRef name) const
bool add_float(blender::StringRef name, double value)
bool remove(blender::StringRef name)
bool add_integer(blender::StringRef name, int64_t value)
std::optional< double > get_float(blender::StringRef name) const
static int left
static void error(const char *str)
bool operator==(const Error &left, const Error &right)
const char * name
Definition DNA_ID.h:414
PointerRNA * ptr
Definition wm_files.cc:4238