Cleanup: indentation, naming

Use rna naming conventions for unit-settings callbacks.
This commit is contained in:
Campbell Barton 2019-01-02 17:03:45 +11:00
parent 09f46ef6fa
commit 1a208f0326
17 changed files with 185 additions and 161 deletions

View File

@ -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;

View File

@ -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);
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;
/* 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 (dist > dist_end) {
gps_next = sort_pt->gps;
dist = dist_end;
reverse = true;
}
BLI_ghash_insert(strokes, sort_pt->gps, sort_pt->gps);
}
for (i = 0; i < totpoints; i++) {
sort_pt = &src_array[i];
/* avoid dups */
if (BLI_ghash_haskey(all_strokes, sort_pt->gps)) {
continue;
}
BLI_ghash_free(strokes, NULL, NULL);
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);
/* 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;
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);
}
}
BLI_ghash_free(strokes, NULL, NULL);
BLI_ghash_free(all_strokes, NULL, NULL);
return last;
/* 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;
}
}
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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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);
/* 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);
/* 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));
/* 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));
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);
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);