[Bf-blender-cvs] [ddee0931b86] master: RNA: use bool for boolean RNA types

Campbell Barton noreply at git.blender.org
Sun Jul 1 15:58:28 CEST 2018


Commit: ddee0931b8687d01186f1941d483c6b3622d1833
Author: Campbell Barton
Date:   Sun Jul 1 15:47:09 2018 +0200
Branches: master
https://developer.blender.org/rBddee0931b8687d01186f1941d483c6b3622d1833

RNA: use bool for boolean RNA types

We were using int's for bool arguments in BKE,
just to avoid having wrapper functions.

===================================================================

M	intern/cycles/blender/blender_util.h
M	source/blender/blenkernel/BKE_curve.h
M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/intern/curve.c
M	source/blender/blenkernel/intern/mesh_validate.c
M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/include/ED_mesh.h
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/mesh/mesh_data.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/space_clip/clip_buttons.c
M	source/blender/editors/space_image/image_buttons.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_define.h
M	source/blender/makesrna/RNA_types.h
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/makesrna/intern/rna_actuator.c
M	source/blender/makesrna/intern/rna_animation.c
M	source/blender/makesrna/intern/rna_armature.c
M	source/blender/makesrna/intern/rna_curve_api.c
M	source/blender/makesrna/intern/rna_define.c
M	source/blender/makesrna/intern/rna_dynamicpaint.c
M	source/blender/makesrna/intern/rna_fcurve.c
M	source/blender/makesrna/intern/rna_gpencil.c
M	source/blender/makesrna/intern/rna_image_api.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_internal_types.h
M	source/blender/makesrna/intern/rna_lattice_api.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_mesh_api.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_object_api.c
M	source/blender/makesrna/intern/rna_render.c
M	source/blender/makesrna/intern/rna_rigidbody.c
M	source/blender/makesrna/intern/rna_rna.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_scene_api.c
M	source/blender/makesrna/intern/rna_screen.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c
M	source/blender/makesrna/intern/rna_sequencer_api.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_tracking.c
M	source/blender/makesrna/intern/rna_ui.c
M	source/blender/makesrna/intern/rna_ui_api.c
M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/makesrna/intern/rna_wm_api.c
M	source/blender/python/generic/py_capi_utils.c
M	source/blender/python/intern/bpy_props.c
M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_rna_array.c
M	source/blender/render/extern/include/RE_engine.h
M	source/blender/render/intern/source/external_engine.c
M	source/blender/windowmanager/WM_keymap.h
M	source/blender/windowmanager/intern/wm_keymap.c
M	source/blenderplayer/bad_level_call_stubs/stubs.c

===================================================================

diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 5176f9c3b50..7e61888348b 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -293,7 +293,7 @@ static inline int4 get_int4(const BL::Array<int, 4>& array)
 	return make_int4(array[0], array[1], array[2], array[3]);
 }
 
-static inline uint get_layer(const BL::Array<int, 20>& array)
+static inline uint get_layer(const BL::Array<bool, 20>& array)
 {
 	uint layer = 0;
 
@@ -304,8 +304,8 @@ static inline uint get_layer(const BL::Array<int, 20>& array)
 	return layer;
 }
 
-static inline uint get_layer(const BL::Array<int, 20>& array,
-                             const BL::Array<int, 8>& local_array,
+static inline uint get_layer(const BL::Array<bool, 20>& array,
+                             const BL::Array<bool, 8>& local_array,
                              bool is_light = false,
                              uint scene_layers = (1 << 20) - 1)
 {
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 175fa1dad79..fc6e86910cf 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -98,7 +98,7 @@ void BKE_curve_transform(struct Curve *cu, float mat[4][4], const bool do_keys,
 void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys);
 void BKE_curve_material_index_remove(struct Curve *cu, int index);
 void BKE_curve_material_index_clear(struct Curve *cu);
-int BKE_curve_material_index_validate(struct Curve *cu);
+bool BKE_curve_material_index_validate(struct Curve *cu);
 void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len);
 
 ListBase    *BKE_curve_nurbs_get(struct Curve *cu);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 3d69358960f..060bb606c2c 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -409,9 +409,9 @@ void BKE_mesh_calc_relative_deform(
 
 /* *** mesh_validate.c *** */
 
-int BKE_mesh_validate(struct Mesh *me, const int do_verbose, const int cddata_check_mask);
+bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask);
 void BKE_mesh_cd_validate(struct Mesh *me);
-int BKE_mesh_validate_material_indices(struct Mesh *me);
+bool BKE_mesh_validate_material_indices(struct Mesh *me);
 
 bool BKE_mesh_validate_arrays(
         struct Mesh *me,
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index af978a2b516..6d1d62f839c 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -5157,7 +5157,7 @@ void BKE_curve_material_index_clear(Curve *cu)
 	}
 }
 
