|
Blender V5.0
|
#include <BKE_path_templates.hh>
Public Member Functions | |
| bool | contains (blender::StringRef name) const |
| bool | remove (blender::StringRef name) |
| bool | add_string (blender::StringRef name, blender::StringRef value) |
| bool | add_filepath (blender::StringRef name, blender::StringRef value) |
| bool | add_integer (blender::StringRef name, int64_t value) |
| bool | add_float (blender::StringRef name, double value) |
| std::optional< blender::StringRefNull > | get_string (blender::StringRef name) const |
| std::optional< blender::StringRefNull > | get_filepath (blender::StringRef name) const |
| std::optional< int64_t > | get_integer (blender::StringRef name) const |
| std::optional< double > | get_float (blender::StringRef name) const |
| bool | add_filename_only (blender::StringRef var_name, blender::StringRefNull full_path, blender::StringRef fallback) |
| bool | add_path_up_to_file (blender::StringRef var_name, blender::StringRefNull full_path, blender::StringRef fallback) |
Variables (names and associated values) for use in template substitution.
Note that this is not intended to be persistent storage, but rather is transient for collecting data that is relevant/available in a given templating context.
There are currently four supported variable types:
Names must be unique across all variable types: you can't have a string and integer both with the name "bob".
A filepath variable can contain either a full or partial filepath. The distinction between string and filepath variables exists because non-path strings may include phrases like and/or or A:Left, which shouldn't be interpreted with path semantics. When used in path templating, the contents of string variables are therefore sanitized (replacing /, etc.), but the contents of filepath variables are left as-is.
Definition at line 111 of file BKE_path_templates.hh.
| bool blender::bke::path_templates::VariableMap::add_filename_only | ( | blender::StringRef | var_name, |
| blender::StringRefNull | full_path, | ||
| blender::StringRef | fallback ) |
Add the filename (sans file extension) from the given path as a variable.
For example, if the full path is /home/bob/project_joe/scene_3.blend, then scene_3 is the value of the added variable.
If the path doesn't contain a filename, then fallback is used for the variable value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 133 of file path_templates.cc.
References add_filepath(), BLI_path_basename(), BLI_path_extension_or_end(), and blender::StringRefNull::c_str().
Referenced by BKE_add_template_variables_general(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::add_filepath | ( | blender::StringRef | name, |
| blender::StringRef | value ) |
Add a filepath variable with the given name and value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 70 of file path_templates.cc.
References contains(), and name.
Referenced by add_filename_only(), add_path_up_to_file(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::add_float | ( | blender::StringRef | name, |
| double | value ) |
Add a float variable with the given name and value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 88 of file path_templates.cc.
References contains(), and name.
Referenced by BKE_add_template_variables_for_render_path(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::add_integer | ( | blender::StringRef | name, |
| int64_t | value ) |
Add an integer variable with the given name and value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 79 of file path_templates.cc.
References contains(), and name.
Referenced by BKE_add_template_variables_for_render_path(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::add_path_up_to_file | ( | blender::StringRef | var_name, |
| blender::StringRefNull | full_path, | ||
| blender::StringRef | fallback ) |
Add the path up-to-but-not-including the filename as a variable.
For example, if the full path is /home/bob/project_joe/scene_3.blend, then /home/bob/project_joe/ is the value of the added variable.
If the path lacks either a filename or a path leading up to that filename, then fallback is used for the variable value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 154 of file path_templates.cc.
References add_filepath(), BLI_path_basename(), BLI_path_parent_dir(), blender::StringRefNull::c_str(), blender::StringRefBase::copy_unsafe(), blender::Vector< T, InlineBufferCapacity, Allocator >::data(), blender::StringRefBase::end(), blender::StringRefBase::is_empty(), and blender::StringRefBase::size().
Referenced by BKE_add_template_variables_general(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::add_string | ( | blender::StringRef | name, |
| blender::StringRef | value ) |
Add a string variable with the given name and value.
If there is already a variable with that name, regardless of type, the new variable is not added (no overwriting).
Definition at line 61 of file path_templates.cc.
References contains(), and name.
Referenced by BKE_add_template_variables_for_node(), BKE_add_template_variables_for_render_path(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::contains | ( | blender::StringRef | name | ) | const |
Check if a variable of the given name exists.
Definition at line 27 of file path_templates.cc.
References name.
Referenced by add_filepath(), add_float(), add_integer(), add_string(), and blender::bke::tests::TEST().
| std::optional< blender::StringRefNull > blender::bke::path_templates::VariableMap::get_filepath | ( | blender::StringRef | name | ) | const |
Fetch the value of the filepath variable with the given name.
Definition at line 106 of file path_templates.cc.
References name.
Referenced by eval_template(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
| std::optional< double > blender::bke::path_templates::VariableMap::get_float | ( | blender::StringRef | name | ) | const |
Fetch the value of the float variable with the given name.
Definition at line 124 of file path_templates.cc.
References name.
Referenced by eval_template(), and blender::bke::tests::TEST().
| std::optional< int64_t > blender::bke::path_templates::VariableMap::get_integer | ( | blender::StringRef | name | ) | const |
Fetch the value of the integer variable with the given name.
Definition at line 115 of file path_templates.cc.
References name.
Referenced by eval_template(), and blender::bke::tests::TEST().
| std::optional< blender::StringRefNull > blender::bke::path_templates::VariableMap::get_string | ( | blender::StringRef | name | ) | const |
Fetch the value of the string variable with the given name.
Definition at line 97 of file path_templates.cc.
References name.
Referenced by eval_template(), and blender::bke::tests::TEST().
| bool blender::bke::path_templates::VariableMap::remove | ( | blender::StringRef | name | ) |
Remove the variable with the given name.
Definition at line 44 of file path_templates.cc.
References name.
Referenced by blender::bke::tests::TEST().