diff options
Diffstat (limited to 'source/blender/makesrna/intern')
44 files changed, 1279 insertions, 635 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 980e3eadd34..0b43a5a6653 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -69,6 +69,7 @@ set(DEFSRC rna_packedfile.c rna_palette.c rna_particle.c + rna_pointcloud.c rna_pose.c rna_render.c rna_rigidbody.c @@ -82,7 +83,6 @@ set(DEFSRC rna_sound.c rna_space.c rna_speaker.c - rna_pointcloud.c rna_test.c rna_text.c rna_texture.c @@ -151,6 +151,16 @@ endif() unset(GENSRC_CFLAGS) +# NOTE: Disable clang-tidy because generated files are stored outside of the source, +# so the clang-tidy can not find our .clang-tidy and fall-backs to own set of rules +# which are too noisy for Blender. +# +# In the future clang-tidy would either need to be inlined checks and passed via the +# command line (instead of using .clang-tidy file). Or, maybe, there is a way to +# pass configuration file to the clang-tidy command. +unset(CMAKE_C_CLANG_TIDY) +unset(CMAKE_CXX_CLANG_TIDY) + set(SRC_RNA_INC ../RNA_access.h ../RNA_define.h @@ -165,6 +175,7 @@ set(SRC ${DEFSRC} ${APISRC} ../../../../intern/clog/clog.c + ../../../../intern/guardedalloc/intern/leak_detector.cc ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -350,7 +361,7 @@ blender_include_dirs( ../../imbuf ../../makesdna ../../nodes/ - ../../physics + ../../simulation ../../windowmanager ../../editors/include ../../render/extern/include diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 59087df16dd..bebb3a49c04 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -29,6 +29,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_system.h" /* for 'BLI_system_backtrace' stub. */ #include "BLI_utildefines.h" #include "RNA_define.h" @@ -96,8 +97,9 @@ static void rna_generate_static_parameter_prototypes(FILE *f, /* helpers */ #define WRITE_COMMA \ { \ - if (!first) \ + if (!first) { \ fprintf(f, ", "); \ + } \ first = 0; \ } \ (void)0 @@ -118,10 +120,12 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[]) FILE *file_test = fopen(orgfile, "rb"); \ if (file_test) { \ fclose(file_test); \ - if (fp_org) \ + if (fp_org) { \ fclose(fp_org); \ - if (fp_new) \ + } \ + if (fp_new) { \ fclose(fp_new); \ + } \ if (remove(orgfile) != 0) { \ CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", strerror(errno), orgfile); \ return -1; \ @@ -1080,21 +1084,26 @@ static char *rna_def_property_set_func( if (prop->flag & PROP_ID_SELF_CHECK) { rna_print_id_get(f, dp); - fprintf(f, " if (id == value.data) return;\n\n"); + fprintf(f, " if (id == value.data) {\n"); + fprintf(f, " return;\n"); + fprintf(f, " }\n"); } if (prop->flag & PROP_ID_REFCOUNT) { - fprintf(f, "\n if (data->%s)\n", dp->dnaname); + fprintf(f, "\n if (data->%s) {\n", dp->dnaname); fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname); - fprintf(f, " if (value.data)\n"); - fprintf(f, " id_us_plus((ID *)value.data);\n\n"); + fprintf(f, " }\n"); + fprintf(f, " if (value.data) {\n"); + fprintf(f, " id_us_plus((ID *)value.data);\n"); + fprintf(f, " }\n"); } else { PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL; if (type && (type->flag & STRUCT_ID)) { - fprintf(f, " if (value.data)\n"); - fprintf(f, " id_lib_extern((ID *)value.data);\n\n"); + fprintf(f, " if (value.data) {\n"); + fprintf(f, " id_lib_extern((ID *)value.data);\n"); + fprintf(f, " }\n"); } } @@ -1141,14 +1150,14 @@ static char *rna_def_property_set_func( if (dp->dnaarraylength == 1) { if (prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, - " if (%svalues[i]) data->%s |= (", + " if (%svalues[i]) { data->%s |= (", (dp->booleannegative) ? "!" : "", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, " << i);\n"); - fprintf(f, " else data->%s &= ~(", dp->dnaname); + fprintf(f, " << i); }\n"); + fprintf(f, " else { data->%s &= ~(", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, " << i);\n"); + fprintf(f, " << i); }\n"); } else { fprintf( @@ -1159,14 +1168,14 @@ static char *rna_def_property_set_func( else { if (prop->type == PROP_BOOLEAN && dp->booleanbit) { fprintf(f, - " if (%svalues[i]) data->%s[i] |= ", + " if (%svalues[i]) { data->%s[i] |= ", (dp->booleannegative) ? "!" : "", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); - fprintf(f, " else data->%s[i] &= ~", dp->dnaname); + fprintf(f, "; }\n"); + fprintf(f, " else { data->%s[i] &= ~", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); + fprintf(f, "; }\n"); } else if (rna_color_quantize(prop, dp)) { fprintf( @@ -1215,13 +1224,15 @@ static char *rna_def_property_set_func( else { rna_print_data_get(f, dp); if (prop->type == PROP_BOOLEAN && dp->booleanbit) { - fprintf( - f, " if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname); + fprintf(f, + " if (%svalue) { data->%s |= ", + (dp->booleannegative) ? "!" : "", + dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); - fprintf(f, " else data->%s &= ~", dp->dnaname); + fprintf(f, "; }\n"); + fprintf(f, " else { data->%s &= ~", dp->dnaname); rna_int_print(f, dp->booleanbit); - fprintf(f, ";\n"); + fprintf(f, "; }\n"); } else if (prop->type == PROP_ENUM && dp->enumbitflags) { fprintf(f, " data->%s &= ~", dp->dnaname); @@ -1278,7 +1289,7 @@ static char *rna_def_property_length_func( else { rna_print_data_get(f, dp); if (!(prop->flag & PROP_NEVER_NULL)) { - fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname); + fprintf(f, " if (data->%s == NULL) { return 0; }\n", dp->dnaname); } fprintf(f, " return strlen(data->%s);\n", dp->dnaname); } @@ -1393,8 +1404,9 @@ static char *rna_def_property_begin_func( getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); - fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr = %s(iter);\n", getfunc); + fprintf(f, "\n if (iter->valid) {\n"); + fprintf(f, " iter->ptr = %s(iter);", getfunc); + fprintf(f, "\n }\n"); fprintf(f, "}\n\n"); @@ -1479,14 +1491,15 @@ static char *rna_def_property_lookup_int_func(FILE *f, fprintf(f, " found = (index == -1 && iter.valid);\n"); fprintf(f, " }\n"); fprintf(f, " else {\n"); - fprintf(f, " while (index-- > 0 && internal->link)\n"); + fprintf(f, " while (index-- > 0 && internal->link) {\n"); fprintf(f, " internal->link = internal->link->next;\n"); + fprintf(f, " }\n"); fprintf(f, " found = (index == -1 && internal->link);\n"); fprintf(f, " }\n"); } fprintf(f, - " if (found) *r_ptr = %s_%s_get(&iter);\n", + " if (found) { *r_ptr = %s_%s_get(&iter); }\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " }\n\n"); @@ -1672,8 +1685,9 @@ static char *rna_def_property_next_func(FILE *f, getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); - fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr = %s(iter);\n", getfunc); + fprintf(f, "\n if (iter->valid) {\n"); + fprintf(f, " iter->ptr = %s(iter);", getfunc); + fprintf(f, "\n }\n"); fprintf(f, "}\n\n"); @@ -5131,7 +5145,10 @@ static void mem_error_cb(const char *errorStr) int main(int argc, char **argv) { - int totblock, return_status = 0; + int return_status = 0; + + MEM_init_memleak_detection(); + MEM_set_error_callback(mem_error_cb); CLG_init(); @@ -5153,12 +5170,5 @@ int main(int argc, char **argv) CLG_exit(); - totblock = MEM_get_memory_blocks_in_use(); - if (totblock != 0) { - fprintf(stderr, "Error Totblock: %d\n", totblock); - MEM_set_error_callback(mem_error_cb); - MEM_printmemlist(); - } - return return_status; } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 46001f27fef..e9ca0d577ce 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -96,6 +96,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = { # include "BKE_font.h" # include "BKE_global.h" /* XXX, remove me */ # include "BKE_idprop.h" +# include "BKE_idtype.h" # include "BKE_lib_override.h" # include "BKE_lib_query.h" # include "BKE_lib_remap.h" @@ -518,7 +519,7 @@ static ID *rna_ID_copy(ID *id, Main *bmain) static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) { - if (!BKE_lib_override_library_is_enabled() || !ID_IS_OVERRIDABLE_LIBRARY(id)) { + if (!ID_IS_OVERRIDABLE_LIBRARY(id)) { return NULL; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 79cf993e0cc..793552c5c34 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -558,9 +558,15 @@ static PropertyRNA *arraytypemap[IDP_NUMTYPES] = { (PropertyRNA *)&rna_PropertyGroupItem_double_array, }; -static void *rna_idproperty_check_ex(PropertyRNA **prop, - PointerRNA *ptr, - const bool return_rnaprop) +/* This function initializes a PropertyRNAOrID with all required info, from a given PropertyRNA + * and PointerRNA data. It deals properly with the three cases (static RNA, runtime RNA, and + * IDProperty). + * WARNING: given `ptr` PointerRNA is assumed to be a valid data one here, calling code is + * responsible to ensure that. + */ +void rna_property_rna_or_id_get(PropertyRNA *prop, + PointerRNA *ptr, + PropertyRNAOrID *r_prop_rna_or_id) { /* This is quite a hack, but avoids some complexity in the API. we * pass IDProperty structs as PropertyRNA pointers to the outside. @@ -568,36 +574,64 @@ static void *rna_idproperty_check_ex(PropertyRNA **prop, * distinguish it from IDProperty structs. If it is an ID property, * we look up an IDP PropertyRNA based on the type, and set the data * pointer to the IDProperty. */ + memset(r_prop_rna_or_id, 0, sizeof(*r_prop_rna_or_id)); - if ((*prop)->magic == RNA_MAGIC) { - if ((*prop)->flag & PROP_IDPROPERTY) { - IDProperty *idprop = rna_idproperty_find(ptr, (*prop)->identifier); + r_prop_rna_or_id->ptr = *ptr; + r_prop_rna_or_id->rawprop = prop; + + if (prop->magic == RNA_MAGIC) { + r_prop_rna_or_id->rnaprop = prop; + r_prop_rna_or_id->identifier = prop->identifier; - if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) { + r_prop_rna_or_id->is_array = prop->getlength || prop->totarraylength; + if (r_prop_rna_or_id->is_array) { + int arraylen[RNA_MAX_ARRAY_DIMENSION]; + r_prop_rna_or_id->array_len = (prop->getlength && ptr->data) ? + (uint)prop->getlength(ptr, arraylen) : + prop->totarraylength; + } + + if (prop->flag & PROP_IDPROPERTY) { + IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier); + + if (idprop != NULL && !rna_idproperty_verify_valid(ptr, prop, idprop)) { IDProperty *group = RNA_struct_idprops(ptr, 0); IDP_FreeFromGroup(group, idprop); - return NULL; + idprop = NULL; } - return idprop; + r_prop_rna_or_id->idprop = idprop; + r_prop_rna_or_id->is_set = idprop != NULL && (idprop->flag & IDP_FLAG_GHOST) == 0; } else { - return return_rnaprop ? *prop : NULL; + /* Full static RNA properties are always set. */ + r_prop_rna_or_id->is_set = true; } } + else { + IDProperty *idprop = (IDProperty *)prop; + /* Given prop may come from the custom properties of another data, ensure we get the one from + * given data ptr. */ + IDProperty *idprop_evaluated = rna_idproperty_find(ptr, idprop->name); + if (idprop_evaluated != NULL && idprop->type != idprop_evaluated->type) { + idprop_evaluated = NULL; + } - { - IDProperty *idprop = (IDProperty *)(*prop); + r_prop_rna_or_id->idprop = idprop_evaluated; + r_prop_rna_or_id->is_idprop = true; + /* Full IDProperties are always set, if it exists. */ + r_prop_rna_or_id->is_set = (idprop_evaluated != NULL); + r_prop_rna_or_id->identifier = idprop->name; if (idprop->type == IDP_ARRAY) { - *prop = arraytypemap[(int)(idprop->subtype)]; + r_prop_rna_or_id->rnaprop = arraytypemap[(int)(idprop->subtype)]; + r_prop_rna_or_id->is_array = true; + r_prop_rna_or_id->array_len = idprop_evaluated != NULL ? (uint)idprop_evaluated->len : 0; } else { - *prop = typemap[(int)(idprop->type)]; + r_prop_rna_or_id->rnaprop = typemap[(int)(idprop->type)]; } - - return idprop; } } @@ -605,14 +639,26 @@ static void *rna_idproperty_check_ex(PropertyRNA **prop, * or NULL (in case IDProp could not be found, or prop is a real RNA property). */ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr) { - return rna_idproperty_check_ex(prop, ptr, false); + PropertyRNAOrID prop_rna_or_id; + + rna_property_rna_or_id_get(*prop, ptr, &prop_rna_or_id); + + *prop = prop_rna_or_id.rnaprop; + return prop_rna_or_id.idprop; } /* This function always return the valid, real data pointer, be it a regular RNA property one, * or an IDProperty one. */ PropertyRNA *rna_ensure_property_realdata(PropertyRNA **prop, PointerRNA *ptr) { - return rna_idproperty_check_ex(prop, ptr, true); + PropertyRNAOrID prop_rna_or_id; + + rna_property_rna_or_id_get(*prop, ptr, &prop_rna_or_id); + + *prop = prop_rna_or_id.rnaprop; + return (prop_rna_or_id.is_idprop || prop_rna_or_id.idprop != NULL) ? + (PropertyRNA *)prop_rna_or_id.idprop : + prop_rna_or_id.rnaprop; } PropertyRNA *rna_ensure_property(PropertyRNA *prop) @@ -2102,9 +2148,7 @@ bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char * return false; } if (ID_IS_OVERRIDE_LIBRARY(id)) { - /* We need the real data property in case of IDProperty here... */ - PropertyRNA *real_prop = rna_ensure_property_realdata(&prop, ptr); - if (real_prop == NULL || !RNA_property_overridable_get(ptr, real_prop)) { + if (!RNA_property_overridable_get(ptr, prop)) { if (!(*r_info)[0]) { *r_info = N_("Can't edit this property from an override data-block"); } diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index 8cd8f80b7c8..0a739dcfc5a 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -61,7 +61,7 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop) /* Special handling for insertions of constraints or modifiers... */ /* TODO Note We may want to add a more generic system to RNA * (like a special property in struct of items) - * if we get more override-able collections, + * if we get more overrideable collections, * for now we can live with those special-cases handling I think. */ if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) { bConstraint *con = ptr->data; @@ -177,16 +177,13 @@ bool RNA_property_copy( } static int rna_property_override_diff(Main *bmain, - PointerRNA *ptr_a, - PointerRNA *ptr_b, - PropertyRNA *prop, - PropertyRNA *prop_a, - PropertyRNA *prop_b, + PropertyRNAOrID *prop_a, + PropertyRNAOrID *prop_b, const char *rna_path, const size_t rna_path_len, eRNACompareMode mode, IDOverrideLibrary *override, - const int flags, + const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags); bool RNA_property_equals( @@ -194,8 +191,12 @@ bool RNA_property_equals( { BLI_assert(ELEM(mode, RNA_EQ_STRICT, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE)); - return (rna_property_override_diff( - bmain, ptr_a, ptr_b, prop, NULL, NULL, NULL, 0, mode, NULL, 0, NULL) == 0); + PropertyRNAOrID prop_a, prop_b; + + rna_property_rna_or_id_get(prop, ptr_a, &prop_a); + rna_property_rna_or_id_get(prop, ptr_b, &prop_b); + + return (rna_property_override_diff(bmain, &prop_a, &prop_b, NULL, 0, mode, NULL, 0, NULL) == 0); } bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode) @@ -247,59 +248,42 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo * but we cannot determine an order (greater than/lesser than), we return 1. */ static int rna_property_override_diff(Main *bmain, - PointerRNA *ptr_a, - PointerRNA *ptr_b, - PropertyRNA *prop, - PropertyRNA *prop_a, - PropertyRNA *prop_b, + PropertyRNAOrID *prop_a, + PropertyRNAOrID *prop_b, const char *rna_path, const size_t rna_path_len, eRNACompareMode mode, IDOverrideLibrary *override, - const int flags, + const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags) { - if (prop != NULL) { - BLI_assert(prop_a == NULL && prop_b == NULL); - prop_a = prop; - prop_b = prop; - } + BLI_assert(!ELEM(NULL, prop_a, prop_b)); - if (ELEM(NULL, prop_a, prop_b)) { - return (prop_a == prop_b) ? 0 : 1; - } - - if (!RNA_property_comparable(ptr_a, prop_a) || !RNA_property_comparable(ptr_b, prop_b)) { + if (prop_a->rnaprop->flag_override & PROPOVERRIDE_NO_COMPARISON || + prop_b->rnaprop->flag_override & PROPOVERRIDE_NO_COMPARISON) { return 0; } if (mode == RNA_EQ_UNSET_MATCH_ANY) { - /* uninitialized properties are assumed to match anything */ - if (!RNA_property_is_set(ptr_a, prop_a) || !RNA_property_is_set(ptr_b, prop_b)) { + /* Unset properties are assumed to match anything. */ + if (!prop_a->is_set || !prop_b->is_set) { return 0; } } else if (mode == RNA_EQ_UNSET_MATCH_NONE) { - /* unset properties never match set properties */ - if (RNA_property_is_set(ptr_a, prop_a) != RNA_property_is_set(ptr_b, prop_b)) { + /* Unset properties never match set properties. */ + if (prop_a->is_set != prop_b->is_set) { return 1; } } - if (prop != NULL) { - /* Ensure we get real property data, be it an actual RNA property, - * or an IDProperty in disguise. */ - prop_a = rna_ensure_property_realdata(&prop_a, ptr_a); - prop_b = rna_ensure_property_realdata(&prop_b, ptr_b); - - if (ELEM(NULL, prop_a, prop_b)) { - return (prop_a == prop_b) ? 0 : 1; - } + if (prop_a->is_idprop && ELEM(NULL, prop_a->idprop, prop_b->idprop)) { + return (prop_a->idprop == prop_b->idprop) ? 0 : 1; } /* Check if we are working with arrays. */ - const bool is_array_a = RNA_property_array_check(prop_a); - const bool is_array_b = RNA_property_array_check(prop_b); + const bool is_array_a = prop_a->is_array; + const bool is_array_b = prop_b->is_array; if (is_array_a != is_array_b) { /* Should probably never happen actually... */ @@ -308,8 +292,8 @@ static int rna_property_override_diff(Main *bmain, } /* Get the length of the array to work with. */ - const int len_a = RNA_property_array_length(ptr_a, prop_a); - const int len_b = RNA_property_array_length(ptr_b, prop_b); + const uint len_a = prop_a->array_len; + const uint len_b = prop_b->array_len; if (len_a != len_b) { /* Do not handle override in that case, @@ -324,47 +308,44 @@ static int rna_property_override_diff(Main *bmain, RNAPropOverrideDiff override_diff = NULL; /* Special case for IDProps, we use default callback then. */ - if (prop_a->magic != RNA_MAGIC) { + if (prop_a->is_idprop) { override_diff = rna_property_override_diff_default; - if (prop_b->magic == RNA_MAGIC && prop_b->override_diff != override_diff) { + if (!prop_b->is_idprop && prop_b->rnaprop->override_diff != override_diff) { override_diff = NULL; } } - else if (prop_b->magic != RNA_MAGIC) { + else if (prop_b->is_idprop) { override_diff = rna_property_override_diff_default; - if (prop_a->override_diff != override_diff) { + if (prop_a->rnaprop->override_diff != override_diff) { override_diff = NULL; } } - else if (prop_a->override_diff == prop_b->override_diff) { - override_diff = prop_a->override_diff; + else if (prop_a->rnaprop->override_diff == prop_b->rnaprop->override_diff) { + override_diff = prop_a->rnaprop->override_diff; + if (override_diff == NULL) { + override_diff = rna_property_override_diff_default; + } } if (override_diff == NULL) { #ifndef NDEBUG printf("'%s' gives unmatching or NULL RNA diff callbacks, should not happen (%d vs. %d).\n", - rna_path ? - rna_path : - (prop_a->magic != RNA_MAGIC ? ((IDProperty *)prop_a)->name : prop_a->identifier), - prop_a->magic == RNA_MAGIC, - prop_b->magic == RNA_MAGIC); + rna_path ? rna_path : prop_a->identifier, + !prop_a->is_idprop, + !prop_b->is_idprop); #endif BLI_assert(0); return 1; } bool override_changed = false; - int diff_flags = flags; - if (!RNA_property_overridable_get(ptr_a, prop_a)) { + eRNAOverrideMatch diff_flags = flags; + if (!RNA_property_overridable_get(&prop_a->ptr, prop_a->rawprop)) { diff_flags &= ~RNA_OVERRIDE_COMPARE_CREATE; } const int diff = override_diff(bmain, - ptr_a, - ptr_b, prop_a, prop_b, - len_a, - len_b, mode, override, rna_path, @@ -426,10 +407,13 @@ static bool rna_property_override_operation_store(Main *bmain, } else if (prop_local->override_store == prop_reference->override_store) { override_store = prop_local->override_store; + if (override_store == NULL) { + override_store = rna_property_override_store_default; + } } if (ptr_storage != NULL && prop_storage->magic == RNA_MAGIC && - prop_storage->override_store != override_store) { + !ELEM(prop_storage->override_store, NULL, override_store)) { override_store = NULL; } @@ -512,10 +496,13 @@ static bool rna_property_override_operation_apply(Main *bmain, } else if (prop_dst->override_apply == prop_src->override_apply) { override_apply = prop_dst->override_apply; + if (override_apply == NULL) { + override_apply = rna_property_override_apply_default; + } } if (ptr_storage && prop_storage->magic == RNA_MAGIC && - prop_storage->override_apply != override_apply) { + !ELEM(prop_storage->override_apply, NULL, override_apply)) { override_apply = NULL; } @@ -612,38 +599,29 @@ bool RNA_struct_override_matches(Main *bmain, for (RNA_property_collection_begin(ptr_local, iterprop, &iter); iter.valid; RNA_property_collection_next(&iter)) { - PropertyRNA *prop_local = iter.ptr.data; - PropertyRNA *prop_reference = iter.ptr.data; - - /* Ensure we get real property data, be it an actual RNA property, - * or an IDProperty in disguise. */ - prop_local = rna_ensure_property_realdata(&prop_local, ptr_local); - prop_reference = rna_ensure_property_realdata(&prop_reference, ptr_reference); - - /* IDProps (custom properties) are even more of a PITA here, we cannot use - * `rna_ensure_property_realdata()` to deal with them, we have to use the path generated from - * `prop_local` (which is valid) to access to the actual reference counterpart... */ - if (prop_local != NULL && prop_local->magic != RNA_MAGIC && prop_local == prop_reference) { - /* We could also use (lower in this code, after rna_path has been computed): - * RNA_path_resolve_property(ptr_reference, rna_path, &some_rna_ptr, &prop_reference); - * But that would be much more costly, and would also fail when ptr_reference - * is not an ID pointer itself, so we'd need to rebuild it from its owner_id, then check that - * generated some_rna_ptr and ptr_reference do point to the same data, etc. - * For now, let's try that simple access, it won't cover all cases but should handle fine - * most basic custom properties situations. */ - prop_reference = (PropertyRNA *)rna_idproperty_find(ptr_reference, - ((IDProperty *)prop_local)->name); - } + PropertyRNA *rawprop = iter.ptr.data; + + PropertyRNAOrID prop_local; + PropertyRNAOrID prop_reference; - if (ELEM(NULL, prop_local, prop_reference)) { + rna_property_rna_or_id_get(rawprop, ptr_local, &prop_local); + rna_property_rna_or_id_get(rawprop, ptr_reference, &prop_reference); + + BLI_assert(prop_local.rnaprop != NULL); + BLI_assert(prop_local.rnaprop == prop_reference.rnaprop); + BLI_assert(prop_local.is_idprop == prop_reference.is_idprop); + + if ((prop_local.is_idprop && prop_local.idprop == NULL) || + (prop_reference.is_idprop && prop_reference.idprop == NULL)) { continue; } - if (ignore_non_overridable && !RNA_property_overridable_get(ptr_local, prop_local)) { + if (ignore_non_overridable && !RNA_property_overridable_get(&prop_local.ptr, rawprop)) { continue; } - if (RNA_property_override_flag(prop_local) & PROPOVERRIDE_IGNORE) { + if (!prop_local.is_idprop && + RNA_property_override_flag(prop_local.rnaprop) & PROPOVERRIDE_IGNORE) { continue; } @@ -665,11 +643,11 @@ bool RNA_struct_override_matches(Main *bmain, if (root_path) { BLI_assert(strlen(root_path) == root_path_len); - const char *prop_name = RNA_property_identifier(prop_local); + const char *prop_name = prop_local.identifier; const size_t prop_name_len = strlen(prop_name); /* Inlined building, much much more efficient. */ - if (prop_local->magic == RNA_MAGIC) { + if (!prop_local.is_idprop) { rna_path_len = root_path_len + 1 + prop_name_len; if (rna_path_len >= RNA_PATH_BUFFSIZE) { rna_path = MEM_mallocN(rna_path_len + 1, __func__); @@ -697,7 +675,7 @@ bool RNA_struct_override_matches(Main *bmain, } else { /* This is rather slow, but is not much called, so not really worth optimizing. */ - rna_path = RNA_path_from_ID_to_property(ptr_local, prop_local); + rna_path = RNA_path_from_ID_to_property(ptr_local, rawprop); if (rna_path != NULL) { rna_path_len = strlen(rna_path); } @@ -726,11 +704,8 @@ bool RNA_struct_override_matches(Main *bmain, eRNAOverrideMatchResult report_flags = 0; const int diff = rna_property_override_diff(bmain, - ptr_local, - ptr_reference, - NULL, - prop_local, - prop_reference, + &prop_local, + &prop_reference, rna_path, rna_path_len, RNA_EQ_STRICT, @@ -764,7 +739,7 @@ bool RNA_struct_override_matches(Main *bmain, /* We are allowed to restore to reference's values. */ if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDE_LIBRARY_OP_NOOP) { /* We should restore that property to its reference value */ - if (RNA_property_editable(ptr_local, prop_local)) { + if (RNA_property_editable(ptr_local, rawprop)) { IDOverrideLibraryPropertyOperation opop_tmp = { .operation = IDOVERRIDE_LIBRARY_OP_REPLACE, .subitem_reference_index = -1, @@ -774,8 +749,8 @@ bool RNA_struct_override_matches(Main *bmain, ptr_local, ptr_reference, NULL, - prop_local, - prop_reference, + rawprop, + rawprop, NULL, NULL, NULL, @@ -1077,7 +1052,8 @@ void RNA_struct_override_apply(Main *bmain, #endif } -static char *rna_property_override_property_real_id_owner(PointerRNA *ptr, +static char *rna_property_override_property_real_id_owner(Main *bmain, + PointerRNA *ptr, PropertyRNA *prop, ID **r_id) { @@ -1104,10 +1080,9 @@ static char *rna_property_override_property_real_id_owner(PointerRNA *ptr, rna_path_prefix = "shape_keys."; break; case ID_GR: - /* Master collection, TODO. */ - break; case ID_NT: - /* Root node trees, TODO. */ + /* Master collections, Root node trees. */ + owner_id = RNA_find_real_ID_and_path(bmain, id, &rna_path_prefix); break; default: BLI_assert(0); @@ -1132,13 +1107,15 @@ static char *rna_property_override_property_real_id_owner(PointerRNA *ptr, return NULL; } -IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr, +IDOverrideLibraryProperty *RNA_property_override_property_find(Main *bmain, + PointerRNA *ptr, PropertyRNA *prop, ID **r_owner_id) { char *rna_path; - if ((rna_path = rna_property_override_property_real_id_owner(ptr, prop, r_owner_id)) != NULL) { + if ((rna_path = rna_property_override_property_real_id_owner(bmain, ptr, prop, r_owner_id)) != + NULL) { IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find( (*r_owner_id)->override_library, rna_path); MEM_freeN(rna_path); @@ -1147,14 +1124,15 @@ IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr, return NULL; } -IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr, +IDOverrideLibraryProperty *RNA_property_override_property_get(Main *bmain, + PointerRNA *ptr, PropertyRNA *prop, bool *r_created) { ID *id; char *rna_path; - if ((rna_path = rna_property_override_property_real_id_owner(ptr, prop, &id)) != NULL) { + if ((rna_path = rna_property_override_property_real_id_owner(bmain, ptr, prop, &id)) != NULL) { IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( id->override_library, rna_path, r_created); MEM_freeN(rna_path); @@ -1164,10 +1142,15 @@ IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr, } IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_find( - PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict) + Main *bmain, + PointerRNA *ptr, + PropertyRNA *prop, + const int index, + const bool strict, + bool *r_strict) { ID *owner_id; - IDOverrideLibraryProperty *op = RNA_property_override_property_find(ptr, prop, &owner_id); + IDOverrideLibraryProperty *op = RNA_property_override_property_find(bmain, ptr, prop, &owner_id); if (!op) { return NULL; @@ -1178,6 +1161,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_fin } IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get( + Main *bmain, PointerRNA *ptr, PropertyRNA *prop, const short operation, @@ -1186,7 +1170,7 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get bool *r_strict, bool *r_created) { - IDOverrideLibraryProperty *op = RNA_property_override_property_get(ptr, prop, NULL); + IDOverrideLibraryProperty *op = RNA_property_override_property_get(bmain, ptr, prop, NULL); if (!op) { return NULL; @@ -1196,16 +1180,13 @@ IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get op, operation, NULL, NULL, index, index, strict, r_strict, r_created); } -eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr, +eRNAOverrideStatus RNA_property_override_library_status(Main *bmain, + PointerRNA *ptr, PropertyRNA *prop, const int index) { uint override_status = 0; - if (!BKE_lib_override_library_is_enabled()) { - return override_status; - } - if (!ptr || !prop || !ptr->owner_id || !ID_IS_OVERRIDE_LIBRARY(ptr->owner_id)) { return override_status; } @@ -1215,7 +1196,7 @@ eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr, } IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_find( - ptr, prop, index, false, NULL); + bmain, ptr, prop, index, false, NULL); if (opop != NULL) { override_status |= RNA_OVERRIDE_STATUS_OVERRIDDEN; if (opop->flag & IDOVERRIDE_LIBRARY_FLAG_MANDATORY) { diff --git a/source/blender/makesrna/intern/rna_access_internal.h b/source/blender/makesrna/intern/rna_access_internal.h index c7995746d08..73407123863 100644 --- a/source/blender/makesrna/intern/rna_access_internal.h +++ b/source/blender/makesrna/intern/rna_access_internal.h @@ -18,18 +18,18 @@ * \ingroup RNA */ -#ifndef __RNA_ACCESS_INTERNAL_H__ -#define __RNA_ACCESS_INTERNAL_H__ +#pragma once #include "BLI_utildefines.h" #include "rna_internal_types.h" struct IDProperty; +struct PropertyRNAOrID; -PropertyRNA *rna_ensure_property(PropertyRNA *prop); +void rna_property_rna_or_id_get(PropertyRNA *prop, + PointerRNA *ptr, + PropertyRNAOrID *r_prop_rna_or_id); void rna_idproperty_touch(struct IDProperty *idprop); struct IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name); - -#endif /* __ACCESS_RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index b139e4609cd..11b563dae52 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -237,12 +237,27 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = { {GP_FILL_DMODE_BOTH, "BOTH", 0, - "Default", + "All", "Use both visible strokes and edit lines as fill boundary limits"}, {GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits"}, {GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Edit Lines", "Use edit lines as fill boundary limits"}, {0, NULL, 0, NULL, NULL}}; +static EnumPropertyItem rna_enum_gpencil_fill_layers_modes_items[] = { + {GP_FILL_GPLMODE_VISIBLE, "VISIBLE", 0, "Visible", "Visible layers"}, + {GP_FILL_GPLMODE_ACTIVE, "ACTIVE", 0, "Active", "Only active layer"}, + {GP_FILL_GPLMODE_ABOVE, "ABOVE", 0, "Layer Above", "Layer above active"}, + {GP_FILL_GPLMODE_BELOW, "BELOW", 0, "Layer Below", "Layer below active"}, + {GP_FILL_GPLMODE_ALL_ABOVE, "ALL_ABOVE", 0, "All Above", "All layers above active"}, + {GP_FILL_GPLMODE_ALL_BELOW, "ALL_BELOW", 0, "All Below", "All layers below active"}, + {0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem rna_enum_gpencil_brush_modes_items[] = { + {GP_BRUSH_MODE_ACTIVE, "ACTIVE", 0, "Active", "Use current mode"}, + {GP_BRUSH_MODE_MATERIAL, "MATERIAL", 0, "Material", "Use always material mode"}, + {GP_BRUSH_MODE_VERTEXCOLOR, "VERTEXCOLOR", 0, "Vertex Color", "Use always Vertex Color mode"}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem rna_enum_gpencil_brush_paint_icons_items[] = { {GP_BRUSH_ICON_PENCIL, "PENCIL", ICON_GPBRUSH_PENCIL, "Pencil", ""}, {GP_BRUSH_ICON_PEN, "PEN", ICON_GPBRUSH_PEN, "Pen", ""}, @@ -359,7 +374,7 @@ static bool rna_BrushCapabilities_has_overlay_get(PointerRNA *ptr) static bool rna_BrushCapabilitiesSculpt_has_persistence_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; - return br->sculpt_tool == SCULPT_TOOL_LAYER; + return ELEM(br->sculpt_tool, SCULPT_TOOL_LAYER, SCULPT_TOOL_CLOTH); } static bool rna_BrushCapabilitiesSculpt_has_pinch_factor_get(PointerRNA *ptr) @@ -1519,7 +1534,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); prop = RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STENGTH_PRESSURE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STRENGTH_PRESSURE); RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); RNA_def_property_ui_text( prop, "Use Pressure Strength", "Use tablet pressure for color strength"); @@ -1640,6 +1655,18 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + prop = RNA_def_property(srna, "fill_layer_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "fill_layer_mode"); + RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_layers_modes_items); + RNA_def_property_ui_text(prop, "Layer Mode", "Layers used as boundaries"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "brush_draw_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "brush_draw_mode"); + RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_modes_items); + RNA_def_property_ui_text(prop, "Mode", "Preselected mode when using this brush"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + prop = RNA_def_property(srna, "trim", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_TRIM_STROKE); RNA_def_property_boolean_default(prop, false); @@ -1956,6 +1983,16 @@ static void rna_def_brush(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem brush_cloth_simulation_area_type_items[] = { + {BRUSH_CLOTH_SIMULATION_AREA_LOCAL, + "LOCAL", + 0, + "Local", + "Simulates only a specific area arround the brush limited by a fixed radius"}, + {BRUSH_CLOTH_SIMULATION_AREA_GLOBAL, "GLOBAL", 0, "Global", "Simulates the entire mesh"}, + {0, NULL, 0, NULL, NULL}, + }; + static const EnumPropertyItem brush_smooth_deform_type_items[] = { {BRUSH_SMOOTH_DEFORM_LAPLACIAN, "LAPLACIAN", @@ -1973,7 +2010,7 @@ static void rna_def_brush(BlenderRNA *brna) static const EnumPropertyItem brush_pose_deform_type_items[] = { {BRUSH_POSE_DEFORM_ROTATE_TWIST, "ROTATE_TWIST", 0, "Rotate/Twist", ""}, {BRUSH_POSE_DEFORM_SCALE_TRASLATE, "SCALE_TRANSLATE", 0, "Scale/Translate", ""}, - {BRUSH_POSE_DEFORM_SQUASH_STRETCH, "SQUASH_STRETCH", 0, "Squash/Stretch", ""}, + {BRUSH_POSE_DEFORM_SQUASH_STRETCH, "SQUASH_STRETCH", 0, "Squash & Stretch", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -1997,6 +2034,20 @@ static void rna_def_brush(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem brush_smear_deform_type_items[] = { + {BRUSH_SMEAR_DEFORM_DRAG, "DRAG", 0, "Drag", ""}, + {BRUSH_SMEAR_DEFORM_PINCH, "PINCH", 0, "Pinch", ""}, + {BRUSH_SMEAR_DEFORM_EXPAND, "EXPAND", 0, "Expand", ""}, + {0, NULL, 0, NULL, NULL}, + }; + + static const EnumPropertyItem brush_slide_deform_type_items[] = { + {BRUSH_SLIDE_DEFORM_DRAG, "DRAG", 0, "Drag", ""}, + {BRUSH_SLIDE_DEFORM_PINCH, "PINCH", 0, "Pinch", ""}, + {BRUSH_SLIDE_DEFORM_EXPAND, "EXPAND", 0, "Expand", ""}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "Brush", "ID"); RNA_def_struct_ui_text( srna, "Brush", "Brush data-block for storing brush settings for painting and sculpting"); @@ -2112,11 +2163,29 @@ static void rna_def_brush(BlenderRNA *brna) prop, "Force Falloff", "Shape used in the brush to apply force to the cloth"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "cloth_simulation_area_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, brush_cloth_simulation_area_type_items); + RNA_def_property_ui_text( + prop, + "Simulation Area", + "Part of the mesh that is going to be simulated when the stroke is active"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "smooth_deform_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, brush_smooth_deform_type_items); RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "smear_deform_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, brush_smear_deform_type_items); + RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "slide_deform_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, brush_slide_deform_type_items); + RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "pose_deform_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, brush_pose_deform_type_items); RNA_def_property_ui_text(prop, "Deformation", "Deformation type that is used in the brush"); @@ -2253,7 +2322,7 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Wet Persistence", - "Amount of wet paint that stays in the brush after applyig paint to the surface"); + "Amount of wet paint that stays in the brush after applying paint to the surface"); RNA_def_property_update(prop, 0, "rna_Brush_update"); prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR); @@ -2271,6 +2340,84 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tip Scale X", "Scale of the brush tip in the X axis"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_hardness_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_HARDNESS_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Use Pressure for Hardness", "Use pressure to modulate hardness"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "invert_hardness_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_HARDNESS_PRESSURE_INVERT); + RNA_def_property_ui_icon(prop, ICON_ARROW_LEFTRIGHT, 0); + RNA_def_property_ui_text( + prop, "Invert Pressure for Hardness", "Invert the modulation of pressure in hardness"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_flow_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_FLOW_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Use Pressure for Flow", "Use pressure to modulate flow"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "invert_flow_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_FLOW_PRESSURE_INVERT); + RNA_def_property_ui_icon(prop, ICON_ARROW_LEFTRIGHT, 0); + RNA_def_property_ui_text( + prop, "Invert Pressure for Flow", "Invert the modulation of pressure in flow"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_wet_mix_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_WET_MIX_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Use Pressure for Wet Mix", "Use pressure to modulate wet mix"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "invert_wet_mix_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_WET_MIX_PRESSURE_INVERT); + RNA_def_property_ui_icon(prop, ICON_ARROW_LEFTRIGHT, 0); + RNA_def_property_ui_text( + prop, "Invert Pressure for Wet Mix", "Invert the modulation of pressure in wet mix"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_wet_persistence_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_WET_PERSISTENCE_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text( + prop, "Use Pressure for Wet Persistence", "Use pressure to modulate wet persistence"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "invert_wet_persistence_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna( + prop, NULL, "paint_flags", BRUSH_PAINT_WET_PERSISTENCE_PRESSURE_INVERT); + RNA_def_property_ui_icon(prop, ICON_ARROW_LEFTRIGHT, 0); + RNA_def_property_ui_text(prop, + "Invert Pressure for Wet Persistence", + "Invert the modulation of pressure in wet persistence"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_density_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_DENSITY_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Use Pressure for Density", "Use pressure to modulate density"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "invert_density_pressure", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "paint_flags", BRUSH_PAINT_DENSITY_PRESSURE_INVERT); + RNA_def_property_ui_icon(prop, ICON_ARROW_LEFTRIGHT, 0); + RNA_def_property_ui_text( + prop, "Invert Pressure for Density", "Invert the modulation of pressure in density"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "dash_ratio", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "dash_ratio"); RNA_def_property_range(prop, 0.0f, 1.0f); @@ -2454,6 +2601,15 @@ static void rna_def_brush(BlenderRNA *brna) "Area to apply deformation falloff to the effects of the simulation"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "cloth_constraint_softbody_strength", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "cloth_constraint_softbody_strength"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text( + prop, + "Soft Body Influence", + "How much the simulation preserves the original shape, acting as a soft body"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "hardness", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "hardness"); RNA_def_property_range(prop, 0.0f, 1.0f); @@ -2665,11 +2821,32 @@ static void rna_def_brush(BlenderRNA *brna) prop, "Keep Anchor Point", "Keep the position of the last segment in the IK chain fixed"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_pose_lock_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_POSE_USE_LOCK_ROTATION); + RNA_def_property_ui_text(prop, + "Lock Rotation When Scaling", + "Do not rotate the segment when using the scale deform mode"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_connected_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_USE_CONNECTED_ONLY); RNA_def_property_ui_text(prop, "Connected Only", "Affect only topologically connected elements"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "use_cloth_pin_simulation_boundary", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY); + RNA_def_property_ui_text( + prop, + "Pin Simulation Boundary", + "Lock the position of the vertices in the simulation falloff area to avoid artifacts and " + "create a softer transitionwith with unnafected areas"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_cloth_collision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_CLOTH_USE_COLLISION); + RNA_def_property_ui_text(prop, "Enable Collision", "Collide with objects during the simulation"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); + prop = RNA_def_property(srna, "invert_to_scrape_fill", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERT_TO_SCRAPE_FILL); RNA_def_property_ui_text(prop, diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c index f9275ef1993..c25cea1b4b3 100644 --- a/source/blender/makesrna/intern/rna_cachefile.c +++ b/source/blender/makesrna/intern/rna_cachefile.c @@ -174,6 +174,32 @@ static void rna_def_cachefile(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Object Paths", "Paths of the objects inside the Alembic archive"); + /* ----------------- Alembic Velocity Attribute ----------------- */ + + prop = RNA_def_property(srna, "velocity_name", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, + "Velocity Attribute", + "Name of the Alembic attribute used for generating motion blur data"); + RNA_def_property_update(prop, 0, "rna_CacheFile_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + static const EnumPropertyItem velocity_unit_items[] = { + {CACHEFILE_VELOCITY_UNIT_SECOND, "SECOND", 0, "Second", ""}, + {CACHEFILE_VELOCITY_UNIT_FRAME, "FRAME", 0, "Frame", ""}, + {0, NULL, 0, NULL, NULL}, + }; + + prop = RNA_def_property(srna, "velocity_unit", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "velocity_unit"); + RNA_def_property_enum_items(prop, velocity_unit_items); + RNA_def_property_ui_text( + prop, + "Velocity Unit", + "Define how the velocity vectors are interpreted with regard to time, 'frame' means " + "the delta time is 1 frame, 'second' means the delta time is 1 / FPS"); + RNA_def_property_update(prop, 0, "rna_CacheFile_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_define_lib_overridable(false); rna_def_cachefile_object_paths(brna, prop); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 594b77ea1ad..e99bd531c65 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -34,7 +34,7 @@ #include "BKE_cloth.h" #include "BKE_modifier.h" -#include "BPH_mass_spring.h" +#include "SIM_mass_spring.h" #include "WM_api.h" #include "WM_types.h" @@ -482,18 +482,18 @@ static void rna_def_cloth_solver_result(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem status_items[] = { - {BPH_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"}, - {BPH_SOLVER_NUMERICAL_ISSUE, + {SIM_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"}, + {SIM_SOLVER_NUMERICAL_ISSUE, "NUMERICAL_ISSUE", 0, "Numerical Issue", "The provided data did not satisfy the prerequisites"}, - {BPH_SOLVER_NO_CONVERGENCE, + {SIM_SOLVER_NO_CONVERGENCE, "NO_CONVERGENCE", 0, "No Convergence", "Iterative procedure did not converge"}, - {BPH_SOLVER_INVALID_INPUT, + {SIM_SOLVER_INVALID_INPUT, "INVALID_INPUT", 0, "Invalid Input", diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 56ad8e2677b..60b6cc40792 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -702,7 +702,7 @@ static float rna_CurveMapping_evaluateF(struct CurveMapping *cumap, static void rna_CurveMap_initialize(struct CurveMapping *cumap) { - BKE_curvemapping_initialize(cumap); + BKE_curvemapping_init(cumap); } #else diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index c8abf774561..e6dceb5af72 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -41,7 +41,7 @@ const EnumPropertyItem rna_enum_context_mode_items[] = { {CTX_MODE_EDIT_ARMATURE, "EDIT_ARMATURE", 0, "Armature Edit", ""}, {CTX_MODE_EDIT_METABALL, "EDIT_METABALL", 0, "Metaball Edit", ""}, {CTX_MODE_EDIT_LATTICE, "EDIT_LATTICE", 0, "Lattice Edit", ""}, - {CTX_MODE_POSE, "POSE", 0, "Pose ", ""}, + {CTX_MODE_POSE, "POSE", 0, "Pose", ""}, {CTX_MODE_SCULPT, "SCULPT", 0, "Sculpt", ""}, {CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, {CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""}, diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 771235c85aa..1768d79fe8f 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -570,7 +570,7 @@ static void rna_Curve_body_set(PointerRNA *ptr, const char *value) Curve *cu = (Curve *)ptr->owner_id; - cu->len_wchar = len_chars; + cu->len_char32 = len_chars; cu->len = len_bytes; cu->pos = len_chars; @@ -1191,9 +1191,9 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) RNA_def_property_ui_text( prop, "Object Font", - "Use Objects as font characters (give font objects a common name " + "Use objects as font characters (give font objects a common name " "followed by the character they represent, eg. 'family-a', 'family-b', etc, " - "set this setting to 'family-', and turn on Vertex Duplication)"); + "set this setting to 'family-', and turn on Vertex Instancing)"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE); @@ -1206,7 +1206,7 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len_wchar"); + RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len_char32"); RNA_def_property_struct_type(prop, "TextCharacterFormat"); RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character"); diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index 1207f19b95f..94fdb130026 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -37,7 +37,7 @@ #ifdef RNA_RUNTIME static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) { - BKE_curve_transform(cu, (float(*)[4])mat, shape_keys, true); + BKE_curve_transform(cu, (const float(*)[4])mat, shape_keys, true); DEG_id_tag_update(&cu->id, 0); } diff --git a/source/blender/makesrna/intern/rna_curveprofile.c b/source/blender/makesrna/intern/rna_curveprofile.c index ce91fc79085..ee1c659fcd5 100644 --- a/source/blender/makesrna/intern/rna_curveprofile.c +++ b/source/blender/makesrna/intern/rna_curveprofile.c @@ -146,7 +146,7 @@ static void rna_CurveProfile_evaluate(struct CurveProfile *profile, static void rna_CurveProfile_initialize(struct CurveProfile *profile, int segments_len) { - BKE_curveprofile_initialize(profile, (short)segments_len); + BKE_curveprofile_init(profile, (short)segments_len); } static void rna_CurveProfile_update(struct CurveProfile *profile) diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index ca34f69ab1e..da1ed166eb2 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -551,7 +551,7 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna) prop, "Persistent ID", "Persistent identifier for inter-frame matching of objects with motion blur"); - RNA_def_property_array(prop, 2 * MAX_DUPLI_RECUR); + RNA_def_property_array(prop, MAX_DUPLI_RECUR); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_persistent_id_get", NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 3ae16f8577a..d5449a69cf6 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1635,7 +1635,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) /* TODO: setting this to true must ensure that all others in stack are turned off too... */ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE); - RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited "); + RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited"); RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_active_set"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_active_update"); RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1); diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index ab0cc6def6f..0a58f8af593 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -161,7 +161,7 @@ static void rna_Fluid_flow_reset(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Fluid_update(bmain, scene, ptr); } -static void rna_Fluid_domain_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Fluid_domain_data_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { # ifdef WITH_FLUID FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data; @@ -172,6 +172,39 @@ static void rna_Fluid_domain_reset(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Fluid_update(bmain, scene, ptr); } +static void rna_Fluid_domain_noise_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +{ +# ifdef WITH_FLUID + FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data; + BKE_fluid_modifier_reset(settings->fmd); +# endif + + rna_Fluid_noisecache_reset(bmain, scene, ptr); + rna_Fluid_update(bmain, scene, ptr); +} + +static void rna_Fluid_domain_mesh_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +{ +# ifdef WITH_FLUID + FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data; + BKE_fluid_modifier_reset(settings->fmd); +# endif + + rna_Fluid_meshcache_reset(bmain, scene, ptr); + rna_Fluid_update(bmain, scene, ptr); +} + +static void rna_Fluid_domain_particles_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +{ +# ifdef WITH_FLUID + FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data; + BKE_fluid_modifier_reset(settings->fmd); +# endif + + rna_Fluid_particlescache_reset(bmain, scene, ptr); + rna_Fluid_update(bmain, scene, ptr); +} + static void rna_Fluid_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { # ifdef WITH_FLUID @@ -232,7 +265,7 @@ static void rna_Fluid_flip_parts_update(Main *bmain, Scene *scene, PointerRNA *p if (fmd->domain->type != FLUID_DOMAIN_TYPE_LIQUID) { rna_Fluid_parts_delete(ptr, PART_FLUID_FLIP); fmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FLIP; - rna_Fluid_domain_reset(bmain, scene, ptr); + rna_Fluid_domain_data_reset(bmain, scene, ptr); return; } @@ -685,10 +718,10 @@ static int rna_FluidModifier_grid_get_length(PointerRNA *ptr, int length[RNA_MAX /* high resolution smoke */ int res[3]; - manta_smoke_turbulence_get_res(fds->fluid, res); + manta_noise_get_res(fds->fluid, res); size = res[0] * res[1] * res[2]; - density = manta_smoke_turbulence_get_density(fds->fluid); + density = manta_noise_get_density(fds->fluid); } else if (fds->fluid) { /* regular resolution */ @@ -757,7 +790,7 @@ static void rna_FluidModifier_density_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_lock(fds->fluid_mutex, THREAD_LOCK_READ); if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) { - density = manta_smoke_turbulence_get_density(fds->fluid); + density = manta_noise_get_density(fds->fluid); } else { density = manta_smoke_get_density(fds->fluid); @@ -804,11 +837,11 @@ static void rna_FluidModifier_color_grid_get(PointerRNA *ptr, float *values) } else { if (fds->flags & FLUID_DOMAIN_USE_NOISE) { - if (manta_smoke_turbulence_has_colors(fds->fluid)) { - manta_smoke_turbulence_get_rgba(fds->fluid, values, 0); + if (manta_noise_has_colors(fds->fluid)) { + manta_noise_get_rgba(fds->fluid, values, 0); } else { - manta_smoke_turbulence_get_rgba_fixed_color(fds->fluid, fds->active_color, values, 0); + manta_noise_get_rgba_fixed_color(fds->fluid, fds->active_color, values, 0); } } else { @@ -834,7 +867,7 @@ static void rna_FluidModifier_flame_grid_get(PointerRNA *ptr, float *values) BLI_rw_mutex_lock(fds->fluid_mutex, THREAD_LOCK_READ); if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) { - flame = manta_smoke_turbulence_get_flame(fds->fluid); + flame = manta_noise_get_flame(fds->fluid); } else { flame = manta_smoke_get_flame(fds->fluid); @@ -884,7 +917,7 @@ static void rna_FluidModifier_temperature_grid_get(PointerRNA *ptr, float *value BLI_rw_mutex_lock(fds->fluid_mutex, THREAD_LOCK_READ); if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) { - flame = manta_smoke_turbulence_get_flame(fds->fluid); + flame = manta_noise_get_flame(fds->fluid); } else { flame = manta_smoke_get_flame(fds->fluid); @@ -991,14 +1024,18 @@ static void rna_Fluid_flowtype_set(struct PointerRNA *ptr, int value) FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data; if (value != settings->type) { + short prev_value = settings->type; settings->type = value; - /* Force flow source to mesh */ + /* Force flow source to mesh for liquids. + * Also use different surface emission. Liquids should by default not emit around surface. */ if (value == FLUID_FLOW_TYPE_LIQUID) { rna_Fluid_flowsource_set(ptr, FLUID_FLOW_SOURCE_MESH); settings->surface_distance = 0.0f; } - else { + /* Use some surface emission when switching to a gas emitter. Gases should by default emit a + * bit around surface. */ + if (prev_value == FLUID_FLOW_TYPE_LIQUID) { settings->surface_distance = 1.5f; } } @@ -1350,7 +1387,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset"); /* fluid domain options */ @@ -1364,7 +1401,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "Resolution used for the fluid domain. Value corresponds to the longest domain side " "(resolution for other domain sides is calculated automatically)"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset"); prop = RNA_def_property(srna, "use_collision_border_front", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "border_collisions", FLUID_DOMAIN_BORDER_FRONT); @@ -1547,7 +1584,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "The noise simulation is scaled up by this factor (compared to the " "base resolution of the domain)"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_noise_reset"); prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "noise_type"); @@ -1555,7 +1592,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Noise Method", "Noise method which is used during the high-res simulation"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_noise_reset"); prop = RNA_def_property(srna, "use_noise", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_NOISE); @@ -1569,7 +1606,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "simulation_method"); RNA_def_property_enum_items(prop, simulation_methods); RNA_def_property_ui_text(prop, "Simulation Method", "Change the underlying simulation method"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset"); prop = RNA_def_property(srna, "flip_ratio", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 1.0); @@ -1644,12 +1681,21 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1.0); RNA_def_property_ui_range(prop, 0.01, 1.0, 0.05, -1); RNA_def_property_ui_text(prop, - "Obstacle-Fluid Threshold ", + "Obstacle-Fluid Threshold", "Determines how much fluid is allowed in an obstacle cell " "(higher values will tag a boundary cell as an obstacle easier " "and reduce the boundary smoothening effect)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + prop = RNA_def_property(srna, "sys_particle_maximum", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "sys_particle_maximum"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_text( + prop, + "System Maximum", + "Maximum number of fluid particles that are allowed in this simulation"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + /* diffusion options */ prop = RNA_def_property(srna, "use_diffusion", PROP_BOOLEAN, PROP_NONE); @@ -1657,7 +1703,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Use Diffusion", "Enable fluid diffusion settings (e.g. viscosity, surface tension)"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); prop = RNA_def_property(srna, "surface_tension", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.0); @@ -1724,7 +1770,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "resolution of the domain). For best meshing, it is recommended to " "adjust the mesh particle radius alongside this value"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_mesh_reset"); prop = RNA_def_property(srna, "mesh_generator", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mesh_generator"); @@ -1924,7 +1970,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "The particle simulation is scaled up by this factor (compared to the " "base resolution of the domain)"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_particles_reset"); prop = RNA_def_property(srna, "use_spray_particles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "particle_type", FLUID_DOMAIN_PARTICLE_SPRAY); @@ -2006,6 +2052,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, "Start", "Frame on which the simulation starts. This is the first frame that will be baked"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "cache_frame_end", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "cache_frame_end"); @@ -2015,6 +2062,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, "End", "Frame on which the simulation stops. This is the last frame that will be baked"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "cache_frame_offset", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "cache_frame_offset"); @@ -2024,6 +2072,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "Offset", "Frame offset that is used when loading the simulation from the cache. It is not considered " "when baking the simulation, only when loading it"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "cache_frame_pause_data", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "cache_frame_pause_data"); @@ -2047,6 +2096,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, NULL, "rna_Fluid_cachetype_mesh_set", "rna_Fluid_cachetype_mesh_itemf"); RNA_def_property_ui_text( prop, "File Format", "Select the file format to be used for caching surface data"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset"); prop = RNA_def_property(srna, "cache_data_format", PROP_ENUM, PROP_NONE); @@ -2056,6 +2106,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, NULL, "rna_Fluid_cachetype_data_set", "rna_Fluid_cachetype_volume_itemf"); RNA_def_property_ui_text( prop, "File Format", "Select the file format to be used for caching volumetric data"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); prop = RNA_def_property(srna, "cache_particle_format", PROP_ENUM, PROP_NONE); @@ -2065,6 +2116,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, NULL, "rna_Fluid_cachetype_particle_set", "rna_Fluid_cachetype_particle_itemf"); RNA_def_property_ui_text( prop, "File Format", "Select the file format to be used for caching particle data"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset"); prop = RNA_def_property(srna, "cache_noise_format", PROP_ENUM, PROP_NONE); @@ -2074,6 +2126,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop, NULL, "rna_Fluid_cachetype_noise_set", "rna_Fluid_cachetype_volume_itemf"); RNA_def_property_ui_text( prop, "File Format", "Select the file format to be used for caching noise data"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_noisecache_reset"); prop = RNA_def_property(srna, "cache_type", PROP_ENUM, PROP_NONE); @@ -2081,7 +2134,8 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, cache_types); RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_cachetype_set", NULL); RNA_def_property_ui_text(prop, "Type", "Change the cache type of the simulation"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_domain_reset"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_domain_data_reset"); prop = RNA_def_property(srna, "cache_resumable", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_RESUMABLE_CACHE); @@ -2091,6 +2145,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "Additional data will be saved so that the bake jobs can be resumed after pausing. Because " "more data will be written to disk it is recommended to avoid enabling this option when " "baking at high resolutions"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); prop = RNA_def_property(srna, "cache_directory", PROP_STRING, PROP_DIRPATH); @@ -2158,7 +2213,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "only needed if you plan to analyze the cache (e.g. view grids, velocity vectors, " "particles) in Mantaflow directly (outside of Blender) after baking the simulation"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset"); /* time options */ @@ -2343,7 +2398,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "openvdb_compression"); RNA_def_property_enum_items(prop, prop_compression_items); - RNA_def_property_ui_text(prop, "Compression", "facession method to be used"); + RNA_def_property_ui_text(prop, "Compression", "Compression method to be used"); prop = RNA_def_property(srna, "openvdb_data_depth", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "openvdb_data_depth"); @@ -2655,7 +2710,7 @@ static void rna_def_fluid_effector_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_EFFECTOR_USE_PLANE_INIT); RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset"); prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 1c39ad3a1a8..9519e3e1433 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -1817,8 +1817,7 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "MirrorGpencilModifier", "GpencilModifier"); - RNA_def_struct_ui_text( - srna, "Mirror Modifier", "Change stroke using lattice to deform modifier"); + RNA_def_struct_ui_text(srna, "Mirror Modifier", "Create mirroring strokes"); RNA_def_struct_sdna(srna, "MirrorGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 887bded8540..1c43815d3a2 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -67,7 +67,6 @@ static const EnumPropertyItem image_source_items[] = { # include "BKE_global.h" -# include "GPU_draw.h" # include "GPU_texture.h" # include "IMB_imbuf.h" @@ -200,7 +199,7 @@ static void rna_Image_gpu_texture_update(Main *UNUSED(bmain), Image *ima = (Image *)ptr->owner_id; if (!G.background) { - GPU_free_image(ima); + BKE_image_free_gputextures(ima); } WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); @@ -398,7 +397,7 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values) static int rna_Image_bindcode_get(PointerRNA *ptr) { Image *ima = (Image *)ptr->data; - GPUTexture *tex = ima->gputexture[TEXTARGET_TEXTURE_2D][0]; + GPUTexture *tex = ima->gputexture[TEXTARGET_2D][0]; return (tex) ? GPU_texture_opengl_bindcode(tex) : 0; } @@ -516,7 +515,7 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID; BKE_image_mark_dirty(ima, ibuf); if (!G.background) { - GPU_free_image(ima); + BKE_image_free_gputextures(ima); } WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 41c0e724234..6f876923e52 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -50,8 +50,6 @@ # include "DNA_image_types.h" # include "DNA_scene_types.h" -# include "GPU_glew.h" - # include "MEM_guardedalloc.h" static void rna_ImagePackedFile_save(ImagePackedFile *imapf, Main *bmain, ReportList *reports) @@ -222,23 +220,24 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame) BKE_imageuser_default(&iuser); iuser.framenr = frame; - GPUTexture *tex = GPU_texture_from_blender(image, &iuser, NULL, GL_TEXTURE_2D); + GPUTexture *tex = BKE_image_get_gpu_texture(image, &iuser, NULL); if (tex == NULL) { BKE_reportf(reports, RPT_ERROR, "Failed to load image texture '%s'", image->id.name + 2); - return (int)GL_INVALID_OPERATION; + /* TODO(fclem) this error code makes no sense for vulkan. */ + return 0x0502; /* GL_INVALID_OPERATION */ } - return GL_NO_ERROR; + return 0; /* GL_NO_ERROR */ } static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) { - int error = GL_NO_ERROR; + int error = 0; /* GL_NO_ERROR */ BKE_image_tag_time(image); - if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL) { + if (image->gputexture[TEXTARGET_2D][0] == NULL) { error = rna_Image_gl_load(image, reports, frame); } @@ -247,7 +246,7 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) static void rna_Image_gl_free(Image *image) { - GPU_free_image(image); + BKE_image_free_gputextures(image); /* remove the nocollect flag, image is available for garbage collection again */ image->flag &= ~IMA_NOCOLLECT; diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 0783addd78b..8045279eef2 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -18,11 +18,12 @@ * \ingroup RNA */ -#ifndef __RNA_INTERNAL_H__ -#define __RNA_INTERNAL_H__ +#pragma once #include "BLI_utildefines.h" +#include "BLI_compiler_attrs.h" + #include "rna_internal_types.h" #include "UI_resources.h" @@ -478,9 +479,11 @@ extern StructRNA RNA_PropertyGroupItem; extern StructRNA RNA_PropertyGroup; #endif -struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct PointerRNA *ptr); +struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, + struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, - struct PointerRNA *ptr); + struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; +struct PropertyRNA *rna_ensure_property(struct PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT; /* Override default callbacks. */ /* Default override callbacks for all types. */ @@ -489,12 +492,8 @@ struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, * Not obvious though, those are fairly more complicated than basic SDNA access. */ int rna_property_override_diff_default(struct Main *bmain, - struct PointerRNA *ptr_a, - struct PointerRNA *ptr_b, - struct PropertyRNA *prop_a, - struct PropertyRNA *prop_b, - const int len_a, - const int len_b, + struct PropertyRNAOrID *prop_a, + struct PropertyRNAOrID *prop_b, const int mode, struct IDOverrideLibrary *override, const char *rna_path, @@ -644,5 +643,3 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); : -FLT_MAX, double \ : -DBL_MAX) #endif - -#endif /* __RNA_INTERNAL_H__ */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 345d84fc5b1..01c406104d7 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_INTERNAL_TYPES_H__ -#define __RNA_INTERNAL_TYPES_H__ +#pragma once #include "DNA_listBase.h" @@ -41,6 +40,8 @@ struct Scene; struct StructRNA; struct bContext; +typedef struct IDProperty IDProperty; + /* store local properties here */ #define RNA_IDP_UI "_RNA_UI" @@ -155,24 +156,55 @@ typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *pr /* Handling override operations, and also comparison. */ +/** Structure storing all needed data to process all three kinds of RNA properties. */ +typedef struct PropertyRNAOrID { + PointerRNA ptr; + + /** The PropertyRNA passed as parameter, used to generate that structure's content: + * - Static RNA: The RNA property (same as `rnaprop`), never NULL. + * - Runtime RNA: The RNA property (same as `rnaprop`), never NULL. + * - IDProperty: The IDProperty, never NULL. + */ + PropertyRNA *rawprop; + /** The real RNA property of this property, never NULL: + * - Static RNA: The rna property, also gives direct access to the data (from any matching + * PointerRNA). + * - Runtime RNA: The rna property, does not directly gives access to the data. + * - IDProperty: The generic PropertyRNA matching its type. + */ + PropertyRNA *rnaprop; + /** The IDProperty storing the data of this property, may be NULL: + * - Static RNA: Always NULL. + * - Runtime RNA: The IDProperty storing the data of that property, may be NULL if never set yet. + * - IDProperty: The IDProperty, never NULL. + */ + IDProperty *idprop; + /** The name of the property. */ + const char *identifier; + + /** Whether this property is a 'pure' IDProperty or not. */ + bool is_idprop; + /** For runtime RNA properties, whether it is set, defined, or not. + * WARNING: This DOES take into account the `IDP_FLAG_GHOST` flag, i.e. it matches result of + * `RNA_property_is_set`. */ + bool is_set; + + bool is_array; + uint array_len; +} PropertyRNAOrID; + /** - * If \a override is NULL, merely do comparison between prop_a from ptr_a and prop_b from ptr_b, + * If \a override is NULL, merely do comparison between prop_a and prop_b, * following comparison mode given. * If \a override and \a rna_path are not NULL, it will add a new override operation for * overridable properties that differ and have not yet been overridden * (and set accordingly \a r_override_changed if given). * - * \note Given PropertyRNA are final (in case of IDProps...). - * \note In non-array cases, \a len values are 0. * \note \a override, \a rna_path and \a r_override_changed may be NULL pointers. */ typedef int (*RNAPropOverrideDiff)(struct Main *bmain, - struct PointerRNA *ptr_a, - struct PointerRNA *ptr_b, - struct PropertyRNA *prop_a, - struct PropertyRNA *prop_b, - const int len_a, - const int len_b, + struct PropertyRNAOrID *prop_a, + struct PropertyRNAOrID *prop_b, const int mode, struct IDOverrideLibrary *override, const char *rna_path, @@ -536,5 +568,3 @@ struct BlenderRNA { }; #define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont)) + 1)) - -#endif /* __RNA_INTERNAL_TYPES_H__ */ diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index b99457056fe..e7a898b97ae 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -458,7 +458,7 @@ static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop) NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer"); - /* Could call: ED_object_base_activate(C, rl->basact); + /* Could call: `ED_object_base_activate(C, view_layer->basact);` * but would be a bad level call and it seems the notifier is enough */ RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL); diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 1670e08325f..97702b06b6f 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -410,7 +410,7 @@ void RNA_def_main(BlenderRNA *brna) srna = RNA_def_struct(brna, "BlendData", NULL); RNA_def_struct_ui_text(srna, - "Blendfile Data", + "Blend-file Data", "Main data structure representing a .blend file and all its data-blocks"); RNA_def_struct_ui_icon(srna, ICON_BLENDER); @@ -436,7 +436,7 @@ void RNA_def_main(BlenderRNA *brna) prop = RNA_def_property(srna, "use_autopack", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Main_use_autopack_get", "rna_Main_use_autopack_set"); RNA_def_property_ui_text( - prop, "Use Autopack", "Automatically pack all external data into .blend file"); + prop, "Use Auto-pack", "Automatically pack all external data into .blend file"); prop = RNA_def_int_vector(srna, "version", diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 506bfdb8c75..bb5ec0d6835 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -3376,7 +3376,7 @@ static void rna_def_mesh(BlenderRNA *brna) /* readonly editmesh info - use for extrude menu */ prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex count in editmode"); + RNA_def_property_ui_text(prop, "Selected Vertex Total", "Selected vertex count in editmode"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h index 9c5b4f9d5b3..5e11be382ec 100644 --- a/source/blender/makesrna/intern/rna_mesh_utils.h +++ b/source/blender/makesrna/intern/rna_mesh_utils.h @@ -18,8 +18,7 @@ * \ingroup RNA */ -#ifndef __RNA_MESH_UTILS_H__ -#define __RNA_MESH_UTILS_H__ +#pragma once /* Macros to help reduce code clutter in rna_mesh.c */ @@ -123,5 +122,3 @@ BKE_mesh_update_customdata_pointers(me, true); \ } \ } - -#endif /* __RNA_MESH_UTILS_H__ */ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c92fe5ee508..05e11ffc919 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -302,7 +302,7 @@ const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = { {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, - "Beauty ", + "Beauty", "Split the quads in nice triangles, slower method"}, {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", @@ -1163,7 +1163,7 @@ static void rna_BevelModifier_update_segments(Main *bmain, Scene *scene, Pointer BevelModifierData *bmd = (BevelModifierData *)ptr->data; if (RNA_enum_get(ptr, "profile_type") == MOD_BEVEL_PROFILE_CUSTOM) { short segments = (short)RNA_int_get(ptr, "segments"); - BKE_curveprofile_initialize(bmd->custom_profile, segments); + BKE_curveprofile_init(bmd->custom_profile, segments); } rna_Modifier_update(bmain, scene, ptr); } @@ -1639,6 +1639,40 @@ static void rna_SimulationModifier_simulation_update(Main *bmain, Scene *scene, rna_Modifier_dependency_update(bmain, scene, ptr); } +static void rna_SimulationModifier_data_path_get(PointerRNA *ptr, char *value) +{ + SimulationModifierData *smd = ptr->data; + + if (smd->data_path) { + strcpy(value, smd->data_path); + } + else { + value[0] = '\0'; + } +} + +static int rna_SimulationModifier_data_path_length(PointerRNA *ptr) +{ + SimulationModifierData *smd = ptr->data; + return smd->data_path ? strlen(smd->data_path) : 0; +} + +static void rna_SimulationModifier_data_path_set(PointerRNA *ptr, const char *value) +{ + SimulationModifierData *smd = ptr->data; + + if (smd->data_path) { + MEM_freeN(smd->data_path); + } + + if (value[0]) { + smd->data_path = BLI_strdup(value); + } + else { + smd->data_path = NULL; + } +} + /** * Special set callback that just changes the first bit of the expansion flag. * This way the expansion state of all the sub-panels is not changed by RNA. @@ -1654,6 +1688,62 @@ static void rna_Modifier_show_expanded_set(PointerRNA *ptr, bool value) } } +/** + * Only check the first bit of the expansion flag for the main panel's expansion, + * maintaining compatibility with older versions where there was only one expansion + * value. + */ +static bool rna_Modifier_show_expanded_get(PointerRNA *ptr) +{ + ModifierData *md = ptr->data; + return md->ui_expand_flag & (1 << 0); +} + +static int rna_MeshSequenceCacheModifier_has_velocity_get(PointerRNA *ptr) +{ +# ifdef WITH_ALEMBIC + MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data; + return ABC_has_vec3_array_property_named(mcmd->reader, mcmd->cache_file->velocity_name); +# else + return false; + UNUSED_VARS(ptr); +# endif +} + +static int rna_MeshSequenceCacheModifier_read_velocity_get(PointerRNA *ptr) +{ +# ifdef WITH_ALEMBIC + MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data; + + if (mcmd->num_vertices == 0) { + return 0; + } + + if (mcmd->vertex_velocities) { + MEM_freeN(mcmd->vertex_velocities); + } + + mcmd->vertex_velocities = MEM_mallocN(sizeof(MeshCacheVertexVelocity) * mcmd->num_vertices, + "Mesh Cache Velocities"); + + int num_read = ABC_read_velocity_cache(mcmd->reader, + mcmd->cache_file->velocity_name, + mcmd->last_lookup_time, + mcmd->velocity_scale * mcmd->velocity_delta, + mcmd->num_vertices, + (float *)mcmd->vertex_velocities); + + if (num_read == -1 || num_read != mcmd->num_vertices) { + return false; + } + + return true; +# else + return false; + UNUSED_VARS(ptr); +# endif +} + #else /* NOTE: *MUST* return subdivision_type property. */ @@ -1773,6 +1863,12 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) prop, "Use Creases", "Use mesh edge crease information to sharpen edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "use_custom_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_UseCustomNormals); + RNA_def_property_ui_text( + prop, "Use Custom Normals", "Interpolates existing custom normals to resulting mesh"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + RNA_define_lib_overridable(false); } @@ -1974,6 +2070,12 @@ static void rna_def_modifier_multires(BlenderRNA *brna) prop, "Use Creases", "Use mesh edge crease information to sharpen edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "use_custom_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_UseCustomNormals); + RNA_def_property_ui_text( + prop, "Use Custom Normals", "Interpolates existing custom normals to resulting mesh"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + RNA_define_lib_overridable(false); } @@ -3200,12 +3302,12 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) "ORCO", 0, "Original Coords", - "Use base mesh vert coords as the rest position"}, + "Use base mesh vertex coords as the rest position"}, {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords", - "Use bind vert coords for rest position"}, + "Use bind vertex coords for rest position"}, {0, NULL, 0, NULL, NULL}, }; @@ -4002,8 +4104,8 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) }; static const EnumPropertyItem prop_affect_items[] = { - {0, "EDGES", 0, "Edges", "Affect only edges"}, - {MOD_BEVEL_VERT, "VERTICES", 0, "Vertices", "Affect only vertices"}, + {MOD_BEVEL_AFFECT_VERTICES, "VERTICES", 0, "Vertices", "Affect only vertices"}, + {MOD_BEVEL_AFFECT_EDGES, "EDGES", 0, "Edges", "Affect only edges"}, {0, NULL, 0, NULL, NULL}, }; @@ -4036,7 +4138,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments"); prop = RNA_def_property(srna, "affect", PROP_ENUM, PROP_NONE); /* as an enum */ - RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); + RNA_def_property_enum_sdna(prop, NULL, "affect_type"); RNA_def_property_enum_items(prop, prop_affect_items); RNA_def_property_ui_text(prop, "Affect", "Affect edges or vertices"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -5610,7 +5712,17 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 1024); RNA_def_property_ui_range(prop, 1, 32, 1, -1); - RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface"); + RNA_def_property_ui_text( + prop, "Render Resolution", "Resolution of the generated surface for rendering and baking"); + RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); + + prop = RNA_def_property(srna, "viewport_resolution", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "viewport_resolution"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 1, 1024); + RNA_def_property_ui_range(prop, 1, 32, 1, -1); + RNA_def_property_ui_text( + prop, "Viewport Resolution", "Viewport resolution of the generated surface"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_NONE); @@ -5644,7 +5756,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "wave_alignment"); - RNA_def_property_range(prop, 0.0, 10.0); + RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Wave Alignment", "How much the waves are aligned to each other"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); @@ -5721,7 +5833,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) prop = RNA_def_property(srna, "sharpen_peak_jonswap", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "sharpen_peak_jonswap"); - RNA_def_property_range(prop, 0.0, 10.0); + RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Sharpen peak", "Peak sharpening for 'JONSWAP' and 'TMA' models"); RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update"); @@ -5848,7 +5960,7 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna) static void rna_def_modifier_meshcache(BlenderRNA *brna) { static const EnumPropertyItem prop_format_type_items[] = { - {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""}, + {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD", ""}, {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -5869,7 +5981,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) }; static const EnumPropertyItem prop_interpolation_type_items[] = { - {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None ", ""}, + {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None", ""}, {MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""}, /* for cardinal we'd need to read 4x cache's */ // {MOD_MESHCACHE_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, @@ -6009,6 +6121,22 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) RNA_define_lib_overridable(false); } +static void rna_def_mesh_cache_velocities(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "MeshCacheVertexVelocity", NULL); + RNA_def_struct_ui_text(srna, "Mesh Cache Velocity", "Velocity attribute of an Alembic mesh"); + RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); + + prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_array(prop, 3); + RNA_def_property_float_sdna(prop, NULL, "vel"); + RNA_def_property_ui_text(prop, "Velocity", ""); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + static void rna_def_modifier_meshseqcache(BlenderRNA *brna) { StructRNA *srna; @@ -6051,6 +6179,35 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "velocity_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "velocity_scale"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_text( + prop, + "Velocity Scale", + "Multiplier used to control the magnitude of the velocity vectors for time effects"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + /* -------------------------- Velocity Vectors -------------------------- */ + + prop = RNA_def_property(srna, "vertex_velocities", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "vertex_velocities", "num_vertices"); + RNA_def_property_struct_type(prop, "MeshCacheVertexVelocity"); + RNA_def_property_ui_text( + prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); + + rna_def_mesh_cache_velocities(brna); + + prop = RNA_def_property(srna, "has_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Has Velocity Cache", ""); + RNA_def_property_boolean_funcs(prop, "rna_MeshSequenceCacheModifier_has_velocity_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "read_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Read Velocity Cache", ""); + RNA_def_property_boolean_funcs(prop, "rna_MeshSequenceCacheModifier_read_velocity_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_define_lib_overridable(false); } @@ -6859,6 +7016,10 @@ static void rna_def_modifier_simulation(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_SimulationModifier_simulation_update"); prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE); + RNA_def_property_string_funcs(prop, + "rna_SimulationModifier_data_path_get", + "rna_SimulationModifier_data_path_length", + "rna_SimulationModifier_data_path_set"); RNA_def_property_ui_text( prop, "Data Path", "Identifier of the simulation component that should be accessed"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -6921,7 +7082,8 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Modifier_show_expanded_set"); + RNA_def_property_boolean_funcs( + prop, "rna_Modifier_show_expanded_get", "rna_Modifier_show_expanded_set"); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index f3c73e75434..b94221ae936 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -218,7 +218,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna) RNA_def_property_ui_text( prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension"); - /* build timecodes */ + /* Build time-codes. */ prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6312c84cf9f..af07185ab4a 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -38,6 +38,7 @@ #include "BKE_animsys.h" #include "BKE_image.h" #include "BKE_node.h" +#include "BKE_simulation.h" #include "BKE_texture.h" #include "RNA_access.h" @@ -2848,6 +2849,14 @@ static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA * } } +static void rna_NodeSocketStandard_value_and_relation_update(struct bContext *C, PointerRNA *ptr) +{ + rna_NodeSocketStandard_value_update(C, ptr); + bNodeTree *ntree = (bNodeTree *)ptr->owner_id; + Main *bmain = CTX_data_main(C); + ntreeUpdateTree(bmain, ntree); +} + /* ******** Node Types ******** */ static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value) @@ -4421,7 +4430,7 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "sky_model"); RNA_def_property_enum_items(prop, prop_sky_type); RNA_def_property_ui_text(prop, "Sky Type", "Which sky model should be used"); - RNA_def_property_update(prop, 0, "rna_Node_update"); + RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update"); prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining"); @@ -4445,46 +4454,51 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_ui_text(prop, "Sun Disc", "Include the sun itself in the output"); RNA_def_property_boolean_sdna(prop, NULL, "sun_disc", 1); RNA_def_property_boolean_default(prop, true); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update"); prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc (angular diameter)"); + RNA_def_property_ui_text(prop, "Sun Size", "Size of sun disc"); RNA_def_property_range(prop, 0.0f, M_PI_2); RNA_def_property_float_default(prop, DEG2RADF(0.545)); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Sun Intensity", "Strength of sun"); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_ui_text(prop, "Sun Elevation", "Angle between sun and horizon"); + RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon"); RNA_def_property_range(prop, -M_PI_2, M_PI_2); RNA_def_property_float_default(prop, M_PI_2); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "sun_rotation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_ui_text(prop, "Sun Rotation", "Rotation of sun around zenith"); - RNA_def_property_range(prop, 0.0f, 2.0f * M_PI); RNA_def_property_float_default(prop, 0.0f); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "altitude", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Altitude", "Altitude height from sea level in meters"); - RNA_def_property_range(prop, 0, 60000); - RNA_def_property_int_default(prop, 0); + prop = RNA_def_property(srna, "altitude", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Altitude", "Height from sea level"); + RNA_def_property_range(prop, 0.0f, 60.0f); + RNA_def_property_float_default(prop, 0.0f); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "air_density", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_ui_text(prop, "Air", "Density of air molecules (Rayleigh scattering)"); + RNA_def_property_ui_text(prop, "Air", "Density of air molecules"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_float_default(prop, 1.0f); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "dust_density", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_ui_text(prop, "Dust", "Density of dust and water molecules (Mie scattering)"); + RNA_def_property_ui_text(prop, "Dust", "Density of dust molecules and water droplets"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_float_default(prop, 1.0f); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "ozone_density", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_ui_text(prop, "Ozone", "Density of Ozone layer (Ozone absorption)"); + RNA_def_property_ui_text(prop, "Ozone", "Density of Ozone layer"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_float_default(prop, 1.0f); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); @@ -6490,7 +6504,7 @@ static void def_cmp_channel_matte(StructRNA *srna) static const EnumPropertyItem algorithm_items[] = { {0, "SINGLE", 0, "Single", "Limit by single channel"}, - {1, "MAX", 0, "Max", "Limit by max of other channels "}, + {1, "MAX", 0, "Max", "Limit by max of other channels"}, {0, NULL, 0, NULL, NULL}, }; @@ -8361,6 +8375,8 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_NodeSocket_node_get", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "Node"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "Node", "Node owning this socket"); /* NB: the type property is used by standard sockets. @@ -8459,6 +8475,12 @@ static void rna_def_node_socket_interface(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input"); + prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDE_VALUE); + RNA_def_property_ui_text( + prop, "Hide Value", "Hide the socket input value even when the socket is not connected"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); + /* registration */ prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname"); @@ -8855,7 +8877,8 @@ static void rna_def_node_socket_object(BlenderRNA *brna, RNA_def_property_pointer_sdna(prop, NULL, "value"); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update"); + RNA_def_property_update( + prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_CONTEXT_UPDATE); /* socket interface */ @@ -8889,7 +8912,8 @@ static void rna_def_node_socket_image(BlenderRNA *brna, RNA_def_property_pointer_sdna(prop, NULL, "value"); RNA_def_property_struct_type(prop, "Image"); RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update"); + RNA_def_property_update( + prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_and_relation_update"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_CONTEXT_UPDATE); /* socket interface */ @@ -9316,6 +9340,8 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "parent"); RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll"); RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_struct_type(prop, "Node"); RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to"); @@ -9530,29 +9556,39 @@ static void rna_def_node_link(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "fromnode"); RNA_def_property_struct_type(prop, "Node"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "From node", ""); prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tonode"); RNA_def_property_struct_type(prop, "Node"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "To node", ""); prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "fromsock"); RNA_def_property_struct_type(prop, "NodeSocket"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "From socket", ""); prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "tosock"); RNA_def_property_struct_type(prop, "NodeSocket"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "To socket", ""); prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets"); } @@ -9891,7 +9927,7 @@ static void rna_def_composite_nodetree(BlenderRNA *brna) prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_VIEWER_BORDER); RNA_def_property_ui_text( - prop, "Viewer Border", "Use boundaries for viewer nodes and composite backdrop"); + prop, "Viewer Region", "Use boundaries for viewer nodes and composite backdrop"); RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update"); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 089410ffd25..08ca3f16b6d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -174,7 +174,7 @@ static const EnumPropertyItem parent_type_items[] = { #define INSTANCE_ITEMS_SHARED \ {0, "NONE", 0, "None", ""}, \ - {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Instantiate child objects on all vertices"}, \ + {OB_DUPLIVERTS, "VERTS", 0, "Vertices", "Instantiate child objects on all vertices"}, \ { \ OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces" \ } @@ -193,6 +193,12 @@ static EnumPropertyItem instance_items_nogroup[] = { INSTANCE_ITEMS_SHARED, {0, NULL, 0, NULL, NULL}, }; + +static EnumPropertyItem instance_items_pointcloud[] = { + {0, "NONE", 0, "None", ""}, + {OB_DUPLIVERTS, "POINTS", 0, "Points", "Instantiate child objects on all points"}, + {0, NULL, 0, NULL, NULL}, +}; #endif #undef INSTANCE_ITEMS_SHARED #undef INSTANCE_ITEM_COLLECTION @@ -707,6 +713,9 @@ static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext *UNUSED(C if (ob->type == OB_EMPTY) { item = instance_items; } + else if (ob->type == OB_POINTCLOUD) { + item = instance_items_pointcloud; + } else { item = instance_items_nogroup; } @@ -1579,7 +1588,8 @@ static void rna_Object_modifier_remove(Object *object, PointerRNA *md_ptr) { ModifierData *md = md_ptr->data; - if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == false) { + if (ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md) == + false) { /* error is already set */ return; } @@ -1591,7 +1601,7 @@ static void rna_Object_modifier_remove(Object *object, static void rna_Object_modifier_clear(Object *object, bContext *C) { - ED_object_modifier_clear(CTX_data_main(C), object); + ED_object_modifier_clear(CTX_data_main(C), CTX_data_scene(C), object); WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); } @@ -3241,7 +3251,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); + RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_IN_FRONT); RNA_def_property_ui_text(prop, "In Front", "Make the object draw in front of others"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 0b932f3236f..fa837df682a 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -809,7 +809,7 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr) if (fmd->domain->effector_weights == ew) { char name_esc[sizeof(md->name) * 2]; BLI_strescape(name_esc, md->name, sizeof(name_esc)); - return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc); + return BLI_sprintfN("modifiers[\"%s\"].domain_settings.effector_weights", name_esc); } } @@ -851,7 +851,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); } else if (!ob->pd->deflect && md) { - ED_object_modifier_remove(NULL, bmain, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); } WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 14d84ddb9c8..3067a5a9453 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -52,7 +52,7 @@ #ifdef RNA_RUNTIME static const EnumPropertyItem part_from_items[] = { - {PART_FROM_VERT, "VERT", 0, "Verts", ""}, + {PART_FROM_VERT, "VERT", 0, "Vertices", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL}, @@ -61,7 +61,7 @@ static const EnumPropertyItem part_from_items[] = { #ifndef RNA_RUNTIME static const EnumPropertyItem part_reactor_from_items[] = { - {PART_FROM_VERT, "VERT", 0, "Verts", ""}, + {PART_FROM_VERT, "VERT", 0, "Vertices", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL}, @@ -2887,7 +2887,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "userjit"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)"); + RNA_def_property_ui_text(prop, "Particles/Face", "Emission locations per face (0 = automatic)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index a41abb1a1dd..5b77632be79 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -27,6 +27,8 @@ #include "BLI_path_util.h" #include "BLI_utildefines.h" +#include "BPY_extern.h" + #include "DEG_depsgraph.h" #include "BKE_image.h" @@ -408,6 +410,19 @@ static PointerRNA rna_RenderEngine_camera_override_get(PointerRNA *ptr) } } +static void rna_RenderEngine_engine_frame_set(RenderEngine *engine, int frame, float subframe) +{ +# ifdef WITH_PYTHON + BPy_BEGIN_ALLOW_THREADS; +# endif + + RE_engine_frame_set(engine, frame, subframe); + +# ifdef WITH_PYTHON + BPy_END_ALLOW_THREADS; +# endif +} + static void rna_RenderResult_views_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { RenderResult *rr = (RenderResult *)ptr->data; @@ -673,7 +688,7 @@ static void rna_def_render_engine(BlenderRNA *brna) parm = RNA_def_string(func, "info", NULL, 0, "Info", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - func = RNA_def_function(srna, "frame_set", "RE_engine_frame_set"); + func = RNA_def_function(srna, "frame_set", "rna_RenderEngine_engine_frame_set"); RNA_def_function_ui_description(func, "Evaluate scene at a different frame (for motion blur)"); parm = RNA_def_int(func, "frame", 0, INT_MIN, INT_MAX, "Frame", "", INT_MIN, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -830,6 +845,14 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Use Eevee Viewport", "Uses Eevee for viewport shading in LookDev shading mode"); + prop = RNA_def_property(srna, "bl_use_gpu_context", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_GPU_CONTEXT); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_def_property_ui_text( + prop, + "Use GPU Context", + "Enable OpenGL context for the render method, for engines that render using OpenGL"); + prop = RNA_def_property(srna, "bl_use_shading_nodes_custom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES_CUSTOM); RNA_def_property_boolean_default(prop, true); diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 325c4e3caa9..450d148d8a3 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -75,6 +75,11 @@ const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = { "Mesh", "Mesh consisting of triangles only, allowing for more detailed interactions than convex " "hulls"}, + {RB_SHAPE_COMPOUND, + "COMPOUND", + ICON_MESH_DATA, + "Compound Parent", + "Combines all of its direct rigid body children into one rigid object."}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 623b5864f5b..9f5440be9f8 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -479,7 +479,7 @@ static StructRNA *rna_Property_refine(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); /* XXX ptr? */ + prop = rna_ensure_property(prop); switch (prop->type) { case PROP_BOOLEAN: @@ -504,90 +504,90 @@ static StructRNA *rna_Property_refine(PointerRNA *ptr) static void rna_Property_identifier_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); strcpy(value, ((PropertyRNA *)prop)->identifier); } static int rna_Property_identifier_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return strlen(prop->identifier); } static void rna_Property_name_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); strcpy(value, prop->name ? prop->name : ""); } static int rna_Property_name_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->name ? strlen(prop->name) : 0; } static void rna_Property_description_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); strcpy(value, prop->description ? prop->description : ""); } static int rna_Property_description_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->description ? strlen(prop->description) : 0; } static void rna_Property_translation_context_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); strcpy(value, prop->translation_context); } static int rna_Property_translation_context_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return strlen(prop->translation_context); } static int rna_Property_type_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->type; } static int rna_Property_subtype_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->subtype; } static PointerRNA rna_Property_srna_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna); } static int rna_Property_unit_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return RNA_SUBTYPE_UNIT(prop->subtype); } static int rna_Property_icon_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->icon; } @@ -698,7 +698,7 @@ static const EnumPropertyItem *rna_Property_tags_itemf(bContext *UNUSED(C), static int rna_Property_array_length_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return prop->totarraylength; } @@ -706,7 +706,7 @@ static void rna_Property_array_dimensions_get(PointerRNA *ptr, int dimensions[RNA_MAX_ARRAY_DIMENSION]) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); if (prop->arraydimension > 1) { for (int i = RNA_MAX_ARRAY_DIMENSION; i--;) { @@ -740,14 +740,14 @@ static bool rna_Property_is_runtime_get(PointerRNA *ptr) static bool rna_BoolProperty_default_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((BoolPropertyRNA *)prop)->defaultvalue; } static int rna_IntProperty_default_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->defaultvalue; } /* int/float/bool */ @@ -755,7 +755,7 @@ static int rna_NumberProperty_default_array_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); length[0] = prop->totarraylength; @@ -771,7 +771,7 @@ static bool rna_NumberProperty_is_array_get(PointerRNA *ptr) static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); if (prop->totarraylength > 0) { PointerRNA null_ptr = PointerRNA_NULL; RNA_property_int_get_default_array(&null_ptr, prop, values); @@ -781,7 +781,7 @@ static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values) static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); if (prop->totarraylength > 0) { PointerRNA null_ptr = PointerRNA_NULL; RNA_property_boolean_get_default_array(&null_ptr, prop, values); @@ -791,7 +791,7 @@ static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values) static void rna_FloatProperty_default_array_get(PointerRNA *ptr, float *values) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); if (prop->totarraylength > 0) { PointerRNA null_ptr = PointerRNA_NULL; RNA_property_float_get_default_array(&null_ptr, prop, values); @@ -801,103 +801,103 @@ static void rna_FloatProperty_default_array_get(PointerRNA *ptr, float *values) static int rna_IntProperty_hard_min_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->hardmin; } static int rna_IntProperty_hard_max_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->hardmax; } static int rna_IntProperty_soft_min_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->softmin; } static int rna_IntProperty_soft_max_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->softmax; } static int rna_IntProperty_step_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((IntPropertyRNA *)prop)->step; } static float rna_FloatProperty_default_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->defaultvalue; } static float rna_FloatProperty_hard_min_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->hardmin; } static float rna_FloatProperty_hard_max_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->hardmax; } static float rna_FloatProperty_soft_min_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->softmin; } static float rna_FloatProperty_soft_max_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->softmax; } static float rna_FloatProperty_step_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->step; } static int rna_FloatProperty_precision_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((FloatPropertyRNA *)prop)->precision; } static void rna_StringProperty_default_get(PointerRNA *ptr, char *value) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); strcpy(value, ((StringPropertyRNA *)prop)->defaultvalue); } static int rna_StringProperty_default_length(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return strlen(((StringPropertyRNA *)prop)->defaultvalue); } static int rna_StringProperty_max_length_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((StringPropertyRNA *)prop)->maxlength; } @@ -909,7 +909,7 @@ static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PropertyRNA *prop = (PropertyRNA *)ptr->data; EnumPropertyRNA *eprop; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); eprop = (EnumPropertyRNA *)prop; /* incompatible default attributes */ @@ -931,7 +931,7 @@ static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, static int rna_EnumProperty_default_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return ((EnumPropertyRNA *)prop)->defaultvalue; } @@ -950,7 +950,7 @@ static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, Point int totitem; bool free; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); /* eprop = (EnumPropertyRNA *)prop; */ RNA_property_enum_items_ex( @@ -1016,14 +1016,14 @@ static int rna_EnumPropertyItem_icon_get(PointerRNA *ptr) static PointerRNA rna_PointerProperty_fixed_type_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((PointerPropertyRNA *)prop)->type); } static PointerRNA rna_CollectionProperty_fixed_type_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - rna_idproperty_check(&prop, ptr); + prop = rna_ensure_property(prop); return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA *)prop)->item_type); } @@ -1250,6 +1250,7 @@ static int rna_property_override_diff_propptr(Main *bmain, IDOverrideLibrary *override, const char *rna_path, size_t rna_path_len, + const uint property_type, const char *rna_itemname_a, const char *rna_itemname_b, const int rna_itemindex_a, @@ -1257,6 +1258,8 @@ static int rna_property_override_diff_propptr(Main *bmain, const int flags, bool *r_override_changed) { + BLI_assert(ELEM(property_type, PROP_POINTER, PROP_COLLECTION)); + const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != NULL; @@ -1300,6 +1303,13 @@ static int rna_property_override_diff_propptr(Main *bmain, if (op != NULL) { BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false); + if (created || op->rna_prop_type == 0) { + op->rna_prop_type = property_type; + } + else { + BLI_assert(op->rna_prop_type == property_type); + } + if (created || rna_itemname_a != NULL || rna_itemname_b != NULL || rna_itemindex_a != -1 || rna_itemindex_b != -1) { BKE_lib_override_library_property_operation_get(op, @@ -1431,12 +1441,8 @@ static int rna_property_override_diff_propptr(Main *bmain, RNA_property_##_typename##_set((_ptr), (_prop), (_value))) int rna_property_override_diff_default(Main *bmain, - PointerRNA *ptr_a, - PointerRNA *ptr_b, - PropertyRNA *prop_a, - PropertyRNA *prop_b, - const int len_a, - const int len_b, + PropertyRNAOrID *prop_a, + PropertyRNAOrID *prop_b, const int mode, IDOverrideLibrary *override, const char *rna_path, @@ -1444,6 +1450,13 @@ int rna_property_override_diff_default(Main *bmain, const int flags, bool *r_override_changed) { + PointerRNA *ptr_a = &prop_a->ptr; + PointerRNA *ptr_b = &prop_b->ptr; + PropertyRNA *rawprop_a = prop_a->rawprop; + PropertyRNA *rawprop_b = prop_b->rawprop; + const uint len_a = prop_a->array_len; + const uint len_b = prop_b->array_len; + BLI_assert(len_a == len_b); /* Note: at this point, we are sure that when len_a is zero, @@ -1452,7 +1465,20 @@ int rna_property_override_diff_default(Main *bmain, const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != NULL; - switch (RNA_property_type(prop_a)) { + const bool no_ownership = (prop_a->rnaprop->flag & PROP_PTR_NO_OWNERSHIP) != 0; + const bool no_prop_name = (prop_a->rnaprop->flag_override & PROPOVERRIDE_NO_PROP_NAME) != 0; + + /* Note: we assume we only insert in ptr_a (i.e. we can only get new items in ptr_a), + * and that we never remove anything. */ + const bool use_collection_insertion = (prop_a->rnaprop->flag_override & + PROPOVERRIDE_LIBRARY_INSERTION) && + do_create; + + const uint rna_prop_type = RNA_property_type(prop_a->rnaprop); + bool created = false; + IDOverrideLibraryProperty *op = NULL; + + switch (rna_prop_type) { case PROP_BOOLEAN: { if (len_a) { bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; @@ -1463,16 +1489,14 @@ int rna_property_override_diff_default(Main *bmain, array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") : array_stack_b; - RNA_property_boolean_get_array(ptr_a, prop_a, array_a); - RNA_property_boolean_get_array(ptr_b, prop_b, array_b); + RNA_property_boolean_get_array(ptr_a, rawprop_a, array_a); + RNA_property_boolean_get_array(ptr_b, rawprop_b, array_b); const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a); if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1496,14 +1520,12 @@ int rna_property_override_diff_default(Main *bmain, return comp; } else { - const bool value_a = RNA_property_boolean_get(ptr_a, prop_a); - const bool value_b = RNA_property_boolean_get(ptr_b, prop_b); + const bool value_a = RNA_property_boolean_get(ptr_a, rawprop_a); + const bool value_b = RNA_property_boolean_get(ptr_b, rawprop_b); const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1528,16 +1550,14 @@ int rna_property_override_diff_default(Main *bmain, array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") : array_stack_b; - RNA_property_int_get_array(ptr_a, prop_a, array_a); - RNA_property_int_get_array(ptr_b, prop_b, array_b); + RNA_property_int_get_array(ptr_a, rawprop_a, array_a); + RNA_property_int_get_array(ptr_b, rawprop_b, array_b); const int comp = memcmp(array_a, array_b, sizeof(int) * len_a); if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1561,14 +1581,12 @@ int rna_property_override_diff_default(Main *bmain, return comp; } else { - const int value_a = RNA_property_int_get(ptr_a, prop_a); - const int value_b = RNA_property_int_get(ptr_b, prop_b); + const int value_a = RNA_property_int_get(ptr_a, rawprop_a); + const int value_b = RNA_property_int_get(ptr_b, rawprop_b); const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1593,16 +1611,14 @@ int rna_property_override_diff_default(Main *bmain, array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_b, "RNA equals") : array_stack_b; - RNA_property_float_get_array(ptr_a, prop_a, array_a); - RNA_property_float_get_array(ptr_b, prop_b, array_b); + RNA_property_float_get_array(ptr_a, rawprop_a, array_a); + RNA_property_float_get_array(ptr_b, rawprop_b, array_b); const int comp = memcmp(array_a, array_b, sizeof(float) * len_a); if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { BKE_lib_override_library_property_operation_get( @@ -1626,14 +1642,12 @@ int rna_property_override_diff_default(Main *bmain, return comp; } else { - const float value_a = RNA_property_float_get(ptr_a, prop_a); - const float value_b = RNA_property_float_get(ptr_b, prop_b); + const float value_a = RNA_property_float_get(ptr_a, rawprop_a); + const float value_b = RNA_property_float_get(ptr_b, rawprop_b); const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1649,14 +1663,12 @@ int rna_property_override_diff_default(Main *bmain, } case PROP_ENUM: { - const int value_a = RNA_property_enum_get(ptr_a, prop_a); - const int value_b = RNA_property_enum_get(ptr_b, prop_b); + const int value_a = RNA_property_enum_get(ptr_a, rawprop_a); + const int value_b = RNA_property_enum_get(ptr_b, rawprop_b); const int comp = value_a != value_b; if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1674,9 +1686,9 @@ int rna_property_override_diff_default(Main *bmain, char fixed_a[4096], fixed_b[4096]; int len_str_a, len_str_b; char *value_a = RNA_property_string_get_alloc( - ptr_a, prop_a, fixed_a, sizeof(fixed_a), &len_str_a); + ptr_a, rawprop_a, fixed_a, sizeof(fixed_a), &len_str_a); char *value_b = RNA_property_string_get_alloc( - ptr_b, prop_b, fixed_b, sizeof(fixed_b), &len_str_b); + ptr_b, rawprop_b, fixed_b, sizeof(fixed_b), &len_str_b); /* TODO we could do a check on length too, * but then we would not have a 'real' string comparison... * Maybe behind a eRNAOverrideMatch flag? */ @@ -1688,9 +1700,7 @@ int rna_property_override_diff_default(Main *bmain, const int comp = strcmp(value_a, value_b); if (do_create && comp != 0) { - bool created = false; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (op != NULL && created) { /* If not yet overridden... */ BKE_lib_override_library_property_operation_get( @@ -1712,16 +1722,13 @@ int rna_property_override_diff_default(Main *bmain, } case PROP_POINTER: { - if (STREQ(RNA_property_identifier(prop_a), "rna_type")) { + if (STREQ(prop_a->identifier, "rna_type")) { /* Dummy 'pass' answer, this is a meta-data and must be ignored... */ return 0; } else { - PointerRNA propptr_a = RNA_property_pointer_get(ptr_a, prop_a); - PointerRNA propptr_b = RNA_property_pointer_get(ptr_b, prop_b); - const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0; - const bool no_prop_name = (RNA_property_override_flag(prop_a) & - PROPOVERRIDE_NO_PROP_NAME) != 0; + PointerRNA propptr_a = RNA_property_pointer_get(ptr_a, rawprop_a); + PointerRNA propptr_b = RNA_property_pointer_get(ptr_b, rawprop_b); return rna_property_override_diff_propptr(bmain, &propptr_a, &propptr_b, @@ -1731,6 +1738,7 @@ int rna_property_override_diff_default(Main *bmain, override, rna_path, rna_path_len, + PROP_POINTER, NULL, NULL, -1, @@ -1742,14 +1750,6 @@ int rna_property_override_diff_default(Main *bmain, } case PROP_COLLECTION: { - /* Note: we assume we only insert in ptr_a (i.e. we can only get new items in ptr_a), - * and that we never remove anything. */ - const bool use_insertion = (RNA_property_override_flag(prop_a) & - PROPOVERRIDE_LIBRARY_INSERTION) && - do_create; - const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0; - const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != - 0; bool equals = true; bool abort = false; bool is_first_insert = true; @@ -1757,8 +1757,8 @@ int rna_property_override_diff_default(Main *bmain, int idx_b = 0; CollectionPropertyIterator iter_a, iter_b; - RNA_property_collection_begin(ptr_a, prop_a, &iter_a); - RNA_property_collection_begin(ptr_b, prop_b, &iter_b); + RNA_property_collection_begin(ptr_a, rawprop_a, &iter_a); + RNA_property_collection_begin(ptr_b, rawprop_b, &iter_b); char buff_a[4096]; char buff_prev_a[4096] = {0}; @@ -1773,7 +1773,7 @@ int rna_property_override_diff_default(Main *bmain, do { bool is_id = false, is_null = false, is_type_diff = false; - is_valid_for_insertion = use_insertion; + is_valid_for_insertion = use_collection_insertion; /* If false, it means that the whole data itself is different, * so no point in going inside of it at all! */ @@ -1846,10 +1846,8 @@ int rna_property_override_diff_default(Main *bmain, /* Collections do not support replacement of their data (except for collections of ID * pointers), since they do not support removing, only in *some* cases, insertion. We * also assume then that _a data is the one where things are inserted. */ - if (is_valid_for_insertion && use_insertion) { - bool created; - IDOverrideLibraryProperty *op = BKE_lib_override_library_property_get( - override, rna_path, &created); + if (is_valid_for_insertion && use_collection_insertion) { + op = BKE_lib_override_library_property_get(override, rna_path, &created); if (is_first_insert) { /* We need to clean up all possible existing insertion operations, @@ -1882,6 +1880,7 @@ int rna_property_override_diff_default(Main *bmain, prev_propname_a, idx_a - 1); # endif + op = NULL; } else if (is_id || is_valid_for_diffing) { if (equals || do_create) { @@ -1894,6 +1893,7 @@ int rna_property_override_diff_default(Main *bmain, override, rna_path, rna_path_len, + PROP_COLLECTION, propname_a, propname_b, idx_a, @@ -1930,7 +1930,7 @@ int rna_property_override_diff_default(Main *bmain, break; } - if (!(use_insertion && !(is_id || is_valid_for_diffing))) { + if (!(use_collection_insertion && !(is_id || is_valid_for_diffing))) { break; } @@ -1962,6 +1962,15 @@ int rna_property_override_diff_default(Main *bmain, break; } + if (op != NULL) { + if (created || op->rna_prop_type == 0) { + op->rna_prop_type = rna_prop_type; + } + else { + BLI_assert(op->rna_prop_type == rna_prop_type); + } + } + return 0; } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d141e6f3b19..262c9f87b66 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -924,13 +924,6 @@ static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS); } -static const char *rna_Scene_statistics_string_get(Scene *UNUSED(scene), - Main *UNUSED(bmain), - ViewLayer *view_layer) -{ - return ED_info_footer_string(view_layer); -} - static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images; @@ -2869,7 +2862,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) "3D Cursor", "Draw stroke at 3D cursor location"}, /* Weird, GP_PROJECT_VIEWALIGN is inverted. */ - {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view "}, + {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view"}, {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, @@ -3097,6 +3090,15 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Correct data such as UV's and vertex colors when transforming"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_transform_correct_keep_connected", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna( + prop, NULL, "uvcalc_flag", UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED); + RNA_def_property_ui_text( + prop, + "Keep Connected", + "During the Face Attributes correction, merge attributes connected to the same vertex"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automerge", AUTO_MERGE); RNA_def_property_ui_text( @@ -3456,7 +3458,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1); - RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap"); + RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam recalculates UV unwrap"); prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ); RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply"); @@ -3587,7 +3589,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, brush_size_unit_items); RNA_def_property_ui_text( - prop, "Radius Unit", "Measure brush size relative to the view or the scene "); + prop, "Radius Unit", "Measure brush size relative to the view or the scene"); } static void rna_def_curve_paint_settings(BlenderRNA *brna) @@ -4814,7 +4816,7 @@ void rna_def_freestyle_settings(BlenderRNA *brna) RNA_def_property_ui_text( prop, "View Map Cache", - "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); + "Keep the computed view map and avoid recalculating it if mesh geometry is unchanged"); RNA_def_property_update( prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update"); @@ -6463,7 +6465,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX); - RNA_def_property_ui_text(prop, "ShadersFX", "Display Shader FX"); + RNA_def_property_ui_text(prop, "Shaders Effects", "Display Shader Effects"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); prop = RNA_def_property(srna, "simplify_gpencil_tint", PROP_BOOLEAN, PROP_NONE); @@ -7275,9 +7277,6 @@ void RNA_def_scene(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - static const EnumPropertyItem audio_distance_model_items[] = { {0, "NONE", 0, "None", "No distance attenuation"}, {1, "INVERSE", 0, "Inverse", "Inverse distance model"}, @@ -7669,14 +7668,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); - /* Statistics */ - func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get"); - RNA_def_function_flag(func, FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); - RNA_def_function_return(func, parm); - /* Grease Pencil */ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "gpd"); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index e9c59fc5011..06c73fbb19c 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -98,13 +98,13 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf } } -static void rna_Scene_uvedit_aspect(Scene *scene, Object *ob, float *aspect) +static void rna_Scene_uvedit_aspect(Scene *UNUSED(scene), Object *ob, float *aspect) { if ((ob->type == OB_MESH) && (ob->mode == OB_MODE_EDIT)) { BMEditMesh *em; em = BKE_editmesh_from_object(ob); if (EDBM_uv_check(em)) { - ED_uvedit_get_aspect(scene, ob, em->bm, aspect, aspect + 1); + ED_uvedit_get_aspect(ob, aspect, aspect + 1); return; } } @@ -138,8 +138,7 @@ static void rna_SceneRender_get_frame_path( } static void rna_Scene_ray_cast(Scene *scene, - Main *bmain, - ViewLayer *view_layer, + Depsgraph *depsgraph, float origin[3], float direction[3], float ray_dist, @@ -151,8 +150,6 @@ static void rna_Scene_ray_cast(Scene *scene, float r_obmat[16]) { normalize_v3(direction); - - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); SnapObjectContext *sctx = ED_transform_snap_object_context_create(scene, 0); bool ret = ED_transform_snap_object_project_ray_ex(sctx, @@ -292,9 +289,9 @@ void RNA_api_scene(StructRNA *srna) /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); - RNA_def_function_flag(func, FUNC_USE_MAIN); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); - parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer"); + + parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "The current dependency graph"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 20ae69dc031..fb2a60db0fd 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -30,6 +30,8 @@ #include "DNA_screen_types.h" #include "DNA_workspace_types.h" +#include "ED_info.h" + const EnumPropertyItem rna_enum_region_type_items[] = { {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, @@ -90,6 +92,12 @@ static bool rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr)) return wm ? (ED_screen_animation_playing(wm) != NULL) : 0; } +static bool rna_Screen_is_scrubbing_get(PointerRNA *ptr) +{ + bScreen *screen = (bScreen *)ptr->data; + return screen->scrubbing; +} + static int rna_region_alignment_get(PointerRNA *ptr) { ARegion *region = ptr->data; @@ -223,7 +231,7 @@ static int rna_Area_ui_type_get(PointerRNA *ptr) * the area type is changing. * So manually do the lookup in those cases, but do not actually change area->type * since that prevents a proper exit when the area type is changing. - * Logic copied from `ED_area_initialize()`.*/ + * Logic copied from `ED_area_init()`.*/ SpaceType *type = area->type; if (type == NULL || area_changing) { type = BKE_spacetype_from_id(area_type); @@ -280,6 +288,11 @@ static void rna_View2D_view_to_region( } } +static const char *rna_Screen_statusbar_info_get(struct bScreen *screen, Main *bmain, bContext *C) +{ + return ED_info_statusbar_string(bmain, screen, C); +} + #else /* Area.spaces */ @@ -354,7 +367,7 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Area_type_update"); prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, DummyRNA_NULL_items); /* infact dummy */ + RNA_def_property_enum_items(prop, DummyRNA_NULL_items); /* in fact dummy */ RNA_def_property_enum_default(prop, SPACE_VIEW3D << 16); RNA_def_property_enum_funcs( prop, "rna_Area_ui_type_get", "rna_Area_ui_type_set", "rna_Area_ui_type_itemf"); @@ -530,6 +543,9 @@ static void rna_def_screen(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + srna = RNA_def_struct(brna, "Screen", "ID"); RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */ RNA_def_struct_ui_text( @@ -548,6 +564,12 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL); RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active"); + prop = RNA_def_property(srna, "is_scrubbing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Screen_is_scrubbing_get", NULL); + RNA_def_property_ui_text( + prop, "User is Scrubbing", "True when the user is scrubbing through time"); + prop = RNA_def_property(srna, "is_temporary", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_sdna(prop, NULL, "temp", 1); @@ -558,11 +580,18 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen"); + /* Status Bar. */ + prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR); - RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar"); + RNA_def_property_ui_text(prop, "Show Status Bar", "Show Status Bar"); RNA_def_property_update(prop, 0, "rna_Screen_bar_update"); + func = RNA_def_function(srna, "statusbar_info", "rna_Screen_statusbar_info_get"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT); + parm = RNA_def_string(func, "statusbar_info", NULL, 0, "Status Bar Info", ""); + RNA_def_function_return(func, parm); + /* Define Anim Playback Areas */ prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 7342879e9e6..0cfc6fd569c 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -749,6 +749,25 @@ static IDProperty *rna_Sequence_idprops(PointerRNA *ptr, bool create) return seq->prop; } +static bool rna_MovieSequence_reload_if_needed(ID *scene_id, Sequence *seq, Main *bmain) +{ + Scene *scene = (Scene *)scene_id; + bool has_reloaded; + bool can_produce_frames; + + BKE_sequence_movie_reload_if_needed(bmain, scene, seq, &has_reloaded, &can_produce_frames); + + if (has_reloaded && can_produce_frames) { + BKE_sequence_calc(scene, seq); + BKE_sequence_invalidate_cache_raw(scene, seq); + + DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); + WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); + } + + return can_produce_frames; +} + static PointerRNA rna_MovieSequence_metadata_get(Sequence *seq) { if (seq == NULL || seq->anims.first == NULL) { @@ -843,6 +862,43 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) return BKE_sequence_effect_get_num_inputs(seq->type); } +static void rna_Sequence_input_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports, + int input_num) +{ + + Sequence *seq = ptr->data; + Sequence *input = ptr_value.data; + + if (BKE_sequencer_render_loop_check(input, seq)) { + BKE_report(reports, RPT_ERROR, "Cannot reassign inputs: recursion detected"); + return; + } + + switch (input_num) { + case 1: + seq->seq1 = input; + break; + case 2: + seq->seq2 = input; + break; + } +} + +static void rna_Sequence_input_1_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports) +{ + rna_Sequence_input_set(ptr, ptr_value, reports, 1); +} + +static void rna_Sequence_input_2_set(PointerRNA *ptr, + PointerRNA ptr_value, + struct ReportList *reports) +{ + rna_Sequence_input_set(ptr, ptr_value, reports, 2); +} # if 0 static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { @@ -1253,6 +1309,24 @@ static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); } +static void rna_SequenceModifier_strip_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + SequenceModifierData *smd = ptr->data; + Scene *scene = (Scene *)ptr->owner_id; + Editing *ed = BKE_sequencer_editing_get(scene, false); + Sequence *seq = sequence_get_by_modifier(ed, smd); + Sequence *target = (Sequence *)value.data; + + if (target != NULL && BKE_sequencer_render_loop_check(target, seq)) { + BKE_report(reports, RPT_ERROR, "Recursion detected, can not use this strip"); + return; + } + + smd->mask_sequence = target; +} + static float rna_Sequence_fps_get(PointerRNA *ptr) { Scene *scene = (Scene *)ptr->owner_id; @@ -2126,7 +2200,7 @@ static void rna_def_proxy(StructRNA *srna) prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY); RNA_def_property_ui_text( - prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip"); + prop, "Use Proxy / Timecode", "Use a preview proxy and/or time-code index for this strip"); RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); @@ -2174,6 +2248,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "seq1"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_input_1_set", NULL, NULL); RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip"); } @@ -2181,6 +2256,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count) prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "seq2"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_input_2_set", NULL, NULL); RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip"); } @@ -2385,6 +2461,13 @@ static void rna_def_movie(BlenderRNA *brna) "rna_Sequence_filepath_set"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update"); + func = RNA_def_function(srna, "reload_if_needed", "rna_MovieSequence_reload_if_needed"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); + /* return type */ + parm = RNA_def_boolean( + func, "can_produce_frames", 0, "True if the strip can produce frames, False otherwise", ""); + RNA_def_function_return(func, parm); + /* metadata */ func = RNA_def_function(srna, "metadata", "rna_MovieSequence_metadata_get"); RNA_def_function_ui_description(func, "Retrieve metadata of the movie file"); @@ -3027,8 +3110,11 @@ static void rna_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence"); - RNA_def_property_pointer_funcs( - prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll"); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_SequenceModifier_strip_set", + NULL, + "rna_SequenceModifier_otherSequence_poll"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update"); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 28603132c77..59cedf8fcb8 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -79,7 +79,6 @@ static Sequence *alloc_generic_sequence( Editing *ed, const char *name, int frame_start, int channel, int type, const char *file) { Sequence *seq; - Strip *strip; StripElem *se; seq = BKE_sequence_alloc(ed->seqbasep, frame_start, channel, type); @@ -87,8 +86,7 @@ static Sequence *alloc_generic_sequence( BLI_strncpy(seq->name + 2, name, sizeof(seq->name) - 2); BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); - seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); - seq->strip->us = 1; + Strip *strip = seq->strip; if (file) { strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); @@ -207,33 +205,28 @@ static Sequence *rna_Sequences_new_image(ID *id, return seq; } -static Sequence *rna_Sequences_new_movie(ID *id, - Editing *ed, - ReportList *reports, - const char *name, - const char *file, - int channel, - int frame_start) +static Sequence *rna_Sequences_new_movie( + ID *id, Editing *ed, const char *name, const char *file, int channel, int frame_start) { Scene *scene = (Scene *)id; Sequence *seq; StripAnim *sanim; - struct anim *an = openanim(file, IB_rect, 0, NULL); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file); + struct anim *an = openanim(file, IB_rect, 0, NULL); if (an == NULL) { - BKE_report(reports, RPT_ERROR, "Sequences.new_movie: unable to open movie file"); - return NULL; + /* Without anim, the strip gets duration 0, which makes it impossible to select in the UI. */ + seq->len = 1; } + else { + sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); + BLI_addtail(&seq->anims, sanim); + sanim->anim = an; - seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file); - - sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); - BLI_addtail(&seq->anims, sanim); - sanim->anim = an; - - seq->anim_preseek = IMB_anim_get_preseek(an); - seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN); + seq->anim_preseek = IMB_anim_get_preseek(an); + seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN); + } BKE_sequence_calc_disp(scene, seq); BKE_sequence_invalidate_cache_composite(scene, seq); @@ -377,13 +370,14 @@ static void rna_Sequences_remove( Sequence *seq = seq_ptr->data; Scene *scene = (Scene *)id; - if (BLI_remlink_safe(&ed->seqbase, seq) == false) { + if (BLI_findindex(&ed->seqbase, seq) == -1) { BKE_reportf( reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2); return; } - BKE_sequence_free(scene, seq, true); + BKE_sequencer_flag_for_removal(scene, &ed->seqbase, seq); + BKE_sequencer_remove_flagged_sequences(scene, &ed->seqbase); RNA_POINTER_INVALIDATE(seq_ptr); DEG_relations_tag_update(bmain); @@ -506,7 +500,7 @@ void RNA_api_sequence_strip(StructRNA *srna) func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc"); RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, - "Invalidate Cached images for strip and all dependant strips. "); + "Invalidate cached images for strip and all dependent strips"); parm = RNA_def_enum(func, "type", seq_cahce_type_items, 0, "Type", "Cache Type"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); } @@ -669,7 +663,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie"); - RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new movie sequence"); parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c index 80f3cab147c..7b039b91188 100644 --- a/source/blender/makesrna/intern/rna_shader_fx.c +++ b/source/blender/makesrna/intern/rna_shader_fx.c @@ -168,7 +168,7 @@ static char *rna_ShaderFx_path(PointerRNA *ptr) static void rna_ShaderFx_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); - WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->owner_id); + WM_main_add_notifier(NC_OBJECT | ND_SHADERFX, ptr->owner_id); } static void rna_ShaderFx_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -220,7 +220,7 @@ static void rna_def_shader_fx_blur(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Size", "Factor of Blur"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); @@ -228,18 +228,18 @@ static void rna_def_shader_fx_blur(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 32, 2, -1); RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "rotation"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Rotation", "Rotation of the effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_dof_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_BLUR_DOF_MODE); RNA_def_property_ui_text(prop, "Use as Depth Of Field", "Blur using camera depth of field"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_colorize(BlenderRNA *brna) @@ -256,27 +256,27 @@ static void rna_def_shader_fx_colorize(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "factor"); RNA_def_property_range(prop, 0, 1.0); RNA_def_property_ui_text(prop, "Factor", "Mix factor"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "low_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "low_color"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Low Color", "First color used for effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "high_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "high_color"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "High Color", "Second color used for effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, rna_enum_shaderfx_colorize_modes_items); RNA_def_property_ui_text(prop, "Mode", "Effect mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_wave(BlenderRNA *brna) @@ -298,25 +298,25 @@ static void rna_def_shader_fx_wave(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "orientation"); RNA_def_property_enum_items(prop, prop_shaderfx_wave_type_items); RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "amplitude"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "period"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "Period", "Period of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "phase"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_pixel(BlenderRNA *brna) @@ -334,12 +334,12 @@ static void rna_def_shader_fx_pixel(BlenderRNA *brna) RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_array(prop, 2); RNA_def_property_ui_text(prop, "Size", "Pixel size"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FX_PIXEL_FILTER_NEAREST); - RNA_def_property_ui_text(prop, "Antialiasing", "Antialiase pixels"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_ui_text(prop, "Antialiasing", "Antialias pixels"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_rim(BlenderRNA *brna) @@ -356,34 +356,34 @@ static void rna_def_shader_fx_rim(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX); RNA_def_property_ui_text(prop, "Offset", "Offset of the rim"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "rim_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "rim_rgb"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Rim Color", "Color used for Rim"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "mask_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "mask_rgb"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Mask Color", "Color that must be kept"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, rna_enum_shaderfx_rim_modes_items); RNA_def_property_ui_text(prop, "Mode", "Blend mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "blur"); RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text( prop, "Blur", "Number of pixels for blurring rim (set to 0 to disable)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); @@ -391,7 +391,7 @@ static void rna_def_shader_fx_rim(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 32, 2, -1); RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_shadow(BlenderRNA *brna) @@ -420,58 +420,58 @@ static void rna_def_shader_fx_shadow(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX); RNA_def_property_ui_text(prop, "Offset", "Offset of the shadow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "scale"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Scale", "Offset of the shadow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "shadow_rgba"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Shadow Color", "Color used for Shadow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "orientation"); RNA_def_property_enum_items(prop, prop_shaderfx_shadow_type_items); RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "amplitude"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "period"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "Period", "Period of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "phase"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "rotation"); RNA_def_property_range(prop, DEG2RAD(-360), DEG2RAD(360)); RNA_def_property_ui_range(prop, DEG2RAD(-360), DEG2RAD(360), 5, 2); RNA_def_property_ui_text(prop, "Rotation", "Rotation around center or object"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "blur"); RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text( prop, "Blur", "Number of pixels for blurring shadow (set to 0 to disable)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); @@ -479,17 +479,17 @@ static void rna_def_shader_fx_shadow(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 32, 2, -1); RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_object", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_OBJECT); RNA_def_property_ui_text(prop, "Use Object", "Use object as center of rotation"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_wave", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_WAVE); RNA_def_property_ui_text(prop, "Wave", "Use wave effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_glow(BlenderRNA *brna) @@ -507,41 +507,41 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "glow_color"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Glow Color", "Color used for generated glow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "glow_color[3]"); RNA_def_property_range(prop, 0.0, 1.0f); RNA_def_property_ui_text(prop, "Opacity", "Effect Opacity"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "select_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "select_color"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Select Color", "Color selected to apply glow"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, rna_enum_shaderfx_glow_modes_items); RNA_def_property_ui_text(prop, "Mode", "Glow mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "threshold"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); RNA_def_property_ui_text(prop, "Threshold", "Limit to select color for glow effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); /* Use blur fields to make compatible with blur filter */ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "blur"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Size", "Size of the effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "samples"); @@ -549,26 +549,26 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 32, 2, -1); RNA_def_property_int_default(prop, 4); RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_glow_under", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_GLOW_USE_ALPHA); RNA_def_property_ui_text( prop, "Glow Under", "Glow only areas with alpha (not supported with Regular blend mode)"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "rotation"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Rotation", "Rotation of the effect"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); /* blend mode */ prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); RNA_def_property_enum_items(prop, rna_enum_glow_blend_modes_items); RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } static void rna_def_shader_fx_swirl(BlenderRNA *brna) @@ -585,19 +585,19 @@ static void rna_def_shader_fx_swirl(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text(prop, "Radius", "Radius to apply"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360)); RNA_def_property_ui_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360), 5, 2); RNA_def_property_ui_text(prop, "Angle", "Angle of rotation"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "use_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SWIRL_MAKE_TRANSPARENT); RNA_def_property_ui_text(prop, "Transparent", "Make image transparent outside of radius"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Object to determine center location"); @@ -620,12 +620,12 @@ static void rna_def_shader_fx_flip(BlenderRNA *brna) prop = RNA_def_property(srna, "flip_horizontal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_HORIZONTAL); RNA_def_property_ui_text(prop, "Horizontal", "Flip image horizontally"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); prop = RNA_def_property(srna, "flip_vertical", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_VERTICAL); RNA_def_property_ui_text(prop, "Vertical", "Flip image vertically"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); } void RNA_def_shader_fx(BlenderRNA *brna) @@ -644,7 +644,7 @@ void RNA_def_shader_fx(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShaderFx_name_set"); RNA_def_property_ui_text(prop, "Name", "Effect name"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX | NA_RENAME, NULL); RNA_def_struct_name_property(srna, prop); /* enums */ @@ -661,7 +661,7 @@ void RNA_def_shader_fx(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Realtime", "Display effect in viewport"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1); prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); @@ -669,12 +669,12 @@ void RNA_def_shader_fx(BlenderRNA *brna) RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Render", "Use effect during render"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, NULL); prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Editmode); RNA_def_property_ui_text(prop, "Edit Mode", "Display effect in Edit mode"); - RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update"); + RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0); prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 49a21799d5b..155f5ab3043 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1776,87 +1776,28 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSE { SpaceProperties *sbuts = (SpaceProperties *)(ptr->data); EnumPropertyItem *item = NULL; - int totitem = 0; - - if (sbuts->pathflag & (1 << BCONTEXT_TOOL)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TOOL); - } - - if (totitem) { - RNA_enum_item_add_separator(&item, &totitem); - } - - if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER); - } - - if (sbuts->pathflag & (1 << BCONTEXT_OUTPUT)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OUTPUT); - } - - if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_VIEW_LAYER); - } - - if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE); - } - - if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD); - } - if (totitem) { - RNA_enum_item_add_separator(&item, &totitem); - } - - if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT); - } - - if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER); - } - - if (sbuts->pathflag & (1 << BCONTEXT_SHADERFX)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SHADERFX); - } - - if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE); - } - - if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS); - } - - if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT); - } - - if (sbuts->pathflag & (1 << BCONTEXT_DATA)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA); - (item + totitem - 1)->icon = sbuts->dataicon; - } - - if (sbuts->pathflag & (1 << BCONTEXT_BONE)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE); - } - - if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE_CONSTRAINT); - } - - if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL); - } + /* We use 32 tabs maximum here so a flag for each can fit into a 32 bit integer flag. + * A theoretical maximum would be BCONTEXT_TOT * 2, with every tab displayed and a spacer + * in every other item. But this size is currently limited by the size of integer + * supported by RNA enums. */ + int context_tabs_array[32]; + int totitem = ED_buttons_tabs_list(sbuts, context_tabs_array); + BLI_assert(totitem <= ARRAY_SIZE(context_tabs_array)); + + int totitem_added = 0; + for (int i = 0; i < totitem; i++) { + if (context_tabs_array[i] == -1) { + RNA_enum_item_add_separator(&item, &totitem_added); + continue; + } - if (totitem) { - RNA_enum_item_add_separator(&item, &totitem); - } + RNA_enum_items_add_value(&item, &totitem_added, buttons_context_items, context_tabs_array[i]); - if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE); + /* Add the object data icon dynamically for the data tab. */ + if (context_tabs_array[i] == BCONTEXT_DATA) { + (item + totitem_added - 1)->icon = sbuts->dataicon; + } } RNA_enum_item_end(&item, &totitem); @@ -6601,7 +6542,7 @@ static void rna_def_space_clip(BlenderRNA *brna) prop = RNA_def_property(srna, "show_graph_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_SEL_ONLY); RNA_def_property_ui_text( - prop, "Only Selected", "Only include channels relating to selected objects and data"); + prop, "Only Show Selected", "Only include channels relating to selected objects and data"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 54fe2e4b513..27297a4d19a 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -2440,7 +2440,7 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SELECTED_ONLY); RNA_def_property_ui_text( - prop, "Only Selected", "Only include channels relating to selected objects and data"); + prop, "Only Show Selected", "Only include channels relating to selected objects and data"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0); RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index c31b313d827..0567b22d23f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -179,6 +179,7 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = { # include "BKE_blender.h" # include "BKE_global.h" # include "BKE_idprop.h" +# include "BKE_image.h" # include "BKE_main.h" # include "BKE_mesh_runtime.h" # include "BKE_paint.h" @@ -187,8 +188,9 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = { # include "DEG_depsgraph.h" -# include "GPU_draw.h" +# include "GPU_extensions.h" # include "GPU_select.h" +# include "GPU_texture.h" # include "BLF_api.h" @@ -362,13 +364,14 @@ static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene) static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - GPU_set_anisotropic(U.anisotropic_filter); + GPU_samplers_free(); + GPU_samplers_init(); rna_userdef_update(bmain, scene, ptr); } static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - GPU_free_images(bmain); + BKE_image_free_all_gputextures(bmain); rna_userdef_update(bmain, scene, ptr); } @@ -439,13 +442,12 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value) UserDef *userdef = (UserDef *)ptr->data; int required_size = userdef->v2d_min_gridsize; - /* set the timecode style */ + /* Set the time-code style. */ userdef->timecode_style = value; - /* adjust the v2d gridsize if needed so that timecodes don't overlap + /* Adjust the v2d grid-size if needed so that time-codes don't overlap * NOTE: most of these have been hand-picked to avoid overlaps while still keeping - * things from getting too blown out - */ + * things from getting too blown out. */ switch (value) { case USER_TIMECODE_MINIMAL: case USER_TIMECODE_SECONDS_ONLY: @@ -1066,6 +1068,11 @@ static void rna_UserDef_studiolight_light_ambient_get(PointerRNA *ptr, float *va copy_v3_v3(values, sl->light_ambient); } +int rna_show_statusbar_vram_editable(struct PointerRNA *UNUSED(ptr), const char **UNUSED(r_info)) +{ + return GPU_mem_stats_supported() ? PROP_EDITABLE : 0; +} + #else # define USERDEF_TAG_DIRTY_PROPERTY_UPDATE_ENABLE \ @@ -2272,7 +2279,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", ""); + RNA_def_property_ui_text(prop, "Active Vertex/Edge/Face", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -2971,7 +2978,7 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna) prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", ""); + RNA_def_property_ui_text(prop, "Active Vertex/Edge/Face", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -3973,12 +3980,13 @@ static void rna_def_userdef_studiolights(BlenderRNA *brna) func = RNA_def_function(srna, "new", "rna_StudioLights_new"); RNA_def_function_ui_description(func, "Create studiolight from default lighting"); - parm = RNA_def_string(func, - "path", - NULL, - 0, - "Path", - "Path to the file that will contain the lighing info (without extension)"); + parm = RNA_def_string( + func, + "path", + NULL, + 0, + "Path", + "Path to the file that will contain the lighting info (without extension)"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight"); RNA_def_function_return(func, parm); @@ -4587,7 +4595,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) "no matter opening direction"); static const EnumPropertyItem header_align_items[] = { - {0, "NONE", 0, "Default", "Keep existing header alignment"}, + {0, "NONE", 0, "Keep Existing", "Keep existing header alignment"}, {USER_HEADER_FROM_PREF, "TOP", 0, "Top", "Top aligned on load"}, {USER_HEADER_FROM_PREF | USER_HEADER_BOTTOM, "BOTTOM", @@ -4770,6 +4778,29 @@ static void rna_def_userdef_view(BlenderRNA *brna) "Translate New Names", "Translate the names of new data-blocks (objects, materials...)"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* Statusbar. */ + + prop = RNA_def_property(srna, "show_statusbar_memory", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_MEMORY); + RNA_def_property_ui_text(prop, "Show Memory", "Show Blender memory usage"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_vram", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VRAM); + RNA_def_property_ui_text(prop, "Show VRAM", "Show GPU video memory usage"); + RNA_def_property_editable_func(prop, "rna_show_statusbar_vram_editable"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_version", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VERSION); + RNA_def_property_ui_text(prop, "Show Version", "Show Blender version string"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_stats", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_STATS); + RNA_def_property_ui_text(prop, "Show Statistics", "Show scene statistics"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); } static void rna_def_userdef_edit(BlenderRNA *brna) @@ -4959,7 +4990,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) /* grease pencil */ prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist"); + RNA_def_property_int_sdna(prop, NULL, "gp_manhattandist"); RNA_def_property_range(prop, 0, 100); RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance", @@ -6084,6 +6115,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "use_cycles_debug", 1); RNA_def_property_ui_text(prop, "Cycles Debug", "Enable Cycles debugging options for developers"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "use_sculpt_vertex_colors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_sculpt_vertex_colors", 1); + RNA_def_property_ui_text(prop, "Sculpt Vertex Colors", "Use the new Vertex Painting system"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) |