diff options
Diffstat (limited to 'source/blender/makesrna/intern')
57 files changed, 2584 insertions, 544 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 4fafa356879..95b7b7e5406 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -99,7 +99,7 @@ set(DEFSRC ) if(WITH_EXPERIMENTAL_FEATURES) - add_definitions(-DWITH_GEOMETRY_NODES) + add_definitions(-DWITH_SIMULATION_DATABLOCK) add_definitions(-DWITH_POINT_CLOUD) add_definitions(-DWITH_HAIR_NODES) list(APPEND DEFSRC diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b20d9218316..7a9cfa79324 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -684,6 +684,29 @@ static char *rna_def_property_get_func( } } } + + /* Check log scale sliders for negative range. */ + if (prop->type == PROP_FLOAT) { + FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; + /* NOTE: UI_BTYPE_NUM_SLIDER can't have a softmin of zero. */ + if ((fprop->ui_scale_type == PROP_SCALE_LOG) && (fprop->hardmin < 0 || fprop->softmin < 0)) { + CLOG_ERROR( + &LOG, "\"%s.%s\", range for log scale < 0.", srna->identifier, prop->identifier); + DefRNA.error = true; + return NULL; + } + } + if (prop->type == PROP_INT) { + IntPropertyRNA *iprop = (IntPropertyRNA *)prop; + /* Only UI_BTYPE_NUM_SLIDER is implemented and that one can't have a softmin of zero. */ + if ((iprop->ui_scale_type == PROP_SCALE_LOG) && + (iprop->hardmin <= 0 || iprop->softmin <= 0)) { + CLOG_ERROR( + &LOG, "\"%s.%s\", range for log scale <= 0.", srna->identifier, prop->identifier); + DefRNA.error = true; + return NULL; + } + } } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); @@ -3178,6 +3201,8 @@ static const char *rna_property_subtypename(PropertySubType type) return "PROP_ANGLE"; case PROP_TIME: return "PROP_TIME"; + case PROP_TIME_ABSOLUTE: + return "PROP_TIME_ABSOLUTE"; case PROP_DISTANCE: return "PROP_DISTANCE"; case PROP_DISTANCE_CAMERA: @@ -3243,6 +3268,8 @@ static const char *rna_property_subtype_unit(PropertySubType type) return "PROP_UNIT_ROTATION"; case PROP_UNIT_TIME: return "PROP_UNIT_TIME"; + case PROP_UNIT_TIME_ABSOLUTE: + return "PROP_UNIT_TIME_ABSOLUTE"; case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY"; case PROP_UNIT_ACCELERATION: @@ -3935,6 +3962,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(iprop->getarray_ex), rna_function_string(iprop->setarray_ex), rna_function_string(iprop->range_ex)); + rna_int_print(f, iprop->ui_scale_type); + fprintf(f, ", "); rna_int_print(f, iprop->softmin); fprintf(f, ", "); rna_int_print(f, iprop->softmax); @@ -3969,6 +3998,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(fprop->getarray_ex), rna_function_string(fprop->setarray_ex), rna_function_string(fprop->range_ex)); + rna_float_print(f, fprop->ui_scale_type); + fprintf(f, ", "); rna_float_print(f, fprop->softmin); fprintf(f, ", "); rna_float_print(f, fprop->softmax); @@ -4341,7 +4372,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_screen.c", NULL, RNA_def_screen}, {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer}, -#ifdef WITH_GEOMETRY_NODES +#ifdef WITH_SIMULATION_DATABLOCK {"rna_simulation.c", NULL, RNA_def_simulation}, #endif {"rna_space.c", "rna_space_api.c", RNA_def_space}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 6e2005b7314..43b65b087bf 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -85,6 +85,47 @@ const EnumPropertyItem rna_enum_id_type_items[] = { {0, NULL, 0, NULL, NULL}, }; +static const EnumPropertyItem rna_enum_override_library_property_operation_items[] = { + {IDOVERRIDE_LIBRARY_OP_NOOP, + "NOOP", + 0, + "No-Op", + "Does nothing, prevents adding actual overrides (NOT USED)"}, + {IDOVERRIDE_LIBRARY_OP_REPLACE, + "REPLACE", + 0, + "Replace", + "Replace value of reference by overriding one"}, + {IDOVERRIDE_LIBRARY_OP_ADD, + "DIFF_ADD", + 0, + "Differential", + "Stores and apply difference between reference and local value (NOT USED)"}, + {IDOVERRIDE_LIBRARY_OP_SUBTRACT, + "DIFF_SUB", + 0, + "Differential", + "Stores and apply difference between reference and local value (NOT USED)"}, + {IDOVERRIDE_LIBRARY_OP_MULTIPLY, + "FACT_MULTIPLY", + 0, + "Factor", + "Stores and apply multiplication factor between reference and local value (NOT USED)"}, + {IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, + "INSERT_AFTER", + 0, + "Insert After", + "Insert a new item into collection after the one referenced in subitem_reference_name or " + "_index"}, + {IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE, + "INSERT_BEFORE", + 0, + "Insert Before", + "Insert a new item into collection after the one referenced in subitem_reference_name or " + "_index (NOT USED)"}, + {0, NULL, 0, NULL, NULL}, +}; + #ifdef RNA_RUNTIME # include "DNA_anim_types.h" @@ -107,6 +148,8 @@ const EnumPropertyItem rna_enum_id_type_items[] = { # include "DEG_depsgraph_build.h" # include "DEG_depsgraph_query.h" +# include "ED_asset.h" + # include "WM_api.h" void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value) @@ -303,7 +346,7 @@ short RNA_type_to_ID_code(const StructRNA *type) if (base_type == &RNA_Screen) { return ID_SCR; } -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK if (base_type == &RNA_Simulation) { return ID_SIM; } @@ -411,7 +454,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_SCR: return &RNA_Screen; case ID_SIM: -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK return &RNA_Simulation; # else return &RNA_ID; @@ -534,6 +577,22 @@ static ID *rna_ID_copy(ID *id, Main *bmain) return newid; } +static void rna_ID_asset_mark(ID *id, bContext *C) +{ + if (ED_asset_mark_id(C, id)) { + WM_main_add_notifier(NC_ID | NA_EDITED, NULL); + WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL); + } +} + +static void rna_ID_asset_clear(ID *id) +{ + if (ED_asset_clear_id(id)) { + WM_main_add_notifier(NC_ID | NA_EDITED, NULL); + WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL); + } +} + static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) { if (!ID_IS_OVERRIDABLE_LIBRARY(id)) { @@ -549,9 +608,88 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) if (remap_local_usages) { BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); } + + WM_main_add_notifier(NC_ID | NA_ADDED, NULL); + return local_id; } +static ID *rna_ID_override_hierarchy_create( + ID *id, Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_reference) +{ + if (!ID_IS_OVERRIDABLE_LIBRARY(id)) { + return NULL; + } + + BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + + ID *id_root_override = NULL; + BKE_lib_override_library_create(bmain, scene, view_layer, id, id_reference, &id_root_override); + + WM_main_add_notifier(NC_ID | NA_ADDED, NULL); + + return id_root_override; +} + +static void rna_ID_override_template_create(ID *id, ReportList *reports) +{ + if (!U.experimental.use_override_templates) { + BKE_report(reports, RPT_ERROR, "Override template experimental feature is disabled"); + return; + } + if (ID_IS_LINKED(id)) { + BKE_report(reports, RPT_ERROR, "Unable to create override template for linked data-blocks"); + return; + } + if (ID_IS_OVERRIDE_LIBRARY(id)) { + BKE_report( + reports, RPT_ERROR, "Unable to create override template for overridden data-blocks"); + return; + } + BKE_lib_override_library_template_create(id); +} + +static IDOverrideLibraryProperty *rna_ID_override_library_properties_add( + IDOverrideLibrary *override_library, ReportList *reports, const char rna_path[]) +{ + bool created; + IDOverrideLibraryProperty *result = BKE_lib_override_library_property_get( + override_library, rna_path, &created); + + if (!created) { + BKE_report(reports, RPT_DEBUG, "No new override property created, property already exists"); + } + + return result; +} + +static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add( + IDOverrideLibraryProperty *override_property, + ReportList *reports, + int operation, + const char *subitem_refname, + const char *subitem_locname, + int subitem_refindex, + int subitem_locindex) +{ + bool created; + bool strict; + IDOverrideLibraryPropertyOperation *result = BKE_lib_override_library_property_operation_get( + override_property, + operation, + subitem_refname, + subitem_locname, + subitem_refindex, + subitem_locindex, + false, + &strict, + &created); + if (!created) { + BKE_report(reports, RPT_DEBUG, "No new override operation created, operation already exists"); + } + return result; +} + static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag) { /* XXX, new function for this! */ @@ -1019,7 +1157,7 @@ static void rna_ImagePreview_icon_reload(PreviewImage *prv) static PointerRNA rna_IDPreview_get(PointerRNA *ptr) { ID *id = (ID *)ptr->data; - PreviewImage *prv_img = BKE_previewimg_id_ensure(id); + PreviewImage *prv_img = BKE_previewimg_id_get(id); return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img); } @@ -1267,47 +1405,6 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem override_library_property_operation_items[] = { - {IDOVERRIDE_LIBRARY_OP_NOOP, - "NOOP", - 0, - "No-Op", - "Does nothing, prevents adding actual overrides (NOT USED)"}, - {IDOVERRIDE_LIBRARY_OP_REPLACE, - "REPLACE", - 0, - "Replace", - "Replace value of reference by overriding one"}, - {IDOVERRIDE_LIBRARY_OP_ADD, - "DIFF_ADD", - 0, - "Differential", - "Stores and apply difference between reference and local value (NOT USED)"}, - {IDOVERRIDE_LIBRARY_OP_SUBTRACT, - "DIFF_SUB", - 0, - "Differential", - "Stores and apply difference between reference and local value (NOT USED)"}, - {IDOVERRIDE_LIBRARY_OP_MULTIPLY, - "FACT_MULTIPLY", - 0, - "Factor", - "Stores and apply multiplication factor between reference and local value (NOT USED)"}, - {IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, - "INSERT_AFTER", - 0, - "Insert After", - "Insert a new item into collection after the one referenced in subitem_reference_name or " - "_index"}, - {IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE, - "INSERT_BEFORE", - 0, - "Insert Before", - "Insert a new item into collection after the one referenced in subitem_reference_name or " - "_index (NOT USED)"}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem override_library_property_flag_items[] = { {IDOVERRIDE_LIBRARY_FLAG_MANDATORY, "MANDATORY", @@ -1329,7 +1426,7 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna) prop = RNA_def_enum(srna, "operation", - override_library_property_operation_items, + rna_enum_override_library_property_operation_items, IDOVERRIDE_LIBRARY_OP_REPLACE, "Operation", "What override operation is performed"); @@ -1386,6 +1483,66 @@ static void rna_def_ID_override_library_property_operation(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ } +static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "IDOverrideLibraryPropertyOperations"); + srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperations", NULL); + RNA_def_struct_sdna(srna, "IDOverrideLibraryProperty"); + RNA_def_struct_ui_text(srna, "Override Operations", "Collection of override operations"); + + /* Add Property */ + func = RNA_def_function(srna, "add", "rna_ID_override_library_property_operations_add"); + RNA_def_function_ui_description(func, "Add a new operation"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_enum(func, + "operation", + rna_enum_override_library_property_operation_items, + IDOVERRIDE_LIBRARY_OP_REPLACE, + "Operation", + "What override operation is performed"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_string(func, + "subitem_reference_name", + NULL, + INT_MAX, + "Subitem Reference Name", + "Used to handle insertions into collection"); + parm = RNA_def_string(func, + "subitem_local_name", + NULL, + INT_MAX, + "Subitem Local Name", + "Used to handle insertions into collection"); + parm = RNA_def_int(func, + "subitem_reference_index", + -1, + -1, + INT_MAX, + "Subitem Reference Index", + "Used to handle insertions into collection", + -1, + INT_MAX); + parm = RNA_def_int(func, + "subitem_local_index", + -1, + -1, + INT_MAX, + "Subitem Local Index", + "Used to handle insertions into collection", + -1, + INT_MAX); + parm = RNA_def_pointer(func, + "property", + "IDOverrideLibraryPropertyOperation", + "New Operation", + "Created operation"); + RNA_def_function_return(func, parm); +} + static void rna_def_ID_override_library_property(BlenderRNA *brna) { StructRNA *srna; @@ -1405,18 +1562,47 @@ static void rna_def_ID_override_library_property(BlenderRNA *brna) "RNA path leading to that property, from owning ID"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ - RNA_def_collection(srna, - "operations", - "IDOverrideLibraryPropertyOperation", - "Operations", - "List of overriding operations for a property"); + prop = RNA_def_collection(srna, + "operations", + "IDOverrideLibraryPropertyOperation", + "Operations", + "List of overriding operations for a property"); + rna_def_ID_override_library_property_operations(brna, prop); rna_def_ID_override_library_property_operation(brna); } +static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "IDOverrideLibraryProperties"); + srna = RNA_def_struct(brna, "IDOverrideLibraryProperties", NULL); + RNA_def_struct_sdna(srna, "IDOverrideLibrary"); + RNA_def_struct_ui_text(srna, "Override Properties", "Collection of override properties"); + + /* Add Property */ + func = RNA_def_function(srna, "add", "rna_ID_override_library_properties_add"); + RNA_def_function_ui_description( + func, "Add a property to the override library when it doesn't exist yet"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm = RNA_def_pointer(func, + "property", + "IDOverrideLibraryProperty", + "New Property", + "Newly created override property or existing one"); + RNA_def_function_return(func, parm); + parm = RNA_def_string( + func, "rna_path", NULL, 256, "RNA Path", "RNA-Path of the property to add"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); +} + static void rna_def_ID_override_library(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL); RNA_def_struct_ui_text( @@ -1425,11 +1611,12 @@ static void rna_def_ID_override_library(BlenderRNA *brna) RNA_def_pointer( srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override"); - RNA_def_collection(srna, - "properties", - "IDOverrideLibraryProperty", - "Properties", - "List of overridden properties"); + prop = RNA_def_collection(srna, + "properties", + "IDOverrideLibraryProperty", + "Properties", + "List of overridden properties"); + rna_def_ID_override_library_properties(brna, prop); rna_def_ID_override_library_property(brna); } @@ -1540,12 +1727,12 @@ static void rna_def_ID(BlenderRNA *brna) srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_pointer( - srna, - "preview", - "ImagePreview", - "Preview", - "Preview image and icon of this data-block (None if not supported for this type of data)"); + prop = RNA_def_pointer(srna, + "preview", + "ImagePreview", + "Preview", + "Preview image and icon of this data-block (always None if not supported " + "for this type of data)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL); @@ -1567,6 +1754,18 @@ static void rna_def_ID(BlenderRNA *brna) parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark"); + RNA_def_function_ui_description( + func, + "Enable easier reuse of the data-block through the Asset Browser, with the help of " + "customizable metadata (like previews, descriptions and tags)"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + + func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear"); + RNA_def_function_ui_description( + func, + "Delete all asset metadata and turn the asset data-block back into a normal data-block"); + func = RNA_def_function(srna, "override_create", "rna_ID_override_create"); RNA_def_function_ui_description(func, "Create an overridden local copy of this linked data-block (not " @@ -1581,6 +1780,34 @@ static void rna_def_ID(BlenderRNA *brna) "Whether local usages of the linked ID should be remapped to the new " "library override of it"); + func = RNA_def_function(srna, "override_hierarchy_create", "rna_ID_override_hierarchy_create"); + RNA_def_function_ui_description( + func, + "Create an overridden local copy of this linked data-block, and most of its dependencies " + "when it is a Collection or and Object"); + RNA_def_function_flag(func, FUNC_USE_MAIN); + parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the root ID"); + RNA_def_function_return(func, parm); + parm = RNA_def_pointer( + func, "scene", "Scene", "", "In which scene the new overrides should be instantiated"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + parm = RNA_def_pointer(func, + "view_layer", + "ViewLayer", + "", + "In which view layer the new overrides should be instantiated"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + RNA_def_pointer(func, + "reference", + "ID", + "", + "Another ID (usually an Object or Collection) used to decide where to " + "instantiate the new overrides"); + + func = RNA_def_function(srna, "override_template_create", "rna_ID_override_template_create"); + RNA_def_function_ui_description(func, "Create an override template for this ID"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear"); RNA_def_function_ui_description(func, "Clear the user count of a data-block so its not saved, " @@ -1643,6 +1870,13 @@ static void rna_def_ID(BlenderRNA *brna) "e.g. when calling :class:`bpy.types.Scene.update`"); RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform"); + func = RNA_def_function(srna, "preview_ensure", "BKE_previewimg_id_ensure"); + RNA_def_function_ui_description(func, + "Ensure that this ID has preview data (if ID type supports it)"); + parm = RNA_def_pointer( + func, "preview_image", "ImagePreview", "", "The existing or created preview"); + RNA_def_function_return(func, parm); + # ifdef WITH_PYTHON RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance"); # endif diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f94dc38ddfe..948fef1b51e 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1189,6 +1189,24 @@ PropertyUnit RNA_property_unit(PropertyRNA *prop) return RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)); } +PropertyScaleType RNA_property_ui_scale(PropertyRNA *prop) +{ + PropertyRNA *rna_prop = rna_ensure_property(prop); + + switch (rna_prop->type) { + case PROP_INT: { + IntPropertyRNA *iprop = (IntPropertyRNA *)rna_prop; + return iprop->ui_scale_type; + } + case PROP_FLOAT: { + FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_prop; + return fprop->ui_scale_type; + } + default: + return PROP_SCALE_LINEAR; + } +} + int RNA_property_flag(PropertyRNA *prop) { return rna_ensure_property(prop)->flag; @@ -1623,35 +1641,35 @@ void RNA_property_enum_items_ex(bContext *C, *r_free = false; - if (!use_static && eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { - const EnumPropertyItem *item; + if (!use_static && (eprop->item_fn != NULL)) { + const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) || + ((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) && + (ptr->owner_id == NULL)); + if (C != NULL || no_context) { + const EnumPropertyItem *item; - if (prop->flag & PROP_ENUM_NO_CONTEXT) { - item = eprop->item_fn(NULL, ptr, prop, r_free); - } - else { - item = eprop->item_fn(C, ptr, prop, r_free); - } + item = eprop->item_fn(no_context ? NULL : C, ptr, prop, r_free); - /* any callbacks returning NULL should be fixed */ - BLI_assert(item != NULL); + /* any callbacks returning NULL should be fixed */ + BLI_assert(item != NULL); - if (r_totitem) { - int tot; - for (tot = 0; item[tot].identifier; tot++) { - /* pass */ + if (r_totitem) { + int tot; + for (tot = 0; item[tot].identifier; tot++) { + /* pass */ + } + *r_totitem = tot; } - *r_totitem = tot; - } - *r_item = item; - } - else { - *r_item = eprop->item; - if (r_totitem) { - *r_totitem = eprop->totitem; + *r_item = item; + return; } } + + *r_item = eprop->item; + if (r_totitem) { + *r_totitem = eprop->totitem; + } } void RNA_property_enum_items(bContext *C, @@ -1753,42 +1771,42 @@ void RNA_property_enum_items_gettexted_all(bContext *C, *r_totitem = eprop->totitem; } - if (eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { - const EnumPropertyItem *item; - int i; - bool free = false; + if (eprop->item_fn != NULL) { + const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) || + ((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) && + (ptr->owner_id == NULL)); + if (C != NULL || no_context) { + const EnumPropertyItem *item; + int i; + bool free = false; - if (prop->flag & PROP_ENUM_NO_CONTEXT) { - item = eprop->item_fn(NULL, ptr, prop, &free); - } - else { - item = eprop->item_fn(C, ptr, prop, &free); - } + item = eprop->item_fn(no_context ? NULL : NULL, ptr, prop, &free); - /* any callbacks returning NULL should be fixed */ - BLI_assert(item != NULL); + /* any callbacks returning NULL should be fixed */ + BLI_assert(item != NULL); - for (i = 0; i < eprop->totitem; i++) { - bool exists = false; - int i_fixed; + for (i = 0; i < eprop->totitem; i++) { + bool exists = false; + int i_fixed; - /* Items that do not exist on list are returned, - * but have their names/identifiers NULL'ed out. */ - for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) { - if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) { - exists = true; - break; + /* Items that do not exist on list are returned, + * but have their names/identifiers NULL'ed out. */ + for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) { + if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) { + exists = true; + break; + } } - } - if (!exists) { - item_array[i].name = NULL; - item_array[i].identifier = ""; + if (!exists) { + item_array[i].name = NULL; + item_array[i].identifier = ""; + } } - } - if (free) { - MEM_freeN((void *)item); + if (free) { + MEM_freeN((void *)item); + } } } @@ -6097,13 +6115,25 @@ char *RNA_path_full_ID_py(Main *bmain, ID *id) path = ""; } - char id_esc[(sizeof(id->name) - 2) * 2]; + char lib_filepath_esc[(sizeof(id->lib->filepath) * 2) + 4]; + if (id->lib != NULL) { + int ofs = 0; + memcpy(lib_filepath_esc, ", \"", 3); + ofs += 3; + ofs += BLI_str_escape(lib_filepath_esc + ofs, id->lib->filepath, sizeof(lib_filepath_esc)); + memcpy(lib_filepath_esc + ofs, "\"", 2); + } + else { + lib_filepath_esc[0] = '\0'; + } + char id_esc[(sizeof(id->name) - 2) * 2]; BLI_str_escape(id_esc, id->name + 2, sizeof(id_esc)); - return BLI_sprintfN("bpy.data.%s[\"%s\"]%s%s", + return BLI_sprintfN("bpy.data.%s[\"%s\"%s]%s%s", BKE_idtype_idcode_to_name_plural(GS(id->name)), id_esc, + lib_filepath_esc, path[0] ? "." : "", path); } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 69ddcee60fa..fb9f5e0292e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -407,8 +407,10 @@ static void rna_def_dopesheet(BlenderRNA *brna) /* Multi-word fuzzy search option for name/text filters */ prop = RNA_def_property(srna, "use_multi_word_filter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_FUZZY_NAMES); - RNA_def_property_ui_text( - prop, "Multi-Word Fuzzy Filter", "Perform fuzzy/multi-word matching (WARNING: May be slow)"); + RNA_def_property_ui_text(prop, + "Multi-Word Fuzzy Filter", + "Perform fuzzy/multi-word matching.\n" + "Warning: May be slow"); RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c index 48da32afba5..308a34f9cf1 100644 --- a/source/blender/makesrna/intern/rna_action_api.c +++ b/source/blender/makesrna/intern/rna_action_api.c @@ -41,10 +41,32 @@ # include "DNA_anim_types.h" # include "DNA_curve_types.h" +static void rna_Action_flip_with_pose(bAction *act, ReportList *reports, Object *ob) +{ + if (ob->type != OB_ARMATURE) { + BKE_report(reports, RPT_ERROR, "Only armature objects are supported"); + return; + } + BKE_action_flip_with_pose(act, ob); + + /* Only for redraw. */ + WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); +} + #else -void RNA_api_action(StructRNA *UNUSED(srna)) +void RNA_api_action(StructRNA *srna) { + FunctionRNA *func; + PropertyRNA *parm; + + func = RNA_def_function(srna, "flip_with_pose", "rna_Action_flip_with_pose"); + RNA_def_function_ui_description(func, "Flip the action around the X axis using a pose"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + + parm = RNA_def_pointer( + func, "object", "Object", "", "The reference armature object to use when flipping"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); } #endif diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 554f04ca23c..c8fccfc27f8 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -674,7 +674,7 @@ static bool rna_Armature_is_editmode_get(PointerRNA *ptr) return (arm->edbo != NULL); } -static void rna_Armature_transform(bArmature *arm, float *mat) +static void rna_Armature_transform(bArmature *arm, float mat[16]) { ED_armature_transform(arm, (const float(*)[4])mat, true); } @@ -1537,6 +1537,16 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); + prop = RNA_def_property(srna, "axes_position", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "axes_position"); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 1); + RNA_def_property_ui_text(prop, + "Axes Position", + "The position for the axes on the bone. Increasing the value moves it " + "closer to the tip; decreasing moves it closer to the root"); + RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES); RNA_def_property_ui_text(prop, "Display Names", "Display bone names"); diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c index 36aa0401c7d..a02f55667e3 100644 --- a/source/blender/makesrna/intern/rna_armature_api.c +++ b/source/blender/makesrna/intern/rna_armature_api.c @@ -44,7 +44,7 @@ static void rna_EditBone_align_roll(EditBone *ebo, float no[3]) ebo->roll = ED_armature_ebone_roll_to_vector(ebo, no, false); } -static float rna_Bone_do_envelope(Bone *bone, float *vec) +static float rna_Bone_do_envelope(Bone *bone, float vec[3]) { float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f; return distfactor_to_bone(vec, @@ -56,11 +56,11 @@ static float rna_Bone_do_envelope(Bone *bone, float *vec) } static void rna_Bone_convert_local_to_pose(Bone *bone, - float *r_matrix, - float *matrix, - float *matrix_local, - float *parent_matrix, - float *parent_matrix_local, + float r_matrix[16], + float matrix[16], + float matrix_local[16], + float parent_matrix[16], + float parent_matrix_local[16], bool invert) { BoneParentTransform bpt; @@ -89,14 +89,14 @@ static void rna_Bone_convert_local_to_pose(Bone *bone, BKE_bone_parent_transform_apply(&bpt, (float(*)[4])matrix, (float(*)[4])r_matrix); } -static void rna_Bone_MatrixFromAxisRoll(float *axis, float roll, float *r_matrix) +static void rna_Bone_MatrixFromAxisRoll(float axis[3], float roll, float r_matrix[9]) { vec_roll_to_mat3(axis, roll, (float(*)[3])r_matrix); } -static void rna_Bone_AxisRollFromMatrix(float *matrix, - float *axis_override, - float *r_axis, +static void rna_Bone_AxisRollFromMatrix(float matrix[9], + float axis_override[3], + float r_axis[3], float *r_roll) { float mat[3][3]; diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 7976df3e4e4..a256002ffc1 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -49,6 +49,19 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = { {0, NULL, 0, NULL, NULL}, }; +const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = { + {CD_AUTO_FROM_NAME, "AUTO", 0, "Auto", ""}, + {CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"}, + {CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"}, + {CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"}, + {CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point precisions"}, + {CD_MLOOPCOL, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit precision"}, + {CD_PROP_STRING, "STRING", 0, "String", "Text string"}, + {CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"}, + {CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_attribute_domain_items[] = { /* Not implement yet */ // {ATTR_DOMAIN_GEOMETRY, "GEOMETRY", 0, "Geometry", "Attribute on (whole) geometry"}, @@ -58,7 +71,7 @@ const EnumPropertyItem rna_enum_attribute_domain_items[] = { {ATTR_DOMAIN_CORNER, "CORNER", 0, "Face Corner", "Attribute on mesh face corner"}, /* Not implement yet */ // {ATTR_DOMAIN_GRIDS, "GRIDS", 0, "Grids", "Attribute on mesh multires grids"}, - {ATTR_DOMAIN_CURVE, "CURVE", 0, "Curve", "Attribute on hair curve"}, + {ATTR_DOMAIN_CURVE, "CURVE", 0, "Spline", "Attribute on spline"}, {0, NULL, 0, NULL, NULL}, }; @@ -68,6 +81,7 @@ const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[] = { {ATTR_DOMAIN_EDGE, "EDGE", 0, "Edge", "Attribute on mesh edge"}, {ATTR_DOMAIN_FACE, "FACE", 0, "Face", "Attribute on mesh faces"}, {ATTR_DOMAIN_CORNER, "CORNER", 0, "Face Corner", "Attribute on mesh face corner"}, + {ATTR_DOMAIN_CURVE, "CURVE", 0, "Spline", "Attribute on spline"}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index e7daa55af6c..7e1d513502c 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1617,6 +1617,15 @@ static void rna_def_gpencil_options(BlenderRNA *brna) prop, "Stroke Extension", "Strokes end extension for closing gaps, use zero to disable"); RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + /* Number of pixels to dilate fill area. */ + prop = RNA_def_property(srna, "dilate", PROP_INT, PROP_PIXEL); + RNA_def_property_int_sdna(prop, NULL, "dilate_pixels"); + RNA_def_property_range(prop, 0, 20); + RNA_def_property_int_default(prop, 1); + RNA_def_property_ui_text(prop, "Dilate", "Number of pixels to dilate fill area"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + /* Flags */ prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_PRESSURE); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 2bc00dd5af5..9e57368f8f9 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -652,6 +652,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_ui_text(prop, "Vertex Mass", "The mass of each vertex on the cloth material"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 206ebc2cb14..54f9a93d90a 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -650,7 +650,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, seq->strip->proxy->anim = NULL; } - SEQ_relations_invalidate_cache_preprocessed(scene, seq); + SEQ_relations_invalidate_cache_raw(scene, seq); } else { SEQ_ALL_BEGIN (scene->ed, seq) { diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 843cb326be2..b363dcd4ba9 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1923,7 +1923,8 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "offset_fac"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3); RNA_def_property_ui_text( prop, "Offset Factor", "Percentage value defining target position along length of curve"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); @@ -2597,6 +2598,12 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "euler_order"); + RNA_def_property_enum_items(prop, euler_order_items); + RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order"); + RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 3e90b4bd9d4..dd7d50a80ba 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -357,9 +357,8 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } else { cu->flag &= ~CU_3D; + BKE_curve_dimension_update(cu); } - - BKE_curve_curve_dimension_update(cu); } static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), @@ -721,10 +720,6 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type) nu->resolv = cu->resolv; nu->flag = CU_SMOOTH; - if ((cu->flag & CU_3D) == 0) { - nu->flag |= CU_2D; - } - BLI_addtail(BKE_curve_nurbs_get(cu), nu); return nu; @@ -1035,6 +1030,14 @@ static void rna_def_path(BlenderRNA *UNUSED(brna), StructRNA *srna) RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + prop = RNA_def_property(srna, "use_path_clamp", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_CLAMP); + RNA_def_property_ui_text( + prop, + "Clamp", + "Clamp the curve path children so they can't travel past the start/end point of the curve"); + RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH); RNA_def_property_ui_text(prop, @@ -1373,7 +1376,7 @@ static void rna_def_charinfo(BlenderRNA *brna) prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); // RNA_def_property_int_sdna(prop, NULL, "mat_nr"); - RNA_def_property_ui_text(prop, "Material Index", ""); + RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this character"); RNA_def_property_int_funcs(prop, "rna_ChariInfo_material_index_get", "rna_ChariInfo_material_index_set", @@ -1834,7 +1837,7 @@ static void rna_def_curve(BlenderRNA *brna) prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location"); + RNA_def_property_ui_text(prop, "Texture Space Location", ""); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable"); RNA_def_property_float_funcs( @@ -1844,7 +1847,7 @@ static void rna_def_curve(BlenderRNA *brna) prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size"); + RNA_def_property_ui_text(prop, "Texture Space Size", ""); RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable"); RNA_def_property_float_funcs( prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", NULL); @@ -2065,7 +2068,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "mat_nr"); - RNA_def_property_ui_text(prop, "Material Index", ""); + RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this curve"); RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index 94fdb130026..beea607e8c0 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -35,7 +35,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) +static void rna_Curve_transform(Curve *cu, float mat[16], bool shape_keys) { BKE_curve_transform(cu, (const float(*)[4])mat, shape_keys, true); diff --git a/source/blender/makesrna/intern/rna_curveprofile.c b/source/blender/makesrna/intern/rna_curveprofile.c index bb54d55f8bd..b3ab8cc15a2 100644 --- a/source/blender/makesrna/intern/rna_curveprofile.c +++ b/source/blender/makesrna/intern/rna_curveprofile.c @@ -137,7 +137,7 @@ static void rna_CurveProfile_remove_point(CurveProfile *profile, static void rna_CurveProfile_evaluate(struct CurveProfile *profile, ReportList *reports, float length_portion, - float *location) + float location[2]) { if (!profile->table) { BKE_report(reports, RPT_ERROR, "CurveProfile table not initialized, call initialize()"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 08f52be4257..9b9d561603b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1754,6 +1754,28 @@ void RNA_def_property_ui_range( } } +void RNA_def_property_ui_scale_type(PropertyRNA *prop, PropertyScaleType ui_scale_type) +{ + StructRNA *srna = DefRNA.laststruct; + + switch (prop->type) { + case PROP_INT: { + IntPropertyRNA *iprop = (IntPropertyRNA *)prop; + iprop->ui_scale_type = ui_scale_type; + break; + } + case PROP_FLOAT: { + FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; + fprop->ui_scale_type = ui_scale_type; + break; + } + default: + CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for scale.", srna->identifier, prop->identifier); + DefRNA.error = true; + break; + } +} + void RNA_def_property_range(PropertyRNA *prop, double min, double max) { StructRNA *srna = DefRNA.laststruct; @@ -2410,6 +2432,10 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const iprop->softmin = -10000; /* rather arbitrary .. */ iprop->softmax = 10000; } + else if (dp->dnatype && STREQ(dp->dnatype, "int8_t")) { + iprop->hardmin = iprop->softmin = INT8_MIN; + iprop->hardmax = iprop->softmax = INT8_MAX; + } if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || prop->subtype == PROP_FACTOR) { diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 36d39c5c201..85071e8cd19 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -505,11 +505,10 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "DepsgraphObjectInstance", NULL); - RNA_def_struct_ui_text( - srna, - "Dependency Graph Object Instance", - "Extended information about dependency graph object iterator " - "(WARNING: all data here is *evaluated* one, not original .blend IDs...)"); + RNA_def_struct_ui_text(srna, + "Dependency Graph Object Instance", + "Extended information about dependency graph object iterator " + "(Warning: All data here is 'evaluated' one, not original .blend IDs)"); prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); @@ -773,7 +772,7 @@ static void rna_def_depsgraph(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object Instances", "All object instances to display or render " - "(WARNING: only use this as an iterator, never as a sequence, " + "(Warning: Only use this as an iterator, never as a sequence, " "and do not keep any references to its items)"); prop = RNA_def_property(srna, "updates", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 1c7f6ef5cb3..1b89d866aba 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1160,6 +1160,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) /* define common props */ prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Additive", "Values generated by this modifier are applied on top of " @@ -1168,12 +1169,14 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, generator_mode_items); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Mode", "Type of generator to use"); RNA_def_property_update( prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update"); /* order of the polynomial */ prop = RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Polynomial Order", @@ -1184,6 +1187,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) /* coefficients array */ prop = RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_array(prop, 32); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length"); @@ -1221,25 +1225,30 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) /* coefficients */ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Amplitude", "Scale factor determining the maximum/minimum values"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Phase Multiple", "Scale factor determining the 'speed' of the function"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Phase Offset", "Constant factor to offset time by for function"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Value Offset", "Constant factor to offset values by"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); /* flags */ prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE); RNA_def_property_ui_text(prop, "Additive", @@ -1248,6 +1257,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "function_type", PROP_ENUM, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Type of built-in function to use"); @@ -1271,17 +1281,20 @@ static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna) */ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "min"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Minimum Value", "Lower bound of envelope at this control-point"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Maximum Value", "Upper bound of envelope at this control-point"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); /* Frame */ prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "time"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Frame", "Frame this control-point occurs on"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); @@ -1340,6 +1353,7 @@ static void rna_def_fmodifier_envelope(BlenderRNA *brna) /* Collections */ prop = RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "data", "totvert"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint"); RNA_def_property_ui_text( prop, "Control Points", "Control points defining the shape of the envelope"); @@ -1348,18 +1362,21 @@ static void rna_def_fmodifier_envelope(BlenderRNA *brna) /* Range Settings */ prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "midval"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Reference Value", "Value that envelope's influence is centered around / based on"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "min"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Default Minimum", "Lower distance from Reference Value for 1:1 default influence"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "max"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Default Maximum", "Upper distance from Reference Value for 1:1 default influence"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); @@ -1395,12 +1412,14 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) /* before */ prop = RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_enum_sdna(prop, NULL, "before_mode"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_int_sdna(prop, NULL, "before_cycles"); RNA_def_property_ui_text( prop, @@ -1410,12 +1429,14 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) /* after */ prop = RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_enum_sdna(prop, NULL, "after_mode"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_int_sdna(prop, NULL, "after_cycles"); RNA_def_property_ui_text(prop, "After Cycles", @@ -1450,26 +1471,31 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMIN); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMIN); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMAX); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMAX); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.xmin"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifierLimits_minx_set", "rna_FModifierLimits_minx_range"); RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow"); @@ -1477,6 +1503,7 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.ymin"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifierLimits_miny_set", "rna_FModifierLimits_miny_range"); RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow"); @@ -1484,6 +1511,7 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.xmax"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifierLimits_maxx_set", "rna_FModifierLimits_maxx_range"); RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow"); @@ -1491,6 +1519,7 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna) prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rect.ymax"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifierLimits_maxy_set", "rna_FModifierLimits_maxy_range"); RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow"); @@ -1519,16 +1548,19 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "modification"); RNA_def_property_enum_items(prop, prop_modification_items); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Blend Type", "Method of modifying the existing F-Curve"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "size"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Scale", "Scaling (in time) of the noise"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "strength"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Strength", @@ -1537,16 +1569,19 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "phase"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "offset"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Offset", "Time offset for the noise effect"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); } @@ -1569,11 +1604,13 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) /* properties */ prop = RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "step_size"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "offset"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Offset", "Reference number of frames before frames get held " @@ -1582,18 +1619,21 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) prop = RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_BEFORE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_AFTER); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update"); prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "start_frame"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs(prop, NULL, "rna_FModifierStepped_frame_start_set", @@ -1604,6 +1644,7 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "end_frame"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifierStepped_frame_end_set", "rna_FModifierStepped_end_frame_range"); RNA_def_property_ui_text( @@ -1641,12 +1682,14 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); 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); RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_show_expanded_set"); RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Enabled", "Enable F-Curve modifier evaluation"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update"); RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1); @@ -1654,6 +1697,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED); + // RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update"); @@ -1661,6 +1705,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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Active", "F-Curve modifier will show settings in the editor"); 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"); @@ -1669,6 +1714,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) /* restricted range */ prop = RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_RANGERESTRICT); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Restrict Frame Range", @@ -1678,6 +1724,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sfra"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range"); RNA_def_property_ui_text( @@ -1688,6 +1735,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "efra"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs( prop, NULL, "rna_FModifier_end_frame_set", "rna_FModifier_end_frame_range"); RNA_def_property_ui_text( @@ -1698,6 +1746,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "blendin"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range"); RNA_def_property_ui_text( prop, "Blend In", "Number of frames from start frame for influence to take effect"); @@ -1705,6 +1754,7 @@ static void rna_def_fmodifier(BlenderRNA *brna) prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "blendout"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range"); RNA_def_property_ui_text( prop, "Blend Out", "Number of frames from end frame for influence to fade out"); @@ -1713,12 +1763,14 @@ static void rna_def_fmodifier(BlenderRNA *brna) /* influence */ prop = RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_USEINFLUENCE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor"); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update"); prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "influence"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text( @@ -2162,6 +2214,7 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop) /* Collection active property */ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "FModifier"); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_pointer_funcs( prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -2378,6 +2431,7 @@ static void rna_def_fcurve(BlenderRNA *brna) prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation"); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval"); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 1a0497b72f4..19ed5f960cf 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1037,7 +1037,7 @@ static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src) static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, bool setactive) { - bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0); + bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0, false); WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); @@ -1625,7 +1625,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna) /* Material Index */ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "mat_nr"); - RNA_def_property_ui_text(prop, "Material Index", "Index of material used in this stroke"); + RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this stroke"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); /* Settings */ @@ -2114,6 +2114,12 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) "ViewLayer", "Only include Layer in this View Layer render output (leave blank to include always)"); + prop = RNA_def_property(srna, "use_viewlayer_masks", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_DISABLE_MASKS_IN_VIEWLAYER); + RNA_def_property_ui_text( + prop, "Use Masks in Render", "Include the mask layers when rendering the viewlayer"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + /* blend mode */ prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); @@ -2197,7 +2203,10 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop = RNA_def_property(srna, "use_mask_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK); - RNA_def_property_ui_text(prop, "Mask Layer", "Mask pixels from underlying layers drawing"); + RNA_def_property_ui_text( + prop, + "Use Mask", + "The visibility of drawings on this layer is affected by the layers in its masks list"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); prop = RNA_def_property(srna, "use_lights", PROP_BOOLEAN, PROP_NONE); @@ -2568,7 +2577,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Auto-Lock Layers", - "Lock automatically all layers except active one to avoid accidental changes"); + "Automatically lock all layers except the active one to avoid accidental changes"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_autolock"); prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA); diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 0aa2e652d2d..92d65961743 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -68,6 +68,11 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = { ICON_MOD_BUILD, "Build", "Create duplication of strokes"}, + {eGpencilModifierType_Lineart, + "GP_LINEART", + ICON_MOD_EDGESPLIT, /* TODO: Use a proper icon. */ + "Line Art", + "Generate line art strokes from selected source"}, {eGpencilModifierType_Mirror, "GP_MIRROR", ICON_MOD_MIRROR, @@ -88,11 +93,6 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = { ICON_MOD_SUBSURF, "Subdivide", "Subdivide stroke adding more control points"}, - {eGpencilModifierType_Lineart, - "GP_LINEART", - ICON_MOD_EDGESPLIT, /* TODO: Use a proper icon. */ - "Line Art", - "Generate line art strokes from selected source"}, {0, "", 0, N_("Deform"), ""}, {eGpencilModifierType_Armature, "GP_ARMATURE", @@ -109,6 +109,11 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = { ICON_MOD_LATTICE, "Lattice", "Deform strokes using lattice"}, + {eGpencilModifierType_Length, + "GP_LENGTH", + ICON_MOD_EDGESPLIT, + "Length", + "Extend or shrink strokes"}, {eGpencilModifierType_Noise, "GP_NOISE", ICON_MOD_NOISE, "Noise", "Add noise to strokes"}, {eGpencilModifierType_Offset, "GP_OFFSET", @@ -188,12 +193,18 @@ static const EnumPropertyItem gpencil_tint_type_items[] = { {GP_TINT_GRADIENT, "GRADIENT", 0, "Gradient", ""}, {0, NULL, 0, NULL, NULL}, }; +static const EnumPropertyItem gpencil_length_mode_items[] = { + {GP_LENGTH_RELATIVE, "RELATIVE", 0, "Relative", "Length in ratio to the stroke's length"}, + {GP_LENGTH_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Length in geometry space"}, + {0, NULL, 0, NULL, NULL}, +}; #endif #ifdef RNA_RUNTIME # include "DNA_curve_types.h" # include "DNA_fluid_types.h" +# include "DNA_material_types.h" # include "DNA_particle_types.h" # include "BKE_cachefile.h" @@ -232,6 +243,8 @@ static StructRNA *rna_GpencilModifier_refine(struct PointerRNA *ptr) return &RNA_OpacityGpencilModifier; case eGpencilModifierType_Lattice: return &RNA_LatticeGpencilModifier; + case eGpencilModifierType_Length: + return &RNA_LengthGpencilModifier; case eGpencilModifierType_Mirror: return &RNA_MirrorGpencilModifier; case eGpencilModifierType_Smooth: @@ -350,6 +363,8 @@ static void greasepencil_modifier_object_set(Object *self, RNA_GP_MOD_OBJECT_SET(Armature, object, OB_ARMATURE); RNA_GP_MOD_OBJECT_SET(Lattice, object, OB_LATTICE); RNA_GP_MOD_OBJECT_SET(Mirror, object, OB_EMPTY); +RNA_GP_MOD_OBJECT_SET(Opacity, object, OB_EMPTY); +RNA_GP_MOD_OBJECT_SET(Thick, object, OB_EMPTY); # undef RNA_GP_MOD_OBJECT_SET @@ -434,6 +449,195 @@ static void rna_GpencilModifier_opacity_update(Main *bmain, Scene *scene, Pointe rna_GpencilModifier_update(bmain, scene, ptr); } +bool rna_GpencilModifier_material_poll(PointerRNA *ptr, PointerRNA value) +{ + Object *ob = (Object *)ptr->owner_id; + Material *ma = (Material *)value.owner_id; + + return BKE_gpencil_object_material_index_get(ob, ma) != -1; +} + +static void rna_GpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + Material **ma_target, + struct ReportList *reports) +{ + Object *ob = (Object *)ptr->owner_id; + Material *ma = (Material *)value.owner_id; + + if (ma == NULL || BKE_gpencil_object_material_index_get(ob, ma) != -1) { + id_lib_extern((ID *)ob); + *ma_target = ma; + } + else { + BKE_reportf( + reports, + RPT_ERROR, + "Cannot assign material '%s', it has to be used by the grease pencil object already", + ma->id.name); + } +} + +static void rna_LineartGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)ptr->data; + Material **ma_target = &lmd->target_material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_NoiseGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + NoiseGpencilModifierData *nmd = (NoiseGpencilModifierData *)ptr->data; + Material **ma_target = &nmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_SmoothGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + SmoothGpencilModifierData *smd = (SmoothGpencilModifierData *)ptr->data; + Material **ma_target = &smd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_SubdivGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + SubdivGpencilModifierData *smd = (SubdivGpencilModifierData *)ptr->data; + Material **ma_target = &smd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_SimplifyGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + SimplifyGpencilModifierData *smd = (SimplifyGpencilModifierData *)ptr->data; + Material **ma_target = &smd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_ThickGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + ThickGpencilModifierData *tmd = (ThickGpencilModifierData *)ptr->data; + Material **ma_target = &tmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_OffsetGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + OffsetGpencilModifierData *omd = (OffsetGpencilModifierData *)ptr->data; + Material **ma_target = &omd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_TintGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + TintGpencilModifierData *tmd = (TintGpencilModifierData *)ptr->data; + Material **ma_target = &tmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_ColorGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + ColorGpencilModifierData *cmd = (ColorGpencilModifierData *)ptr->data; + Material **ma_target = &cmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_ArrayGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + ArrayGpencilModifierData *amd = (ArrayGpencilModifierData *)ptr->data; + Material **ma_target = &amd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_OpacityGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + OpacityGpencilModifierData *omd = (OpacityGpencilModifierData *)ptr->data; + Material **ma_target = &omd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_LatticeGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + LatticeGpencilModifierData *lmd = (LatticeGpencilModifierData *)ptr->data; + Material **ma_target = &lmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_MirrorGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + MirrorGpencilModifierData *mmd = (MirrorGpencilModifierData *)ptr->data; + Material **ma_target = &mmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_HookGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + HookGpencilModifierData *hmd = (HookGpencilModifierData *)ptr->data; + Material **ma_target = &hmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_MultiplyGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)ptr->data; + Material **ma_target = &mmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + +static void rna_TextureGpencilModifier_material_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *reports) +{ + TextureGpencilModifierData *tmd = (TextureGpencilModifierData *)ptr->data; + Material **ma_target = &tmd->material; + + rna_GpencilModifier_material_set(ptr, value, ma_target, reports); +} + #else static void rna_def_modifier_gpencilnoise(BlenderRNA *brna) @@ -446,14 +650,20 @@ static void rna_def_modifier_gpencilnoise(BlenderRNA *brna) RNA_def_struct_sdna(srna, "NoiseGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_NOISE); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_NoiseGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -567,6 +777,8 @@ static void rna_def_modifier_gpencilnoise(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_LAYERPASS); RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilsmooth(BlenderRNA *brna) @@ -579,14 +791,20 @@ static void rna_def_modifier_gpencilsmooth(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SmoothGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_SmoothGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -680,6 +898,8 @@ static void rna_def_modifier_gpencilsmooth(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "curve_intensity"); RNA_def_property_ui_text(prop, "Curve", "Custom curve to apply effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna) @@ -692,14 +912,20 @@ static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SubdivGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_SubdivGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -746,6 +972,8 @@ static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_LAYERPASS); RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna) @@ -782,14 +1010,20 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SimplifyGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLIFY); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_SimplifyGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -859,6 +1093,8 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 1.0, 0.01, 3); RNA_def_property_ui_text(prop, "Distance", "Distance between points"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilthick(BlenderRNA *brna) @@ -871,14 +1107,20 @@ static void rna_def_modifier_gpencilthick(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ThickGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_THICKNESS); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_ThickGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -901,6 +1143,37 @@ static void rna_def_modifier_gpencilthick(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Thickness Factor", "Factor to multiply the thickness with"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "use_fading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_FADING); + RNA_def_property_ui_text(prop, "Fading", "Fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + /* Distance reference object */ + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Object used as distance reference"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_ThickGpencilModifier_object_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); + + prop = RNA_def_property(srna, "fading_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_start"); + RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2); + RNA_def_property_ui_text(prop, "Fading Start", "Start distance of fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "fading_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_end"); + RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2); + RNA_def_property_ui_text(prop, "Fading End", "End distance of fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "fading_end_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_end_factor"); + RNA_def_property_range(prop, 0.0, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 10.0, 0.1, 3); + RNA_def_property_ui_text(prop, "End Factor", "Fading end thickness factor"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "pass_index"); RNA_def_property_range(prop, 0, 100); @@ -953,6 +1226,8 @@ static void rna_def_modifier_gpencilthick(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "curve_thickness"); RNA_def_property_ui_text(prop, "Curve", "Custom curve to apply effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpenciloffset(BlenderRNA *brna) @@ -965,14 +1240,20 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna) RNA_def_struct_sdna(srna, "OffsetGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_OFFSET); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_OffsetGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1036,6 +1317,36 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Scale", "Values for changes in scale"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "random_offset", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "rnd_offset"); + RNA_def_property_ui_text(prop, "Random Offset", "Value for changes in location"); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_EULER); + RNA_def_property_float_sdna(prop, NULL, "rnd_rot"); + RNA_def_property_ui_text(prop, "Random Rotation", "Value for changes in rotation"); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "random_scale", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "rnd_scale"); + RNA_def_property_ui_text(prop, "Scale", "Value for changes in scale"); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(prop, "Seed", "Random seed"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "use_uniform_random_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_UNIFORM_RANDOM_SCALE); + RNA_def_property_ui_text( + prop, "Uniform Scale", "Use the same random seed for each scale axis for a uniform scale"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpenciltint(BlenderRNA *brna) @@ -1056,10 +1367,11 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna) RNA_def_struct_sdna(srna, "TintGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_COLOR); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Parent object to define the center of the effect"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_pointer_funcs(prop, NULL, "rna_TintGpencilModifier_object_set", NULL, NULL); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); @@ -1069,8 +1381,12 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_TintGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1171,6 +1487,8 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "curve_intensity"); RNA_def_property_ui_text(prop, "Curve", "Custom curve to apply effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpenciltime(BlenderRNA *brna) @@ -1183,6 +1501,8 @@ static void rna_def_modifier_gpenciltime(BlenderRNA *brna) RNA_def_struct_sdna(srna, "TimeGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_TIME); + RNA_define_lib_overridable(true); + 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_time_mode_items); @@ -1250,6 +1570,8 @@ static void rna_def_modifier_gpenciltime(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Custom Range", "Define a custom range of frames to use in modifier"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilcolor(BlenderRNA *brna) @@ -1262,6 +1584,8 @@ static void rna_def_modifier_gpencilcolor(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ColorGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_TINT); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */ RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected"); @@ -1273,8 +1597,12 @@ static void rna_def_modifier_gpencilcolor(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_ColorGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1341,6 +1669,8 @@ static void rna_def_modifier_gpencilcolor(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "curve_intensity"); RNA_def_property_ui_text(prop, "Curve", "Custom curve to apply effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilopacity(BlenderRNA *brna) @@ -1353,6 +1683,8 @@ static void rna_def_modifier_gpencilopacity(BlenderRNA *brna) RNA_def_struct_sdna(srna, "OpacityGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_OPACITY); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, modifier_modify_opacity_items); RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected"); @@ -1364,8 +1696,12 @@ static void rna_def_modifier_gpencilopacity(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_OpacityGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1390,6 +1726,37 @@ static void rna_def_modifier_gpencilopacity(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Hardness", "Factor of stroke hardness"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "use_fading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_FADING); + RNA_def_property_ui_text(prop, "Fading", "Fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + /* Distance reference object */ + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Object used as distance reference"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_OpacityGpencilModifier_object_set", NULL, NULL); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); + + prop = RNA_def_property(srna, "fading_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_start"); + RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2); + RNA_def_property_ui_text(prop, "Fading Start", "Start distance of fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "fading_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_end"); + RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2); + RNA_def_property_ui_text(prop, "Fading End", "End distance of fading effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "fading_end_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fading_end_factor"); + RNA_def_property_range(prop, 0.0, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 10.0, 0.1, 3); + RNA_def_property_ui_text(prop, "End Factor", "Fading end thickness factor"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "pass_index"); RNA_def_property_range(prop, 0, 100); @@ -1442,6 +1809,8 @@ static void rna_def_modifier_gpencilopacity(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "curve_intensity"); RNA_def_property_ui_text(prop, "Curve", "Custom curve to apply effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilarray(BlenderRNA *brna) @@ -1454,14 +1823,20 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ArrayGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_ArrayGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1486,7 +1861,6 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna) "Use the location and rotation of another object to determine the distance and " "rotational change between arrayed items"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); prop = RNA_def_property(srna, "constant_offset", PROP_FLOAT, PROP_TRANSLATION); @@ -1581,6 +1955,8 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Uniform Scale", "Use the same random seed for each scale axis for a uniform scale"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) @@ -1643,6 +2019,8 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) RNA_def_struct_sdna(srna, "BuildGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD); + RNA_define_lib_overridable(true); + /* Mode */ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_gpencil_build_mode_items); @@ -1740,6 +2118,8 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERT_LAYERPASS); RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencillattice(BlenderRNA *brna) @@ -1753,14 +2133,20 @@ static void rna_def_modifier_gpencillattice(BlenderRNA *brna) RNA_def_struct_sdna(srna, "LatticeGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_LatticeGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1812,7 +2198,6 @@ static void rna_def_modifier_gpencillattice(BlenderRNA *brna) RNA_def_property_pointer_funcs( prop, NULL, "rna_LatticeGpencilModifier_object_set", NULL, "rna_Lattice_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); @@ -1820,6 +2205,8 @@ static void rna_def_modifier_gpencillattice(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 1, 10, 2); RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilmirror(BlenderRNA *brna) @@ -1832,14 +2219,20 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna) RNA_def_struct_sdna(srna, "MirrorGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_MirrorGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -1879,7 +2272,6 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object", "Object used as center"); RNA_def_property_pointer_funcs(prop, NULL, "rna_MirrorGpencilModifier_object_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE); @@ -1901,6 +2293,8 @@ static void rna_def_modifier_gpencilmirror(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Z); RNA_def_property_ui_text(prop, "Z", "Mirror the Z axis"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilhook(BlenderRNA *brna) @@ -1914,11 +2308,12 @@ static void rna_def_modifier_gpencilhook(BlenderRNA *brna) RNA_def_struct_sdna(srna, "HookGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_HOOK); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text( prop, "Object", "Parent Object for hook, also recalculates and clears offset"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_pointer_funcs(prop, NULL, "rna_HookGpencilModifier_object_set", NULL, NULL); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); @@ -1936,8 +2331,12 @@ static void rna_def_modifier_gpencilhook(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_HookGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -2025,6 +2424,8 @@ static void rna_def_modifier_gpencilhook(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_UNIFORM_SPACE); RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilarmature(BlenderRNA *brna) @@ -2038,12 +2439,13 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ArmatureGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Armature object to deform with"); RNA_def_property_pointer_funcs( prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE); @@ -2075,6 +2477,8 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP); RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencilmultiply(BlenderRNA *brna) @@ -2087,14 +2491,20 @@ static void rna_def_modifier_gpencilmultiply(BlenderRNA *brna) RNA_def_struct_sdna(srna, "MultiplyGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_GP_MULTIFRAME_EDITING); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_MultiplyGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -2167,6 +2577,8 @@ static void rna_def_modifier_gpencilmultiply(BlenderRNA *brna) RNA_def_property_range(prop, 0, 1); RNA_def_property_ui_text(prop, "Center", "Fade center"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpenciltexture(BlenderRNA *brna) @@ -2205,6 +2617,8 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna) RNA_def_struct_sdna(srna, "TextureGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_TEXTURE); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); @@ -2216,8 +2630,12 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_TextureGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -2311,6 +2729,8 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna) RNA_def_property_enum_items(prop, mode_items); RNA_def_property_ui_text(prop, "Mode", ""); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); + + RNA_define_lib_overridable(false); } static void rna_def_modifier_gpencillineart(BlenderRNA *brna) @@ -2331,6 +2751,8 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_struct_sdna(srna, "LineartGpencilModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "use_fuzzy_intersections", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_INTERSECTION_AS_CONTOUR); RNA_def_property_ui_text(prop, @@ -2407,7 +2829,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) prop = RNA_def_property(srna, "source_object", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Source Object", "Source object that this modifier uses data from"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); @@ -2415,7 +2836,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) prop = RNA_def_property(srna, "source_collection", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_struct_type(prop, "Collection"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text( prop, "Source Collection", "Source collection that this modifier uses data from"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); @@ -2466,9 +2886,13 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "target_material", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_pointer_funcs(prop, + NULL, + "rna_LineartGpencilModifier_material_set", + NULL, + "rna_GpencilModifier_material_poll"); RNA_def_property_ui_text( prop, "Target Material", "Grease Pencil material assigned to the generated strokes"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -2501,12 +2925,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Match Output", "Match output vertex group based on name"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "use_soft_selection", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_SOFT_SELECTION); - RNA_def_property_ui_text( - prop, "Clip", "Preserve original vertex weight instead of clipping to 0/1"); - RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_IS_BAKED); RNA_def_property_ui_text(prop, "Is Baked", "This modifier has baked data"); @@ -2524,15 +2942,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "resample_length", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_ui_text(prop, - "Resample Length", - "Resample the strokes so that the stroke points have the specified " - "length between them. Zero length disables the resampling"); - RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 2); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transparency_flags", LRT_GPENCIL_TRANSPARENCY_ENABLE); RNA_def_property_ui_text( @@ -2550,6 +2959,92 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_array(prop, 8); RNA_def_property_ui_text(prop, "Mask", ""); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); +} + +static void rna_def_modifier_gpencillength(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "LengthGpencilModifier", "GpencilModifier"); + RNA_def_struct_ui_text(srna, "Length Modifier", "Stretch or shrink strokes"); + RNA_def_struct_sdna(srna, "LengthGpencilModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT); + + RNA_define_lib_overridable(true); + + prop = RNA_def_property(srna, "start_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "start_fac"); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 1); + RNA_def_property_ui_text(prop, "Start Factor", "Length difference for each segment"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "end_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "end_fac"); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 1); + RNA_def_property_ui_text(prop, "End Factor", "Length difference for each segment"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "overshoot_factor", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "overshoot_fac"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text( + prop, + "Overshoot Factor", + "Defines how precise must follow the stroke trajectory for the overshoot extremes"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_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, gpencil_length_mode_items); + RNA_def_property_ui_text(prop, "Mode", "Mode to define length"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "layername"); + RNA_def_property_ui_text(prop, "Layer", "Layer name"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_ui_text(prop, "Material", "Material used for filtering effect"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "pass_index"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Pass", "Pass index"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_LAYER); + RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_materials", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_MATERIAL); + RNA_def_property_ui_text(prop, "Inverse Materials", "Inverse filter"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_PASS); + RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "layer_pass"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Pass", "Layer pass index"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_LAYERPASS); + RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + RNA_define_lib_overridable(false); } void RNA_def_greasepencil_modifier(BlenderRNA *brna) @@ -2627,6 +3122,7 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna) rna_def_modifier_gpencilmultiply(brna); rna_def_modifier_gpenciltexture(brna); rna_def_modifier_gpencillineart(brna); + rna_def_modifier_gpencillength(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 95972dd444f..bfe9d4bb77c 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -476,7 +476,7 @@ void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop); #endif void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop); -#ifdef WITH_GEOMETRY_NODES +#ifdef WITH_SIMULATION_DATABLOCK void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop); #endif diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 0c0260c889c..245730919b0 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -400,6 +400,7 @@ typedef struct IntPropertyRNA { PropIntArraySetFuncEx setarray_ex; PropIntRangeFuncEx range_ex; + PropertyScaleType ui_scale_type; int softmin, softmax; int hardmin, hardmax; int step; @@ -423,6 +424,7 @@ typedef struct FloatPropertyRNA { PropFloatArraySetFuncEx setarray_ex; PropFloatRangeFuncEx range_ex; + PropertyScaleType ui_scale_type; float softmin, softmax; float hardmin, hardmax; float step; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 3b9fc970072..a48727526c9 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -699,6 +699,16 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p } } +static void rna_ShapeKey_update_minmax(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + KeyBlock *data = (KeyBlock *)ptr->data; + if (IN_RANGE_INCL(data->curval, data->slidermin, data->slidermax)) { + return; + } + CLAMP(data->curval, data->slidermin, data->slidermax); + rna_Key_update_data(bmain, scene, ptr); +} + static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point) { KeyBlock *kb; @@ -955,6 +965,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_float_funcs( prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range"); RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider"); + RNA_def_property_update(prop, 0, "rna_ShapeKey_update_minmax"); prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "slidermax"); @@ -963,6 +974,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_float_funcs( prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range"); RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider"); + RNA_def_property_update(prop, 0, "rna_ShapeKey_update_minmax"); prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "data", "totelem"); diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c index 0b61603dd09..5b69a743d47 100644 --- a/source/blender/makesrna/intern/rna_lattice_api.c +++ b/source/blender/makesrna/intern/rna_lattice_api.c @@ -33,7 +33,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Lattice_transform(Lattice *lt, float *mat, bool shape_keys) +static void rna_Lattice_transform(Lattice *lt, float mat[16], bool shape_keys) { BKE_lattice_transform(lt, (float(*)[4])mat, shape_keys); diff --git a/source/blender/makesrna/intern/rna_light.c b/source/blender/makesrna/intern/rna_light.c index bb99e5c6c1d..0593db0dd56 100644 --- a/source/blender/makesrna/intern/rna_light.c +++ b/source/blender/makesrna/intern/rna_light.c @@ -480,6 +480,15 @@ static void rna_def_area_light(BlenderRNA *brna) "Size Y", "Size of the area of the area light in the Y direction for rectangle shapes"); RNA_def_property_update(prop, 0, "rna_Light_draw_update"); + + prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "area_spread"); + RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(180.0f)); + RNA_def_property_ui_text( + prop, + "Spread", + "How widely the emitted light fans out, as in the case of a gridded softbox"); + RNA_def_property_update(prop, 0, "rna_Light_draw_update"); } static void rna_def_spot_light(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index c80f856dd6b..464abc6b543 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -134,7 +134,7 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(pointclouds) RNA_MAIN_LISTBASE_FUNCS_DEF(scenes) RNA_MAIN_LISTBASE_FUNCS_DEF(screens) RNA_MAIN_LISTBASE_FUNCS_DEF(shapekeys) -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK RNA_MAIN_LISTBASE_FUNCS_DEF(simulations) # endif RNA_MAIN_LISTBASE_FUNCS_DEF(sounds) @@ -407,7 +407,7 @@ void RNA_def_main(BlenderRNA *brna) "Volumes", "Volume data-blocks", RNA_def_main_volumes}, -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK {"simulations", "Simulation", "rna_Main_simulations_begin", diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index d24be91f731..8e6ff961721 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -806,7 +806,7 @@ static Volume *rna_Main_volumes_new(Main *bmain, const char *name) return volume; } -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK static Simulation *rna_Main_simulations_new(Main *bmain, const char *name) { char safe_name[MAX_ID_NAME - 2]; @@ -870,7 +870,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(hairs, hairs, ID_HA) RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT) # endif RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO) -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK RNA_MAIN_ID_TAG_FUNCS_DEF(simulations, simulations, ID_SIM) # endif @@ -996,7 +996,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); - RNA_def_function_ui_description(func, "Remove a object from the current blendfile"); + RNA_def_function_ui_description(func, "Remove an object from the current blendfile"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); @@ -1200,7 +1200,7 @@ void RNA_def_main_lights(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_string(func, "name", "Light", 0, "", "New name for the data-block"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum( - func, "type", rna_enum_light_type_items, 0, "Type", "The type of texture to add"); + func, "type", rna_enum_light_type_items, 0, "Type", "The type of light to add"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "light", "Light", "", "New light data-block"); @@ -1216,7 +1216,7 @@ void RNA_def_main_lights(BlenderRNA *brna, PropertyRNA *cprop) "do_unlink", true, "", - "Unlink all usages of this Light before deleting it " + "Unlink all usages of this light before deleting it " "(WARNING: will also delete objects instancing that light data)"); RNA_def_boolean(func, "do_id_user", @@ -1248,7 +1248,7 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a camera from the current blendfile"); + RNA_def_function_ui_description(func, "Remove a library from the current blendfile"); parm = RNA_def_pointer(func, "library", "Library", "", "Library to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); @@ -1258,9 +1258,9 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) "do_id_user", true, "", - "Decrement user counter of all datablocks used by this object"); + "Decrement user counter of all datablocks used by this library"); RNA_def_boolean( - func, "do_ui_user", true, "", "Make sure interface does not reference this object"); + func, "do_ui_user", true, "", "Make sure interface does not reference this library"); } void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) @@ -1327,7 +1327,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Load a new image into the main database"); parm = RNA_def_string_file_path( - func, "filepath", "File Path", 0, "", "path of the file to load"); + func, "filepath", "File Path", 0, "", "Path of the file to load"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "check_existing", @@ -1372,7 +1372,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the data-block"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return type */ - parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices data-block"); + parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattice data-block"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); @@ -1857,7 +1857,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a armature from the current blendfile"); + RNA_def_function_ui_description(func, "Remove an armature from the current blendfile"); parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); @@ -1900,7 +1900,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a action from the current blendfile"); + RNA_def_function_ui_description(func, "Remove an action from the current blendfile"); parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); @@ -2158,7 +2158,7 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) /* remove func */ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a masks from the current blendfile."); + RNA_def_function_ui_description(func, "Remove a mask from the current blendfile"); parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); @@ -2238,11 +2238,11 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Main Light Probes", "Collection of light probes"); func = RNA_def_function(srna, "new", "rna_Main_lightprobe_new"); - RNA_def_function_ui_description(func, "Add a new probe to the main database"); + RNA_def_function_ui_description(func, "Add a new light probe to the main database"); parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum( - func, "type", rna_enum_lightprobes_type_items, 0, "Type", "The type of lightprobe to add"); + func, "type", rna_enum_lightprobes_type_items, 0, "Type", "The type of light probe to add"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* return type */ parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "New light probe data-block"); @@ -2250,15 +2250,15 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove a probe from the current blendfile"); - parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Probe to remove"); + RNA_def_function_ui_description(func, "Remove a light probe from the current blendfile"); + parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Light probe to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); RNA_def_boolean(func, "do_unlink", true, "", - "Unlink all usages of this probe before deleting it " + "Unlink all usages of this light probe before deleting it " "(WARNING: will also delete objects instancing that light probe data)"); RNA_def_boolean(func, "do_id_user", @@ -2412,7 +2412,7 @@ void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } -# ifdef WITH_GEOMETRY_NODES +# ifdef WITH_SIMULATION_DATABLOCK void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 7ef1904fc34..a4052430d9a 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -840,6 +840,8 @@ void RNA_def_material(BlenderRNA *brna) prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); RNA_def_property_clear_flag(prop, PROP_PTR_NO_OWNERSHIP); + /* XXX: remove once overrides in material node trees are supported. */ + RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials"); prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index cf7d1f30dde..d5a1047d287 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -958,13 +958,14 @@ static void rna_MeshPaintMaskLayer_data_begin(CollectionPropertyIterator *iter, { Mesh *me = rna_mesh(ptr); CustomDataLayer *layer = (CustomDataLayer *)ptr->data; - rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL); + rna_iterator_array_begin( + iter, layer->data, sizeof(MFloatProperty), (me->edit_mesh) ? 0 : me->totvert, 0, NULL); } static int rna_MeshPaintMaskLayer_data_length(PointerRNA *ptr) { Mesh *me = rna_mesh(ptr); - return me->totvert; + return (me->edit_mesh) ? 0 : me->totvert; } /* End paint mask */ @@ -987,13 +988,14 @@ static void rna_MeshFaceMapLayer_data_begin(CollectionPropertyIterator *iter, Po { Mesh *me = rna_mesh(ptr); CustomDataLayer *layer = (CustomDataLayer *)ptr->data; - rna_iterator_array_begin(iter, layer->data, sizeof(int), me->totpoly, 0, NULL); + rna_iterator_array_begin( + iter, layer->data, sizeof(int), (me->edit_mesh) ? 0 : me->totpoly, 0, NULL); } static int rna_MeshFaceMapLayer_data_length(PointerRNA *ptr) { Mesh *me = rna_mesh(ptr); - return me->totpoly; + return (me->edit_mesh) ? 0 : me->totpoly; } static PointerRNA rna_Mesh_face_map_new(struct Mesh *me, ReportList *reports, const char *name) @@ -1821,7 +1823,7 @@ static void rna_def_mlooptri(BlenderRNA *brna) prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_material_index_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Material Index", ""); + RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this triangle"); prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1931,7 +1933,7 @@ static void rna_def_mpolygon(BlenderRNA *brna) prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "mat_nr"); - RNA_def_property_ui_text(prop, "Material Index", ""); + RNA_def_property_ui_text(prop, "Material Index", "Material slot index of this polygon"); # if 0 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range"); # endif @@ -3289,10 +3291,12 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Z", "Enable symmetry in the Z axis"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - prop = RNA_def_property(srna, "use_mirror_vertex_group_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERTEX_GROUPS_X_SYMMETRY); - RNA_def_property_ui_text( - prop, "Vertex Groups X Symmetry", "Mirror the left/right vertex groups when painting"); + prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_VERTEX_GROUPS); + RNA_def_property_ui_text(prop, + "Mirror Vertex Groups", + "Mirror the left/right vertex groups when painting. The symmetry axis " + "is determined by the symmetry settings"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); /* End Symmetry */ diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index f92a2932f06..2b0582cae9a 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -172,7 +172,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh, DEG_id_tag_update(&mesh->id, 0); } -static void rna_Mesh_transform(Mesh *mesh, float *mat, bool shape_keys) +static void rna_Mesh_transform(Mesh *mesh, float mat[16], bool shape_keys) { BKE_mesh_transform(mesh, (float(*)[4])mat, shape_keys); diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c index 19d0b35959b..93bd9fe3b9c 100644 --- a/source/blender/makesrna/intern/rna_meta_api.c +++ b/source/blender/makesrna/intern/rna_meta_api.c @@ -35,7 +35,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Meta_transform(struct MetaBall *mb, float *mat) +static void rna_Meta_transform(struct MetaBall *mb, float mat[16]) { BKE_mball_transform(mb, (float(*)[4])mat, true); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 98a2b683f18..674e5845ccb 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2226,6 +2226,14 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) prop, "Merge Distance", "Distance within which mirrored vertices are merged"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "bisect_threshold", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "bisect_threshold"); + RNA_def_property_range(prop, 0, FLT_MAX); + RNA_def_property_ui_range(prop, 0, 1, 0.01, 6); + RNA_def_property_ui_text( + prop, "Bisect Distance", "Distance from the bisect plane within which vertices are removed"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob"); RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror"); @@ -2773,7 +2781,8 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "double_threshold"); RNA_def_property_range(prop, 0, 1.0f); - RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6); + RNA_def_property_ui_range(prop, 0, 1, 1.0, 6); + RNA_def_property_ui_scale_type(prop, PROP_SCALE_LOG); RNA_def_property_ui_text( prop, "Overlap Threshold", "Threshold for checking overlapping geometry"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -5522,6 +5531,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "voxel_size"); RNA_def_property_range(prop, 0.0001f, FLT_MAX); RNA_def_property_ui_range(prop, 0.0001, 2, 0.1, 3); + RNA_def_property_ui_scale_type(prop, PROP_SCALE_LOG); RNA_def_property_ui_text(prop, "Voxel Size", "Size of the voxel in object space used for volume evaluation. Lower " @@ -5920,8 +5930,9 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Keep Normals", - "Try to preserve custom normals (WARNING: depending on chosen triangulation method, " - "shading may not be fully preserved, 'Fixed' method usually gives the best result here)"); + "Try to preserve custom normals.\n" + "Warning: Depending on chosen triangulation method, " + "shading may not be fully preserved, \"Fixed\" method usually gives the best result here"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); RNA_define_lib_overridable(false); diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index c9520c939f4..f8fa2aab5e7 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -402,7 +402,7 @@ static void rna_def_movieclip(BlenderRNA *brna) "Start Frame", "Global scene frame number at which this movie starts playing " "(affects all data associated with a clip)"); - RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update"); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); /* frame_offset */ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); @@ -412,7 +412,7 @@ static void rna_def_movieclip(BlenderRNA *brna) "Frame Offset", "Offset of footage first frame relative to its file name " "(affects only how footage is loading, does not change data associated with a clip)"); - RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update"); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); /* length */ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index d69a1e3dd06..2a1ea3d6716 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -65,6 +65,22 @@ const EnumPropertyItem rna_enum_node_socket_in_out_items[] = { {SOCK_IN, "IN", 0, "Input", ""}, {SOCK_OUT, "OUT", 0, "Output", ""}, {0, NULL, 0, NULL, NULL}}; +static const EnumPropertyItem node_socket_data_type_items[] = { + {SOCK_FLOAT, "FLOAT", 0, "Float", ""}, + {SOCK_INT, "INT", 0, "Integer", ""}, + {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""}, + {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, + {SOCK_STRING, "STRING", 0, "String", ""}, + {SOCK_RGBA, "RGBA", 0, "Color", ""}, + {SOCK_OBJECT, "OBJECT", 0, "Object", ""}, + {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, + {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""}, + {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""}, + {SOCK_TEXTURE, "TEXTURE", 0, "Texture", ""}, + {SOCK_MATERIAL, "MATERIAL", 0, "Material", ""}, + {0, NULL, 0, NULL, NULL}, +}; + #ifndef RNA_RUNTIME static const EnumPropertyItem rna_enum_node_socket_display_shape_items[] = { {SOCK_DISPLAY_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""}, @@ -78,7 +94,7 @@ static const EnumPropertyItem rna_enum_node_socket_display_shape_items[] = { static const EnumPropertyItem node_socket_type_items[] = { {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""}, {SOCK_FLOAT, "VALUE", 0, "Value", ""}, - {SOCK_INT, "INT", 0, "Int", ""}, + {SOCK_INT, "INT", 0, "Integer", ""}, {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""}, {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, {SOCK_STRING, "STRING", 0, "String", ""}, @@ -88,6 +104,8 @@ static const EnumPropertyItem node_socket_type_items[] = { {SOCK_IMAGE, "IMAGE", 0, "Image", ""}, {SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""}, {SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""}, + {SOCK_TEXTURE, "TEXTURE", 0, "Texture", ""}, + {SOCK_MATERIAL, "MATERIAL", 0, "Material", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -109,6 +127,20 @@ static const EnumPropertyItem node_chunksize_items[] = { }; #endif +static const EnumPropertyItem rna_enum_execution_mode_items[] = { + {NTREE_EXECUTION_MODE_TILED, + "TILED", + 0, + "Tiled", + "Compositing is tiled, having as priority to display first tiles as fast as possible"}, + {NTREE_EXECUTION_MODE_FULL_FRAME, + "FULL_FRAME", + 0, + "Full Frame", + "Composites full image result as fast as possible"}, + {0, NULL, 0, NULL, NULL}, +}; + const EnumPropertyItem rna_enum_mapping_type_items[] = { {NODE_MAPPING_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, {NODE_MAPPING_TYPE_TEXTURE, @@ -216,6 +248,7 @@ const EnumPropertyItem rna_enum_node_vec_math_items[] = { {NODE_VECTOR_MATH_SUBTRACT, "SUBTRACT", 0, "Subtract", "A - B"}, {NODE_VECTOR_MATH_MULTIPLY, "MULTIPLY", 0, "Multiply", "Entry-wise multiply"}, {NODE_VECTOR_MATH_DIVIDE, "DIVIDE", 0, "Divide", "Entry-wise divide"}, + {NODE_VECTOR_MATH_MULTIPLY_ADD, "MULTIPLY_ADD", 0, "Multiply Add", "A * B + C"}, {0, "", ICON_NONE, NULL, NULL}, {NODE_VECTOR_MATH_CROSS_PRODUCT, "CROSS_PRODUCT", 0, "Cross Product", "A cross B"}, {NODE_VECTOR_MATH_PROJECT, "PROJECT", 0, "Project", "Project A onto B"}, @@ -329,8 +362,12 @@ const EnumPropertyItem rna_enum_node_map_range_items[] = { }; const EnumPropertyItem rna_enum_node_clamp_items[] = { - {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Clamp values using Min and Max values"}, - {NODE_CLAMP_RANGE, "RANGE", 0, "Range", "Clamp values between Min and Max range"}, + {NODE_CLAMP_MINMAX, "MINMAX", 0, "Min Max", "Constrain value between min and max"}, + {NODE_CLAMP_RANGE, + "RANGE", + 0, + "Range", + "Constrain value between min and max, swapping arguments when min > max"}, {0, NULL, 0, NULL, NULL}, }; @@ -449,6 +486,12 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_vecto ITEM_VECTOR, {0, NULL, 0, NULL, NULL}, }; +static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_float_vector[] = { + ITEM_ATTRIBUTE, + ITEM_FLOAT, + ITEM_VECTOR, + {0, NULL, 0, NULL, NULL}, +}; static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_float[] = { ITEM_ATTRIBUTE, ITEM_FLOAT, @@ -487,6 +530,7 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_bo # include "NOD_common.h" # include "NOD_composite.h" +# include "NOD_geometry.h" # include "NOD_shader.h" # include "NOD_socket.h" @@ -946,6 +990,32 @@ static void rna_NodeTree_get_from_context( RNA_parameter_list_free(&list); } +static bool rna_NodeTree_valid_socket_type(eNodeSocketDatatype socket_type, + bNodeTreeType *ntreetype) +{ + extern FunctionRNA rna_NodeTree_valid_socket_type_func; + + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + void *ret; + bool valid; + + RNA_pointer_create(NULL, ntreetype->rna_ext.srna, NULL, &ptr); /* dummy */ + func = &rna_NodeTree_valid_socket_type_func; + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "type", &socket_type); + ntreetype->rna_ext.call(NULL, &ptr, func, &list); + + RNA_parameter_get_lookup(&list, "valid", &ret); + valid = *(bool *)ret; + + RNA_parameter_list_free(&list); + + return valid; +} + static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type) { bNodeTreeType *nt = RNA_struct_blender_type_get(type); @@ -974,7 +1044,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain, bNodeTreeType *nt, dummynt; bNodeTree dummyntree; PointerRNA dummyptr; - int have_function[3]; + int have_function[4]; /* setup dummy tree & tree type to store static properties in */ memset(&dummynt, 0, sizeof(bNodeTreeType)); @@ -1020,6 +1090,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain, nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL; nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL; nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL; + nt->valid_socket_type = (have_function[3]) ? rna_NodeTree_valid_socket_type : NULL; ntreeTypeAdd(nt); @@ -1074,13 +1145,25 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, return NULL; } - if (ntype->poll && !ntype->poll(ntype, ntree)) { - BKE_reportf(reports, - RPT_ERROR, - "Cannot add node of type %s to node tree '%s'", - type, - ntree->id.name + 2); - return NULL; + const char *disabled_hint = NULL; + if (ntype->poll && !ntype->poll(ntype, ntree, &disabled_hint)) { + if (disabled_hint) { + BKE_reportf(reports, + RPT_ERROR, + "Cannot add node of type %s to node tree '%s'\n %s", + type, + ntree->id.name + 2, + disabled_hint); + return NULL; + } + else { + BKE_reportf(reports, + RPT_ERROR, + "Cannot add node of type %s to node tree '%s'", + type, + ntree->id.name + 2); + return NULL; + } } node = nodeAddNode(C, ntree, type); @@ -1200,6 +1283,13 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, if (nodeCountSocketLinks(ntree, tosock) + 1 > nodeSocketLinkLimit(tosock)) { nodeRemSocketLinks(ntree, tosock); } + if (tosock->flag & SOCK_MULTI_INPUT) { + LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) { + if (link->fromsock == fromsock && link->tosock == tosock) { + nodeRemLink(ntree, link); + } + } + } } ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); @@ -1355,6 +1445,7 @@ static void rna_NodeTree_socket_remove(bNodeTree *ntree, ntreeRemoveSocketInterface(ntree, sock); ntreeUpdateTree(bmain, ntree); + DEG_id_tag_update(&ntree->id, 0); WM_main_add_notifier(NC_NODE | NA_EDITED, ntree); } } @@ -1520,7 +1611,7 @@ char *rna_Node_ImageUser_path(PointerRNA *ptr) return NULL; } -static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) +static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree, const char **UNUSED(r_disabled_hint)) { extern FunctionRNA rna_Node_poll_func; @@ -1545,7 +1636,9 @@ static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) return visible; } -static bool rna_Node_poll_instance(bNode *node, bNodeTree *ntree) +static bool rna_Node_poll_instance(bNode *node, + bNodeTree *ntree, + const char **UNUSED(disabled_info)) { extern FunctionRNA rna_Node_poll_instance_func; @@ -1570,10 +1663,12 @@ static bool rna_Node_poll_instance(bNode *node, bNodeTree *ntree) return visible; } -static bool rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree) +static bool rna_Node_poll_instance_default(bNode *node, + bNodeTree *ntree, + const char **disabled_info) { /* use the basic poll function */ - return rna_Node_poll(node->typeinfo, ntree); + return rna_Node_poll(node->typeinfo, ntree, disabled_info); } static void rna_Node_update_reg(bNodeTree *ntree, bNode *node) @@ -1886,6 +1981,44 @@ static const EnumPropertyItem *itemf_function_check( return item_array; } +static bool switch_type_supported(const EnumPropertyItem *item) +{ + return ELEM(item->value, + SOCK_FLOAT, + SOCK_INT, + SOCK_BOOLEAN, + SOCK_VECTOR, + SOCK_STRING, + SOCK_RGBA, + SOCK_GEOMETRY, + SOCK_OBJECT, + SOCK_COLLECTION, + SOCK_TEXTURE, + SOCK_MATERIAL); +} + +static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C), + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + *r_free = true; + return itemf_function_check(node_socket_data_type_items, switch_type_supported); +} + +static bool attribute_clamp_type_supported(const EnumPropertyItem *item) +{ + return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_INT32, CD_PROP_COLOR); +} +static const EnumPropertyItem *rna_GeometryNodeAttributeClamp_type_itemf(bContext *UNUSED(C), + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + *r_free = true; + return itemf_function_check(rna_enum_attribute_type_items, attribute_clamp_type_supported); +} + static bool attribute_random_type_supported(const EnumPropertyItem *item) { return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL, CD_PROP_INT32); @@ -1943,6 +2076,7 @@ static void rna_GeometryNodeAttributeRandomize_data_type_update(Main *bmain, static bool attribute_convert_type_supported(const EnumPropertyItem *item) { return ELEM(item->value, + CD_AUTO_FROM_NAME, CD_PROP_FLOAT, CD_PROP_FLOAT2, CD_PROP_FLOAT3, @@ -1954,7 +2088,8 @@ static const EnumPropertyItem *rna_GeometryNodeAttributeConvert_type_itemf( bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { *r_free = true; - return itemf_function_check(rna_enum_attribute_type_items, attribute_convert_type_supported); + return itemf_function_check(rna_enum_attribute_type_with_auto_items, + attribute_convert_type_supported); } static bool attribute_fill_type_supported(const EnumPropertyItem *item) @@ -2065,6 +2200,28 @@ static void rna_GeometryNodeAttributeVectorMath_operation_update(Main *bmain, rna_Node_socket_update(bmain, scene, ptr); } +static bool attribute_map_range_type_supported(const EnumPropertyItem *item) +{ + return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3); +} +static const EnumPropertyItem *rna_GeometryNodeAttributeMapRange_type_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + *r_free = true; + return itemf_function_check(rna_enum_attribute_type_items, attribute_map_range_type_supported); +} + +static bool attribute_curve_map_type_supported(const EnumPropertyItem *item) +{ + return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_COLOR); +} +static const EnumPropertyItem *rna_GeometryNodeAttributeCurveMap_type_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + *r_free = true; + return itemf_function_check(rna_enum_attribute_type_items, attribute_curve_map_type_supported); +} + static StructRNA *rna_ShaderNode_register(Main *bmain, ReportList *reports, void *data, @@ -3001,7 +3158,7 @@ static void rna_NodeSocketStandard_draw(ID *id, } static void rna_NodeSocketStandard_draw_color( - ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float *r_color) + ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float r_color[4]) { PointerRNA ptr; RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr); @@ -3021,7 +3178,7 @@ static void rna_NodeSocketInterfaceStandard_draw(ID *id, static void rna_NodeSocketInterfaceStandard_draw_color(ID *id, bNodeSocket *sock, struct bContext *C, - float *r_color) + float r_color[4]) { PointerRNA ptr; RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr); @@ -3179,18 +3336,20 @@ static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index) static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree) { bNodeType *ntype = RNA_struct_blender_type_get(srna); - return ntype && (!ntype->poll || ntype->poll(ntype, ntree)); + const char *disabled_hint; + return ntype && (!ntype->poll || ntype->poll(ntype, ntree, &disabled_hint)); } static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) { bNodeType *ntype = node->typeinfo; + const char *disabled_hint; if (ntype->poll_instance) { - return ntype->poll_instance(node, ntree); + return ntype->poll_instance(node, ntree, &disabled_hint); } else { /* fall back to basic poll function */ - return !ntype->poll || ntype->poll(ntype, ntree); + return !ntype->poll || ntype->poll(ntype, ntree, &disabled_hint); } } @@ -3256,6 +3415,35 @@ static StructRNA *rna_NodeCustomGroup_register(Main *bmain, return nt->rna_ext.srna; } +static StructRNA *rna_GeometryNodeCustomGroup_register(Main *bmain, + ReportList *reports, + void *data, + const char *identifier, + StructValidateFunc validate, + StructCallbackFunc call, + StructFreeFunc free) +{ + bNodeType *nt = rna_Node_register_base( + bmain, reports, &RNA_GeometryNodeCustomGroup, data, identifier, validate, call, free); + + if (!nt) { + return NULL; + } + + nt->group_update_func = node_group_update; + nt->type = NODE_CUSTOM_GROUP; + + register_node_type_geo_custom_group(nt); + + nodeRegisterType(nt); + + WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); + + return nt->rna_ext.srna; +} + +void register_node_type_geo_custom_group(bNodeType *ntype); + static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain, ReportList *reports, void *data, @@ -3344,7 +3532,8 @@ static void rna_NodeGroup_node_tree_set(PointerRNA *ptr, bNode *node = ptr->data; bNodeTree *ngroup = value.data; - if (nodeGroupPoll(ntree, ngroup)) { + const char *disabled_hint = NULL; + if (nodeGroupPoll(ntree, ngroup, &disabled_hint)) { if (node->id) { id_us_min(node->id); } @@ -3366,7 +3555,8 @@ static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value return false; } - return nodeGroupPoll(ntree, ngroup); + const char *disabled_hint = NULL; + return nodeGroupPoll(ntree, ngroup, &disabled_hint); } static StructRNA *rna_NodeGroup_interface_typef(PointerRNA *ptr) @@ -3807,7 +3997,7 @@ static void rna_NodeCryptomatte_layer_name_set(PointerRNA *ptr, int new_value) } } -static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *UNUSED(C), +static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) @@ -3818,7 +4008,7 @@ static const EnumPropertyItem *rna_NodeCryptomatte_layer_name_itemf(bContext *UN EnumPropertyItem template = {0, "", 0, "", ""}; int totitem = 0; - ntreeCompositCryptomatteUpdateLayerNames(node); + ntreeCompositCryptomatteUpdateLayerNames(CTX_data_scene(C), node); int layer_index; LISTBASE_FOREACH_INDEX (CryptomatteLayer *, layer, &storage->runtime.layers, layer_index) { template.value = layer_index; @@ -3910,7 +4100,7 @@ static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value) static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr) { - ntreeCompositCryptomatteSyncFromAdd(ptr->data); + ntreeCompositCryptomatteSyncFromAdd(scene, ptr->data); rna_Node_update(bmain, scene, ptr); } @@ -4290,6 +4480,13 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self, RE_point_density_minmax(depsgraph, pd, r_min, r_max); } +bool rna_NodeSocketMaterial_default_value_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +{ + /* Do not show grease pencil materials for now. */ + Material *ma = (Material *)value.data; + return ma->gp_style == NULL; +} + #else static const EnumPropertyItem prop_image_layer_items[] = { @@ -8634,6 +8831,41 @@ static void def_cmp_denoise(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_cmp_antialiasing(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAntiAliasingData", "storage"); + + prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "threshold"); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text( + prop, + "Threshold", + "Threshold to detect edges (smaller threshold makes more sensitive detection)"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "contrast_limit", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "contrast_limit"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text( + prop, + "Contrast Limit", + "How much to eliminate spurious edges to avoid artifacts (the larger value makes less " + "active; the value 2.0, for example, means discard a detected edge if there is a " + "neighboring edge that has 2.0 times bigger contrast than the current one)"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "corner_rounding", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "corner_rounding"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); + RNA_def_property_ui_text(prop, "Corner Rounding", "How much sharp corners will be rounded"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + /* -- Texture Nodes --------------------------------------------------------- */ static void def_tex_output(StructRNA *srna) @@ -8722,7 +8954,7 @@ static void def_geo_boolean(StructRNA *srna) RNA_def_property_enum_items(prop, rna_node_geometry_boolean_method_items); RNA_def_property_enum_default(prop, GEO_NODE_BOOLEAN_INTERSECT); RNA_def_property_ui_text(prop, "Operation", ""); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } static void def_geo_triangulate(StructRNA *srna) @@ -8834,9 +9066,9 @@ static void def_geo_attribute_convert(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeAttributeConvert", "storage"); prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); + RNA_def_property_enum_items(prop, rna_enum_attribute_type_with_auto_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeConvert_type_itemf"); - RNA_def_property_enum_default(prop, CD_PROP_FLOAT); + RNA_def_property_enum_default(prop, CD_AUTO_FROM_NAME); RNA_def_property_ui_text(prop, "Data Type", "The data type to save the result attribute with"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update"); @@ -8915,6 +9147,26 @@ static void def_geo_attribute_vector_math(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_attribute_map_range(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeMapRange", "storage"); + + prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_type"); + RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeMapRange_type_itemf"); + RNA_def_property_ui_text(prop, "Data Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "interpolation_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "interpolation_type"); + RNA_def_property_enum_items(prop, rna_enum_node_map_range_items); + RNA_def_property_ui_text(prop, "Interpolation Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update"); +} + static void def_geo_point_instance(StructRNA *srna) { static const EnumPropertyItem instance_type_items[] = { @@ -8975,6 +9227,26 @@ static void def_geo_attribute_mix(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_attribute_clamp(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeClamp", "storage"); + + prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_type"); + RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeClamp_type_itemf"); + RNA_def_property_ui_text(prop, "Data Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_node_clamp_items); + RNA_def_property_enum_default(prop, NODE_CLAMP_MINMAX); + RNA_def_property_ui_text(prop, "Operation", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + static void def_geo_attribute_attribute_compare(StructRNA *srna) { PropertyRNA *prop; @@ -8988,12 +9260,12 @@ static void def_geo_attribute_attribute_compare(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); prop = RNA_def_property(srna, "input_type_a", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_no_boolean); RNA_def_property_ui_text(prop, "Input Type A", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); prop = RNA_def_property(srna, "input_type_b", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_any); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_no_boolean); RNA_def_property_ui_text(prop, "Input Type B", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } @@ -9037,6 +9309,85 @@ static void def_geo_attribute_color_ramp(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_geo_attribute_curve_map(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeCurveMap", "storage"); + + prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "data_type"); + RNA_def_property_enum_items(prop, rna_enum_attribute_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeAttributeCurveMap_type_itemf"); + RNA_def_property_ui_text(prop, "Data Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "curve_vec", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_ui_text(prop, "Mapping", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "curve_rgb", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_ui_text(prop, "Mapping", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + +static void def_geo_attribute_vector_rotate(StructRNA *srna) +{ + static const EnumPropertyItem rotate_mode_items[] = { + {GEO_NODE_VECTOR_ROTATE_TYPE_AXIS, + "AXIS_ANGLE", + 0, + "Axis Angle", + "Rotate a point using axis angle"}, + {GEO_NODE_VECTOR_ROTATE_TYPE_AXIS_X, "X_AXIS", 0, "X Axis", "Rotate a point using X axis"}, + {GEO_NODE_VECTOR_ROTATE_TYPE_AXIS_Y, "Y_AXIS", 0, "Y Axis", "Rotate a point using Y axis"}, + {GEO_NODE_VECTOR_ROTATE_TYPE_AXIS_Z, "Z_AXIS", 0, "Z Axis", "Rotate a point using Z axis"}, + {GEO_NODE_VECTOR_ROTATE_TYPE_EULER_XYZ, + "EULER_XYZ", + 0, + "Euler", + "Rotate a point using XYZ order"}, + {0, NULL, 0, NULL, NULL}, + }; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeAttributeVectorRotate", "storage"); + + prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, rotate_mode_items); + RNA_def_property_ui_text(prop, "Mode", "Type of rotation"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update"); + + prop = RNA_def_property(srna, "input_type_vector", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); + RNA_def_property_ui_text(prop, "Input Type Vector", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_center", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); + RNA_def_property_ui_text(prop, "Input Type Center", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); + RNA_def_property_ui_text(prop, "Input Type Axis", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_angle", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float); + RNA_def_property_ui_text(prop, "Input Type Angle", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); + + prop = RNA_def_property(srna, "input_type_rotation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); + RNA_def_property_ui_text(prop, "Input Type Rotation", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + static void def_geo_point_rotate(StructRNA *srna) { static const EnumPropertyItem type_items[] = { @@ -9174,7 +9525,7 @@ static void def_geo_point_scale(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeGeometryPointScale", "storage"); prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_vector); + RNA_def_property_enum_items(prop, rna_node_geometry_attribute_input_type_items_float_vector); RNA_def_property_ui_text(prop, "Input Type", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } @@ -9191,19 +9542,6 @@ static void def_geo_point_translate(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } -static void def_geo_attribute_sample_texture(StructRNA *srna) -{ - PropertyRNA *prop; - - prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "id"); - RNA_def_property_struct_type(prop, "Texture"); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_ui_text(prop, "Texture", "Texture to sample values from"); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations"); -} - static void def_geo_object_info(StructRNA *srna) { PropertyRNA *prop; @@ -9471,6 +9809,93 @@ static void def_geo_mesh_line(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); } +static void def_geo_switch(StructRNA *srna) +{ + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeSwitch", "storage"); + prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "input_type"); + RNA_def_property_enum_items(prop, node_socket_data_type_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeSwitch_type_itemf"); + RNA_def_property_ui_text(prop, "Input Type", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_curve_resample(StructRNA *srna) +{ + PropertyRNA *prop; + + static EnumPropertyItem mode_items[] = { + {GEO_NODE_CURVE_SAMPLE_COUNT, + "COUNT", + 0, + "Count", + "Sample the specified number of points along each spline"}, + {GEO_NODE_CURVE_SAMPLE_LENGTH, + "LENGTH", + 0, + "Length", + "Calculate the number of samples by splitting each spline into segments with the specified " + "length"}, + {0, NULL, 0, NULL, NULL}, + }; + + RNA_def_struct_sdna_from(srna, "NodeGeometryCurveResample", "storage"); + + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_ui_text(prop, "Mode", "How to specify the amount of samples"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update"); +} + +static void def_geo_attribute_transfer(StructRNA *srna) +{ + static EnumPropertyItem mapping_items[] = { + {GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST_FACE_INTERPOLATED, + "NEAREST_FACE_INTERPOLATED", + 0, + "Nearest Face Interpolated", + "Transfer the attribute from the nearest face on a surface (loose points and edges are " + "ignored)"}, + {GEO_NODE_ATTRIBUTE_TRANSFER_NEAREST, + "NEAREST", + 0, + "Nearest", + "Transfer the element from the nearest element (using face and edge centers for the " + "distance computation)"}, + {0, NULL, 0, NULL, NULL}, + }; + + PropertyRNA *prop; + + RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeTransfer", "storage"); + + prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_attribute_domain_with_auto_items); + RNA_def_property_enum_default(prop, ATTR_DOMAIN_AUTO); + RNA_def_property_ui_text(prop, "Domain", "The geometry domain to save the result attribute in"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, mapping_items); + RNA_def_property_ui_text(prop, "Mapping", "Mapping between geometries"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + +static void def_geo_input_material(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_ui_text(prop, "Material", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + /* -------------------------------------------------------------------------- */ static void rna_def_shader_node(BlenderRNA *brna) @@ -9566,6 +9991,11 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets"); + prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "description"); + RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update"); + prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -9594,6 +10024,12 @@ static void rna_def_node_socket(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected"); + prop = RNA_def_property(srna, "is_multi_input", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_MULTI_INPUT); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text( + prop, "Multi Input", "True if the socket can accept multiple ordered input links"); + prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED); @@ -9704,6 +10140,11 @@ static void rna_def_node_socket_interface(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets"); + prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "description"); + RNA_def_property_ui_text(prop, "Tooltip", "Socket tooltip"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); + prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -10227,6 +10668,80 @@ static void rna_def_node_socket_collection(BlenderRNA *brna, RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); } +static void rna_def_node_socket_texture(BlenderRNA *brna, + const char *identifier, + const char *interface_idname) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, identifier, "NodeSocketStandard"); + RNA_def_struct_ui_text(srna, "Texture Node Socket", "Texture socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueTexture", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Texture"); + 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_and_relation_update"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_CONTEXT_UPDATE); + + /* socket interface */ + srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard"); + RNA_def_struct_ui_text(srna, "Texture Node Socket Interface", "Texture socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueTexture", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Texture"); + RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); +} + +static void rna_def_node_socket_material(BlenderRNA *brna, + const char *identifier, + const char *interface_idname) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, identifier, "NodeSocketStandard"); + RNA_def_struct_ui_text(srna, "Material Node Socket", "Material socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueMaterial", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_pointer_funcs( + prop, NULL, NULL, NULL, "rna_NodeSocketMaterial_default_value_poll"); + 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_and_relation_update"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_CONTEXT_UPDATE); + + /* socket interface */ + srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard"); + RNA_def_struct_ui_text(srna, "Material Node Socket Interface", "Material socket of a node"); + RNA_def_struct_sdna(srna, "bNodeSocket"); + + RNA_def_struct_sdna_from(srna, "bNodeSocketValueMaterial", "default_value"); + + prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "value"); + RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_pointer_funcs( + prop, NULL, NULL, NULL, "rna_NodeSocketMaterial_default_value_poll"); + RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update"); +} + static void rna_def_node_socket_standard_types(BlenderRNA *brna) { /* XXX Workaround: Registered functions are not exposed in python by bpy, @@ -10326,6 +10841,8 @@ static void rna_def_node_socket_standard_types(BlenderRNA *brna) rna_def_node_socket_float( brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME); rna_def_node_socket_float( + brna, "NodeSocketFloatTimeAbsolute", "NodeSocketInterfaceFloatTimeAbsolute", PROP_TIME_ABSOLUTE); + rna_def_node_socket_float( brna, "NodeSocketFloatDistance", "NodeSocketInterfaceFloatDistance", PROP_DISTANCE); rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE); @@ -10371,6 +10888,10 @@ static void rna_def_node_socket_standard_types(BlenderRNA *brna) rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry"); rna_def_node_socket_collection(brna, "NodeSocketCollection", "NodeSocketInterfaceCollection"); + + rna_def_node_socket_texture(brna, "NodeSocketTexture", "NodeSocketInterfaceTexture"); + + rna_def_node_socket_material(brna, "NodeSocketMaterial", "NodeSocketInterfaceMaterial"); } static void rna_def_internal_node(BlenderRNA *brna) @@ -10654,6 +11175,12 @@ static void rna_def_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Texture", "Display node in viewport textured shading mode"); RNA_def_property_update(prop, 0, "rna_Node_update"); + prop = RNA_def_property(srna, "active_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_ACTIVE_PREVIEW); + RNA_def_property_ui_text(prop, "Active Preview", "Node is previewed in other editor"); + RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); + RNA_def_property_update(prop, NC_NODE, NULL); + /* generic property update function */ func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update"); RNA_def_function_ui_description(func, "Update after property changes"); @@ -11149,6 +11676,14 @@ static void rna_def_nodetree(BlenderRNA *brna) parm = RNA_def_pointer( func, "result_3", "ID", "From ID", "Original ID data-block selected from the context"); RNA_def_function_output(func, parm); + + /* Check for support of a socket type. */ + func = RNA_def_function(srna, "valid_socket_type", NULL); + RNA_def_function_ui_description(func, "Check if the socket type is valid for the node tree"); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); + parm = RNA_def_enum(func, "type", node_socket_type_items, 0, "", ""); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + RNA_def_function_return(func, RNA_def_boolean(func, "valid", false, "", "")); } static void rna_def_composite_nodetree(BlenderRNA *brna) @@ -11162,6 +11697,12 @@ static void rna_def_composite_nodetree(BlenderRNA *brna) RNA_def_struct_sdna(srna, "bNodeTree"); RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + prop = RNA_def_property(srna, "execution_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "execution_mode"); + RNA_def_property_enum_items(prop, rna_enum_execution_mode_items); + RNA_def_property_ui_text(prop, "Execution Mode", "Set how compositing is executed"); + RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update"); + prop = RNA_def_property(srna, "render_quality", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "render_quality"); RNA_def_property_enum_items(prop, node_quality_items); @@ -11386,6 +11927,12 @@ void RNA_def_nodetree(BlenderRNA *brna) "Custom Group", "Base node type for custom registered node group types", "rna_NodeCustomGroup_register"); + def_custom_group(brna, + "GeometryNodeCustomGroup", + "GeometryNode", + "Geometry Custom Group", + "Custom Geometry Group Node for Python nodes", + "rna_GeometryNodeCustomGroup_register"); /* special socket types */ rna_def_cmp_output_file_slot_file(brna); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index b53318cfbfe..b339682222c 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -62,6 +62,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "DEG_depsgraph_query.h" + const EnumPropertyItem rna_enum_object_mode_items[] = { {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""}, {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""}, @@ -84,7 +86,7 @@ const EnumPropertyItem rna_enum_object_mode_items[] = { {OB_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", ICON_GREASEPENCIL, - "Draw", + "Draw Mode", "Paint Grease Pencil Strokes"}, {OB_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", @@ -1253,10 +1255,16 @@ static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index) return PROP_EDITABLE; } +static int rna_MaterialSlot_index(PointerRNA *ptr) +{ + /* There is an offset of one, so that `ptr->data` is not null. */ + return POINTER_AS_INT(ptr->data) - 1; +} + static int rna_MaterialSlot_material_editable(PointerRNA *ptr, const char **UNUSED(r_info)) { Object *ob = (Object *)ptr->owner_id; - const int index = (Material **)ptr->data - ob->mat; + const int index = rna_MaterialSlot_index(ptr); bool is_editable; if ((ob->matbits == NULL) || ob->matbits[index]) { @@ -1273,9 +1281,14 @@ static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr) { Object *ob = (Object *)ptr->owner_id; Material *ma; - const int index = (Material **)ptr->data - ob->mat; + const int index = rna_MaterialSlot_index(ptr); - ma = BKE_object_material_get(ob, index + 1); + if (DEG_is_evaluated_object(ob)) { + ma = BKE_object_material_get_eval(ob, index + 1); + } + else { + ma = BKE_object_material_get(ob, index + 1); + } return rna_pointer_inherit_refine(ptr, &RNA_Material, ma); } @@ -1284,7 +1297,7 @@ static void rna_MaterialSlot_material_set(PointerRNA *ptr, struct ReportList *UNUSED(reports)) { Object *ob = (Object *)ptr->owner_id; - int index = (Material **)ptr->data - ob->mat; + int index = rna_MaterialSlot_index(ptr); BLI_assert(BKE_id_is_in_global_main(&ob->id)); BLI_assert(BKE_id_is_in_global_main(value.data)); @@ -1309,15 +1322,17 @@ static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value) static int rna_MaterialSlot_link_get(PointerRNA *ptr) { Object *ob = (Object *)ptr->owner_id; - int index = (Material **)ptr->data - ob->mat; - - return ob->matbits[index] != 0; + int index = rna_MaterialSlot_index(ptr); + if (index < ob->totcol) { + return ob->matbits[index] != 0; + } + return false; } static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value) { Object *ob = (Object *)ptr->owner_id; - int index = (Material **)ptr->data - ob->mat; + int index = rna_MaterialSlot_index(ptr); if (value) { ob->matbits[index] = 1; @@ -1335,7 +1350,7 @@ static int rna_MaterialSlot_name_length(PointerRNA *ptr) { Object *ob = (Object *)ptr->owner_id; Material *ma; - int index = (Material **)ptr->data - ob->mat; + int index = rna_MaterialSlot_index(ptr); ma = BKE_object_material_get(ob, index + 1); @@ -1350,7 +1365,7 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) { Object *ob = (Object *)ptr->owner_id; Material *ma; - int index = (Material **)ptr->data - ob->mat; + int index = rna_MaterialSlot_index(ptr); ma = BKE_object_material_get(ob, index + 1); @@ -1373,10 +1388,49 @@ static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) static char *rna_MaterialSlot_path(PointerRNA *ptr) { + int index = rna_MaterialSlot_index(ptr); + return BLI_sprintfN("material_slots[%d]", index); +} + +static int rna_Object_material_slots_length(PointerRNA *ptr) +{ Object *ob = (Object *)ptr->owner_id; - int index = (Material **)ptr->data - ob->mat; + if (DEG_is_evaluated_object(ob)) { + return BKE_object_material_count_eval(ob); + } + else { + return ob->totcol; + } +} - return BLI_sprintfN("material_slots[%d]", index); +static void rna_Object_material_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + const int length = rna_Object_material_slots_length(ptr); + iter->internal.count.item = 0; + iter->internal.count.ptr = ptr->owner_id; + iter->valid = length > 0; +} + +static void rna_Object_material_slots_next(CollectionPropertyIterator *iter) +{ + const int length = rna_Object_material_slots_length(&iter->ptr); + iter->internal.count.item++; + iter->valid = iter->internal.count.item < length; +} + +static PointerRNA rna_Object_material_slots_get(CollectionPropertyIterator *iter) +{ + PointerRNA ptr; + RNA_pointer_create((ID *)iter->internal.count.ptr, + &RNA_MaterialSlot, + /* Add one, so that `ptr->data` is not null. */ + POINTER_FROM_INT(iter->internal.count.item + 1), + &ptr); + return ptr; +} + +static void rna_Object_material_slots_end(CollectionPropertyIterator *UNUSED(iter)) +{ } static PointerRNA rna_Object_display_get(PointerRNA *ptr) @@ -1448,11 +1502,6 @@ static PointerRNA rna_Object_field_get(PointerRNA *ptr) { Object *ob = (Object *)ptr->owner_id; - /* weak */ - if (!ob->pd) { - ob->pd = BKE_partdeflect_new(0); - } - return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd); } @@ -1464,11 +1513,6 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) return PointerRNA_NULL; } - /* weak */ - if (!ob->pd) { - ob->pd = BKE_partdeflect_new(0); - } - return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd); } @@ -2106,6 +2150,81 @@ static void rna_object_lineart_update(Main *UNUSED(bmain), Scene *UNUSED(scene), WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->owner_id); } +static bool mesh_symmetry_get_common(PointerRNA *ptr, const eMeshSymmetryType sym) +{ + const Object *ob = (Object *)ptr->owner_id; + if (ob->type != OB_MESH) { + return false; + } + + const Mesh *mesh = ob->data; + return mesh->symmetry & sym; +} + +static bool rna_Object_mesh_symmetry_x_get(PointerRNA *ptr) +{ + return mesh_symmetry_get_common(ptr, ME_SYMMETRY_X); +} + +static bool rna_Object_mesh_symmetry_y_get(PointerRNA *ptr) +{ + return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Y); +} + +static bool rna_Object_mesh_symmetry_z_get(PointerRNA *ptr) +{ + return mesh_symmetry_get_common(ptr, ME_SYMMETRY_Z); +} + +static void mesh_symmetry_set_common(PointerRNA *ptr, + const bool value, + const eMeshSymmetryType sym) +{ + Object *ob = (Object *)ptr->owner_id; + if (ob->type != OB_MESH) { + return; + } + + Mesh *mesh = ob->data; + if (value) { + mesh->symmetry |= sym; + } + else { + mesh->symmetry &= ~sym; + } +} + +static void rna_Object_mesh_symmetry_x_set(PointerRNA *ptr, bool value) +{ + mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_X); +} + +static void rna_Object_mesh_symmetry_y_set(PointerRNA *ptr, bool value) +{ + mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Y); +} + +static void rna_Object_mesh_symmetry_z_set(PointerRNA *ptr, bool value) +{ + mesh_symmetry_set_common(ptr, value, ME_SYMMETRY_Z); +} + +static int rna_Object_mesh_symmetry_yz_editable(PointerRNA *ptr, const char **UNUSED(r_info)) +{ + const Object *ob = (Object *)ptr->owner_id; + if (ob->type != OB_MESH) { + return 0; + } + + const Mesh *mesh = ob->data; + if (ob->mode == OB_MODE_WEIGHT_PAINT && mesh->editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) { + /* Only X symmetry is available in weightpaint mode. */ + return 0; + } + + return PROP_EDITABLE; +} + #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -2798,6 +2917,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_multi_array(prop, 2, boundbox_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); RNA_def_property_ui_text( prop, @@ -2882,12 +3002,18 @@ static void rna_def_object(BlenderRNA *brna) /* materials */ prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "MaterialSlot"); RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_PROP_NAME); - /* don't dereference pointer! */ - RNA_def_property_collection_funcs( - prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); + /* Don't dereference the material slot pointer, it is the slot index encoded in a pointer. */ + RNA_def_property_collection_funcs(prop, + "rna_Object_material_slots_begin", + "rna_Object_material_slots_next", + "rna_Object_material_slots_end", + "rna_Object_material_slots_get", + "rna_Object_material_slots_length", + NULL, + NULL, + NULL); RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object"); prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); @@ -2968,12 +3094,11 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_float_funcs( prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL); RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); - RNA_def_property_ui_text( - prop, - "Dimensions", - "Absolute bounding box dimensions of the object (WARNING: assigning to it or " - "its members multiple consecutive times will not work correctly, " - "as this needs up-to-date evaluated data)"); + RNA_def_property_ui_text(prop, + "Dimensions", + "Absolute bounding box dimensions of the object.\n" + "Warning: Assigning to it or its members multiple consecutive times " + "will not work correctly, as this needs up-to-date evaluated data"); RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update"); /* delta transforms */ @@ -3076,8 +3201,8 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Local Matrix", - "Parent relative transformation matrix - " - "WARNING: Only takes into account 'Object' parenting, so e.g. in case of bone parenting " + "Parent relative transformation matrix.\n" + "Warning: Only takes into account object parenting, so e.g. in case of bone parenting " "you get a matrix relative to the Armature object, not to the actual parent bone"); RNA_def_property_float_funcs( prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL); @@ -3499,6 +3624,28 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ObjectLineArt"); RNA_def_property_ui_text(prop, "Line Art", "Line art settings for the object"); + /* Mesh Symmetry Settings */ + + prop = RNA_def_property(srna, "use_mesh_mirror_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs( + prop, "rna_Object_mesh_symmetry_x_get", "rna_Object_mesh_symmetry_x_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "X", "Enable mesh symmetry in the X axis"); + + prop = RNA_def_property(srna, "use_mesh_mirror_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs( + prop, "rna_Object_mesh_symmetry_y_get", "rna_Object_mesh_symmetry_y_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable"); + RNA_def_property_ui_text(prop, "Y", "Enable mesh symmetry in the Y axis"); + + prop = RNA_def_property(srna, "use_mesh_mirror_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs( + prop, "rna_Object_mesh_symmetry_z_get", "rna_Object_mesh_symmetry_z_set"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable"); + RNA_def_property_ui_text(prop, "Z", "Enable mesh symmetry in the Z axis"); + RNA_define_lib_overridable(false); /* anim */ diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index df628caa000..e463323c6dc 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -296,8 +296,8 @@ static bool rna_Object_visible_in_viewport_get(Object *ob, View3D *v3d) static void rna_Object_mat_convert_space(Object *ob, ReportList *reports, bPoseChannel *pchan, - float *mat, - float *mat_ret, + float mat[16], + float mat_ret[16], int from, int to) { diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 14dd8a68fee..eb7da0d0ce2 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -648,6 +648,13 @@ static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), ob->pd->tex = NULL; } + /* In the case of specific force-fields that are using the #EffectorData's normal, we need to + * rebuild mesh and BVH-tree for #SurfaceModifier to work correctly. */ + if (ELEM(ob->pd->shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS) || + ob->pd->forcefield == PFIELD_GUIDE) { + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } + DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); 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 d94e68a6808..7ff2a82a465 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1413,24 +1413,12 @@ static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), static PointerRNA rna_Particle_field1_get(PointerRNA *ptr) { ParticleSettings *part = (ParticleSettings *)ptr->owner_id; - - /* weak */ - if (!part->pd) { - part->pd = BKE_partdeflect_new(0); - } - return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd); } static PointerRNA rna_Particle_field2_get(PointerRNA *ptr) { ParticleSettings *part = (ParticleSettings *)ptr->owner_id; - - /* weak */ - if (!part->pd2) { - part->pd2 = BKE_partdeflect_new(0); - } - return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2); } diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index ba65e42895c..b8bb4f58dcd 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -1359,12 +1359,27 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update"); - prop = RNA_def_property(srna, "custom_shape_scale", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "custom_scale"); - RNA_def_property_range(prop, 0.0f, 1000.0f); + prop = RNA_def_property(srna, "custom_shape_scale_xyz", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "custom_scale_xyz"); + RNA_def_property_flag(prop, PROP_PROPORTIONAL); + RNA_def_property_float_array_default(prop, rna_default_scale_3d); RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape"); RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + prop = RNA_def_property(srna, "custom_shape_translation", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "custom_translation"); + RNA_def_property_flag(prop, PROP_PROPORTIONAL); + RNA_def_property_ui_text( + prop, "Custom Shape Translation", "Adjust the location of the custom shape"); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + + prop = RNA_def_property(srna, "custom_shape_rotation_euler", PROP_FLOAT, PROP_EULER); + RNA_def_property_float_sdna(prop, NULL, "custom_rotation_euler"); + RNA_def_property_ui_text( + prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape"); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c index 29516830058..0d35365c2d8 100644 --- a/source/blender/makesrna/intern/rna_pose_api.c +++ b/source/blender/makesrna/intern/rna_pose_api.c @@ -47,7 +47,7 @@ # include "BLI_ghash.h" -static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec) +static float rna_PoseBone_do_envelope(bPoseChannel *chan, float vec[3]) { Bone *bone = chan->bone; diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 0411ef6d6ee..dd91a5509f5 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -298,13 +298,13 @@ static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type) return; } + /* Stop all renders in case we were using this one. */ + ED_render_engine_changed(bmain, false); RE_FreeAllPersistentData(); + RNA_struct_free_extension(type, &et->rna_ext); RNA_struct_free(&BLENDER_RNA, type); BLI_freelinkN(&R_engines, et); - - /* Stop all renders in case we were using this one. */ - ED_render_engine_changed(bmain, false); } static StructRNA *rna_RenderEngine_register(Main *bmain, diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index d8336e79064..9e7d0f99dfa 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -20,6 +20,8 @@ #include <stdlib.h> +#include <CLG_log.h> + #include "DNA_ID.h" #include "BLI_utildefines.h" @@ -79,7 +81,16 @@ const EnumPropertyItem rna_enum_property_subtype_items[] = { {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""}, {PROP_FACTOR, "FACTOR", 0, "Factor", ""}, {PROP_ANGLE, "ANGLE", 0, "Angle", ""}, - {PROP_TIME, "TIME", 0, "Time", ""}, + {PROP_TIME, + "TIME", + 0, + "Time (Scene Relative)", + "Time specified in frames, converted to seconds based on scene frame rate"}, + {PROP_TIME_ABSOLUTE, + "TIME_ABSOLUTE", + 0, + "Time (Absolute)", + "Time specified in seconds, independent of the scene"}, {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""}, {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""}, {PROP_POWER, "POWER", 0, "Power", ""}, @@ -132,6 +143,8 @@ const EnumPropertyItem rna_enum_property_unit_items[] = { # include "BKE_idprop.h" # include "BKE_lib_override.h" +static CLG_LogRef LOG_COMPARE_OVERRIDE = {"rna.rna_compare_override"}; + /* Struct */ static void rna_Struct_identifier_get(PointerRNA *ptr, char *value) @@ -1366,11 +1379,11 @@ static int rna_property_override_diff_propptr(Main *bmain, /* In case one of the owner of the checked property is tagged as needing resync, do * not change the 'match reference' status of its ID pointer properties overrides, * since many non-matching ones are likely due to missing resync. */ - printf( - "%s: Not checking matching ID pointer properties, since owner %s is tagged as " - "needing resync.\n", - __func__, - id_a->name); + CLOG_INFO(&LOG_COMPARE_OVERRIDE, + 4, + "Not checking matching ID pointer properties, since owner %s is tagged as " + "needing resync.\n", + id_a->name); } else if (id_a->override_library != NULL && id_a->override_library->reference == id_b) { opop->flag |= IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3344b8c286d..2ccc8fe949c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -778,7 +778,6 @@ static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA Scene *scene = (Scene *)ptr->data; iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__); - ((BLI_Iterator *)iter->internal.custom)->valid = true; BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene); iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } @@ -1896,10 +1895,10 @@ static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { - Scene *sce = (Scene *)ptr->owner_id; + Scene *scene = (Scene *)ptr->owner_id; - if (!(sce->r.mode & R_PERSISTENT_DATA)) { - RE_FreePersistentData(); + if (!(scene->r.mode & R_PERSISTENT_DATA)) { + RE_FreePersistentData(scene); } } @@ -1913,10 +1912,9 @@ static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterat iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL); } -static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr) +static int rna_Scene_transform_orientation_slots_length(PointerRNA *UNUSED(ptr)) { - Scene *scene = (Scene *)ptr->owner_id; - return ARRAY_SIZE(scene->orientation_slots); + return ARRAY_SIZE(((Scene *)NULL)->orientation_slots); } static bool rna_Scene_use_audio_get(PointerRNA *ptr) @@ -2484,6 +2482,10 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PropertyRNA *UNUSED(prop), bool *r_free) { + if (C == NULL) { + return rna_enum_transform_orientation_items; + } + Scene *scene; if (ptr->owner_id && (GS(ptr->owner_id->name) == ID_SCE)) { scene = (Scene *)ptr->owner_id; @@ -2494,11 +2496,15 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, return rna_TransformOrientation_impl_itemf(scene, false, r_free); } -const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C), +const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { + if (C == NULL) { + return rna_enum_transform_orientation_items; + } + Scene *scene = (Scene *)ptr->owner_id; TransformOrientationSlot *orient_slot = ptr->data; bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]); @@ -2685,6 +2691,7 @@ static void rna_def_view3d_cursor(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_View3DCursor_path"); RNA_def_struct_ui_text(srna, "3D Cursor", ""); RNA_def_struct_ui_icon(srna, ICON_CURSOR); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -2855,7 +2862,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1); RNA_def_property_ui_text(prop, - "WPaint Auto-Normalize", + "Weight Paint Auto-Normalize", "Ensure all bone-deforming vertex groups add up " "to 1.0 while weight painting"); RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); @@ -2864,7 +2871,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "wpaint_lock_relative", 1); RNA_def_property_ui_text(prop, - "WPaint Lock-Relative", + "Weight Paint Lock-Relative", "Display bone-deforming groups as if all locked deform groups " "were deleted, and the remaining ones were re-normalized"); RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); @@ -2873,7 +2880,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1); RNA_def_property_ui_text(prop, - "WPaint Multi-Paint", + "Weight Paint Multi-Paint", "Paint across the weights of all selected bones, " "maintaining their relative influence"); RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data"); @@ -6605,8 +6612,10 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* persistent data */ prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA); - RNA_def_property_ui_text( - prop, "Persistent Data", "Keep render data around for faster re-renders"); + RNA_def_property_ui_text(prop, + "Persistent Data", + "Keep render data around for faster re-renders and animation renders, " + "at the cost of increased memory usage"); RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update"); /* Freestyle line thickness options */ diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index c2089004da2..c49b41867a8 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -98,7 +98,7 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf } } -static void rna_Scene_uvedit_aspect(Scene *UNUSED(scene), Object *ob, float *aspect) +static void rna_Scene_uvedit_aspect(Scene *UNUSED(scene), Object *ob, float aspect[2]) { if ((ob->type == OB_MESH) && (ob->mode == OB_MODE_EDIT)) { BMEditMesh *em; diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 6cf1d7a923b..fba1d3cda9a 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -112,18 +112,6 @@ static bool rna_Screen_fullscreen_get(PointerRNA *ptr) return (screen->state == SCREENMAXIMIZED); } -/* UI compatible list: should not be needed, but for now we need to keep EMPTY - * at least in the static version of this enum for python scripts. */ -static const EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), - PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), - bool *r_free) -{ - /* +1 to skip SPACE_EMPTY */ - *r_free = false; - return rna_enum_space_type_items + 1; -} - static int rna_Area_type_get(PointerRNA *ptr) { ScrArea *area = (ScrArea *)ptr->data; @@ -142,6 +130,11 @@ static void rna_Area_type_set(PointerRNA *ptr, int value) } ScrArea *area = (ScrArea *)ptr->data; + /* Empty areas are locked. */ + if ((value == SPACE_EMPTY) || (area->spacetype == SPACE_EMPTY)) { + return; + } + area->butspacetype = value; } @@ -188,16 +181,20 @@ static void rna_Area_type_update(bContext *C, PointerRNA *ptr) } static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C, - PointerRNA *UNUSED(ptr), + PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; - /* +1 to skip SPACE_EMPTY */ - for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier; - item_from++) { + ScrArea *area = (ScrArea *)ptr->data; + const EnumPropertyItem *item_from = rna_enum_space_type_items; + if (area->spacetype != SPACE_EMPTY) { + item_from += 1; /* +1 to skip SPACE_EMPTY */ + } + + for (; item_from->identifier; item_from++) { if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) { continue; } @@ -224,6 +221,10 @@ static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C, static int rna_Area_ui_type_get(PointerRNA *ptr) { ScrArea *area = ptr->data; + /* This is for the Python API which may inspect empty areas. */ + if (UNLIKELY(area->spacetype == SPACE_EMPTY)) { + return SPACE_EMPTY; + } const int area_type = rna_Area_type_get(ptr); const bool area_changing = area->butspacetype != SPACE_EMPTY; int value = area_type << 16; @@ -252,6 +253,10 @@ static void rna_Area_ui_type_set(PointerRNA *ptr, int value) { ScrArea *area = ptr->data; const int space_type = value >> 16; + /* Empty areas are locked. */ + if ((space_type == SPACE_EMPTY) || (area->spacetype == SPACE_EMPTY)) { + return; + } SpaceType *st = BKE_spacetype_from_id(space_type); rna_Area_type_set(ptr, space_type); @@ -380,12 +385,17 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN); RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header"); + /* Note on space type use of #SPACE_EMPTY, this is not visible to the user, + * and script authors should be able to assign this value, however the value may be set + * and needs to be read back by script authors. + * + * This happens when an area is full-screen (when #ScrArea.full is set). + * in this case reading the empty value is needed, but it should never be set, see: T87187. */ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "spacetype"); RNA_def_property_enum_items(prop, rna_enum_space_type_items); RNA_def_property_enum_default(prop, SPACE_VIEW3D); - RNA_def_property_enum_funcs( - prop, "rna_Area_type_get", "rna_Area_type_set", "rna_Area_type_itemf"); + RNA_def_property_enum_funcs(prop, "rna_Area_type_get", "rna_Area_type_set", NULL); RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 4481555b931..81acedb76f2 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -786,7 +786,8 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowMask_update"); prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_PIXEL); - RNA_def_property_ui_range(prop, 0.5, 40.0, 10, 2); + RNA_def_property_ui_range(prop, 0.5, 40.0, 0.1, 2); + RNA_def_property_ui_scale_type(prop, PROP_SCALE_CUBIC); RNA_def_property_ui_text( prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 24d051fecc8..2652003cb1c 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -293,7 +293,7 @@ static void do_sequence_frame_change_update(Scene *scene, Sequence *seq) if (SEQ_transform_test_overlap(seqbase, seq)) { SEQ_transform_seqbase_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */ } - SEQ_sort(scene); + SEQ_sort(seqbase); } /* A simple wrapper around above func, directly usable as prop update func. @@ -440,8 +440,7 @@ static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) Scene *scene = (Scene *)ptr->owner_id; SEQ_relations_invalidate_cache_composite(scene, seq); - SEQ_transform_set_right_handle_frame(seq, - SEQ_transform_get_left_handle_frame(seq, false) + value); + SEQ_transform_set_right_handle_frame(seq, SEQ_transform_get_left_handle_frame(seq) + value); do_sequence_frame_change_update(scene, seq); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -449,8 +448,7 @@ static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) static int rna_Sequence_frame_length_get(PointerRNA *ptr) { Sequence *seq = (Sequence *)ptr->data; - return SEQ_transform_get_right_handle_frame(seq, false) - - SEQ_transform_get_left_handle_frame(seq, false); + return SEQ_transform_get_right_handle_frame(seq) - SEQ_transform_get_left_handle_frame(seq); } static int rna_Sequence_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info)) @@ -476,7 +474,7 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value) /* XXX - BROKEN!, uses context seqbasep */ SEQ_transform_seqbase_shuffle_ex(seqbase, seq, scene, channel_delta); } - SEQ_sort(scene); + SEQ_sort(seqbase); SEQ_relations_invalidate_cache_composite(scene, seq); } @@ -505,7 +503,7 @@ static Sequence *sequence_get_by_transform(Editing *ed, StripTransform *transfor data.data = transform; /* irritating we need to search for our sequence! */ - SEQ_iterator_seqbase_recursive_apply(&ed->seqbase, transform_seq_cmp_fn, &data); + SEQ_seqbase_recursive_apply(&ed->seqbase, transform_seq_cmp_fn, &data); return data.seq; } @@ -557,7 +555,7 @@ static Sequence *sequence_get_by_crop(Editing *ed, StripCrop *crop) data.data = crop; /* irritating we need to search for our sequence! */ - SEQ_iterator_seqbase_recursive_apply(&ed->seqbase, crop_seq_cmp_fn, &data); + SEQ_seqbase_recursive_apply(&ed->seqbase, crop_seq_cmp_fn, &data); return data.seq; } @@ -951,7 +949,7 @@ static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy) data.seq = NULL; data.data = proxy; - SEQ_iterator_seqbase_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_fn, &data); + SEQ_seqbase_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_fn, &data); return data.seq; } @@ -990,18 +988,14 @@ static int colbalance_seq_cmp_fn(Sequence *seq, void *arg_pt) { SequenceSearchData *data = arg_pt; - if (seq->modifiers.first) { - SequenceModifierData *smd = seq->modifiers.first; + for (SequenceModifierData *smd = seq->modifiers.first; smd; smd = smd->next) { + if (smd->type == seqModifierType_ColorBalance) { + ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; - for (smd = seq->modifiers.first; smd; smd = smd->next) { - if (smd->type == seqModifierType_ColorBalance) { - ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd; - - if (&cbmd->color_balance == data->data) { - data->seq = seq; - data->smd = smd; - return -1; /* done so bail out */ - } + if (&cbmd->color_balance == data->data) { + data->seq = seq; + data->smd = smd; + return -1; /* done so bail out */ } } } @@ -1020,7 +1014,7 @@ static Sequence *sequence_get_by_colorbalance(Editing *ed, data.data = cb; /* irritating we need to search for our sequence! */ - SEQ_iterator_seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_fn, &data); + SEQ_seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_fn, &data); *r_smd = data.smd; @@ -1144,7 +1138,7 @@ static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd data.data = smd; /* irritating we need to search for our sequence! */ - SEQ_iterator_seqbase_recursive_apply(&ed->seqbase, modifier_seq_cmp_fn, &data); + SEQ_seqbase_recursive_apply(&ed->seqbase, modifier_seq_cmp_fn, &data); return data.seq; } @@ -1350,6 +1344,11 @@ static void rna_def_strip_element(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "orig_height"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Orig Height", "Original image height"); + + prop = RNA_def_property(srna, "orig_fps", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "orig_fps"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Orig FPS", "Original frames per second"); } static void rna_def_strip_crop(BlenderRNA *brna) @@ -1517,7 +1516,7 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "quality"); - RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build"); + RNA_def_property_ui_text(prop, "Quality", "Quality of proxies to build"); RNA_def_property_ui_range(prop, 1, 100, 1, -1); prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); @@ -2394,11 +2393,10 @@ static void rna_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Input", "Input type to use for the Scene strip"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_use_sequence"); - prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_SCENE_NO_GPENCIL); - RNA_def_property_ui_text( - prop, "Use Grease Pencil", "Show Grease Pencil strokes in OpenGL previews"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + prop = RNA_def_property(srna, "use_annotations", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_SCENE_NO_ANNOTATION); + RNA_def_property_ui_text(prop, "Use Annotations", "Show Annotations in OpenGL previews"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); rna_def_filter_video(srna); rna_def_proxy(srna); @@ -2417,12 +2415,6 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video"); RNA_def_struct_sdna(srna, "Sequence"); - prop = RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "anim_preseek"); - RNA_def_property_range(prop, 0, 50); - RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); - prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "streamindex"); RNA_def_property_range(prop, 0, 20); @@ -2930,7 +2922,7 @@ static void rna_def_text(StructRNA *srna) prop = RNA_def_property(srna, "use_box", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TEXT_BOX); - RNA_def_property_ui_text(prop, "Shadow", "Display colored box behind text"); + RNA_def_property_ui_text(prop, "Box", "Display colored box behind text"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index a49a404fe6c..8aab0c079a3 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -224,13 +224,15 @@ static Sequence *rna_Sequences_new_image(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { Scene *scene = (Scene *)id; SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); load_data.image.len = 1; + load_data.fit_method = fit_method; Sequence *seq = SEQ_add_image_strip(bmain, scene, seqbase, &load_data); char dir[FILE_MAX], filename[FILE_MAX]; @@ -253,10 +255,11 @@ static Sequence *rna_Sequences_editing_new_image(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { return rna_Sequences_new_image( - id, &ed->seqbase, bmain, reports, name, file, channel, frame_start); + id, &ed->seqbase, bmain, reports, name, file, channel, frame_start, fit_method); } static Sequence *rna_Sequences_meta_new_image(ID *id, @@ -266,10 +269,11 @@ static Sequence *rna_Sequences_meta_new_image(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { return rna_Sequences_new_image( - id, &seq->seqbase, bmain, reports, name, file, channel, frame_start); + id, &seq->seqbase, bmain, reports, name, file, channel, frame_start, fit_method); } static Sequence *rna_Sequences_new_movie(ID *id, @@ -278,11 +282,13 @@ static Sequence *rna_Sequences_new_movie(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { Scene *scene = (Scene *)id; SeqLoadData load_data; SEQ_add_load_data_init(&load_data, name, file, frame_start, channel); + load_data.fit_method = fit_method; load_data.allow_invalid_file = true; Sequence *seq = SEQ_add_movie_strip(bmain, scene, seqbase, &load_data); @@ -299,9 +305,11 @@ static Sequence *rna_Sequences_editing_new_movie(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { - return rna_Sequences_new_movie(id, &ed->seqbase, bmain, name, file, channel, frame_start); + return rna_Sequences_new_movie( + id, &ed->seqbase, bmain, name, file, channel, frame_start, fit_method); } static Sequence *rna_Sequences_meta_new_movie(ID *id, @@ -310,9 +318,11 @@ static Sequence *rna_Sequences_meta_new_movie(ID *id, const char *name, const char *file, int channel, - int frame_start) + int frame_start, + int fit_method) { - return rna_Sequences_new_movie(id, &seq->seqbase, bmain, name, file, channel, frame_start); + return rna_Sequences_new_movie( + id, &seq->seqbase, bmain, name, file, channel, frame_start, fit_method); } # ifdef WITH_AUDASPACE @@ -724,6 +734,18 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem scale_fit_methods[] = { + {SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image so fits in preview"}, + {SEQ_SCALE_TO_FILL, + "FILL", + 0, + "Scale to Fill", + "Scale image so it fills preview completely"}, + {SEQ_STRETCH_TO_FILL, "STRETCH", 0, "Stretch to Fill", "Stretch image so it fills preview"}, + {SEQ_USE_ORIGINAL_SIZE, "ORIGINAL", 0, "Use Original Size", "Don't scale the image"}, + {0, NULL, 0, NULL, NULL}, + }; + const char *new_clip_func_name = "rna_Sequences_editing_new_clip"; const char *new_mask_func_name = "rna_Sequences_editing_new_mask"; const char *new_scene_func_name = "rna_Sequences_editing_new_scene"; @@ -849,6 +871,9 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri -MAXFRAME, MAXFRAME); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_enum( + func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL); + RNA_def_parameter_flags(parm, 0, PARM_PYFUNC_OPTIONAL); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); @@ -873,6 +898,9 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri -MAXFRAME, MAXFRAME); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_enum( + func, "fit_method", scale_fit_methods, SEQ_USE_ORIGINAL_SIZE, "Image Fit Method", NULL); + RNA_def_parameter_flags(parm, 0, PARM_PYFUNC_OPTIONAL); /* return type */ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c index 451cc56eba7..4a6cb0d740a 100644 --- a/source/blender/makesrna/intern/rna_shader_fx.c +++ b/source/blender/makesrna/intern/rna_shader_fx.c @@ -216,6 +216,8 @@ static void rna_def_shader_fx_blur(BlenderRNA *brna) RNA_def_struct_sdna(srna, "BlurShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0.0f, FLT_MAX); @@ -240,6 +242,8 @@ static void rna_def_shader_fx_blur(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_colorize(BlenderRNA *brna) @@ -252,6 +256,8 @@ static void rna_def_shader_fx_colorize(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ColorizeShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "factor"); RNA_def_property_range(prop, 0, 1.0); @@ -277,6 +283,8 @@ static void rna_def_shader_fx_colorize(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_wave(BlenderRNA *brna) @@ -294,6 +302,8 @@ static void rna_def_shader_fx_wave(BlenderRNA *brna) RNA_def_struct_sdna(srna, "WaveShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + 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_wave_type_items); @@ -317,6 +327,8 @@ static void rna_def_shader_fx_wave(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_pixel(BlenderRNA *brna) @@ -329,6 +341,8 @@ static void rna_def_shader_fx_pixel(BlenderRNA *brna) RNA_def_struct_sdna(srna, "PixelShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "size"); RNA_def_property_range(prop, 1, SHRT_MAX); @@ -340,6 +354,8 @@ static void rna_def_shader_fx_pixel(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FX_PIXEL_FILTER_NEAREST); RNA_def_property_ui_text(prop, "Antialiasing", "Antialias pixels"); RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_rim(BlenderRNA *brna) @@ -352,6 +368,8 @@ static void rna_def_shader_fx_rim(BlenderRNA *brna) RNA_def_struct_sdna(srna, "RimShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX); @@ -392,6 +410,8 @@ static void rna_def_shader_fx_rim(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_shadow(BlenderRNA *brna) @@ -409,11 +429,12 @@ static void rna_def_shader_fx_shadow(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ShadowShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Object", "Object to determine center of rotation"); RNA_def_property_pointer_funcs(prop, NULL, "rna_ShadowShaderFx_object_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update"); prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL); @@ -490,6 +511,8 @@ static void rna_def_shader_fx_shadow(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_glow(BlenderRNA *brna) @@ -502,6 +525,8 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna) RNA_def_struct_sdna(srna, "GlowShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "glow_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_float_sdna(prop, NULL, "glow_color"); @@ -569,6 +594,8 @@ static void rna_def_shader_fx_glow(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_swirl(BlenderRNA *brna) @@ -581,6 +608,8 @@ static void rna_def_shader_fx_swirl(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SwirlShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + prop = RNA_def_property(srna, "radius", PROP_INT, PROP_PIXEL); RNA_def_property_int_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0, SHRT_MAX); @@ -603,8 +632,9 @@ static void rna_def_shader_fx_swirl(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object", "Object to determine center location"); RNA_def_property_pointer_funcs(prop, NULL, "rna_SwirlShaderFx_object_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); - RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update"); + + RNA_define_lib_overridable(false); } static void rna_def_shader_fx_flip(BlenderRNA *brna) @@ -617,6 +647,8 @@ static void rna_def_shader_fx_flip(BlenderRNA *brna) RNA_def_struct_sdna(srna, "FlipShaderFxData"); RNA_def_struct_ui_icon(srna, ICON_SHADERFX); + RNA_define_lib_overridable(true); + 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"); @@ -626,6 +658,8 @@ static void rna_def_shader_fx_flip(BlenderRNA *brna) 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_SHADERFX, "rna_ShaderFx_update"); + + RNA_define_lib_overridable(false); } void RNA_def_shader_fx(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index f9b1816e1ba..39edc6c3b9a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -34,6 +34,7 @@ #include "BKE_node.h" #include "BKE_studiolight.h" +#include "ED_spreadsheet.h" #include "ED_text.h" #include "BLI_listbase.h" @@ -1673,7 +1674,7 @@ static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values) values[0] = values[1] = 1; - /* find aregion */ + /* Find #ARegion. */ area = rna_area_from_space(ptr); /* can be NULL */ region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); if (region) { @@ -1793,7 +1794,13 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, st->text = value.data; - WM_main_add_notifier(NC_TEXT | NA_SELECTED, st->text); + ScrArea *area = rna_area_from_space(ptr); + if (area) { + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + if (region) { + ED_text_scroll_to_cursor(st, region, true); + } + } } static bool rna_SpaceTextEditor_text_is_syntax_highlight_supported(struct SpaceText *space) @@ -3031,14 +3038,6 @@ static void rna_SpaceFileBrowser_browse_mode_update(Main *UNUSED(bmain), ED_area_tag_refresh(area); } -static void rna_SpaceSpreadsheet_pinned_id_set(PointerRNA *ptr, - PointerRNA value, - struct ReportList *UNUSED(reports)) -{ - SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)ptr->data; - sspreadsheet->pinned_id = value.data; -} - static void rna_SpaceSpreadsheet_geometry_component_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -3047,9 +3046,13 @@ static void rna_SpaceSpreadsheet_geometry_component_type_update(Main *UNUSED(bma if (sspreadsheet->geometry_component_type == GEO_COMPONENT_TYPE_POINT_CLOUD) { sspreadsheet->attribute_domain = ATTR_DOMAIN_POINT; } + if (sspreadsheet->geometry_component_type == GEO_COMPONENT_TYPE_CURVE && + !ELEM(sspreadsheet->attribute_domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE)) { + sspreadsheet->attribute_domain = ATTR_DOMAIN_POINT; + } } -const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *C, +const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) @@ -3057,20 +3060,23 @@ const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *C, SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)ptr->data; GeometryComponentType component_type = sspreadsheet->geometry_component_type; if (sspreadsheet->object_eval_state == SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL) { - Object *active_object = CTX_data_active_object(C); - Object *used_object = (sspreadsheet->pinned_id && GS(sspreadsheet->pinned_id->name) == ID_OB) ? - (Object *)sspreadsheet->pinned_id : - active_object; - if (used_object != NULL) { - if (used_object->type == OB_POINTCLOUD) { - component_type = GEO_COMPONENT_TYPE_POINT_CLOUD; - } - else { - component_type = GEO_COMPONENT_TYPE_MESH; + ID *used_id = ED_spreadsheet_get_current_id(sspreadsheet); + if (used_id != NULL) { + if (GS(used_id->name) == ID_OB) { + Object *used_object = (Object *)used_id; + if (used_object->type == OB_POINTCLOUD) { + component_type = GEO_COMPONENT_TYPE_POINT_CLOUD; + } + else { + component_type = GEO_COMPONENT_TYPE_MESH; + } } } } + static EnumPropertyItem mesh_vertex_domain_item = { + ATTR_DOMAIN_POINT, "POINT", 0, "Vertex", "Attribute per point/vertex"}; + EnumPropertyItem *item_array = NULL; int items_len = 0; for (const EnumPropertyItem *item = rna_enum_attribute_domain_items; item->identifier != NULL; @@ -3089,7 +3095,17 @@ const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *C, continue; } } - RNA_enum_item_add(&item_array, &items_len, item); + if (component_type == GEO_COMPONENT_TYPE_CURVE) { + if (!ELEM(item->value, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CURVE)) { + continue; + } + } + if (item->value == ATTR_DOMAIN_POINT && component_type == GEO_COMPONENT_TYPE_MESH) { + RNA_enum_item_add(&item_array, &items_len, &mesh_vertex_domain_item); + } + else { + RNA_enum_item_add(&item_array, &items_len, item); + } } RNA_enum_item_end(&item_array, &items_len); @@ -3097,6 +3113,61 @@ const EnumPropertyItem *rna_SpaceSpreadsheet_attribute_domain_itemf(bContext *C, return item_array; } +static SpreadsheetContext *rna_SpaceSpreadsheet_context_path_append(SpaceSpreadsheet *sspreadsheet, + int type) +{ + SpreadsheetContext *context = ED_spreadsheet_context_new(type); + BLI_addtail(&sspreadsheet->context_path, context); + ED_spreadsheet_context_path_update_tag(sspreadsheet); + WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL); + return context; +} + +static void rna_SpaceSpreadsheet_context_path_clear(SpaceSpreadsheet *sspreadsheet) +{ + ED_spreadsheet_context_path_clear(sspreadsheet); + ED_spreadsheet_context_path_update_tag(sspreadsheet); + WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL); +} + +static StructRNA *rna_spreadsheet_context_refine(PointerRNA *ptr) +{ + SpreadsheetContext *context = ptr->data; + switch (context->type) { + case SPREADSHEET_CONTEXT_OBJECT: + return &RNA_SpreadsheetContextObject; + case SPREADSHEET_CONTEXT_MODIFIER: + return &RNA_SpreadsheetContextModifier; + case SPREADSHEET_CONTEXT_NODE: + return &RNA_SpreadsheetContextNode; + } + BLI_assert_unreachable(); + return NULL; +} + +static void rna_spreadsheet_context_update(Main *UNUSED(bmain), + Scene *UNUSED(scene), + PointerRNA *ptr) +{ + bScreen *screen = (bScreen *)ptr->owner_id; + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + SpaceLink *sl = area->spacedata.first; + if (sl->spacetype == SPACE_SPREADSHEET) { + SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl; + ED_spreadsheet_context_path_update_tag(sspreadsheet); + } + } +} + +static void rna_spreadsheet_set_geometry_node_context(SpaceSpreadsheet *sspreadsheet, + SpaceNode *snode, + bNode *node) +{ + ED_spreadsheet_set_geometry_node_context(sspreadsheet, snode, node); + ED_spreadsheet_context_path_update_tag(sspreadsheet); + WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL); +} + #else static const EnumPropertyItem dt_uv_items[] = { @@ -3399,6 +3470,11 @@ static void rna_def_space_outliner(BlenderRNA *brna) ICON_RNA, "Data API", "Display low level Blender data and its properties"}, + {SO_OVERRIDES_LIBRARY, + "LIBRARY_OVERRIDES", + ICON_LIBRARY_DATA_OVERRIDE, + "Library Overrides", + "Display data-blocks with library overrides and list their overridden properties"}, {SO_ID_ORPHANS, "ORPHAN_DATA", ICON_ORPHAN_DATA, @@ -3588,6 +3664,16 @@ static void rna_def_space_outliner(BlenderRNA *brna) "Show Library Overrides", "For libraries with overrides created, show the overridden values"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); + + prop = RNA_def_property(srna, "use_filter_lib_override_system", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_SHOW_SYSTEM_OVERRIDES); + RNA_def_property_ui_text( + prop, + "Show System Overrides", + "For libraries with overrides created, show the overridden values that are " + "defined/controlled automatically (e.g. to make users of an overridden data-block point to " + "the override data, not the original linked data)"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL); } static void rna_def_space_view3d_shading(BlenderRNA *brna) @@ -4080,7 +4166,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_LOOK_DEV); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "HDRI Preview", "Show HDRI preview spheres"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL); prop = RNA_def_property(srna, "show_wireframes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_WIREFRAMES); @@ -4406,7 +4492,6 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) prop = RNA_def_property(srna, "gpencil_vertex_paint_opacity", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_vertex_paint_opacity"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Opacity", "Vertex Paint mix factor"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); } @@ -5381,7 +5466,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXIES); RNA_def_property_ui_text( prop, "Use Proxies", "Use optimized files for faster scrubbing when available"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache"); /* grease pencil */ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); @@ -6476,6 +6561,16 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem asset_import_type_items[] = { + {FILE_ASSET_IMPORT_LINK, "LINK", 0, "Link", "Import the assets as linked data-block"}, + {FILE_ASSET_IMPORT_APPEND, + "APPEND", + 0, + "Append", + "Import the assets as copied data-block, with no link to the original asset data-block"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "FileAssetSelectParams", "FileSelectParams"); RNA_def_struct_ui_text( srna, "Asset Select Parameters", "Settings for the file selection in Asset Browser mode"); @@ -6497,6 +6592,13 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna) NULL); RNA_def_property_ui_text(prop, "Asset Category", "Determine which kind of assets to display"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); + + prop = RNA_def_property(srna, "import_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, asset_import_type_items); + RNA_def_property_ui_text(prop, "Import Type", "Determine how the asset will be imported"); + /* Asset drag info saved by buttons stores the import type, so the space must redraw when import + * type changes. */ + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); } static void rna_def_filemenu_entry(BlenderRNA *brna) @@ -7309,10 +7411,93 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL); } -static void rna_def_space_spreadsheet(BlenderRNA *brna) +static const EnumPropertyItem spreadsheet_context_type_items[] = { + {SPREADSHEET_CONTEXT_OBJECT, "OBJECT", ICON_NONE, "Object", ""}, + {SPREADSHEET_CONTEXT_MODIFIER, "MODIFIER", ICON_NONE, "Modifier", ""}, + {SPREADSHEET_CONTEXT_NODE, "NODE", ICON_NONE, "Node", ""}, + {0, NULL, 0, NULL, NULL}, +}; + +static void rna_def_space_spreadsheet_context(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SpreadsheetContext", NULL); + RNA_def_struct_ui_text(srna, "Spreadsheet Context", "Element of spreadsheet context path"); + RNA_def_struct_refine_func(srna, "rna_spreadsheet_context_refine"); + + prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, spreadsheet_context_type_items); + RNA_def_property_ui_text(prop, "Type", "Type of the context"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + +static void rna_def_space_spreadsheet_context_object(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SpreadsheetContextObject", "SpreadsheetContext"); + + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, "rna_spreadsheet_context_update"); +} + +static void rna_def_space_spreadsheet_context_modifier(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SpreadsheetContextModifier", "SpreadsheetContext"); + + prop = RNA_def_property(srna, "modifier_name", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, "Modifier Name", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, "rna_spreadsheet_context_update"); +} + +static void rna_def_space_spreadsheet_context_node(BlenderRNA *brna) { + StructRNA *srna; PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SpreadsheetContextNode", "SpreadsheetContext"); + + prop = RNA_def_property(srna, "node_name", PROP_STRING, PROP_NONE); + RNA_def_property_ui_text(prop, "Node Name", ""); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, "rna_spreadsheet_context_update"); +} + +static void rna_def_space_spreadsheet_context_path(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *parm; + FunctionRNA *func; + + RNA_def_property_srna(cprop, "SpreadsheetContextPath"); + srna = RNA_def_struct(brna, "SpreadsheetContextPath", NULL); + RNA_def_struct_sdna(srna, "SpaceSpreadsheet"); + + func = RNA_def_function(srna, "append", "rna_SpaceSpreadsheet_context_path_append"); + RNA_def_function_ui_description(func, "Append a context path element"); + parm = RNA_def_property(func, "type", PROP_ENUM, PROP_NONE); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_property_enum_items(parm, spreadsheet_context_type_items); + parm = RNA_def_pointer( + func, "context", "SpreadsheetContext", "", "Newly created context path element"); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "clear", "rna_SpaceSpreadsheet_context_path_clear"); + RNA_def_function_ui_description(func, "Clear entire context path"); +} + +static void rna_def_space_spreadsheet(BlenderRNA *brna) +{ + PropertyRNA *prop, *parm; StructRNA *srna; + FunctionRNA *func; static const EnumPropertyItem geometry_component_type_items[] = { {GEO_COMPONENT_TYPE_MESH, @@ -7325,6 +7510,11 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) ICON_POINTCLOUD_DATA, "Point Cloud", "Point cloud component containing only point data"}, + {GEO_COMPONENT_TYPE_CURVE, + "CURVE", + ICON_CURVE_DATA, + "Curve", + "Curve component containing spline and control point data"}, {GEO_COMPONENT_TYPE_INSTANCES, "INSTANCES", ICON_EMPTY_AXIS, @@ -7334,11 +7524,11 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) }; static const EnumPropertyItem object_eval_state_items[] = { - {SPREADSHEET_OBJECT_EVAL_STATE_FINAL, - "FINAL", + {SPREADSHEET_OBJECT_EVAL_STATE_EVALUATED, + "EVALUATED", ICON_NONE, - "Final", - "Use data from object with all modifiers applied"}, + "Evaluated", + "Use data from fully or partially evaluated object"}, {SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL, "ORIGINAL", ICON_NONE, @@ -7347,17 +7537,31 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + rna_def_space_spreadsheet_context(brna); + rna_def_space_spreadsheet_context_object(brna); + rna_def_space_spreadsheet_context_modifier(brna); + rna_def_space_spreadsheet_context_node(brna); + srna = RNA_def_struct(brna, "SpaceSpreadsheet", "Space"); RNA_def_struct_ui_text(srna, "Space Spreadsheet", "Spreadsheet space data"); rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_FOOTER)); - prop = RNA_def_property(srna, "pinned_id", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceSpreadsheet_pinned_id_set", NULL, NULL); - RNA_def_property_ui_text(prop, "Pinned ID", "Data-block whose values are displayed"); + prop = RNA_def_property(srna, "is_pinned", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPREADSHEET_FLAG_PINNED); + RNA_def_property_ui_text(prop, "Is Pinned", "Context path is pinned"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL); + + prop = RNA_def_property(srna, "display_context_path_collapsed", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPREADSHEET_FLAG_CONTEXT_PATH_COLLAPSED); + RNA_def_property_ui_text(prop, "Display Context Path Collapsed", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL); + prop = RNA_def_property(srna, "context_path", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "SpreadsheetContext"); + RNA_def_property_ui_text(prop, "Context Path", "Context path to the data being displayed"); + rna_def_space_spreadsheet_context_path(brna, prop); + prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", SPREADSHEET_FILTER_SELECTED_ONLY); RNA_def_property_ui_text( @@ -7382,6 +7586,16 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) RNA_def_property_enum_items(prop, object_eval_state_items); RNA_def_property_ui_text(prop, "Object Evaluation State", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SPREADSHEET, NULL); + + func = RNA_def_function( + srna, "set_geometry_node_context", "rna_spreadsheet_set_geometry_node_context"); + RNA_def_function_ui_description( + func, "Update context_path to point to a specific node in a node editor"); + parm = RNA_def_pointer( + func, "node_editor", "SpaceNodeEditor", "", "Editor to take the context from"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_pointer(func, "node", "Node", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } void RNA_def_space(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index c4a44556cf4..336359a9dc0 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -697,7 +697,7 @@ static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *t static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack *track, int framenr, - float *co) + float co[2]) { MovieTrackingMarker marker, *new_marker; @@ -2367,6 +2367,7 @@ static void rna_def_trackingObject(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "keyframe1"); RNA_def_property_ui_text( prop, "Keyframe A", "First keyframe used for reconstruction initialization"); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); /* keyframe_b */ prop = RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE); @@ -2374,6 +2375,7 @@ static void rna_def_trackingObject(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "keyframe2"); RNA_def_property_ui_text( prop, "Keyframe B", "Second keyframe used for reconstruction initialization"); + RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); } static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index aefb77c4077..8f596ec6a5c 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -599,7 +599,7 @@ static void uilist_filter_items(uiList *ui_list, items_shown = flt_data->items_shown = shown_idx; flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * items_shown, __func__); /* And now, bring back new indices into the [0, items_shown[ range! - * XXX This is O(N²)... :/ + * XXX This is O(N^2). :/ */ for (shown_idx = 0, prev_ni = -1; shown_idx < items_shown; shown_idx++) { for (i = 0, t_ni = len, t_idx = -1; i < items_shown; i++) { diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4c86405a44d..4d45d1d6d63 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -779,7 +779,7 @@ static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C RNA_enum_item_add(&item, &totitem, &new_item); } -# ifndef NDEBUG +# if !defined(NDEBUG) || !defined(WITH_AUDASPACE) if (i == 0) { EnumPropertyItem new_item = {i, "SOUND_NONE", 0, "No Sound", ""}; RNA_enum_item_add(&item, &totitem, &new_item); @@ -1072,10 +1072,9 @@ static void rna_UserDef_studiolight_solid_lights_begin(CollectionPropertyIterato rna_iterator_array_begin(iter, sl->light, sizeof(*sl->light), ARRAY_SIZE(sl->light), 0, NULL); } -static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *ptr) +static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *UNUSED(ptr)) { - StudioLight *sl = (StudioLight *)ptr->data; - return ARRAY_SIZE(sl->light); + return ARRAY_SIZE(((StudioLight *)NULL)->light); } /* StudioLight.light_ambient */ @@ -6160,7 +6159,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop, "Python Scripts Directory", "Alternate script path, matching the default layout with subdirectories: " - "startup, add-ons and modules (requires restart)"); + "startup, addons, modules, and presets (requires restart)"); /* TODO, editing should reset sys.path! */ prop = RNA_def_property(srna, "i18n_branches_directory", PROP_STRING, PROP_DIRPATH); @@ -6215,7 +6214,8 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Auto Save Temporary Files", "Automatic saving of temporary files in temp directory, " - "uses process ID (sculpt and edit mode data won't be saved)"); + "uses process ID.\n" + "Warning: Sculpt and edit mode data won't be saved"); RNA_def_property_update(prop, 0, "rna_userdef_autosave_update"); prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE); @@ -6275,6 +6275,14 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_ui_text( prop, "New Point Cloud Type", "Enable the new point cloud type in the ui"); + prop = RNA_def_property(srna, "use_full_frame_compositor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_full_frame_compositor", 1); + RNA_def_property_ui_text(prop, + "Full Frame Compositor", + "Enable compositor full frame execution mode option (no tiling, " + "reduces execution time and memory usage)"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "use_new_hair_type", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_new_hair_type", 1); RNA_def_property_ui_text(prop, "New Hair Type", "Enable the new hair type in the ui"); @@ -6288,11 +6296,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) 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"); - prop = RNA_def_property(srna, "use_switch_object_operator", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "use_switch_object_operator", 1); - RNA_def_property_ui_text( - prop, "Switch Object Operator", "Enable the operator to switch objects by pressing D"); - prop = RNA_def_property(srna, "use_sculpt_tools_tilt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_sculpt_tools_tilt", 1); RNA_def_property_ui_text( @@ -6304,6 +6307,11 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) prop, "Asset Browser", "Enable Asset Browser editor and operators to manage data-blocks as asset"); + + prop = RNA_def_property(srna, "use_override_templates", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_override_templates", 1); + RNA_def_property_ui_text( + prop, "Override Templates", "Enable library override template in the python API"); } static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) diff --git a/source/blender/makesrna/intern/rna_volume.c b/source/blender/makesrna/intern/rna_volume.c index 1bddd9152db..76db6f3e325 100644 --- a/source/blender/makesrna/intern/rna_volume.c +++ b/source/blender/makesrna/intern/rna_volume.c @@ -137,7 +137,7 @@ static void rna_Volume_grids_end(CollectionPropertyIterator *UNUSED(iter)) static PointerRNA rna_Volume_grids_get(CollectionPropertyIterator *iter) { Volume *volume = iter->internal.count.ptr; - const VolumeGrid *grid = BKE_volume_grid_get(volume, iter->internal.count.item); + const VolumeGrid *grid = BKE_volume_grid_get_for_read(volume, iter->internal.count.item); return rna_pointer_inherit_refine(&iter->parent, &RNA_VolumeGrid, (void *)grid); } @@ -207,6 +207,16 @@ static int rna_VolumeGrids_frame_filepath_length(PointerRNA *ptr) return strlen(BKE_volume_grids_frame_filepath(volume)); } +static bool rna_Volume_load(Volume *volume, Main *bmain) +{ + return BKE_volume_load(volume, bmain); +} + +static bool rna_Volume_save(Volume *volume, Main *bmain, ReportList *reports, const char *filepath) +{ + return BKE_volume_save(volume, bmain, reports, filepath); +} + #else static void rna_def_volume_grid(BlenderRNA *brna) @@ -335,7 +345,7 @@ static void rna_def_volume_grids(BlenderRNA *brna, PropertyRNA *cprop) FunctionRNA *func; PropertyRNA *parm; - func = RNA_def_function(srna, "load", "BKE_volume_load"); + func = RNA_def_function(srna, "load", "rna_Volume_load"); RNA_def_function_ui_description(func, "Load list of grids and metadata from file"); RNA_def_function_flag(func, FUNC_USE_MAIN); parm = RNA_def_boolean(func, "success", 0, "", "True if grid list was successfully loaded"); @@ -344,7 +354,7 @@ static void rna_def_volume_grids(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "unload", "BKE_volume_unload"); RNA_def_function_ui_description(func, "Unload all grid and voxel data from memory"); - func = RNA_def_function(srna, "save", "BKE_volume_save"); + func = RNA_def_function(srna, "save", "rna_Volume_save"); RNA_def_function_ui_description(func, "Save grids and metadata to file"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to save to"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index d67d62d7af9..2b1a5f7fde1 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -604,14 +604,22 @@ static PointerRNA rna_Operator_options_get(PointerRNA *ptr) static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) { wmOperator *op = (wmOperator *)ptr->data; - return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties); + + PointerRNA result; + WM_operator_properties_create_ptr(&result, op->type); + result.data = op->properties; + return result; } static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr) { wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data; wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true); - return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties); + + PointerRNA result; + WM_operator_properties_create_ptr(&result, ot); + result.data = otmacro->properties; + return result; } static const EnumPropertyItem *rna_Event_value_itemf(bContext *UNUSED(C), @@ -880,6 +888,7 @@ static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) wmKeyMapItem *kmi = ptr->data; if (kmi->ptr) { + BLI_assert(kmi->ptr->owner_id == NULL); return *(kmi->ptr); } @@ -1781,41 +1790,40 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) } } -static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value) -{ - wmOperator *data = (wmOperator *)(ptr->data); - char *str = (char *)data->type->translation_context; - if (!str[0]) { - BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ - } - else { - BLI_assert(!"setting the bl_translation_context on a non-builtin operator"); - } -} - -static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) -{ - wmOperator *data = (wmOperator *)(ptr->data); - char *str = (char *)data->type->description; - if (!str[0]) { - BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */ - } - else { - BLI_assert(!"setting the bl_description on a non-builtin operator"); - } -} +/** + * Use callbacks that check for NULL instead of clearing #PROP_NEVER_NULL on the string property, + * so the internal value may be NULL, without allowing Python to assign `None` which doesn't + * make any sense in this case. + */ +# define OPERATOR_STR_MAYBE_NULL_GETSET(attr, len) \ + static void rna_Operator_bl_##attr##_set(PointerRNA *ptr, const char *value) \ + { \ + wmOperator *data = (wmOperator *)(ptr->data); \ + char *str = (char *)data->type->attr; \ + if (str && !str[0]) { \ + BLI_strncpy(str, value, len); /* utf8 already ensured */ \ + } \ + else { \ + BLI_assert( \ + !"setting the bl_" STRINGIFY(translation_context) " on a non-builtin operator"); \ + } \ + } \ + static void rna_Operator_bl_##attr##_get(PointerRNA *ptr, char *value) \ + { \ + const wmOperator *data = (wmOperator *)(ptr->data); \ + const char *str = data->type->attr; \ + BLI_strncpy(value, str ? str : "", len); \ + } \ + static int rna_Operator_bl_##attr##_length(PointerRNA *ptr) \ + { \ + const wmOperator *data = (wmOperator *)(ptr->data); \ + const char *str = data->type->attr; \ + return BLI_strnlen(str ? str : "", len); \ + } -static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value) -{ - wmOperator *data = (wmOperator *)(ptr->data); - char *str = (char *)data->type->undo_group; - if (!str[0]) { - BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */ - } - else { - BLI_assert(!"setting the bl_undo_group on a non-builtin operator"); - } -} +OPERATOR_STR_MAYBE_NULL_GETSET(translation_context, RNA_DYN_DESCR_MAX) +OPERATOR_STR_MAYBE_NULL_GETSET(description, RNA_DYN_DESCR_MAX) +OPERATOR_STR_MAYBE_NULL_GETSET(undo_group, OP_MAX_TYPENAME) static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { @@ -1930,26 +1938,32 @@ static void rna_def_operator(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_translation_context_get", + "rna_Operator_bl_translation_context_length", + "rna_Operator_bl_translation_context_set"); RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_description_get", + "rna_Operator_bl_description_length", + "rna_Operator_bl_description_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->undo_group"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_undo_group_get", + "rna_Operator_bl_undo_group_length", + "rna_Operator_bl_undo_group_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->flag"); @@ -1969,7 +1983,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine"); RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops"); RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags); - RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); + RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); } @@ -2022,26 +2036,32 @@ static void rna_def_macro_operator(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_translation_context_get", + "rna_Operator_bl_translation_context_length", + "rna_Operator_bl_translation_context_set"); RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_description_get", + "rna_Operator_bl_description_length", + "rna_Operator_bl_description_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->undo_group"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set"); + RNA_def_property_string_funcs(prop, + "rna_Operator_bl_undo_group_get", + "rna_Operator_bl_undo_group_length", + "rna_Operator_bl_undo_group_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); - RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->flag"); diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index f7d139dd706..e91df38c96e 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -534,12 +534,16 @@ static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type) return; } + WM_gizmotype_remove_ptr(NULL, bmain, gzt); + + /* Free extension after removing instances so `__del__` doesn't crash, see: T85567. */ RNA_struct_free_extension(type, &gzt->rna_ext); RNA_struct_free(&BLENDER_RNA, type); - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + /* Free gizmo group after the extension as it owns the identifier memory. */ + WM_gizmotype_free_ptr(gzt); - WM_gizmotype_remove_ptr(NULL, bmain, gzt); + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); } static void **rna_Gizmo_instance(PointerRNA *ptr) @@ -934,12 +938,16 @@ static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type) return; } + WM_gizmo_group_type_remove_ptr(bmain, gzgt); + + /* Free extension after removing instances so `__del__` doesn't crash, see: T85567. */ RNA_struct_free_extension(type, &gzgt->rna_ext); RNA_struct_free(&BLENDER_RNA, type); - WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); + /* Free gizmo group after the extension as it owns the identifier memory. */ + WM_gizmo_group_type_free_ptr(gzgt); - WM_gizmo_group_type_remove_ptr(bmain, gzgt); + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); } static void **rna_GizmoGroup_instance(PointerRNA *ptr) |