36 {0,
nullptr, 0,
nullptr,
nullptr},
45 "A string interpreted as a filepath. Will be used as-is (unescaped) when substituted into "
46 "part of a filepath"},
47 {0,
nullptr, 0,
nullptr,
nullptr},
62 "The default Blender OpenColorIO configuration. Works with both ACES workflows "
63 "and Blender specific views and color spaces"},
68 "Academy Color Encoding System 2.0, Studio Config v4.0.0. Less compatible with existing "
69 "assets and add-ons, but more consistent with other applications using the same "
75 "Academy Color Encoding System 1.3, Studio Config v2.2.0. Less compatible with existing "
76 "assets and add-ons, but more consistent with other applications using the same "
82 "OpenColorIO configuration from a file path or ocio:// URI"},
83 {0,
nullptr, 0,
nullptr,
nullptr},
120 rna_BlenderProject_update(bmain, scene, ptr);
142 switch (var->type_get()) {
143 case ProjectVariableType::STRING:
144 return RNA_ProjectVariableString;
145 case ProjectVariableType::INT:
146 return RNA_ProjectVariableInteger;
147 case ProjectVariableType::FLOAT:
148 return RNA_ProjectVariableFloat;
150 return RNA_UnknownType;
154static int rna_ProjectVariable_type_get(
PointerRNA *ptr)
159 var_type = int(var->type_get());
164static void rna_ProjectVariable_name_get(
PointerRNA *ptr,
char *value)
168 strcpy(value, var->name_get().c_str());
172static int rna_ProjectVariable_name_length(
PointerRNA *ptr)
182static void rna_ProjectVariable_name_set(
PointerRNA *ptr,
const char *value)
190 project->rename_variable(
project->find_variable_index(var), value);
194static void rna_ProjectVariable_description_get(
PointerRNA *ptr,
char *value)
198 strcpy(value, var->description_get().c_str());
202static int rna_ProjectVariable_description_length(
PointerRNA *ptr)
204 int description_length;
209 return description_length;
212static void rna_ProjectVariable_description_set(
PointerRNA *ptr,
const char *value)
220static int rna_ProjectVariableInteger_value_get(
PointerRNA *ptr)
230static void rna_ProjectVariableInteger_value_set(
PointerRNA *ptr,
int value)
238static float rna_ProjectVariableFloat_value_get(
PointerRNA *ptr)
248static void rna_ProjectVariableFloat_value_set(
PointerRNA *ptr,
float value)
256static void rna_ProjectVariableString_value_get(
PointerRNA *ptr,
char *value)
260 strcpy(value, var->value_string_get().c_str());
264static int rna_ProjectVariableString_value_length(
PointerRNA *ptr)
271 return string_length;
274static void rna_ProjectVariableString_value_set(
PointerRNA *ptr,
const char *value)
282static int rna_ProjectVariableString_subtype_get(
PointerRNA *ptr)
287 var_type = int(var->string_subtype_get());
292static void rna_ProjectVariableString_subtype_set(
PointerRNA *ptr,
int value)
302static void rna_BlenderProject_name_get(
PointerRNA *ptr,
char *value)
306 strcpy(value,
project->get_name().c_str());
310static int rna_BlenderProject_name_length(
PointerRNA *ptr)
315 name_length =
project->get_name().size();
320static void rna_BlenderProject_name_set(
PointerRNA *ptr,
const char *value)
327 if (name.is_empty()) {
336static void rna_BlenderProject_root_path_get(
PointerRNA *ptr,
char *value)
340 strcpy(value,
project->get_root_path().c_str());
344static int rna_BlenderProject_root_path_length(
PointerRNA *ptr)
346 int root_path_length;
349 root_path_length =
project->get_root_path().size();
351 return root_path_length;
354static int rna_BlenderProject_active_variable_index_get(
PointerRNA *ptr)
356 int active_variable_index;
359 active_variable_index =
project->active_variable_index;
361 return active_variable_index;
364static void rna_BlenderProject_active_variable_index_set(
PointerRNA *ptr,
int value)
368 project->active_variable_index = value;
372static void rna_BlenderProject_active_variable_index_range(
392 (
void *)
project->variables.begin(),
393 sizeof(std::unique_ptr<IDProperty, idprop::IDPropertyDeleter>),
400static int rna_iterator_BlenderProject_variables_length(
PointerRNA *ptr)
402 int variables_length;
405 variables_length =
project->variables.size();
407 return variables_length;
418 std::unique_ptr<IDProperty, idprop::IDPropertyDeleter> *var_ptr_ptr =
419 reinterpret_cast<std::unique_ptr<IDProperty, idprop::IDPropertyDeleter> *
>(
internal->ptr);
436 "Invalid variable name '%s': name must not be empty, must not start with a digit, "
437 "and must contain only alphanumeric characters and underscores.",
463 RNA_ProjectVariableString,
464 RNA_ProjectVariableInteger,
465 RNA_ProjectVariableFloat));
469 if (
project->remove_variable(var) == -1) {
484 if (from_index >=
project->variables.size()) {
489 if (to_index >=
project->variables.size()) {
494 project->move_variable(from_index, to_index);
503struct ProjectOCIOConfigPreset {
508static const ProjectOCIOConfigPreset project_ocio_config_presets[] = {
513static int rna_BlenderProject_ocio_config_get(
PointerRNA *ptr)
518 if (
project->ocio_config_use_path) {
524 if (path.is_empty()) {
528 for (
const auto &preset : project_ocio_config_presets) {
529 if (path == preset.uri) {
530 ocio_config = preset.value;
535 return int(ocio_config);
538static void rna_BlenderProject_ocio_config_set(
PointerRNA *ptr,
const int value)
551 for (
const auto &preset : project_ocio_config_presets) {
552 if (ocio_config == preset.value) {
557 if (
project->get_ocio_config_path() != path) {
558 project->set_ocio_config_path(path);
563static void rna_BlenderProject_ocio_config_path_get(
PointerRNA *ptr,
char *value)
567 strcpy(value,
project->get_ocio_config_path().c_str());
571static int rna_BlenderProject_ocio_config_path_length(
PointerRNA *ptr)
573 int ocio_config_path_length;
576 ocio_config_path_length =
project->get_ocio_config_path().size();
578 return ocio_config_path_length;
581static void rna_BlenderProject_ocio_config_path_set(
PointerRNA *ptr,
const char *value)
585 project->set_ocio_config_path(value);
589static std::optional<std::string> rna_BlenderProject_ocio_config_path_filter(
595static void rna_BlenderProject_splash_image_path_get(
PointerRNA *ptr,
char *value)
599 strcpy(value,
project->get_splash_image_path().c_str());
603static int rna_BlenderProject_splash_image_path_length(
PointerRNA *ptr)
605 int splash_image_path_length;
608 splash_image_path_length =
project->get_splash_image_path().size();
610 return splash_image_path_length;
613static void rna_BlenderProject_splash_image_path_set(
PointerRNA *ptr,
const char *value)
617 project->set_splash_image_path(value);
621static std::optional<std::string> rna_BlenderProject_splash_image_path_filter(
624 return "*.png;*.jpg;*.jpeg;*.webp";
627static bool rna_BlenderProject_is_dirty_get(
PointerRNA *ptr)
637static void rna_BlenderProject_is_dirty_set(
PointerRNA *ptr,
bool value)
657static int rna_BlenderProject_active_asset_library_get(
PointerRNA *ptr)
662 active_index =
project->active_asset_library_index;
667static void rna_BlenderProject_active_asset_library_set(
PointerRNA *ptr,
int value)
671 project->active_asset_library_index = value;
677 const char *directory,
678 const char *uuid_str,
679 const char *remote_url)
686 const bool is_remote = remote_url && remote_url[0];
689 std::optional<UUID> uuid = {};
690 bool invalid_uuid =
false;
693 uuid =
UUID(uuid_str);
695 catch (
const std::runtime_error &
e) {
700 const bool path_is_template =
true;
702 directory ? directory :
"", path_is_template, *
project);
706 is_remote ? remote_url : directory_str.c_str(),
717 new_library->invalid_uuid =
BLI_strdup(uuid_str);
720 int project_asset_index = -1;
723 project_asset_index++;
730 project->active_asset_library_index = project_asset_index;
739static void rna_BlenderProject_asset_library_remove(
bContext *
C,
754 int count_remaining = 0;
760 CLAMP(
project->active_asset_library_index, 0, count_remaining - 1);
780 srna =
RNA_def_struct(brna,
"ProjectVariableString",
"ProjectVariable");
786 "rna_ProjectVariableString_value_get",
787 "rna_ProjectVariableString_value_length",
788 "rna_ProjectVariableString_value_set");
795 "rna_ProjectVariableString_subtype_get",
796 "rna_ProjectVariableString_subtype_set",
806 srna =
RNA_def_struct(brna,
"ProjectVariableInteger",
"ProjectVariable");
812 "rna_ProjectVariableInteger_value_get",
813 "rna_ProjectVariableInteger_value_set",
823 srna =
RNA_def_struct(brna,
"ProjectVariableFloat",
"ProjectVariable");
829 prop,
"rna_ProjectVariableFloat_value_get",
"rna_ProjectVariableFloat_value_set",
nullptr);
852 "The variable's name. Must not start with a digit, and must contain "
853 "only alphanumeric characters and underscores");
855 "rna_ProjectVariable_name_get",
856 "rna_ProjectVariable_name_length",
857 "rna_ProjectVariable_name_set");
862 prop,
"Description",
"Description of the variable (e.g. purpose, semantics, etc.)");
864 "rna_ProjectVariable_description_get",
865 "rna_ProjectVariable_description_length",
866 "rna_ProjectVariable_description_set");
891 parm =
RNA_def_string(func,
"name",
"Variable", 0,
"Name",
"Name of the new variable");
898 "The data type of the variable");
900 func,
"variable",
"ProjectVariable",
"",
"Newly created project variable");
909 func,
"variable",
"ProjectVariable",
"Variable",
"The variable to remove");
916 func,
"Move a variable from one position to another in the list of variables");
923 "The index of the variable to move",
933 "The index to move the variable to",
946 srna =
RNA_def_struct(brna,
"ProjectAssetLibraryCollection",
nullptr);
949 func =
RNA_def_function(srna,
"new",
"rna_BlenderProject_asset_library_new");
960 "When set, add a remote asset library instead of a local directory");
962 parm =
RNA_def_pointer(func,
"library",
"ProjectAssetLibrary",
"",
"Newly added asset library");
965 func =
RNA_def_function(srna,
"remove",
"rna_BlenderProject_asset_library_remove");
968 parm =
RNA_def_pointer(func,
"library",
"ProjectAssetLibrary",
"",
"");
981 prop,
"rna_BlenderProject_is_dirty_get",
"rna_BlenderProject_is_dirty_set");
987 "rna_BlenderProject_name_get",
988 "rna_BlenderProject_name_length",
989 "rna_BlenderProject_name_set");
998 prop,
"rna_BlenderProject_root_path_get",
"rna_BlenderProject_root_path_length",
nullptr);
1004 prop,
"rna_BlenderProject_ocio_config_get",
"rna_BlenderProject_ocio_config_set",
nullptr);
1006 prop,
"OpenColorIO Configuration",
"OpenColorIO configuration to use for this project");
1014 "rna_BlenderProject_ocio_config_path_get",
1015 "rna_BlenderProject_ocio_config_path_length",
1016 "rna_BlenderProject_ocio_config_path_set");
1020 "OpenColorIO Configuration Path",
1021 "Path to the OpenColorIO configuration to use for this project. May be an absolute file "
1022 "path, project relative path with {project_root}, or an ocio:// built-in OpenColorIO "
1031 "rna_BlenderProject_splash_image_path_get",
1032 "rna_BlenderProject_splash_image_path_length",
1033 "rna_BlenderProject_splash_image_path_set");
1035 "rna_BlenderProject_splash_image_path_filter");
1039 "Image to show in the splash screen for this project. Expected size is 1000x500 pixels");
1044 "rna_BlenderProject_active_variable_index_get",
1045 "rna_BlenderProject_active_variable_index_set",
1046 "rna_BlenderProject_active_variable_index_range");
1048 prop,
"Active Project Variable",
"Index of the currently active variable in the UI");
1054 "rna_iterator_BlenderProject_variables_begin",
1055 "rna_iterator_array_next",
1056 "rna_iterator_array_end",
1057 "rna_iterator_BlenderProject_variables_get",
1058 "rna_iterator_BlenderProject_variables_length",
1067 "rna_BlenderProject_asset_library_list_begin",
1068 "rna_iterator_listbase_next",
1069 "rna_iterator_listbase_end",
1070 "rna_iterator_listbase_get",
1082 "rna_BlenderProject_active_asset_library_get",
1083 "rna_BlenderProject_active_asset_library_set",
1086 "Active Asset Library",
1087 "Index of the asset library being edited in the Project Settings UI");
Functions and classes for evaluating template expressions in filepaths.
#define ND_PROJECT_CHANGED
constexpr StringRefNull()
void string_subtype_set(ProjectVariableStringSubtype type)
void description_set(StringRef description)
StringRefNull description_get() const
float value_float_get() const
void value_set(StringRefNull value)
StringRefNull value_string_get() const
StringRefNull name_get() const
int value_int_get() const
constexpr int64_t size() const
void with_blender_project_write_lock(FunctionRef< void()> lambda)
void with_blender_project_read_lock(FunctionRef< void()> lambda)
bool is_valid_project_variable_name(StringRef name)
ProjectVariableStringSubtype
void WM_main_add_notifier(uint type, void *reference)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
static void rna_def_ProjectVariables(BlenderRNA *brna, PropertyRNA *cprop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
static void rna_def_project_variable_integer(BlenderRNA *brna)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
@ ASSET_LIBRARY_PROJECT_DEFINED
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
static void rna_def_project_asset_library_collection(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_path_template_type(PropertyRNA *prop, PropertyPathTemplateType path_template_type)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_project_variable_type_items[]
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
void ED_userpref_asset_library_remove(bContext *C, struct bUserAssetLibrary *asset_library)
static void rna_def_project_variable(BlenderRNA *brna)
struct bUserAssetLibrary * ED_userpref_asset_library_new(const struct bContext *C, const char *name, const char *dirpath, bUserAssetLibraryAddType library_type, bool is_project_defined, std::optional< UUID > uuid, std::optional< char * > auth_token)
void RNA_def_property_string_filepath_filter_func(PropertyRNA *prop, const char *filter)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static const EnumPropertyItem rna_enum_project_ocio_config_items[]
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_blender_project(BlenderRNA *brna)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
const EnumPropertyItem rna_enum_project_variable_string_subtype_items[]
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
static void rna_def_project_variable_float(BlenderRNA *brna)
Main * CTX_data_main(const bContext *C)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
static void rna_def_project_variable_string(BlenderRNA *brna)
@ PROP_PATH_SUPPORTS_TEMPLATES
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
static void rna_def_blender_project(BlenderRNA *brna)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
auto BKE_blender_project_write_callback(const Main *bmain, Fn lambda)
std::string BKE_blender_project_path_make_relative(StringRef path, bool path_is_template, const bke::BlenderProject &project)