-int BKE_curve_material_index_validate(Curve *cu)
+bool BKE_curve_material_index_validate(Curve *cu)
 {
 	const int curvetype = BKE_curve_type_get(cu);
 	bool is_valid = true;
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index b0577fdd50d..946677e0ab2 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -992,7 +992,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
  *
  * \returns true if a change is made.
  */
-int BKE_mesh_validate(Mesh *me, const int do_verbose, const int cddata_check_mask)
+bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_mask)
 {
 	bool is_valid = true;
 	bool changed;
@@ -1089,7 +1089,7 @@ void BKE_mesh_cd_validate(Mesh *me)
  * Check all material indices of polygons are valid, invalid ones are set to 0.
  * \returns is_valid.
  */
-int BKE_mesh_validate_material_indices(Mesh *me)
+bool BKE_mesh_validate_material_indices(Mesh *me)
 {
 	MPoly *mp;
 	const int max_idx = max_ii(0, me->totcol - 1);
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 69ee30fa7f6..becda3e452e 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -793,7 +793,7 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
 	bArmature *arm = armature_layers_get_data(&ob);
 	PointerRNA ptr;
 	int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
-	int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 	int i;
 
 	/* sanity checking */
@@ -844,7 +844,7 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev
 	Object *ob = CTX_data_active_object(C);
 	bArmature *arm = armature_layers_get_data(&ob);
 	PointerRNA ptr;
-	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	/* sanity checking */
 	if (arm == NULL)
@@ -865,7 +865,7 @@ static int armature_layers_exec(bContext *C, wmOperator *op)
 	Object *ob = CTX_data_active_object(C);
 	bArmature *arm = armature_layers_get_data(&ob);
 	PointerRNA ptr;
-	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	if (arm == NULL) {
 		return OPERATOR_CANCELLED;
@@ -908,7 +908,7 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
 /* Present a popup to get the layers that should be used */
 static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	/* get layers that are active already */
 	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
@@ -934,7 +934,7 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op)
 {
 	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
 	PointerRNA ptr;
-	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	if (ob == NULL || ob->data == NULL) {
 		return OPERATOR_CANCELLED;
@@ -982,7 +982,7 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
 /* Present a popup to get the layers that should be used */
 static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	/* get layers that are active already */
 	CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
@@ -1011,7 +1011,7 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
 	Object *ob = CTX_data_edit_object(C);
 	bArmature *arm = (ob) ? ob->data : NULL;
 	PointerRNA ptr;
-	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+	bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
 	/* get the values set in the operator properties */
 	RNA_boolean_get_array(op->ptr, "layers", layers);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index d3e3c7b45fa..2558ba6c99a 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -280,7 +280,7 @@ void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int cou
 void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count);
 
 void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly);
-void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
+void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_tessface);
 
 void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name);
 int  ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index fe1fc7dc0cc..43bdafed277 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -354,7 +354,7 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d);
 #  define ED_view3d_clear_mats_rv3d(rv3d) (void)(rv3d)
 #  define ED_view3d_check_mats_rv3d(rv3d) (void)(rv3d)
 #endif
-int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
+int ED_view3d_scene_layer_set(int lay, const bool *values, int *active);
 
 struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
 void                    ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index f4f7945a8eb..0204301941e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -918,14 +918,14 @@ float uiLayoutGetScaleX(uiLayout *layout);
 float uiLayoutGetScaleY(uiLayout *layout);
 
 /* layout specifiers */
-uiLayout *uiLayoutRow(uiLayout *layout, int align);
-uiLayout *uiLayoutColumn(uiLayout *layout, int align);
-uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align);
+uiLayout *uiLayoutRow(uiLayout *layout, bool align);
+uiLayout *uiLayoutColumn(uiLayout *layout, bool align);
+uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align);
 uiLayout *uiLayoutBox(uiLayout *layout);
 uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop,
                           struc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list