diff options
Diffstat (limited to 'source/blender/makesrna')
32 files changed, 537 insertions, 253 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 67605201a9f..005228bea72 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -497,7 +497,7 @@ char *RNA_path_back(const char *path); * character in `rna_path` that is part of the array index for the given property. Return NULL if * none can be found, e.g. because the property is not an RNA array. * - * \param array_prop if not NULL, the PropertyRNA assumed to be the last one from the RNA path. + * \param array_prop: if not NULL, the #PropertyRNA assumed to be the last one from the RNA path. * Only used to ensure it is a valid array property. */ const char *RNA_path_array_index_token_find(const char *rna_path, const PropertyRNA *array_prop); diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index af8767a1220..778c6a6bfdd 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -84,7 +84,6 @@ set(DEFSRC if(WITH_EXPERIMENTAL_FEATURES) add_definitions(-DWITH_SIMULATION_DATABLOCK) - add_definitions(-DWITH_NEW_CURVES_TYPE) list(APPEND DEFSRC rna_curves.c rna_simulation.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b5354514205..2b24bd0b39c 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1117,8 +1117,10 @@ static char *rna_def_property_set_func( fprintf( f, " if (data->%s != NULL) { MEM_freeN(data->%s); }\n", dp->dnaname, dp->dnaname); fprintf(f, " const int length = strlen(value);\n"); - fprintf(f, " data->%s = MEM_mallocN(length + 1, __func__);\n", dp->dnaname); - fprintf(f, " %s(data->%s, value, length + 1);\n", string_copy_func, dp->dnaname); + fprintf(f, " if (length > 0) {\n"); + fprintf(f, " data->%s = MEM_mallocN(length + 1, __func__);\n", dp->dnaname); + fprintf(f, " %s(data->%s, value, length + 1);\n", string_copy_func, dp->dnaname); + fprintf(f, " } else { data->%s = NULL; }\n", dp->dnaname); } else { /* Handle char array properties. */ @@ -4433,9 +4435,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_gpencil.c", NULL, RNA_def_gpencil}, -#ifdef WITH_NEW_CURVES_TYPE {"rna_curves.c", NULL, RNA_def_curves}, -#endif {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, {"rna_light.c", NULL, RNA_def_light}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 8d2ee0ab534..b4fa7088d38 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -16,6 +16,7 @@ #include "BKE_icons.h" #include "BKE_lib_id.h" +#include "BKE_main_namemap.h" #include "BKE_object.h" #include "RNA_access.h" @@ -273,6 +274,7 @@ int rna_ID_name_length(PointerRNA *ptr) void rna_ID_name_set(PointerRNA *ptr, const char *value) { ID *id = (ID *)ptr->data; + BKE_main_namemap_remove_name(G_MAIN, id, id->name + 2); BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2); BLI_assert(BKE_id_is_in_global_main(id)); BLI_libblock_ensure_unique_name(G_MAIN, id->name); @@ -375,11 +377,9 @@ short RNA_type_to_ID_code(const StructRNA *type) if (base_type == &RNA_FreestyleLineStyle) { return ID_LS; } -# ifdef WITH_NEW_CURVES_TYPE if (base_type == &RNA_Curves) { return ID_CV; } -# endif if (base_type == &RNA_Lattice) { return ID_LT; } @@ -483,11 +483,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_GR: return &RNA_Collection; case ID_CV: -# ifdef WITH_NEW_CURVES_TYPE return &RNA_Curves; -# else - return &RNA_ID; -# endif case ID_IM: return &RNA_Image; case ID_KE: diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a0b25cf60b2..cf4182243b9 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2141,6 +2141,7 @@ void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop) void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop) { + BLI_assert(bmain != NULL); rna_property_update(NULL, bmain, scene, ptr, prop); } diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 80a61543b5a..e0d55050c63 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -251,6 +251,11 @@ const EnumPropertyItem rna_enum_brush_curves_sculpt_tool_items[] = { {CURVES_SCULPT_TOOL_ADD, "ADD", ICON_BRUSH_CURVES_ADD, "Add Curves", ""}, {CURVES_SCULPT_TOOL_GROW_SHRINK, "GROW_SHRINK", ICON_BRUSH_CURVES_GROW_SHRINK, "Grow / Shrink Curves", ""}, {CURVES_SCULPT_TOOL_SELECTION_PAINT, "SELECTION_PAINT", ICON_BRUSH_PAINT_SELECT, "Paint Selection", ""}, + {CURVES_SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_CURVES_PINCH, "Pinch Curves", ""}, + {CURVES_SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_CURVES_SMOOTH, "Smooth Curves", ""}, + {CURVES_SCULPT_TOOL_PUFF, "PUFF", ICON_BRUSH_CURVES_PUFF, "Puff Curves", ""}, + {CURVES_SCULPT_TOOL_DENSITY, "DENSITY", ICON_BRUSH_CURVES_DENSITY, "Density Curves", ""}, + {CURVES_SCULPT_TOOL_SLIDE, "SLIDE", ICON_BRUSH_CURVES_SLIDE, "Slide Curves", ""}, {0, NULL, 0, NULL, NULL}, }; /* clang-format on */ @@ -889,6 +894,7 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, switch (me->curves_sculpt_tool) { case CURVES_SCULPT_TOOL_GROW_SHRINK: case CURVES_SCULPT_TOOL_SELECTION_PAINT: + case CURVES_SCULPT_TOOL_PINCH: return prop_direction_items; default: return DummyRNA_DEFAULT_items; @@ -1949,6 +1955,26 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static const EnumPropertyItem density_mode_items[] = { + {BRUSH_CURVES_SCULPT_DENSITY_MODE_AUTO, + "AUTO", + ICON_AUTO, + "Auto", + "Either add or remove curves depending on the minimum distance of the curves under the " + "cursor"}, + {BRUSH_CURVES_SCULPT_DENSITY_MODE_ADD, + "ADD", + ICON_ADD, + "Add", + "Add new curves between existing curves, taking the minimum distance into account"}, + {BRUSH_CURVES_SCULPT_DENSITY_MODE_REMOVE, + "REMOVE", + ICON_REMOVE, + "Remove", + "Remove curves whose root points are too close"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "BrushCurvesSculptSettings", NULL); RNA_def_struct_sdna(srna, "BrushCurvesSculptSettings"); RNA_def_struct_ui_text(srna, "Curves Sculpt Brush Settings", ""); @@ -1997,6 +2023,22 @@ static void rna_def_curves_sculpt_options(BlenderRNA *brna) prop, "Curve Length", "Length of newly added curves when it is not interpolated from other curves"); + + prop = RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 1000.0f, 0.001, 2); + RNA_def_property_ui_text( + prop, "Minimum Distance", "Goal distance between curve roots for the Density brush"); + + prop = RNA_def_property(srna, "density_add_attempts", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, INT32_MAX); + RNA_def_property_ui_text( + prop, "Density Add Attempts", "How many times the Density brush tries to add a new curve"); + + prop = RNA_def_property(srna, "density_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, density_mode_items); + RNA_def_property_ui_text( + prop, "Density Mode", "Determines whether the brush adds or removes curves"); } static void rna_def_brush(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 9628c6b2d65..99f8c263da6 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -519,6 +519,12 @@ static void rna_def_camera_dof_settings_data(BlenderRNA *brna) prop, "Focus Object", "Use this object to define the depth of field focal point"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update"); + prop = RNA_def_property(srna, "focus_subtarget", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "focus_subtarget"); + RNA_def_property_ui_text( + prop, "Focus Bone", "Use this armature bone to define the depth of field focal point"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update"); + prop = RNA_def_property(srna, "focus_distance", PROP_FLOAT, PROP_DISTANCE); // RNA_def_property_pointer_sdna(prop, NULL, "focus_distance"); RNA_def_property_range(prop, 0.0f, FLT_MAX); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 1420ef36493..986de0930ed 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -603,7 +603,7 @@ static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSE if (BKE_constraint_targets_get(con, &targets)) { for (ct = targets.first; ct; ct = ct->next) { - if (ct->tar && ct->tar->type == OB_ARMATURE) { + if (ct->tar && ct->tar->type == OB_ARMATURE && !(ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE)) { break; } } diff --git a/source/blender/makesrna/intern/rna_curves.c b/source/blender/makesrna/intern/rna_curves.c index bc3e5203ed0..cb8b36f41d2 100644 --- a/source/blender/makesrna/intern/rna_curves.c +++ b/source/blender/makesrna/intern/rna_curves.c @@ -64,7 +64,24 @@ static int rna_CurvePoint_index_get_const(const PointerRNA *ptr) { const Curves *curves = rna_curves(ptr); const float(*co)[3] = ptr->data; - return (int)(co - curves->geometry.position); + const float(*positions)[3] = (const float(*)[3])CustomData_get_layer_named( + &curves->geometry.point_data, CD_PROP_FLOAT3, "position"); + return (int)(co - positions); +} + +static int rna_Curves_position_data_length(PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + return curves->geometry.point_num; +} + +static void rna_Curves_position_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + const Curves *curves = rna_curves(ptr); + const float(*positions)[3] = (const float(*)[3])CustomData_get_layer_named( + &curves->geometry.point_data, CD_PROP_FLOAT3, "position"); + rna_iterator_array_begin( + iter, (void *)positions, sizeof(float[3]), curves->geometry.point_num, false, NULL); } static int rna_CurvePoint_index_get(PointerRNA *ptr) @@ -85,21 +102,23 @@ static void rna_CurvePoint_location_set(PointerRNA *ptr, const float value[3]) static float rna_CurvePoint_radius_get(PointerRNA *ptr) { const Curves *curves = rna_curves(ptr); - if (curves->geometry.radius == NULL) { + const float *radii = (const float *)CustomData_get_layer_named( + &curves->geometry.point_data, CD_PROP_FLOAT, "radius"); + if (radii == NULL) { return 0.0f; } - const float(*co)[3] = ptr->data; - return curves->geometry.radius[co - curves->geometry.position]; + return radii[rna_CurvePoint_index_get_const(ptr)]; } static void rna_CurvePoint_radius_set(PointerRNA *ptr, float value) { const Curves *curves = rna_curves(ptr); - if (curves->geometry.radius == NULL) { + float *radii = (float *)CustomData_get_layer_named( + &curves->geometry.point_data, CD_PROP_FLOAT, "radius"); + if (radii == NULL) { return; } - const float(*co)[3] = ptr->data; - curves->geometry.radius[co - curves->geometry.position] = value; + radii[rna_CurvePoint_index_get_const(ptr)] = value; } static char *rna_CurvePoint_path(const PointerRNA *ptr) @@ -123,16 +142,6 @@ static char *rna_CurveSlice_path(const PointerRNA *ptr) return BLI_sprintfN("curves[%d]", rna_CurveSlice_index_get_const(ptr)); } -static void rna_CurveSlice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - Curves *curves = rna_curves(ptr); - const int *offset_ptr = (int *)ptr->data; - const int offset = *offset_ptr; - const int size = *(offset_ptr + 1) - offset; - float(*co)[3] = curves->geometry.position + *offset_ptr; - rna_iterator_array_begin(iter, co, sizeof(float[3]), size, 0, NULL); -} - static int rna_CurveSlice_first_point_index_get(PointerRNA *ptr) { const int *offset_ptr = (int *)ptr->data; @@ -146,6 +155,17 @@ static int rna_CurveSlice_points_length_get(PointerRNA *ptr) return *(offset_ptr + 1) - offset; } +static void rna_CurveSlice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + Curves *curves = rna_curves(ptr); + const int offset = rna_CurveSlice_first_point_index_get(ptr); + const int size = rna_CurveSlice_points_length_get(ptr); + float(*positions)[3] = (float(*)[3])CustomData_get_layer_named( + &curves->geometry.point_data, CD_PROP_FLOAT3, "position"); + float(*co)[3] = positions + offset; + rna_iterator_array_begin(iter, co, sizeof(float[3]), size, 0, NULL); +} + static void rna_Curves_update_data(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene), PointerRNA *ptr) @@ -252,20 +272,32 @@ static void rna_def_curves(BlenderRNA *brna) RNA_def_property_struct_type(prop, "CurveSlice"); RNA_def_property_ui_text(prop, "Curves", "All curves in the data-block"); - /* TODO: better solution for (*co)[3] parsing issue. */ - - RNA_define_verify_sdna(0); prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "geometry.position", "geometry.point_num"); RNA_def_property_struct_type(prop, "CurvePoint"); + RNA_def_property_collection_funcs(prop, + "rna_Curves_position_data_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_Curves_position_data_length", + NULL, + NULL, + NULL); RNA_def_property_ui_text(prop, "Points", "Control points of all curves"); - RNA_define_verify_sdna(1); /* Direct access to built-in attributes. */ RNA_define_verify_sdna(0); prop = RNA_def_property(srna, "position_data", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "geometry.position", "geometry.point_num"); + RNA_def_property_collection_funcs(prop, + "rna_Curves_position_data_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_Curves_position_data_length", + NULL, + NULL, + NULL); RNA_def_property_struct_type(prop, "FloatVectorAttributeValue"); RNA_def_property_update(prop, 0, "rna_Curves_update_data"); RNA_define_verify_sdna(1); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index ac8aebd2fdd..727d329781d 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -612,7 +612,7 @@ static void rna_tag_animation_update(Main *bmain, ID *id) static void rna_FCurve_update_data_ex(ID *id, FCurve *fcu, Main *bmain) { sort_time_fcurve(fcu); - calchandles_fcurve(fcu); + BKE_fcurve_handles_recalc(fcu); rna_tag_animation_update(bmain, id); } @@ -752,7 +752,7 @@ static void rna_FModifier_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * FModifier *fcm = (FModifier *)ptr->data; if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) { - calchandles_fcurve(fcm->curve); + BKE_fcurve_handles_recalc(fcm->curve); } rna_tag_animation_update(bmain, id); @@ -1021,9 +1021,20 @@ static void rna_FKeyframe_points_remove( return; } - delete_fcurve_key(fcu, index, !do_fast); + BKE_fcurve_delete_key(fcu, index); RNA_POINTER_INVALIDATE(bezt_ptr); + if (!do_fast) { + BKE_fcurve_handles_recalc(fcu); + } + + rna_tag_animation_update(bmain, id); +} + +static void rna_FKeyframe_points_clear(ID *id, FCurve *fcu, Main *bmain) +{ + BKE_fcurve_delete_keys_all(fcu); + rna_tag_animation_update(bmain, id); } @@ -2306,6 +2317,10 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) /* optional */ RNA_def_boolean( func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time"); + + func = RNA_def_function(srna, "clear", "rna_FKeyframe_points_clear"); + RNA_def_function_ui_description(func, "Remove all keyframes from an F-Curve"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); } static void rna_def_fcurve(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 89bfb5684e2..0647bc62081 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -774,7 +774,7 @@ static bool dash_segment_name_exists_fn(void *arg, const char *name) { const DashGpencilModifierData *dmd = (const DashGpencilModifierData *)arg; for (int i = 0; i < dmd->segments_len; i++) { - if (STREQ(dmd->segments[i].name, name)) { + if (STREQ(dmd->segments[i].name, name) && dmd->segments[i].name != name) { return true; } } @@ -3268,7 +3268,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) "Crease Threshold", "Angles smaller than this will be treated as creases. Crease angle " "priority: object line art crease override > mesh auto smooth angle > " - "line art default crease."); + "line art default crease"); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE); @@ -3452,7 +3452,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_PROJECTED_SHADOW); RNA_def_property_ui_text( - prop, "Use Shadow", "Project contour lines using a light shource object"); + prop, "Use Shadow", "Project contour lines using a light source object"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "shadow_region_filtering", PROP_ENUM, PROP_NONE); @@ -3464,7 +3464,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) "affect cast shadow and light contour since they are at the border"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); - prop = RNA_def_property(srna, "shadow_enclosed_shapes", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_shadow_enclosed_shapes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_SHADOW_ENCLOSED_SHAPES); RNA_def_property_ui_text(prop, "Shadow Enclosed Shapes", diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 39f5b6e0e9f..7f134c5055f 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -475,18 +475,19 @@ static int rna_Image_frame_duration_get(PointerRNA *ptr) Image *ima = (Image *)ptr->owner_id; int duration = 1; + if (!BKE_image_has_anim(ima)) { + /* Ensure image has been loaded into memory and frame duration is known. */ + void *lock; + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + BKE_image_release_ibuf(ima, ibuf, lock); + } + if (BKE_image_has_anim(ima)) { struct anim *anim = ((ImageAnim *)ima->anims.first)->anim; if (anim) { duration = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN); } } - else { - /* acquire ensures ima->anim is set, if possible! */ - void *lock; - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); - BKE_image_release_ibuf(ima, ibuf, lock); - } return duration; } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 6ca8e668fa0..833060e40f8 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -504,9 +504,7 @@ void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop); -#ifdef WITH_NEW_CURVES_TYPE void RNA_def_main_hair_curves(BlenderRNA *brna, PropertyRNA *cprop); -#endif void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop); #ifdef WITH_SIMULATION_DATABLOCK diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 7200bcaa2a6..4aedb1fc611 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -96,9 +96,7 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(collections) RNA_MAIN_LISTBASE_FUNCS_DEF(curves) RNA_MAIN_LISTBASE_FUNCS_DEF(fonts) RNA_MAIN_LISTBASE_FUNCS_DEF(gpencils) -# ifdef WITH_NEW_CURVES_TYPE RNA_MAIN_LISTBASE_FUNCS_DEF(hair_curves) -# endif RNA_MAIN_LISTBASE_FUNCS_DEF(images) RNA_MAIN_LISTBASE_FUNCS_DEF(lattices) RNA_MAIN_LISTBASE_FUNCS_DEF(libraries) @@ -375,7 +373,6 @@ void RNA_def_main(BlenderRNA *brna) "Light Probes", "Light Probe data-blocks", RNA_def_main_lightprobes}, -# ifdef WITH_NEW_CURVES_TYPE /** * \note The name `hair_curves` is chosen to be different than `curves`, * but they are generic curve data-blocks, not just for hair. @@ -386,7 +383,6 @@ void RNA_def_main(BlenderRNA *brna) "Hair Curves", "Hair curve data-blocks", RNA_def_main_hair_curves}, -# endif {"pointclouds", "PointCloud", "rna_Main_pointclouds_begin", diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 6c621604e40..1f21fa3fab9 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -749,7 +749,6 @@ static bGPdata *rna_Main_gpencils_new(Main *bmain, const char *name) return gpd; } -# ifdef WITH_NEW_CURVES_TYPE static Curves *rna_Main_hair_curves_new(Main *bmain, const char *name) { char safe_name[MAX_ID_NAME - 2]; @@ -762,7 +761,6 @@ static Curves *rna_Main_hair_curves_new(Main *bmain, const char *name) return curves; } -# endif static PointCloud *rna_Main_pointclouds_new(Main *bmain, const char *name) { @@ -847,9 +845,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF) RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC) RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS) RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP) -# ifdef WITH_NEW_CURVES_TYPE RNA_MAIN_ID_TAG_FUNCS_DEF(hair_curves, hair_curves, ID_CV) -# endif RNA_MAIN_ID_TAG_FUNCS_DEF(pointclouds, pointclouds, ID_PT) RNA_MAIN_ID_TAG_FUNCS_DEF(volumes, volumes, ID_VO) # ifdef WITH_SIMULATION_DATABLOCK @@ -2255,7 +2251,6 @@ void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } -# ifdef WITH_NEW_CURVES_TYPE void RNA_def_main_hair_curves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -2299,7 +2294,6 @@ void RNA_def_main_hair_curves(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } -# endif void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop) { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 015b6d4055b..65468977ccb 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1723,6 +1723,56 @@ static void UNUSED_FUNCTION(rna_mesh_unused)(void) /* end unused function block */ } +static bool rna_Mesh_materials_override_apply(Main *bmain, + PointerRNA *ptr_dst, + PointerRNA *UNUSED(ptr_src), + PointerRNA *UNUSED(ptr_storage), + PropertyRNA *prop_dst, + PropertyRNA *UNUSED(prop_src), + PropertyRNA *UNUSED(prop_storage), + const int UNUSED(len_dst), + const int UNUSED(len_src), + const int UNUSED(len_storage), + PointerRNA *ptr_item_dst, + PointerRNA *ptr_item_src, + PointerRNA *UNUSED(ptr_item_storage), + IDOverrideLibraryPropertyOperation *opop) +{ + BLI_assert_msg(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE, + "Unsupported RNA override operation on collections' objects"); + UNUSED_VARS_NDEBUG(opop); + + Mesh *mesh_dst = (Mesh *)ptr_dst->owner_id; + + if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) { + // BLI_assert_msg(0, "invalid source or destination material."); + return false; + } + + Material *mat_dst = ptr_item_dst->data; + Material *mat_src = ptr_item_src->data; + + if (mat_src == mat_dst) { + return true; + } + + bool is_modified = false; + for (int i = 0; i < mesh_dst->totcol; i++) { + if (mesh_dst->mat[i] == mat_dst) { + id_us_min(&mat_dst->id); + mesh_dst->mat[i] = mat_src; + id_us_plus(&mat_src->id); + is_modified = true; + } + } + + if (is_modified) { + RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst); + } + + return true; +} + /** \} */ #else @@ -2478,6 +2528,8 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) RNA_def_property_struct_type(prop, "Material"); RNA_def_property_ui_text(prop, "Materials", ""); RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); + RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Mesh_materials_override_apply"); RNA_def_property_collection_funcs( prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); } diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index e6cf743e167..75188f29fac 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -81,18 +81,16 @@ static void rna_MetaBall_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), WM_main_add_notifier(NC_GEOM | ND_DATA, id); } -static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_MetaBall_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { MetaBall *mb = (MetaBall *)ptr->owner_id; - Object *ob; - /* cheating way for importers to avoid slow updates */ + /* NOTE: The check on the number of users allows to avoid many repetitive (slow) updates in some + * cases, like e.g. importers. Calling `BKE_mball_properties_copy` on an obdata with no users + * would be meaningless anyway, as by definition it would not be used by any object, so not part + * of any meta-ball group. */ if (mb->id.us > 0) { - for (ob = bmain->objects.first; ob; ob = ob->id.next) { - if (ob->data == mb) { - BKE_mball_properties_copy(scene, ob); - } - } + BKE_mball_properties_copy(bmain, mb); DEG_id_tag_update(&mb->id, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, mb); diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 978a94ca7b0..524e3134f9c 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -83,9 +83,6 @@ const EnumPropertyItem rna_enum_nla_mode_extend_items[] = { # include "DEG_depsgraph.h" # include "DEG_depsgraph_build.h" -/* temp constant defined for these funcs only... */ -# define NLASTRIP_MIN_LEN_THRESH 0.1f - static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value) { NlaStrip *data = (NlaStrip *)ptr->data; @@ -165,75 +162,181 @@ static void rna_NlaStrip_transform_update(Main *bmain, Scene *scene, PointerRNA static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value) { + /* Simply set the frame start in a valid range : if there are any NLA strips before/after, clamp + * the start value. If the new start value is past-the-end, clamp it. Otherwise, set it. + * + * NOTE: Unless neighboring strips are transitions, NLASTRIP_MIN_LEN_THRESH is not needed, as + * strips can be 'glued' to one another. If they are however, ensure transitions have a bit of + * time allotted in order to be performed. + */ NlaStrip *data = (NlaStrip *)ptr->data; - /* Clamp value to lie within valid limits: - * - Cannot start past the end of the strip + some flexibility threshold. - * - Cannot start before the previous strip (if present) ends. - * -> But if it was a transition, - * we could go up to the start of the strip + some flexibility threshold. - * as long as we re-adjust the transition afterwards. - * - Minimum frame is -MAXFRAME so that we don't get clipping on frame 0. - */ - if (data->prev) { - if (data->prev->type == NLASTRIP_TYPE_TRANSITION) { - CLAMP( - value, data->prev->start + NLASTRIP_MIN_LEN_THRESH, data->end - NLASTRIP_MIN_LEN_THRESH); + const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data); + const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data); + CLAMP(value, limit_prev, limit_next); - /* re-adjust the transition to stick to the endpoints of the action-clips */ - data->prev->end = value; - } - else { - CLAMP(value, data->prev->end, data->end - NLASTRIP_MIN_LEN_THRESH); + data->start = value; + + /* The ONLY case where we actively modify the value set by the user, is in case the start value + * value is past the old end frame (here delta = NLASTRIP_MIN_LEN_THRESH) : + * - if there's no "room" for the end frame to be placed at (new_start + delta), move old_end to + * the limit, and new_start to (limit - delta) + * - otherwise, do _not_ change the end frame. This property is not accessible from the UI, and + * can only be set via scripts. The script should be responsible of setting the end frame. + */ + if (data->start > (data->end - NLASTRIP_MIN_LEN_THRESH)) { + /* If past-the-allowed-end : */ + if ((data->start + NLASTRIP_MIN_LEN_THRESH) > limit_next) { + data->end = limit_next; + data->start = data->end - NLASTRIP_MIN_LEN_THRESH; } } - else { - CLAMP(value, MINAFRAME, data->end); + + /* Ensure transitions are kept 'glued' to the strip : */ + if (data->prev && data->prev->type == NLASTRIP_TYPE_TRANSITION) { + data->prev->end = data->start; } +} + +static void rna_NlaStrip_frame_start_ui_set(PointerRNA *ptr, float value) +{ + NlaStrip *data = (NlaStrip *)ptr->data; + + /* Changing the NLA strip's start frame is exactly the same as translating it in the NLA editor. + * When 'translating' the clip, the length of it should stay identical. Se we also need to set + * this strip's end frame after modifying its start (to `start + (old_end - old_start)`). + * Of course, we might have a few other strips on this NLA track, so we have to respect the + * previous strip's end frame. + * + * Also, different types of NLA strips (*_CLIP, *_TRANSITION, *_META, *_SOUND) have their own + * properties to respect. Needs testing on a real-world use case for the transition, meta, and + * sound types. + */ + + /* The strip's total length before modifying it & also how long we'd like it to be afterwards. */ + const float striplen = data->end - data->start; + + /* We're only modifying one strip at a time. The start and end times of its neighbors should not + * change. As such, here are the 'bookends' (frame limits) for the start position to respect : + * - if a next strip exists, don't allow the strip to start after (next->end - striplen - delta), + * (delta being the min length of a Nla Strip : the NLASTRIP_MIN_THRESH macro) + * - if a previous strip exists, don't allow this strip to start before it (data->prev) ends + * - otherwise, limit to the program limit macros defined in DNA_scene_types.h : {MINA|MAX}FRAMEF + */ + const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data); + const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data) - striplen; + /* For above : we want to be able to fit the entire strip before the next frame limit, so shift + * the next limit by 'striplen' no matter the context. */ + + CLAMP(value, limit_prev, limit_next); data->start = value; + + if (data->type != NLASTRIP_TYPE_TRANSITION) { + data->end = data->start + striplen; + } + + /* Update properties of the prev/next strips if they are transitions to ensure consistency : */ + if (data->prev && data->prev->type == NLASTRIP_TYPE_TRANSITION) { + data->prev->end = data->start; + } + if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) { + data->next->start = data->end; + } } static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value) { NlaStrip *data = (NlaStrip *)ptr->data; + const float limit_prev = BKE_nlastrip_compute_frame_from_previous_strip(data); + const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data); + CLAMP(value, limit_prev, limit_next); + + data->end = value; + + /* The ONLY case where we actively modify the value set by the user, is in case the start value + * value is past the old end frame (here delta = NLASTRIP_MIN_LEN_THRESH): + * - if there's no "room" for the end frame to be placed at (new_start + delta), move old_end to + * the limit, and new_start to (limit - delta) + * - otherwise, do _not_ change the end frame. This property is not accessible from the UI, and + * can only be set via scripts. The script should be responsible for setting the end frame. + */ + if (data->end < (data->start + NLASTRIP_MIN_LEN_THRESH)) { + /* If before-the-allowed-start : */ + if ((data->end - NLASTRIP_MIN_LEN_THRESH) < limit_prev) { + data->start = limit_prev; + data->end = data->start + NLASTRIP_MIN_LEN_THRESH; + } + } + + /* Ensure transitions are kept "glued" to the strip: */ + if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) { + data->next->start = data->end; + } +} + +static void rna_NlaStrip_frame_end_ui_set(PointerRNA *ptr, float value) +{ + NlaStrip *data = (NlaStrip *)ptr->data; + + /* Changing the strip's end frame will update its action 'range' (defined by actstart->actend) to + * accommodate the extra length of the strip. No other parameters of the strip will change. But + * this means we have to get the current strip's end frame right now : + */ + const float old_strip_end = data->end; + /* clamp value to lie within valid limits * - must not have zero or negative length strip, so cannot start before the first frame * + some minimum-strip-length threshold * - cannot end later than the start of the next strip (if present) - * -> but if it was a transition, - * we could go up to the start of the end - some flexibility threshold - * as long as we re-adjust the transition afterwards + * -> relies on the BKE_nlastrip_compute_frame_to_next_strip() function */ - if (data->next) { - if (data->next->type == NLASTRIP_TYPE_TRANSITION) { - CLAMP( - value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->end - NLASTRIP_MIN_LEN_THRESH); + const float limit_prev = data->start + NLASTRIP_MIN_LEN_THRESH; + const float limit_next = BKE_nlastrip_compute_frame_to_next_strip(data); - /* readjust the transition to stick to the endpoints of the action-clips */ - data->next->start = value; - } - else { - CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->start); - } - } - else { - CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, MAXFRAME); - } + CLAMP(value, limit_prev, limit_next); data->end = value; - /* calculate the lengths the strip and its action (if applicable) */ - if (data->type == NLASTRIP_TYPE_CLIP) { - float len, actlen; + /* Only adjust transitions at this stage : */ + if (data->next && data->next->type == NLASTRIP_TYPE_TRANSITION) { + data->next->start = value; + } - len = data->end - data->start; - actlen = data->actend - data->actstart; + /* calculate the lengths the strip and its action : * + * (Meta and transitions shouldn't be updated, but clip and sound should) */ + if (data->type == NLASTRIP_TYPE_CLIP || data->type == NLASTRIP_TYPE_SOUND) { + float actlen = data->actend - data->actstart; if (IS_EQF(actlen, 0.0f)) { - actlen = 1.0f; + actlen = 1.0f; /* Only sanity check needed : we use this as divisor later on. */ } - /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */ - data->scale = len / ((actlen)*data->repeat); + /* Modify the strip's action end frame, or repeat based on : + * - if data->repeat == 1.0f, modify the action end frame : + * - if the number of frames to subtract is the number of frames, set the action end frame + * to the action start + 1 and modify the end of the strip to add that frame + * - if the number of frames + * - otherwise, modify the repeat property to accommodate for the new length + */ + float action_length_delta = (old_strip_end - data->end) / data->scale; + /* If no repeats are used, then modify the action end frame : */ + if (IS_EQF(data->repeat, 1.0f)) { + /* If they're equal, strip has been reduced by the same amount as the whole strip length, so + * clamp the action clip length to 1 frame, and add a frame to end so that len(strip)!=0 :*/ + if (IS_EQF(action_length_delta, actlen)) { + data->actend = data->actstart + 1.0f; + data->end += 1.0f; + } + else if (action_length_delta < actlen) { + /* Now, adjust the new strip's actend to the value it's supposed to have : */ + data->actend = data->actend - action_length_delta; + } + /* The case where the delta is bigger than the action length should not be possible, since + * data->end is guaranteed to be clamped to data->start + threshold above. + */ + } + else { + data->repeat -= (action_length_delta / actlen); + } } } @@ -640,6 +743,31 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_update( prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update"); + /* Strip extents, when called from UI elements : */ + prop = RNA_def_property(srna, "frame_start_ui", PROP_FLOAT, PROP_TIME); + RNA_def_property_float_sdna(prop, NULL, "start"); + RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_frame_start_ui_set", NULL); + RNA_def_property_ui_text( + prop, + "Start Frame (manipulated from UI)", + "Start frame of the NLA strip. Note: changing this value also updates the value of " + "the strip's end frame. If only the start frame should be changed, see the \"frame_start\" " + "property instead"); + RNA_def_property_update( + prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update"); + + prop = RNA_def_property(srna, "frame_end_ui", PROP_FLOAT, PROP_TIME); + RNA_def_property_float_sdna(prop, NULL, "end"); + RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_frame_end_ui_set", NULL); + RNA_def_property_ui_text( + prop, + "End Frame (manipulated from UI)", + "End frame of the NLA strip. Note: changing this value also updates the value of " + "the strip's repeats or its action's end frame. If only the end frame should be " + "changed, see the \"frame_end\" property instead"); + RNA_def_property_update( + prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update"); + /* Blending */ prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "blendin"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 50e69bfac53..c274813ff1d 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -5305,7 +5305,6 @@ static void def_sh_tex_sky(StructRNA *srna) prop = RNA_def_property(srna, "sun_elevation", PROP_FLOAT, PROP_ANGLE); RNA_def_property_ui_text(prop, "Sun Elevation", "Sun angle from horizon"); - RNA_def_property_range(prop, -M_PI_2, M_PI_2); RNA_def_property_float_default(prop, M_PI_2); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 99315a580cf..103c77fa808 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -607,11 +607,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr) case OB_GPENCIL: return &RNA_GreasePencil; case OB_CURVES: -# ifdef WITH_NEW_CURVES_TYPE return &RNA_Curves; -# else - return &RNA_ID; -# endif case OB_POINTCLOUD: return &RNA_PointCloud; case OB_VOLUME: @@ -3579,6 +3575,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + prop = RNA_def_property(srna, "add_rest_position_attribute", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "modifier_flag", OB_MODIFIER_FLAG_ADD_REST_POSITION); + RNA_def_property_ui_text(prop, + "Add Rest Position", + "Add a \"rest_position\" attribute that is a copy of the position " + "attribute before shape keys and modifiers are evaluated"); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update_data"); + /* render */ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "index"); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index a67b0f7c8e6..3fc98d769b6 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -25,6 +25,7 @@ #include "RNA_enum_types.h" #include "BKE_mesh.h" +#include "BKE_mesh_legacy_convert.h" #include "BLI_listbase.h" diff --git a/source/blender/makesrna/intern/rna_pointcloud.c b/source/blender/makesrna/intern/rna_pointcloud.c index 4c5dcd5a587..df09bff1aea 100644 --- a/source/blender/makesrna/intern/rna_pointcloud.c +++ b/source/blender/makesrna/intern/rna_pointcloud.c @@ -20,6 +20,7 @@ # include "BLI_math_vector.h" +# include "BKE_customdata.h" # include "BKE_pointcloud.h" # include "DEG_depsgraph.h" @@ -36,7 +37,9 @@ static int rna_Point_index_get_const(const PointerRNA *ptr) { const PointCloud *pointcloud = rna_pointcloud(ptr); const float(*co)[3] = ptr->data; - return (int)(co - pointcloud->co); + const float(*positions)[3] = (const float(*)[3])CustomData_get_layer_named( + &pointcloud->pdata, CD_PROP_FLOAT3, "position"); + return (int)(co - positions); } static int rna_Point_index_get(PointerRNA *ptr) @@ -44,6 +47,21 @@ static int rna_Point_index_get(PointerRNA *ptr) return rna_Point_index_get_const(ptr); } +static int rna_PointCloud_points_length(PointerRNA *ptr) +{ + const PointCloud *pointcloud = rna_pointcloud(ptr); + return pointcloud->totpoint; +} + +static void rna_PointCloud_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + const PointCloud *pointcloud = rna_pointcloud(ptr); + const float(*positions)[3] = (const float(*)[3])CustomData_get_layer_named( + &pointcloud->pdata, CD_PROP_FLOAT3, "position"); + rna_iterator_array_begin( + iter, (void *)positions, sizeof(float[3]), pointcloud->totpoint, false, NULL); +} + static void rna_Point_location_get(PointerRNA *ptr, float value[3]) { copy_v3_v3(value, (const float *)ptr->data); @@ -57,21 +75,22 @@ static void rna_Point_location_set(PointerRNA *ptr, const float value[3]) static float rna_Point_radius_get(PointerRNA *ptr) { const PointCloud *pointcloud = rna_pointcloud(ptr); - if (pointcloud->radius == NULL) { + const float *radii = (const float *)CustomData_get_layer_named( + &pointcloud->pdata, CD_PROP_FLOAT, "radius"); + if (radii == NULL) { return 0.0f; } - const float(*co)[3] = ptr->data; - return pointcloud->radius[co - pointcloud->co]; + return radii[rna_Point_index_get_const(ptr)]; } static void rna_Point_radius_set(PointerRNA *ptr, float value) { - const PointCloud *pointcloud = rna_pointcloud(ptr); - if (pointcloud->radius == NULL) { + PointCloud *pointcloud = rna_pointcloud(ptr); + float *radii = (float *)CustomData_get_layer_named(&pointcloud->pdata, CD_PROP_FLOAT, "radius"); + if (radii == NULL) { return; } - const float(*co)[3] = ptr->data; - pointcloud->radius[co - pointcloud->co] = value; + radii[rna_Point_index_get_const(ptr)] = value; } static char *rna_Point_path(const PointerRNA *ptr) @@ -130,13 +149,18 @@ static void rna_def_pointcloud(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_POINTCLOUD_DATA); /* geometry */ - /* TODO: better solution for (*co)[3] parsing issue. */ - RNA_define_verify_sdna(0); prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "co", "totpoint"); RNA_def_property_struct_type(prop, "Point"); + RNA_def_property_collection_funcs(prop, + "rna_PointCloud_points_begin", + "rna_iterator_array_next", + "rna_iterator_array_end", + "rna_iterator_array_get", + "rna_PointCloud_points_length", + NULL, + NULL, + NULL); RNA_def_property_ui_text(prop, "Points", ""); - RNA_define_verify_sdna(1); /* materials */ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index cc7df54e648..f24aec3447b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -151,7 +151,16 @@ const EnumPropertyItem rna_enum_snap_element_items[] = { "Snap to increments of grid"}, {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"}, - {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"}, + {SCE_SNAP_MODE_FACE_RAYCAST, + "FACE", /* TODO(@gfxcoder): replace with "FACE_RAYCAST" as "FACE" is not descriptive. */ + ICON_SNAP_FACE, + "Face Project", + "Snap by projecting onto faces"}, + {SCE_SNAP_MODE_FACE_NEAREST, + "FACE_NEAREST", + ICON_SNAP_FACE_NEAREST, + "Face Nearest", + "Snap to nearest point on faces"}, {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"}, {SCE_SNAP_MODE_EDGE_MIDPOINT, "EDGE_MIDPOINT", @@ -2492,7 +2501,7 @@ static void rna_ViewLayerLightgroup_name_set(PointerRNA *ptr, const char *value) Scene *scene = (Scene *)ptr->owner_id; ViewLayer *view_layer = BKE_view_layer_find_with_lightgroup(scene, lightgroup); - BKE_view_layer_rename_lightgroup(view_layer, lightgroup, value); + BKE_view_layer_rename_lightgroup(scene, view_layer, lightgroup, value); } /* Fake value, used internally (not saved to DNA). */ @@ -3301,6 +3310,21 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + prop = RNA_def_property(srna, "snap_face_nearest_steps", PROP_INT, PROP_FACTOR); + RNA_def_property_int_sdna(prop, NULL, "snap_face_nearest_steps"); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_text( + prop, + "Face Nearest Steps", + "Number of steps to break transformation into for face nearest snapping"); + + prop = RNA_def_property(srna, "use_snap_to_same_target", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_KEEP_ON_SAME_OBJECT); + RNA_def_property_ui_text( + prop, + "Snap to Same Target", + "Snap only to target that source was initially near (Face Nearest Only)"); + /* node editor uses own set of snap modes */ prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode"); @@ -3323,9 +3347,9 @@ static void rna_def_tool_settings(BlenderRNA *brna) "Absolute grid alignment while translating (based on the pivot center)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ - /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid - * previous ambiguity of "target" (now, "source" is geometry to be moved and "target" is - * geometry to which moved geometry is snapped). */ + /* TODO(@gfxcoder): Rename `snap_target` to `snap_source` to avoid previous ambiguity of "target" + * (now, "source" is geometry to be moved and "target" is geometry to which moved geometry is + * snapped). */ prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "snap_target"); RNA_def_property_enum_items(prop, rna_enum_snap_source_items); @@ -3350,9 +3374,30 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Backface Culling", "Exclude back facing geometry from snapping"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + /* TODO(@gfxcoder): Rename `use_snap_self` to `use_snap_active`, because active is correct but + * self is not (breaks API). This only makes a difference when more than one mesh is edited. */ prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF); - RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)"); + RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NOT_TO_ACTIVE); + RNA_def_property_ui_text( + prop, "Snap onto Active", "Snap onto itself only if enabled (Edit Mode Only)"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "use_snap_edit", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_TO_INCLUDE_EDITED); + RNA_def_property_ui_text( + prop, "Snap onto Edited", "Snap onto non-active objects in Edit Mode (Edit Mode Only)"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "use_snap_nonedit", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_TO_INCLUDE_NONEDITED); + RNA_def_property_ui_text( + prop, "Snap onto Non-edited", "Snap onto objects not in Edit Mode (Edit Mode Only)"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + prop = RNA_def_property(srna, "use_snap_selectable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_TO_ONLY_SELECTABLE); + RNA_def_property_ui_text( + prop, "Snap onto Selectable Only", "Snap only onto objects that are selectable"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 3de9e632ff6..2e1fa8db7fe 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -1303,6 +1303,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED); RNA_def_property_ui_text( prop, "Interpolate", "Interpolate new particles from the existing ones"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "totaddkey"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index f9dfb8544ca..3bcd9cd0441 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1754,12 +1754,12 @@ static void rna_def_color_balance(BlenderRNA *brna) prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN); - RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color`"); + RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update"); prop = RNA_def_property(srna, "invert_slope", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_SLOPE); - RNA_def_property_ui_text(prop, "Inverse Slope", "Invert the slope color`"); + RNA_def_property_ui_text(prop, "Inverse Slope", "Invert the slope color"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update"); prop = RNA_def_property(srna, "invert_offset", PROP_BOOLEAN, PROP_NONE); @@ -2331,7 +2331,6 @@ static void rna_def_speed_factor(StructRNA *srna) RNA_def_property_float_default(prop, 1.0f); RNA_def_property_range(prop, 0.1f, FLT_MAX); RNA_def_property_ui_range(prop, 1.0f, 100.0f, 10.0, 3); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Speed Factor", "Multiply playback speed"); RNA_def_property_float_funcs( prop, NULL, "rna_Sequence_speed_factor_set", NULL); /* overlap test */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 745c7137cb2..e67d840eeac 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -5298,6 +5298,7 @@ static void rna_def_space_image_overlay(BlenderRNA *brna) prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SI_OVERLAY_SHOW_OVERLAYS); RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like UV Maps and Metadata"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "show_grid_background", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SI_OVERLAY_SHOW_GRID_BACKGROUND); @@ -6584,7 +6585,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) static const EnumPropertyItem display_size_items[] = { {64, "TINY", 0, "Tiny", ""}, {96, "SMALL", 0, "Small", ""}, - {128, "NORMAL", 0, "Regular", ""}, + {128, "NORMAL", 0, "Medium", ""}, {192, "LARGE", 0, "Large", ""}, {0, NULL, 0, NULL, NULL}, }; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 40dc1254a7d..cfc72791123 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -38,23 +38,6 @@ #include "BLT_lang.h" -#ifdef WITH_OPENSUBDIV -static const EnumPropertyItem opensubdiv_compute_type_items[] = { - {USER_OPENSUBDIV_COMPUTE_NONE, "NONE", 0, "None", ""}, - {USER_OPENSUBDIV_COMPUTE_CPU, "CPU", 0, "CPU", ""}, - {USER_OPENSUBDIV_COMPUTE_OPENMP, "OPENMP", 0, "OpenMP", ""}, - {USER_OPENSUBDIV_COMPUTE_OPENCL, "OPENCL", 0, "OpenCL", ""}, - {USER_OPENSUBDIV_COMPUTE_CUDA, "CUDA", 0, "CUDA", ""}, - {USER_OPENSUBDIV_COMPUTE_GLSL_TRANSFORM_FEEDBACK, - "GLSL_TRANSFORM_FEEDBACK", - 0, - "GLSL Transform Feedback", - ""}, - {USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE, "GLSL_COMPUTE", 0, "GLSL Compute", ""}, - {0, NULL, 0, NULL, NULL}, -}; -#endif - const EnumPropertyItem rna_enum_preference_section_items[] = { {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""}, {USER_SECTION_THEME, "THEMES", 0, "Themes", ""}, @@ -189,10 +172,6 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = { # include "UI_interface.h" -# ifdef WITH_OPENSUBDIV -# include "opensubdiv_capi.h" -# endif - # ifdef WITH_SDL_DYNLOAD # include "sdlew.h" # endif @@ -728,55 +707,6 @@ static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceListGeneric, ptr->data); } -# ifdef WITH_OPENSUBDIV -static const EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C), - PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), - bool *r_free) -{ - EnumPropertyItem *item = NULL; - int totitem = 0; - int evaluators = openSubdiv_getAvailableEvaluators(); - - RNA_enum_items_add_value( - &item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_NONE); - -# define APPEND_COMPUTE(compute) \ - if (evaluators & OPENSUBDIV_EVALUATOR_##compute) { \ - RNA_enum_items_add_value( \ - &item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_##compute); \ - } \ - ((void)0) - - APPEND_COMPUTE(CPU); - APPEND_COMPUTE(OPENMP); - APPEND_COMPUTE(OPENCL); - APPEND_COMPUTE(CUDA); - APPEND_COMPUTE(GLSL_TRANSFORM_FEEDBACK); - APPEND_COMPUTE(GLSL_COMPUTE); - -# undef APPEND_COMPUTE - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static void rna_userdef_opensubdiv_update(Main *bmain, - Scene *UNUSED(scene), - PointerRNA *UNUSED(ptr)) -{ - Object *object; - - for (object = bmain->objects.first; object; object = object->id.next) { - DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM); - } - USERDEF_TAG_DIRTY; -} - -# endif - static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -1101,16 +1031,6 @@ int rna_show_statusbar_vram_editable(struct PointerRNA *UNUSED(ptr), const char return GPU_mem_stats_supported() ? PROP_EDITABLE : 0; } -static int rna_userdef_experimental_use_new_curve_tools_editable(struct PointerRNA *UNUSED(ptr), - const char **r_info) -{ - if (U.experimental.use_new_curves_type) { - return PROP_EDITABLE; - } - *r_info = "Only available when new curves type is enabled"; - return 0; -} - #else # define USERDEF_TAG_DIRTY_PROPERTY_UPDATE_ENABLE \ @@ -5709,17 +5629,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); -# ifdef WITH_OPENSUBDIV - prop = RNA_def_property(srna, "opensubdiv_compute_type", PROP_ENUM, PROP_NONE); - RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); - RNA_def_property_enum_sdna(prop, NULL, "opensubdiv_compute_type"); - RNA_def_property_enum_items(prop, opensubdiv_compute_type_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_opensubdiv_compute_type_itemf"); - RNA_def_property_ui_text( - prop, "OpenSubdiv Compute Type", "Type of computer back-end used with OpenSubdiv"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_userdef_opensubdiv_update"); -# endif - # ifdef WITH_CYCLES prop = RNA_def_property(srna, "legacy_compute_device_type", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "compute_device_type"); @@ -6392,6 +6301,15 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "Enable library overrides automatic resync detection and process on file load. Disable when " "dealing with older .blend files that need manual Resync (Enforce) handling"); + prop = RNA_def_property(srna, "use_override_new_fully_editable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_override_new_fully_editable", 1); + RNA_def_property_ui_text( + prop, + "Override New Fully Editable", + "Make all override of a hierarchy fully user-editable by default when creating a new " + "override (if that option is disabled, most overrides created as part of a hierarchy will " + "not be editable by the user by default)"); + prop = RNA_def_property(srna, "use_new_point_cloud_type", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_new_point_cloud_type", 1); RNA_def_property_ui_text( @@ -6405,13 +6323,8 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "reduces execution time and memory usage)"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "use_new_curves_type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "use_new_curves_type", 1); - RNA_def_property_ui_text(prop, "New Curves Type", "Enable the new curves data type in the UI"); - prop = RNA_def_property(srna, "use_new_curves_tools", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_new_curves_tools", 1); - RNA_def_property_editable_func(prop, "rna_userdef_experimental_use_new_curve_tools_editable"); RNA_def_property_ui_text( prop, "New Curves Tools", "Enable additional features for the new curves data block"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7893a2f4bc0..2009f51e1f2 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -607,14 +607,14 @@ static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr) static void rna_Event_ascii_get(PointerRNA *ptr, char *value) { const wmEvent *event = ptr->data; - value[0] = event->ascii; + value[0] = WM_event_utf8_to_ascii(event); value[1] = '\0'; } static int rna_Event_ascii_length(PointerRNA *ptr) { const wmEvent *event = ptr->data; - return (event->ascii) ? 1 : 0; + return WM_event_utf8_to_ascii(event) ? 1 : 0; } static void rna_Event_unicode_get(PointerRNA *ptr, char *value) diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index b9f36d35ee8..b82458c4442 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -625,7 +625,7 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win, return NULL; } } - if (ELEM(type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { + if (ISMOUSE_MOTION(type)) { if (value != KM_NOTHING) { BKE_report(reports, RPT_ERROR, "Value: must be 'NOTHING' for motion"); return NULL; @@ -639,16 +639,12 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win, } /* TODO: validate NDOF. */ - char ascii = 0; if (unicode != NULL) { int len = BLI_str_utf8_size(unicode); if (len == -1 || unicode[len] != '\0') { BKE_report(reports, RPT_ERROR, "Only a single character supported"); return NULL; } - if (len == 1 && isascii(unicode[0])) { - ascii = unicode[0]; - } } wmEvent e = *win->eventstate; @@ -672,10 +668,8 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win, e.modifier |= KM_OSKEY; } - e.ascii = '\0'; e.utf8_buf[0] = '\0'; if (unicode != NULL) { - e.ascii = ascii; STRNCPY(e.utf8_buf, unicode); } diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index 6c3d96726bb..0e307f5b424 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -1398,6 +1398,11 @@ static void rna_def_gizmogroup(BlenderRNA *brna) 0, "Tool Init", "Postpone running until tool operator run (when used with a tool)"}, + {WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP, + "TOOL_FALLBACK_KEYMAP", + 0, + "Use fallback tools keymap", + "Add fallback tools keymap to this gizmo type."}, {WM_GIZMOGROUPTYPE_VR_REDRAWS, "VR_REDRAWS", 0, diff --git a/source/blender/makesrna/intern/rna_wm_gizmo_api.c b/source/blender/makesrna/intern/rna_wm_gizmo_api.c index 419dfa68305..760121d2279 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo_api.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo_api.c @@ -211,7 +211,15 @@ void RNA_api_gizmo(StructRNA *srna) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); - RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); + RNA_def_int(func, + "select_id", + -1, + -1, + INT_MAX, + "ID to use when gizmo is selectable. Use -1 when not selecting", + "", + -1, + INT_MAX); /* draw_preset_box */ func = RNA_def_function(srna, "draw_preset_arrow", "rna_gizmo_draw_preset_arrow"); @@ -221,7 +229,15 @@ void RNA_api_gizmo(StructRNA *srna) RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation"); - RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); + RNA_def_int(func, + "select_id", + -1, + -1, + INT_MAX, + "ID to use when gizmo is selectable. Use -1 when not selecting", + "", + -1, + INT_MAX); func = RNA_def_function(srna, "draw_preset_circle", "rna_gizmo_draw_preset_circle"); RNA_def_function_ui_description(func, "Draw a box"); @@ -230,7 +246,15 @@ void RNA_api_gizmo(StructRNA *srna) RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation"); - RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); + RNA_def_int(func, + "select_id", + -1, + -1, + INT_MAX, + "ID to use when gizmo is selectable. Use -1 when not selecting", + "", + -1, + INT_MAX); /* -------------------------------------------------------------------- */ /* Other Shapes */ @@ -243,7 +267,15 @@ void RNA_api_gizmo(StructRNA *srna) RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_int(func, "face_map", 0, 0, INT_MAX, "Face map index", "", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); + RNA_def_int(func, + "select_id", + -1, + -1, + INT_MAX, + "ID to use when gizmo is selectable. Use -1 when not selecting", + "", + -1, + INT_MAX); /* -------------------------------------------------------------------- */ /* Property API */ diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 0b6c3934985..a0d89b8b15a 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -413,6 +413,14 @@ static void rna_def_workspace(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Object Mode", "Switch to this object mode when activating the workspace"); + prop = RNA_def_property(srna, "use_pin_scene", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_PIN_SCENE); + RNA_def_property_ui_text(prop, + "Pin Scene", + "Remember the last used scene for the workspace and switch to it " + "whenever this workspace is activated again"); + RNA_def_property_update(prop, NC_WORKSPACE, NULL); + /* Flags */ prop = RNA_def_property(srna, "use_filter_by_owner", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); |