diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 5 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_merge.c | 142 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 20 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 15 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 58 |
17 files changed, 189 insertions, 165 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8c725dc8b9c..84f8f17d4ee 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6133,8 +6133,9 @@ static const EnumPropertyItem curve_delete_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static const EnumPropertyItem *rna_curve_delete_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_curve_delete_type_itemf( + bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index 02f71b19398..3641308ae17 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -208,9 +208,9 @@ static void gpencil_dissolve_points(bContext *C) * All the data is saved to be sorted and used later. */ static void gpencil_calc_points_factor( - bContext *C, const int mode, int totpoints, - const bool clear_point, const bool clear_stroke, - tGPencilPointCache *src_array) + bContext *C, const int mode, int totpoints, + const bool clear_point, const bool clear_stroke, + tGPencilPointCache *src_array) { bGPDspoint *pt; int i; @@ -367,77 +367,77 @@ static void gpencil_get_extremes( } static int gpencil_analyze_strokes( - tGPencilPointCache *src_array, int totstrokes, int totpoints, - tGPencilPointCache *dst_array) + tGPencilPointCache *src_array, int totstrokes, int totpoints, + tGPencilPointCache *dst_array) { - int i; - int last = 0; - GHash *all_strokes = BLI_ghash_ptr_new(__func__); - /* add first stroke to array */ - tGPencilPointCache *sort_pt = &src_array[0]; - bGPDstroke *gps = sort_pt->gps; - last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps, false, last); - float start[3]; - float end[3]; - float end_prv[3]; - gpencil_get_extremes(src_array, totpoints, gps, start, end); - copy_v3_v3(end_prv, end); - BLI_ghash_insert(all_strokes, sort_pt->gps, sort_pt->gps); - - /* look for near stroke */ - bool loop = (bool)(totstrokes > 1); - while (loop) { - bGPDstroke *gps_next = NULL; - GHash *strokes = BLI_ghash_ptr_new(__func__); - float dist_start = 0.0f; - float dist_end = 0.0f; - float dist = FLT_MAX; - bool reverse = false; - - for (i = 0; i < totpoints; i++) { - sort_pt = &src_array[i]; - /* avoid dups */ - if (BLI_ghash_haskey(all_strokes, sort_pt->gps)) { - continue; + int i; + int last = 0; + GHash *all_strokes = BLI_ghash_ptr_new(__func__); + /* add first stroke to array */ + tGPencilPointCache *sort_pt = &src_array[0]; + bGPDstroke *gps = sort_pt->gps; + last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps, false, last); + float start[3]; + float end[3]; + float end_prv[3]; + gpencil_get_extremes(src_array, totpoints, gps, start, end); + copy_v3_v3(end_prv, end); + BLI_ghash_insert(all_strokes, sort_pt->gps, sort_pt->gps); + + /* look for near stroke */ + bool loop = (bool)(totstrokes > 1); + while (loop) { + bGPDstroke *gps_next = NULL; + GHash *strokes = BLI_ghash_ptr_new(__func__); + float dist_start = 0.0f; + float dist_end = 0.0f; + float dist = FLT_MAX; + bool reverse = false; + + for (i = 0; i < totpoints; i++) { + sort_pt = &src_array[i]; + /* avoid dups */ + if (BLI_ghash_haskey(all_strokes, sort_pt->gps)) { + continue; + } + if (!BLI_ghash_haskey(strokes, sort_pt->gps)) { + gpencil_get_extremes(src_array, totpoints, sort_pt->gps, start, end); + /* distances to previous end */ + dist_start = len_v3v3(end_prv, start); + dist_end = len_v3v3(end_prv, end); + + if (dist > dist_start) { + gps_next = sort_pt->gps; + dist = dist_start; + reverse = false; } - if (!BLI_ghash_haskey(strokes, sort_pt->gps)) { - gpencil_get_extremes(src_array, totpoints, sort_pt->gps, start, end); - /* distances to previous end */ - dist_start = len_v3v3(end_prv, start); - dist_end = len_v3v3(end_prv, end); - - if (dist > dist_start) { - gps_next = sort_pt->gps; - dist = dist_start; - reverse = false; - } - if (dist > dist_end) { - gps_next = sort_pt->gps; - dist = dist_end; - reverse = true; - } - BLI_ghash_insert(strokes, sort_pt->gps, sort_pt->gps); + if (dist > dist_end) { + gps_next = sort_pt->gps; + dist = dist_end; + reverse = true; } + BLI_ghash_insert(strokes, sort_pt->gps, sort_pt->gps); } - BLI_ghash_free(strokes, NULL, NULL); - - /* add the stroke to array */ - if (gps->next != NULL) { - BLI_ghash_insert(all_strokes, gps_next, gps_next); - last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps_next, reverse, last); - /* replace last end */ - sort_pt = &dst_array[last - 1]; - copy_v3_v3(end_prv, &sort_pt->x); - } + } + BLI_ghash_free(strokes, NULL, NULL); + + /* add the stroke to array */ + if (gps->next != NULL) { + BLI_ghash_insert(all_strokes, gps_next, gps_next); + last = gpencil_insert_to_array(src_array, dst_array, totpoints, gps_next, reverse, last); + /* replace last end */ + sort_pt = &dst_array[last - 1]; + copy_v3_v3(end_prv, &sort_pt->x); + } - /* loop exit */ - if (last >= totpoints) { - loop = false; - } + /* loop exit */ + if (last >= totpoints) { + loop = false; } + } - BLI_ghash_free(all_strokes, NULL, NULL); - return last; + BLI_ghash_free(all_strokes, NULL, NULL); + return last; } static bool gp_strokes_merge_poll(bContext *C) @@ -458,7 +458,7 @@ static bool gp_strokes_merge_poll(bContext *C) /* check hidden or locked materials */ MaterialGPencilStyle *gp_style = ma->gp_style; if ((gp_style->flag & GP_STYLE_COLOR_HIDE) || - (gp_style->flag & GP_STYLE_COLOR_LOCKED)) + (gp_style->flag & GP_STYLE_COLOR_LOCKED)) { return false; } @@ -466,8 +466,8 @@ static bool gp_strokes_merge_poll(bContext *C) /* check layer */ bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); if ((gpl == NULL) || - (gpl->flag & GP_LAYER_LOCKED) || - (gpl->flag & GP_LAYER_HIDE)) + (gpl->flag & GP_LAYER_LOCKED) || + (gpl->flag & GP_LAYER_HIDE)) { return false; } @@ -523,7 +523,7 @@ static int gp_stroke_merge_exec(bContext *C, wmOperator *op) /* prepare the new stroke */ bGPDstroke *gps = gpencil_prepare_stroke(C, op, totpoints); - + /* copy original points to final stroke */ gpencil_insert_points_to_stroke(gps, sorted_array, totpoints); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ff9678550f9..204d6fe267a 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -371,8 +371,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[ /* add small offset to keep stroke over the surface */ if ((depth) && - (gpd->zdepth_offset > 0.0f) && - (*p->align_flag & GP_PROJECT_DEPTH_VIEW)) + (gpd->zdepth_offset > 0.0f) && + (*p->align_flag & GP_PROJECT_DEPTH_VIEW)) { *depth *= (1.0f - gpd->zdepth_offset); } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 867b807c908..3dec9d945a1 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -385,8 +385,9 @@ static int make_proxy_exec(bContext *C, wmOperator *op) } /* Generic itemf's for operators that take library args */ -static const EnumPropertyItem *proxy_collection_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *proxy_collection_object_itemf( + bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem item_tmp = {0}, *item = NULL; int totitem = 0; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index ccf6f73f284..7ccdf32b44c 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -529,8 +529,9 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) brush->unprojected_radius = value; } -static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Brush_direction_itemf( + bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ePaintMode mode = BKE_paintmode_get_active_from_context(C); @@ -635,8 +636,9 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA } } -static const EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Brush_stroke_itemf( + bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ePaintMode mode = BKE_paintmode_get_active_from_context(C); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index b6bdb91720e..b92d156b674 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -302,8 +302,9 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) BKE_curve_curve_dimension_update(cu); } -static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Curve_fill_mode_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Curve *cu = (Curve *)ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 3da9625eda2..0994d628778 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -179,8 +179,9 @@ static char *rna_ImageUser_path(PointerRNA *ptr) return BLI_strdup(""); } -static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Image_source_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { Image *ima = (Image *)ptr->data; EnumPropertyItem *item = NULL; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 560038edcce..6dd243087c4 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2657,8 +2657,9 @@ static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) return item; } -static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Node_image_layer_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; @@ -2724,8 +2725,9 @@ static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) return item; } -static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Node_image_view_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; @@ -2745,8 +2747,9 @@ static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), Po return item; } -static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Node_view_layer_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Scene *sce = (Scene *)node->id; @@ -2774,8 +2777,9 @@ static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *pt } } -static const EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Node_channel_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; EnumPropertyItem *item = NULL; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 661a3c25e45..feb27018bcd 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -471,8 +471,9 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value) ED_object_parent(ob, ob->parent, value, ob->parsubstr); } -static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Object_parent_type_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = (Object *)ptr->data; EnumPropertyItem *item = NULL; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 6513fb44cf3..406ecd9a8eb 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -689,8 +689,9 @@ static void rna_softbody_dependency_update(Main *bmain, Scene *scene, PointerRNA rna_softbody_update(bmain, scene, ptr); } -static const EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Effector_shape_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Object *ob = NULL; diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 89ddd162669..61707fa4670 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -373,8 +373,9 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o } -static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Particle_Material_itemf( + bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = CTX_data_pointer_get(C, "object").data; Material *ma; @@ -1154,8 +1155,9 @@ static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr) return strlen(tstr); } -static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Particle_from_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { /*if (part->type==PART_REACTOR) */ /* return part_reactor_from_items; */ @@ -1163,8 +1165,9 @@ static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), Poin return part_from_items; } -static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Particle_dist_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; @@ -1174,8 +1177,9 @@ static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), Poin return part_dist_items; } -static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Particle_draw_as_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; @@ -1185,8 +1189,9 @@ static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), P return part_draw_as_items; } -static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_Particle_ren_as_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index d5755387ba0..bbd58b8c4da 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -878,8 +878,9 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr) return ((StringPropertyRNA *)prop)->maxlength; } -static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, - PropertyRNA *prop_parent, bool *r_free) +static const EnumPropertyItem *rna_EnumProperty_default_itemf( + bContext *C, PointerRNA *ptr, + PropertyRNA *prop_parent, bool *r_free) { PropertyRNA *prop = (PropertyRNA *)ptr->data; EnumPropertyRNA *eprop; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e36a124073d..18db0cae8c0 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2113,7 +2113,8 @@ void rna_TransformOrientationSlot_ui_info( } } -static const EnumPropertyItem *get_unit_enum_items(int system, int type, bool *r_free) +static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper( + const int system, const int type, bool *r_free) { const void *usys; int len; @@ -2142,28 +2143,28 @@ static const EnumPropertyItem *get_unit_enum_items(int system, int type, bool *r return items; } -const EnumPropertyItem *rna_get_length_unit_items( +const EnumPropertyItem *rna_UnitSettings_length_unit_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { UnitSettings *units = ptr->data; - return get_unit_enum_items(units->system, B_UNIT_LENGTH, r_free); + return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free); } -const EnumPropertyItem *rna_get_mass_unit_items( +const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { UnitSettings *units = ptr->data; - return get_unit_enum_items(units->system, B_UNIT_MASS, r_free); + return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free); } -const EnumPropertyItem *rna_get_time_unit_items( +const EnumPropertyItem *rna_UnitSettings_time_unit_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { UnitSettings *units = ptr->data; - return get_unit_enum_items(units->system, B_UNIT_TIME, r_free); + return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free); } -static void rna_unit_system_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_UnitSettings_system_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { UnitSettings *unit = &scene->unit; if (unit->system == USER_UNIT_NONE) { @@ -3182,7 +3183,7 @@ static void rna_def_unit_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, unit_systems); RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display"); - RNA_def_property_update(prop, NC_WINDOW, "rna_unit_system_update"); + RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update"); prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rotation_units); @@ -3204,19 +3205,19 @@ static void rna_def_unit_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_get_length_unit_items"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf"); RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values"); RNA_def_property_update(prop, NC_WINDOW, NULL); prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_get_mass_unit_items"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf"); RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values"); RNA_def_property_update(prop, NC_WINDOW, NULL); prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_get_time_unit_items"); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf"); RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values"); RNA_def_property_update(prop, NC_WINDOW, NULL); } diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 0a7c71a683e..ab2a1b3dd82 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -145,8 +145,9 @@ static bool rna_Screen_fullscreen_get(PointerRNA *ptr) /* 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) +static const EnumPropertyItem *rna_Area_type_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index def5a04f0cf..f582c7ce399 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -425,8 +425,9 @@ static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr) #ifdef WITH_OPENSUBDIV -static const EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +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; @@ -468,8 +469,9 @@ static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), Poi #endif -static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_userdef_audio_device_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *r_free) { int index = 0; int totitem = 0; @@ -501,8 +503,9 @@ static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C } #ifdef WITH_INTERNATIONAL -static const EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), - PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_lang_enum_properties_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { const EnumPropertyItem *items = BLT_lang_RNA_enum_properties(); if (items == NULL) { diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 77b9d639fa7..475f53d9ef1 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -877,8 +877,9 @@ static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value) } -static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), - bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_KeyMapItem_type_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) { int map_type = rna_wmKeyMapItem_map_type_get(ptr); @@ -890,8 +891,9 @@ static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), Po else return rna_enum_event_type_items; } -static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), - bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_KeyMapItem_value_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) { int map_type = rna_wmKeyMapItem_map_type_get(ptr); @@ -903,8 +905,9 @@ static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), P return rna_enum_event_value_items; } -static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), - bool *UNUSED(r_free)) +static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf( + bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) { wmWindowManager *wm = CTX_wm_manager(C); wmKeyConfig *kc; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index cc4ad6c93eb..f25f007033f 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1401,41 +1401,39 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) ret = PyUnicode_FromString(identifier); } else { - { - /* Static, no need to free. */ - const EnumPropertyItem *enum_item; - bool free_dummy; - RNA_property_enum_items_ex(NULL, ptr, prop, true, &enum_item, NULL, &free_dummy); - BLI_assert(!free_dummy); - - /* Do not print warning in case of DummyRNA_NULL_items, this one will never match any value... */ - if (enum_item != DummyRNA_NULL_items) { - const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); - - /* prefer not fail silently in case of api errors, maybe disable it later */ - CLOG_WARN(BPY_LOG_RNA, - "current value '%d' " - "matches no enum in '%s', '%s', '%s'", - val, RNA_struct_identifier(ptr->type), - ptr_name, RNA_property_identifier(prop)); + /* Static, no need to free. */ + const EnumPropertyItem *enum_item; + bool free_dummy; + RNA_property_enum_items_ex(NULL, ptr, prop, true, &enum_item, NULL, &free_dummy); + BLI_assert(!free_dummy); + + /* Do not print warning in case of DummyRNA_NULL_items, this one will never match any value... */ + if (enum_item != DummyRNA_NULL_items) { + const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); + + /* prefer not fail silently in case of api errors, maybe disable it later */ + CLOG_WARN(BPY_LOG_RNA, + "current value '%d' " + "matches no enum in '%s', '%s', '%s'", + val, RNA_struct_identifier(ptr->type), + ptr_name, RNA_property_identifier(prop)); #if 0 /* gives python decoding errors while generating docs :( */ - char error_str[256]; - BLI_snprintf(error_str, sizeof(error_str), - "RNA Warning: Current value \"%d\" " - "matches no enum in '%s', '%s', '%s'", - val, RNA_struct_identifier(ptr->type), - ptr_name, RNA_property_identifier(prop)); - - PyErr_Warn(PyExc_RuntimeWarning, error_str); + char error_str[256]; + BLI_snprintf(error_str, sizeof(error_str), + "RNA Warning: Current value \"%d\" " + "matches no enum in '%s', '%s', '%s'", + val, RNA_struct_identifier(ptr->type), + ptr_name, RNA_property_identifier(prop)); + + PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif - if (ptr_name) - MEM_freeN((void *)ptr_name); - } - - ret = PyUnicode_FromString(""); + if (ptr_name) + MEM_freeN((void *)ptr_name); } + + ret = PyUnicode_FromString(""); #if 0 PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val); |