diff options
Diffstat (limited to 'source')
68 files changed, 441 insertions, 362 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 975cea7364d..4843ee9d9b8 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -99,7 +99,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 76205da9565..c87c22953f1 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -467,9 +467,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); bool BKE_mesh_is_valid(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 f6dd630e077..33a24f77937 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -5160,7 +5160,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 62d8210d147..0dca41e60e6 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -975,7 +975,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; @@ -1050,7 +1050,7 @@ bool BKE_mesh_is_valid(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 ffe64cc24b0..b3775402a4b 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -806,7 +806,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 */ @@ -858,7 +858,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) @@ -879,7 +879,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; @@ -923,7 +923,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] = {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, bPoseChannel *, pchan, selected_pose_bones) @@ -949,7 +949,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; @@ -998,7 +998,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) @@ -1026,7 +1026,7 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_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... */ /* 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 32504db6498..a473974eb3f 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -279,7 +279,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 68aeccdcc32..b0bf253dbee 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -407,7 +407,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_view_layer_set(int lay, const int *values, int *active); +int ED_view3d_view_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 dcfb1ac3219..39dee884f48 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -990,16 +990,16 @@ bool uiLayoutGetPropSep(uiLayout *layout); bool uiLayoutGetPropDecorate(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 *uiLayoutGridFlow( - uiLayout *layout, int row_major, int num_columns, int even_columns, int even_rows, int align); + uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align); uiLayout *uiLayoutBox(uiLayout *layout); uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop, struct PointerRNA *actptr, struct PropertyRNA *actprop); -uiLayout *uiLayoutAbsolute(uiLayout *layout, int align); -uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align); +uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align); +uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align); uiLayout *uiLayoutOverlap(uiLayout *layout); uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout); uiLayout *uiLayoutRadial(uiLayout *layout); @@ -1040,22 +1040,22 @@ uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct Pointe void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent, +void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent, struct MTex *slot, const char *preview_id); -void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand); +void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); -void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int show_labels, float icon_scale); +void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, - int levels, int brush, int neg_slope); -void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic); -void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color); + bool levels, bool brush, bool neg_slope); +void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic); +void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool color); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer); -void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview); -void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); +void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview); +void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); void uiTemplateImageViews(uiLayout *layout, struct PointerRNA *imaptr); void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr); @@ -1089,9 +1089,9 @@ void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree * void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); void uiTemplateTextureShow(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); -void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int compact); +void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, bool compact); void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int cmpact); +void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, bool compact); void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr); void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b60042b92a6..ad17a771772 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1616,7 +1616,7 @@ static void ui_selectcontext_apply( wmWindow *win = CTX_wm_window(C); if (!win->eventstate->shift) { const int len = RNA_property_array_length(&but->rnapoin, prop); - int *tmparray = MEM_callocN(sizeof(int) * len, __func__); + bool *tmparray = MEM_callocN(sizeof(bool) * len, __func__); tmparray[index] = true; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a89f91a6b59..062a7681372 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -393,7 +393,7 @@ static int ui_layout_local_dir(uiLayout *layout) } } -static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int align) +static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, bool align) { uiLayout *sub; @@ -564,7 +564,7 @@ static void ui_item_array( uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); } else { - int *boolarr = NULL; + bool *boolarr = NULL; /* even if 'expand' is fale, expanding anyway */ @@ -579,7 +579,7 @@ static void ui_item_array( /* show checkboxes for rna on a non-emboss block (menu for eg) */ if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) { - boolarr = MEM_callocN(sizeof(int) * len, __func__); + boolarr = MEM_callocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, boolarr); } @@ -3533,7 +3533,7 @@ static void ui_litem_init_from_parent(uiLayout *litem, uiLayout *layout, int ali } /* layout create functions */ -uiLayout *uiLayoutRow(uiLayout *layout, int align) +uiLayout *uiLayoutRow(uiLayout *layout, bool align) { uiLayout *litem; @@ -3548,7 +3548,7 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align) return litem; } -uiLayout *uiLayoutColumn(uiLayout *layout, int align) +uiLayout *uiLayoutColumn(uiLayout *layout, bool align) { uiLayout *litem; @@ -3563,7 +3563,7 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align) return litem; } -uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) +uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align) { uiLayoutItemFlow *flow; @@ -3580,7 +3580,7 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) } uiLayout *uiLayoutGridFlow( - uiLayout *layout, int row_major, int columns_len, int even_columns, int even_rows, int align) + uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align) { uiLayoutItemGridFlow *flow; @@ -3689,7 +3689,7 @@ uiLayout *uiLayoutListBox( return (uiLayout *)box; } -uiLayout *uiLayoutAbsolute(uiLayout *layout, int align) +uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align) { uiLayout *litem; @@ -3727,7 +3727,7 @@ uiLayout *uiLayoutOverlap(uiLayout *layout) return litem; } -uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) +uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align) { uiLayoutItemSplit *split; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index de5ba65b4a7..ec9d8eead43 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1839,7 +1839,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event) } void uiTemplatePreview( - uiLayout *layout, bContext *C, ID *id, int show_buttons, ID *parent, MTex *slot, + uiLayout *layout, bContext *C, ID *id, bool show_buttons, ID *parent, MTex *slot, const char *preview_id) { uiLayout *row, *col; @@ -2149,7 +2149,7 @@ static void colorband_buttons_layout( } } -void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand) +void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, bool expand) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -2262,7 +2262,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) /** * \param icon_scale: Scale of the icon, 1x == button height. */ -void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, int show_labels, float icon_scale) +void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); IconViewMenuArgs *cb_args; @@ -2662,8 +2662,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) /* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */ static void curvemap_buttons_layout( - uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, - int brush, int neg_slope, RNAUpdateCb *cb) + uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels, + bool brush, bool neg_slope, RNAUpdateCb *cb) { CurveMapping *cumap = ptr->data; CurveMap *cm = &cumap->cm[cumap->cur]; @@ -2826,7 +2826,7 @@ static void curvemap_buttons_layout( void uiTemplateCurveMapping( uiLayout *layout, PointerRNA *ptr, const char *propname, int type, - int levels, int brush, int neg_slope) + bool levels, bool brush, bool neg_slope) { RNAUpdateCb *cb; PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -2870,8 +2870,8 @@ void uiTemplateCurveMapping( /* This template now follows User Preference for type - name is not correct anymore... */ void uiTemplateColorPicker( - uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, - int lock, int lock_luminosity, int cubic) + uiLayout *layout, PointerRNA *ptr, const char *propname, bool value_slider, + bool lock, bool lock_luminosity, bool cubic) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); uiBlock *block = uiLayoutGetBlock(layout); @@ -2967,7 +2967,7 @@ void uiTemplateColorPicker( } } -void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, int UNUSED(colors)) +void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, bool UNUSED(colors)) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); PointerRNA cptr; diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 4841de3c856..be68bfda09c 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -480,7 +480,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula for (int i = 0; i < 4; i++) { PointerRNA *ptr = WM_manipulator_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL); { - int constraint[3] = {0, 0, 0}; + bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate"); RNA_boolean_set(¯optr, "release_confirm", true); @@ -492,7 +492,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula for (int i = 0; i < 4; i++) { PointerRNA *ptr = WM_manipulator_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL); { - int constraint[3] = {0, 0, 0}; + bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate"); RNA_boolean_set(¯optr, "release_confirm", true); @@ -588,7 +588,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro wmOperator *op_transform = op->macro.last; float value[4]; RNA_float_get_array(op_transform->ptr, "value", value); - int constraint_axis[3]; + bool constraint_axis[3]; RNA_boolean_get_array(op_transform->ptr, "constraint_axis", constraint_axis); int orientation_type = RNA_enum_get(op_transform->ptr, "constraint_orientation"); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 78d98025476..8493d15a3b1 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -693,7 +693,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); ToolSettings *settings = scene->toolsettings; - const int mesh_select_mode[3] = { + const bool mesh_select_mode[3] = { (settings->selectmode & SCE_SELECT_VERTEX) != 0, (settings->selectmode & SCE_SELECT_EDGE) != 0, (settings->selectmode & SCE_SELECT_FACE) != 0, diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index b4588257412..f1f8ed41ca2 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -963,7 +963,7 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot) /************************** Add Geometry Layers *************************/ -void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) +void ED_mesh_update(Mesh *mesh, bContext *C, bool calc_edges, bool calc_tessface) { bool tessface_input = false; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index ac3f8d58de8..73e7271abf7 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -333,7 +333,8 @@ bool ED_object_add_generic_get_opts(bContext *C, wmOperator *op, const char view /* Get layers! */ { - int a, layer_values[20]; + int a; + bool layer_values[20]; if (!layer) layer = &_layer; diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index f2fe06874d7..db5f6c2451c 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -77,7 +77,7 @@ void ED_clip_buttons_register(ARegionType *UNUSED(art)) /********************* MovieClip Template ************************/ -void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int compact) +void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, bool compact) { PropertyRNA *prop; PointerRNA clipptr; @@ -333,7 +333,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) } void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, - PointerRNA *trackptr, int compact) + PointerRNA *trackptr, bool compact) { PropertyRNA *prop; uiBlock *block; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 0cd61f3e330..191f57961c9 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -827,7 +827,7 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) RNA_property_update(C, &cb->ptr, cb->prop); } -void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, int compact, int multiview) +void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, bool compact, bool multiview) { PropertyRNA *prop; PointerRNA imaptr; @@ -1063,7 +1063,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char MEM_freeN(cb); } -void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_management) +void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management) { ImageFormatData *imf = imfptr->data; ID *id = imfptr->id.data; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 53e3fbb87b0..5cb382f63eb 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1076,7 +1076,7 @@ finally: /** \name View Layer Utilities * \{ */ -int ED_view3d_view_layer_set(int lay, const int *values, int *active) +int ED_view3d_view_layer_set(int lay, const bool *values, int *active) { int i, tot = 0; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 261787ef330..53ac3bdd45a 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1951,7 +1951,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); - int constraint_axis[3] = {0, 0, 0}; + bool constraint_axis[3] = {false, false, false}; int proportional = 0; PropertyRNA *prop; @@ -2073,13 +2073,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_AXIS0) { - constraint_axis[0] = 1; + constraint_axis[0] = true; } if (t->con.mode & CON_AXIS1) { - constraint_axis[1] = 1; + constraint_axis[1] = true; } if (t->con.mode & CON_AXIS2) { - constraint_axis[2] = 1; + constraint_axis[2] = true; } } @@ -2269,7 +2269,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* Constraint init from operator */ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { - int constraint_axis[3]; + bool constraint_axis[3]; RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); diff --git a/source/blender/editors/transform/transform_manipulator_2d.c b/source/blender/editors/transform/transform_manipulator_2d.c index d2743f47000..fd6e7ed5442 100644 --- a/source/blender/editors/transform/transform_manipulator_2d.c +++ b/source/blender/editors/transform/transform_manipulator_2d.c @@ -223,7 +223,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator /* assign operator */ PointerRNA *ptr = WM_manipulator_operator_set(axis, 0, ot_translate, NULL); - int constraint[3] = {0}; + bool constraint[3] = {0}; constraint[(axis_idx + 1) % 2] = 1; if (RNA_struct_find_property(ptr, "constraint_axis")) RNA_boolean_set_array(ptr, "constraint_axis", constraint); @@ -240,8 +240,8 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator ptr = WM_manipulator_operator_set(man->cage, 0, ot_translate, NULL); RNA_boolean_set(ptr, "release_confirm", 1); - int constraint_x[3] = {1, 0, 0}; - int constraint_y[3] = {0, 1, 0}; + bool constraint_x[3] = {1, 0, 0}; + bool constraint_y[3] = {0, 1, 0}; ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL); PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index f584a7cf623..8f547fb7451 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -401,9 +401,9 @@ static void manipulator_get_axis_color( r_col_hi[3] = alpha_hi * alpha_fac; } -static void manipulator_get_axis_constraint(const int axis_idx, int r_axis[3]) +static void manipulator_get_axis_constraint(const int axis_idx, bool r_axis[3]) { - zero_v3_int(r_axis); + ARRAY_SET_ITEMS(r_axis, 0, 0, 0); switch (axis_idx) { case MAN_AXIS_TRANS_X: @@ -1293,7 +1293,7 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr MAN_ITER_AXES_BEGIN(axis, axis_idx) { const short axis_type = manipulator_get_axis_type(axis_idx); - int constraint_axis[3] = {1, 0, 0}; + bool constraint_axis[3] = {1, 0, 0}; PointerRNA *ptr; manipulator_get_axis_constraint(axis_idx, constraint_axis); @@ -1665,7 +1665,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { - int constraint[3] = {x != 1, y != 1, z != 1}; + bool constraint[3] = {x != 1, y != 1, z != 1}; ptr = WM_manipulator_operator_set(mpr, i, ot_resize, NULL); if (prop_release_confirm == NULL) { prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 61a82d26b2b..89e210ca7a2 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -304,7 +304,7 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op) if (op->opm && op->opm->opm && op->opm->opm->prev) { wmOperator *op_prev = op->opm->opm->prev; Scene *scene = CTX_data_scene(C); - int mesh_select_mode[3]; + bool mesh_select_mode[3]; PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); if (prop && RNA_property_is_set(op_prev->ptr, prop)) { diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a135e716770..2911162a0f1 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -898,15 +898,15 @@ void RNA_property_update_cache_free(void); /* Property Data */ -int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop); -void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value); -void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values); -int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); -void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values); -void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value); -int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop); -void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values); -int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); +bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value); +void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values); +bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); +void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values); +void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value); +bool RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, bool *values); +bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value); @@ -1050,10 +1050,10 @@ char *RNA_path_property_py(struct PointerRNA *ptr, struct PropertyRNA *prop, int * There is no support for pointers and collections here yet, these can be * added when ID properties support them. */ -int RNA_boolean_get(PointerRNA *ptr, const char *name); -void RNA_boolean_set(PointerRNA *ptr, const char *name, int value); -void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values); -void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values); +bool RNA_boolean_get(PointerRNA *ptr, const char *name); +void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value); +void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values); +void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values); int RNA_int_get(PointerRNA *ptr, const char *name); void RNA_int_set(PointerRNA *ptr, const char *name, int value); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 0c269d17072..97a8a4a5546 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -84,11 +84,11 @@ void RNA_def_struct_translation_context(StructRNA *srna, const char *context); typedef void StructOrFunctionRNA; -PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, int default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, bool default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); @@ -162,8 +162,8 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength); void RNA_def_property_struct_type(PropertyRNA *prop, const char *type); void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type); -void RNA_def_property_boolean_default(PropertyRNA *prop, int value); -void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array); +void RNA_def_property_boolean_default(PropertyRNA *prop, bool value); +void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array); void RNA_def_property_int_default(PropertyRNA *prop, int value); void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array); void RNA_def_property_float_default(PropertyRNA *prop, float value); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 9d304018990..ccf9affa1f8 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -337,6 +337,7 @@ typedef enum RawPropertyType { PROP_RAW_INT, // XXX - abused for types that are not set, eg. MFace.verts, needs fixing. PROP_RAW_SHORT, PROP_RAW_CHAR, + PROP_RAW_BOOLEAN, PROP_RAW_DOUBLE, PROP_RAW_FLOAT } RawPropertyType; @@ -371,10 +372,10 @@ typedef struct EnumPropertyItem { } EnumPropertyItem; /* extended versions with PropertyRNA argument */ -typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); -typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); -typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); -typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef bool (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value); +typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values); +typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values); typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index fe063a8e335..1dd4535610c 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -418,6 +418,7 @@ static const char *rna_type_type_name(PropertyRNA *prop) { switch (prop->type) { case PROP_BOOLEAN: + return "bool"; case PROP_INT: case PROP_ENUM: return "int"; @@ -1617,6 +1618,21 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR switch (prop->type) { case PROP_BOOLEAN: + { + if (!prop->arraydimension) { + fprintf(f, "bool %sget(PointerRNA *ptr);\n", func); + fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func); + } + else if (prop->arraydimension && prop->totarraylength) { + fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength); + fprintf(f, "void %sset(PointerRNA *ptr, const bool values[%u]);\n", func, prop->totarraylength); + } + else { + fprintf(f, "void %sget(PointerRNA *ptr, bool values[]);\n", func); + fprintf(f, "void %sset(PointerRNA *ptr, const bool values[]);\n", func); + } + break; + } case PROP_INT: { if (!prop->arraydimension) { @@ -1749,15 +1765,15 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property { if (!prop->arraydimension) { fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool value);", rna_safe_id(prop->identifier)); } else if (prop->totarraylength) { - fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength); + fprintf(f, "\tinline Array<bool, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength); } else if (prop->getlength) { - fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline DynamicArray<bool> %s(void);\n", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool values[]);", rna_safe_id(prop->identifier)); } break; } @@ -2959,7 +2975,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if (prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, + fprintf(f, "static bool rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for (i = 0; i < prop->totarraylength; i++) { @@ -3589,22 +3605,22 @@ static const char *cpp_classes = "" "\n" "#define BOOLEAN_PROPERTY(sname, identifier) \\\n" " inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n" -" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n" +" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n" "\n" "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n" -" inline Array<int, size> sname::identifier(void) \\\n" -" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n" -" inline void sname::identifier(int values[size]) \\\n" +" inline Array<bool, size> sname::identifier(void) \\\n" +" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n" +" inline void sname::identifier(bool values[size]) \\\n" " { sname##_##identifier##_set(&ptr, values); } \\\n" "\n" "#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n" -" inline DynamicArray<int> sname::identifier(void) { \\\n" +" inline DynamicArray<bool> sname::identifier(void) { \\\n" " int arraylen[3]; \\\n" " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n" -" DynamicArray<int> ar(len); \\\n" +" DynamicArray<bool> ar(len); \\\n" " sname##_##identifier##_get(&ptr, ar.data); \\\n" " return ar; } \\\n" -" inline void sname::identifier(int values[]) \\\n" +" inline void sname::identifier(bool values[]) \\\n" " { sname##_##identifier##_set(&ptr, values); } \\\n" "\n" "#define INT_PROPERTY(sname, identifier) \\\n" diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 5473eec39c5..43535d6f498 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -402,7 +402,7 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id) } } -static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, int clear_proxy) +static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy) { /* Special case, as we can't rely on id_make_local(); it clears proxies. */ if (!clear_proxy && GS(self->name) == ID_OB) { @@ -475,7 +475,8 @@ static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma) WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); } -static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i, int remove_material_slot) +static Material *rna_IDMaterials_pop_id( + ID *id, Main *bmain, ReportList *reports, int index_i, bool remove_material_slot) { Material *ma; short *totcol = give_totcolp_id(id); @@ -503,7 +504,7 @@ static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports return ma; } -static void rna_IDMaterials_clear_id(ID *id, Main *bmain, int remove_material_slot) +static void rna_IDMaterials_clear_id(ID *id, Main *bmain, bool remove_material_slot) { BKE_material_clear_id(bmain, id, remove_material_slot); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9b231f4aa5e..7cb128e7e47 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2238,17 +2238,17 @@ void RNA_property_update_cache_free(void) /* Property Data */ -int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; - int value; + bool value; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) - value = IDP_Int(idprop); + value = IDP_Int(idprop) != 0; else if (bprop->get) value = bprop->get(ptr); else if (bprop->get_ex) @@ -2261,7 +2261,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) return value; } -void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) +void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2271,10 +2271,10 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) BLI_assert(ELEM(value, false, true)); /* just in case other values are passed */ - if (value) value = 1; + BLI_assert(ELEM(value, true, false)); if ((idprop = rna_idproperty_check(&prop, ptr))) { - IDP_Int(idprop) = value; + IDP_Int(idprop) = (int)value; rna_idproperty_touch(idprop); } else if (bprop->set) { @@ -2295,7 +2295,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) } } -void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) +void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2304,10 +2304,15 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = RNA_property_boolean_get(ptr, prop); - else - memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len); + } + else { + int *values_src = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values[i] = (bool)values_src[i]; + } + } } else if (prop->arraydimension == 0) values[0] = RNA_property_boolean_get(ptr, prop); @@ -2316,16 +2321,16 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val else if (bprop->getarray_ex) bprop->getarray_ex(ptr, prop, values); else if (bprop->defaultarray) - memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength); + memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength); else - memset(values, 0, sizeof(int) * prop->totarraylength); + memset(values, 0, sizeof(bool) * prop->totarraylength); } -int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); - int value; + bool value; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) != false); @@ -2337,9 +2342,9 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index value = tmp[index]; } else { - int *tmparray; + bool *tmparray; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, tmparray); value = tmparray[index]; MEM_freeN(tmparray); @@ -2350,7 +2355,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index return value; } -void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values) +void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2359,11 +2364,15 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { IDP_Int(idprop) = values[0]; - else - memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len); - + } + else { + int *values_dst = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values_dst[i] = (int)values[i]; + } + } rna_idproperty_touch(idprop); } else if (prop->arraydimension == 0) @@ -2383,14 +2392,17 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in if (group) { idprop = IDP_New(IDP_ARRAY, &val, prop->identifier); IDP_AddToGroup(group, idprop); - memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len); + int *values_dst = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values_dst[i] = (int)values[i]; + } } } } -void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value) +void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); @@ -2405,9 +2417,9 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde RNA_property_boolean_set_array(ptr, prop, tmp); } else { - int *tmparray; + bool *tmparray; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, tmparray); tmparray[index] = value; RNA_property_boolean_set_array(ptr, prop, tmparray); @@ -2415,7 +2427,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde } } -int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop); @@ -2426,7 +2438,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) return bprop->defaultvalue; } -void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values) +void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop); @@ -2436,14 +2448,14 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA if (prop->arraydimension == 0) values[0] = bprop->defaultvalue; else if (bprop->defaultarray) - memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength); + memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength); else - memset(values, 0, sizeof(int) * prop->totarraylength); + memset(values, 0, sizeof(bool) * prop->totarraylength); } -int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); @@ -2456,9 +2468,9 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i return tmp[index]; } else { - int *tmparray, value; + bool *tmparray, value; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_default_array(ptr, prop, tmparray); value = tmparray[index]; MEM_freeN(tmparray); @@ -3849,6 +3861,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper case PROP_RAW_CHAR: var = (dtype)((char *)raw.array)[a]; break; \ case PROP_RAW_SHORT: var = (dtype)((short *)raw.array)[a]; break; \ case PROP_RAW_INT: var = (dtype)((int *)raw.array)[a]; break; \ + case PROP_RAW_BOOLEAN: var = (dtype)((bool *)raw.array)[a]; break; \ case PROP_RAW_FLOAT: var = (dtype)((float *)raw.array)[a]; break; \ case PROP_RAW_DOUBLE: var = (dtype)((double *)raw.array)[a]; break; \ default: var = (dtype)0; \ @@ -3861,6 +3874,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper case PROP_RAW_CHAR: ((char *)raw.array)[a] = (char)var; break; \ case PROP_RAW_SHORT: ((short *)raw.array)[a] = (short)var; break; \ case PROP_RAW_INT: ((int *)raw.array)[a] = (int)var; break; \ + case PROP_RAW_BOOLEAN: ((bool *)raw.array)[a] = (bool)var; break; \ case PROP_RAW_FLOAT: ((float *)raw.array)[a] = (float)var; break; \ case PROP_RAW_DOUBLE: ((double *)raw.array)[a] = (double)var; break; \ default: break; \ @@ -3873,6 +3887,7 @@ int RNA_raw_type_sizeof(RawPropertyType type) case PROP_RAW_CHAR: return sizeof(char); case PROP_RAW_SHORT: return sizeof(short); case PROP_RAW_INT: return sizeof(int); + case PROP_RAW_BOOLEAN: return sizeof(bool); case PROP_RAW_FLOAT: return sizeof(float); case PROP_RAW_DOUBLE: return sizeof(double); default: return 0; @@ -3974,8 +3989,9 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro int err = 0, j, a = 0; int needconv = 1; - if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) || - (itemtype == PROP_FLOAT && in.type == PROP_RAW_FLOAT)) + if (((itemtype == PROP_INT) && (in.type == PROP_RAW_INT)) || + ((itemtype == PROP_BOOLEAN) && (in.type == PROP_RAW_BOOLEAN)) || + ((itemtype == PROP_FLOAT) && (in.type == PROP_RAW_FLOAT))) { /* avoid creating temporary buffer if the data type match */ needconv = 0; @@ -4025,7 +4041,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { int b; - RAW_GET(int, b, in, a); + RAW_GET(bool, b, in, a); RNA_property_boolean_set(&itemptr, iprop, b); break; } @@ -4052,7 +4068,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { int b = RNA_property_boolean_get(&itemptr, iprop); - RAW_SET(int, in, a, b); + RAW_SET(bool, in, a, b); break; } case PROP_INT: @@ -4090,7 +4106,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { for (j = 0; j < itemlen; j++, a++) - RAW_GET(int, ((int *)tmparray)[j], in, a); + RAW_GET(bool, ((bool *)tmparray)[j], in, a); RNA_property_boolean_set_array(&itemptr, iprop, tmparray); break; } @@ -4118,7 +4134,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro { RNA_property_boolean_get_array(&itemptr, iprop, tmparray); for (j = 0; j < itemlen; j++, a++) - RAW_SET(int, in, a, ((int *)tmparray)[j]); + RAW_SET(int, in, a, ((bool *)tmparray)[j]); break; } case PROP_INT: @@ -4145,7 +4161,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro switch (itemtype) { case PROP_BOOLEAN: { - RNA_property_boolean_set_array(&itemptr, iprop, &((int *)in.array)[a]); + RNA_property_boolean_set_array(&itemptr, iprop, &((bool *)in.array)[a]); a += itemlen; break; } @@ -4169,7 +4185,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro switch (itemtype) { case PROP_BOOLEAN: { - RNA_property_boolean_get_array(&itemptr, iprop, &((int *)in.array)[a]); + RNA_property_boolean_get_array(&itemptr, iprop, &((bool *)in.array)[a]); a += itemlen; break; } @@ -4208,7 +4224,7 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop) /* this property has no raw access, yet we try to provide a raw type to help building the array */ switch (prop->type) { case PROP_BOOLEAN: - return PROP_RAW_INT; + return PROP_RAW_BOOLEAN; case PROP_INT: return PROP_RAW_INT; case PROP_FLOAT: @@ -5479,7 +5495,7 @@ char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index /* Quick name based property access */ -int RNA_boolean_get(PointerRNA *ptr, const char *name) +bool RNA_boolean_get(PointerRNA *ptr, const char *name) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5492,7 +5508,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name) } } -void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) +void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5502,7 +5518,7 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } -void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) +void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5512,7 +5528,7 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } -void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) +void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -6140,8 +6156,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index))); } else { - int fixedbuf[RNA_MAX_ARRAY_LENGTH]; - int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); + bool fixedbuf[RNA_MAX_ARRAY_LENGTH]; + bool *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); RNA_property_boolean_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); @@ -6762,9 +6778,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop } if (len == 0) - *((int *)dest) = *((int *)src); + *((bool *)dest) = *((bool *)src); else - memcpy(dest, src, len * sizeof(int)); + memcpy(dest, src, len * sizeof(bool)); break; } @@ -7112,7 +7128,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) case PROP_BOOLEAN: if (len) { if (index == -1) { - int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - boolean"); + bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean"); RNA_property_boolean_get_default_array(ptr, prop, tmparray); RNA_property_boolean_set_array(ptr, prop, tmparray); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7b14c6960b5..e8d2dc72a75 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -163,7 +163,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) /* read the result */ RNA_parameter_get_lookup(&list, "ok", &ret); - ok = *(int *)ret; + ok = *(bool *)ret; } RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 7e936fd1e5c..596667a0afd 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -259,7 +259,7 @@ static void rna_Armature_layer_used_refresh(bArmature *arm, ListBase *bones) } } -static void rna_bone_layer_set(int *layer, const int *values) +static void rna_bone_layer_set(int *layer, const bool *values) { int i, tot = 0; @@ -277,7 +277,7 @@ static void rna_bone_layer_set(int *layer, const int *values) } } -static void rna_Bone_layer_set(PointerRNA *ptr, const int *values) +static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values) { bArmature *arm = (bArmature *)ptr->id.data; Bone *bone = (Bone *)ptr->data; @@ -288,7 +288,7 @@ static void rna_Bone_layer_set(PointerRNA *ptr, const int *values) rna_Armature_layer_used_refresh(arm, &arm->bonebase); } -static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) +static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values) { bArmature *arm = (bArmature *)ptr->data; int i, tot = 0; @@ -359,7 +359,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value) ED_armature_bone_rename(G_MAIN, arm, oldname, newname); } -static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[]) +static void rna_EditBone_layer_set(PointerRNA *ptr, const bool values[]) { EditBone *data = (EditBone *)(ptr->data); rna_bone_layer_set(&data->layer, values); diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index b518b0cb5b0..b0c07465958 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -43,7 +43,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Curve_transform(Curve *cu, float *mat, int shape_keys) +static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) { BKE_curve_transform(cu, (float (*)[4])mat, shape_keys, true); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 5b91a3e43d2..c84ce56c58b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1651,7 +1651,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength) } } -void RNA_def_property_boolean_default(PropertyRNA *prop, int value) +void RNA_def_property_boolean_default(PropertyRNA *prop, bool value) { StructRNA *srna = DefRNA.laststruct; @@ -1670,7 +1670,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value) } } -void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array) +void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array) { StructRNA *srna = DefRNA.laststruct; @@ -2665,7 +2665,7 @@ void RNA_def_py_data(PropertyRNA *prop, void *py_data) /* Compact definitions */ -PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value, +PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2678,7 +2678,7 @@ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, return prop; } -PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2692,7 +2692,7 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *ident return prop; } -PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2707,7 +2707,7 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *ident } PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, - int *default_value, const char *ui_name, const char *ui_description) + bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; PropertyRNA *prop; @@ -2720,7 +2720,7 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char return prop; } -PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -3259,6 +3259,7 @@ int rna_parameter_size(PropertyRNA *parm) if (len > 0) { switch (ptype) { case PROP_BOOLEAN: + return sizeof(bool) * len; case PROP_INT: return sizeof(int) * len; case PROP_FLOAT: @@ -3270,6 +3271,7 @@ int rna_parameter_size(PropertyRNA *parm) else { switch (ptype) { case PROP_BOOLEAN: + return sizeof(bool); case PROP_INT: case PROP_ENUM: return sizeof(int); @@ -3430,9 +3432,6 @@ void RNA_def_func_free_pointers(FunctionRNA *func) void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop) { ContainerRNA *cont = cont_; - EnumPropertyItem *earray; - float *farray; - int *iarray; int a; /* annoying since we just added this to a hash, could make this add the correct key to the hash @@ -3447,8 +3446,12 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA } } - if (prop->name) prop->name = BLI_strdup(prop->name); - if (prop->description) prop->description = BLI_strdup(prop->description); + if (prop->name) { + prop->name = BLI_strdup(prop->name); + } + if (prop->description) { + prop->description = BLI_strdup(prop->description); + } switch (prop->type) { case PROP_BOOLEAN: @@ -3456,9 +3459,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; if (bprop->defaultarray) { - iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); - memcpy(iarray, bprop->defaultarray, sizeof(int) * prop->totarraylength); - bprop->defaultarray = iarray; + bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength); + bprop->defaultarray = array; } break; } @@ -3467,9 +3470,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA IntPropertyRNA *iprop = (IntPropertyRNA *)prop; if (iprop->defaultarray) { - iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); - memcpy(iarray, iprop->defaultarray, sizeof(int) * prop->totarraylength); - iprop->defaultarray = iarray; + int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength); + iprop->defaultarray = array; } break; } @@ -3478,17 +3481,20 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; if (eprop->item) { - earray = MEM_callocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store"); - memcpy(earray, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1)); - eprop->item = earray; + EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store"); + memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1)); + eprop->item = array; for (a = 0; a < eprop->totitem; a++) { - if (earray[a].identifier) - earray[a].identifier = BLI_strdup(earray[a].identifier); - if (earray[a].name) - earray[a].name = BLI_strdup(earray[a].name); - if (earray[a].description) - earray[a].description = BLI_strdup(earray[a].description); + if (array[a].identifier) { + array[a].identifier = BLI_strdup(array[a].identifier); + } + if (array[a].name) { + array[a].name = BLI_strdup(array[a].name); + } + if (array[a].description) { + array[a].description = BLI_strdup(array[a].description); + } } } break; @@ -3498,9 +3504,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; if (fprop->defaultarray) { - farray = MEM_callocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store"); - memcpy(farray, fprop->defaultarray, sizeof(float) * prop->totarraylength); - fprop->defaultarray = farray; + float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength); + fprop->defaultarray = array; } break; } diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 3e85e225d27..eb069b5e069 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -338,7 +338,7 @@ static ID *rna_Depsgraph_id_eval_get(Depsgraph *depsgraph, ID *id_orig) return DEG_get_evaluated_id(depsgraph, id_orig); } -static int rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type) +static bool rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type) { return DEG_id_type_updated(depsgraph, id_type); } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 509265c04df..2801b292df6 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -240,7 +240,7 @@ static int rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr) } /* does output layer exist*/ -static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) +static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { return dynamicPaint_outputLayerExists(surface, ob, index); } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 64d6960d0ff..f70ce67f1b0 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -853,7 +853,7 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot) } } -static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, int do_fast) +static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, bool do_fast) { BezTriple *bezt = bezt_ptr->data; int index = (int)(bezt - fcu->bezt); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index cd7081d07a8..2418102d94c 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -591,7 +591,7 @@ static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src) return frame; } -static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, int setactive) +static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, bool setactive) { bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0); @@ -636,7 +636,7 @@ static void rna_GPencil_clear(bGPdata *gpd) } /* Palettes */ -static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, int setactive) +static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, bool setactive) { bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, name, setactive != 0); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 1d2c36e3e3e..70b75efdb36 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -148,7 +148,7 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r static void rna_Image_pack( Image *image, Main *bmain, bContext *C, ReportList *reports, - int as_png, const char *data, int data_len) + bool as_png, const char *data, int data_len) { ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 5ab1297f43c..e263ca76f61 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -482,7 +482,7 @@ int rna_parameter_size(struct PropertyRNA *parm); struct Mesh *rna_Main_meshes_new_from_object( struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, - struct Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed); + struct Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed); /* XXX, these should not need to be defined here~! */ struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports); @@ -493,7 +493,7 @@ void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct Re int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); const char *rna_translate_ui_text( - const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, int translate); + const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, bool translate); /* Internal functions that cycles uses so we need to declare (tsk tsk) */ void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index fcca0c0a3ab..a19831c833e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -63,10 +63,10 @@ typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); typedef char *(*StructPathFunc)(struct PointerRNA *ptr); typedef int (*PropArrayLengthGetFunc)(struct PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]); -typedef int (*PropBooleanGetFunc)(struct PointerRNA *ptr); -typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, int value); -typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, int *values); -typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const int *values); +typedef bool (*PropBooleanGetFunc)(struct PointerRNA *ptr); +typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, bool value); +typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, bool *values); +typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const bool *values); typedef int (*PropIntGetFunc)(struct PointerRNA *ptr); typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value); typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values); @@ -100,10 +100,10 @@ typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); /* extended versions with PropertyRNA argument */ -typedef int (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); -typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); -typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); -typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef bool (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value); +typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values); +typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values); typedef int (*PropIntGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*PropIntSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); @@ -294,8 +294,8 @@ typedef struct BoolPropertyRNA { PropBooleanArrayGetFuncEx getarray_ex; PropBooleanArraySetFuncEx setarray_ex; - int defaultvalue; - const int *defaultarray; + bool defaultvalue; + const bool *defaultarray; } BoolPropertyRNA; typedef struct IntPropertyRNA { diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c index 5637f8d9248..231c5ce0c36 100644 --- a/source/blender/makesrna/intern/rna_lattice_api.c +++ b/source/blender/makesrna/intern/rna_lattice_api.c @@ -41,7 +41,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Lattice_transform(Lattice *lt, float *mat, int shape_keys) +static void rna_Lattice_transform(Lattice *lt, float *mat, bool shape_keys) { BKE_lattice_transform(lt, (float (*)[4])mat, shape_keys); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 835d6e5117f..fff53aafcc7 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -129,8 +129,9 @@ static void rna_idname_validate(const char *name, char *r_name) } -static void rna_Main_ID_remove(Main *bmain, ReportList *reports, PointerRNA *id_ptr, - int do_unlink, int do_id_user, int do_ui_user) +static void rna_Main_ID_remove( + Main *bmain, ReportList *reports, PointerRNA *id_ptr, + bool do_unlink, bool do_id_user, bool do_ui_user) { ID *id = id_ptr->data; if (do_unlink) { @@ -166,7 +167,7 @@ static Scene *rna_Main_scenes_new(Main *bmain, const char *name) return BKE_scene_add(bmain, safe_name); } -static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, int do_unlink) +static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink) { /* don't call BKE_libblock_free(...) directly */ Scene *scene = scene_ptr->data; @@ -299,7 +300,7 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) /* copied from Mesh_getFromObject and adapted to RNA interface */ Mesh *rna_Main_meshes_new_from_object( Main *bmain, ReportList *reports, Depsgraph *depsgraph, - Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed) + Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed) { Scene *sce = DEG_get_evaluated_scene(depsgraph); @@ -329,7 +330,7 @@ static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type) return lamp; } -static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer, int stereo3d) +static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, bool alpha, bool float_buffer, bool stereo3d) { char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); @@ -339,7 +340,7 @@ static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int id_us_min(&image->id); return image; } -static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { Image *ima; @@ -390,7 +391,7 @@ static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name) return mb; } -static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { VFont *font; errno = 0; @@ -460,7 +461,7 @@ static Speaker *rna_Main_speakers_new(Main *bmain, const char *name) return speaker; } -static bSound *rna_Main_sounds_load(Main *bmain, const char *name, int check_existing) +static bSound *rna_Main_sounds_load(Main *bmain, const char *name, bool check_existing) { bSound *sound; @@ -483,7 +484,7 @@ static Text *rna_Main_texts_new(Main *bmain, const char *name) return BKE_text_add(bmain, safe_name); } -static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, int is_internal) +static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, bool is_internal) { Text *txt; @@ -537,7 +538,7 @@ static Palette *rna_Main_palettes_new(Main *bmain, const char *name) return (Palette *)palette; } -static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { MovieClip *clip; @@ -592,7 +593,7 @@ static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name) /* tag functions, all the same */ #define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \ - static void rna_Main_##_func_name##_tag(Main *bmain, int value) { \ + static void rna_Main_##_func_name##_tag(Main *bmain, bool value) { \ BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \ } \ diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index ed19877ec0f..0087a154f88 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -101,12 +101,12 @@ static void rna_Mesh_free_tangents(Mesh *mesh) CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop); } -static void rna_Mesh_calc_tessface(Mesh *mesh, int free_mpoly) +static void rna_Mesh_calc_tessface(Mesh *mesh, bool free_mpoly) { ED_mesh_calc_tessface(mesh, free_mpoly != 0); } -static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_poly_group_len, +static void rna_Mesh_calc_smooth_groups(Mesh *mesh, bool use_bitflags, int *r_poly_group_len, int **r_poly_group, int *r_group_total) { *r_poly_group_len = mesh->totpoly; @@ -194,7 +194,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices( DEG_id_tag_update(&mesh->id, 0); } -static void rna_Mesh_transform(Mesh *mesh, float *mat, int shape_keys) +static void rna_Mesh_transform(Mesh *mesh, float *mat, bool shape_keys) { BKE_mesh_transform(mesh, (float (*)[4])mat, shape_keys); @@ -210,7 +210,7 @@ static void rna_Mesh_flip_normals(Mesh *mesh) DEG_id_tag_update(&mesh->id, 0); } -static void rna_Mesh_split_faces(Mesh *mesh, int free_loop_normals) +static void rna_Mesh_split_faces(Mesh *mesh, bool free_loop_normals) { BKE_mesh_split_faces(mesh, free_loop_normals != 0); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 56065df45bb..60937b5db31 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -550,7 +550,7 @@ static int rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype) ntreetype->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -794,7 +794,7 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, Main *bmain, ReportList *reports, bNodeSocket *fromsock, bNodeSocket *tosock, - int verify_limits) + bool verify_limits) { bNodeLink *ret; bNode *fromnode = NULL, *tonode = NULL; @@ -1164,7 +1164,7 @@ static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) ntype->ext.call(NULL, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -1189,7 +1189,7 @@ static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree) node->typeinfo->ext.call(NULL, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -1345,7 +1345,7 @@ static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int RNA_parameter_list_free(&list); } -static int rna_Node_is_registered_node_type(StructRNA *type) +static bool rna_Node_is_registered_node_type(StructRNA *type) { return (RNA_struct_blender_type_get(type) != NULL); } @@ -2397,13 +2397,13 @@ static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index) return PointerRNA_NULL; } -static int rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree) +static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree) { bNodeType *ntype = RNA_struct_blender_type_get(srna); return ntype && (!ntype->poll || ntype->poll(ntype, ntree)); } -static int rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) +static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) { bNodeType *ntype = node->typeinfo; if (ntype->poll_instance) { diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 4ba7ae4b6d8..b902fa73334 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -122,7 +122,7 @@ static void rna_Object_select_set(Object *ob, bContext *C, ReportList *reports, } } -static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) +static bool rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) { ViewLayer *view_layer = CTX_data_view_layer(C); Base *base = BKE_view_layer_base_find(view_layer, ob); @@ -135,7 +135,7 @@ static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) return ((base->flag & BASE_SELECTED) != 0) ? 1 : 0; } -static int rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports) +static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports) { ViewLayer *view_layer = CTX_data_view_layer(C); Base *base = BKE_view_layer_base_find(view_layer, ob); @@ -200,7 +200,7 @@ static void rna_Object_camera_fit_coords( /* settings: 0 - preview, 1 - render */ static Mesh *rna_Object_to_mesh( Object *ob, bContext *C, ReportList *reports, Depsgraph *depsgraph, - int apply_modifiers, int calc_tessface, int calc_undeformed) + bool apply_modifiers, bool calc_tessface, bool calc_undeformed) { Main *bmain = CTX_data_main(C); @@ -208,7 +208,7 @@ static Mesh *rna_Object_to_mesh( } static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, - const char *name, int from_mix) + const char *name, bool from_mix) { Main *bmain = CTX_data_main(C); KeyBlock *kb = NULL; @@ -297,7 +297,7 @@ static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt) static void rna_Object_ray_cast( Object *ob, ReportList *reports, float origin[3], float direction[3], float distance, - int *r_success, float r_location[3], float r_normal[3], int *r_index) + bool *r_success, float r_location[3], float r_normal[3], int *r_index) { bool success = false; @@ -352,7 +352,7 @@ static void rna_Object_ray_cast( static void rna_Object_closest_point_on_mesh( Object *ob, ReportList *reports, float origin[3], float distance, - int *r_success, float r_location[3], float r_normal[3], int *r_index) + bool *r_success, float r_location[3], float r_normal[3], int *r_index) { BVHTreeFromMesh treeData = {NULL}; @@ -397,12 +397,12 @@ finally: free_bvhtree_from_mesh(&treeData); } -static int rna_Object_is_modified(Object *ob, Scene *scene, int settings) +static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings) { return BKE_object_is_modified(scene, ob) & settings; } -static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) +static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) { return BKE_object_is_deform_modified(scene, ob) & settings; } @@ -442,7 +442,7 @@ void rna_Object_me_eval_info(struct Object *ob, int type, char *result) } #endif /* NDEBUG */ -static int rna_Object_update_from_editmode(Object *ob, Main *bmain) +static bool rna_Object_update_from_editmode(Object *ob, Main *bmain) { /* fail gracefully if we aren't in edit-mode. */ return ED_object_editmode_load(bmain, ob); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 0dd33944dda..47933ff4b43 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -127,7 +127,7 @@ static void engine_tag_update(RenderEngine *engine) engine->flag |= RE_ENGINE_DO_UPDATE; } -static int engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) +static bool engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) { return IMB_colormanagement_support_glsl_draw(&scene->view_settings); } diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 9c3b1fe3063..aa90ba28e23 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -261,7 +261,7 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value) #endif } -static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const int *values) +static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const bool *values) { RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; int i; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 0d3fe1bac33..874f3a8049d 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -762,14 +762,14 @@ static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values) values[i] = nprop->defaultvalue; } } -static void rna_BoolProperty_default_array_get(PointerRNA *ptr, int *values) +static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values) { PropertyRNA *prop = (PropertyRNA *)ptr->data; BoolPropertyRNA *nprop = (BoolPropertyRNA *)prop; rna_idproperty_check(&prop, ptr); if (nprop->defaultarray) { - memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(int)); + memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(bool)); } else { int i; @@ -1308,16 +1308,16 @@ int rna_property_override_diff_default( case PROP_BOOLEAN: { if (len_a) { - int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; - int *array_a, *array_b; + bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; + bool *array_a, *array_b; - array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") : array_stack_a; - array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") : array_stack_b; + array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") : array_stack_a; + array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") : array_stack_b; RNA_property_boolean_get_array(ptr_a, prop_a, array_a); RNA_property_boolean_get_array(ptr_b, prop_b, array_b); - const int comp = memcmp(array_a, array_b, sizeof(int) * len_a); + const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a); if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ @@ -1342,8 +1342,8 @@ int rna_property_override_diff_default( return comp; } else { - const int value_a = RNA_property_boolean_get(ptr_a, prop_a); - const int value_b = RNA_property_boolean_get(ptr_b, prop_b); + const bool value_a = RNA_property_boolean_get(ptr_a, prop_a); + const bool value_b = RNA_property_boolean_get(ptr_b, prop_b); const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { @@ -2030,8 +2030,8 @@ bool rna_property_override_apply_default( switch (RNA_property_type(prop_dst)) { case PROP_BOOLEAN: if (is_array && index == -1) { - int array_stack_a[RNA_STACK_ARRAY]; - int *array_a; + bool array_stack_a[RNA_STACK_ARRAY]; + bool *array_a; array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a; @@ -2049,7 +2049,7 @@ bool rna_property_override_apply_default( if (array_a != array_stack_a) MEM_freeN(array_a); } else { - const int value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); + const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); switch (override_op) { case IDOVERRIDESTATIC_OP_REPLACE: diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1fbb416f3d8..512b99bdd79 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -546,7 +546,7 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value) } /* Grease pencil Drawing Brushes */ -static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, int setactive) +static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, bool setactive) { bGPDbrush *brush = BKE_gpencil_brush_addnew(ts, name, setactive != 0); @@ -725,7 +725,7 @@ void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) } } -static void rna_Scene_layer_set(PointerRNA *ptr, const int *values) +static void rna_Scene_layer_set(PointerRNA *ptr, const bool *values) { Scene *scene = (Scene *)ptr->data; @@ -1548,7 +1548,7 @@ static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); } -static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value) +static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value) { ToolSettings *ts = (ToolSettings *)ptr->data; int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 003e2561a22..5a8c9646b0b 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -145,7 +145,7 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain) } static void rna_SceneRender_get_frame_path( - RenderData *rd, Main *bmain, int frame, int preview, const char *view, char *name) + RenderData *rd, Main *bmain, int frame, bool preview, const char *view, char *name) { const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view); @@ -166,7 +166,7 @@ static void rna_SceneRender_get_frame_path( static void rna_Scene_ray_cast( Scene *scene, Main *bmain, ViewLayer *view_layer, float origin[3], float direction[3], float ray_dist, - int *r_success, float r_location[3], float r_normal[3], int *r_index, + bool *r_success, float r_location[3], float r_normal[3], int *r_index, Object **r_ob, float r_obmat[16]) { normalize_v3(direction); @@ -214,22 +214,22 @@ static void rna_Scene_alembic_export( int geom_samples, float shutter_open, float shutter_close, - int selected_only, - int uvs, - int normals, - int vcolors, - int apply_subdiv, - int flatten_hierarchy, - int visible_layers_only, - int renderable_only, - int face_sets, - int use_subdiv_schema, - int export_hair, - int export_particles, + bool selected_only, + bool uvs, + bool normals, + bool vcolors, + bool apply_subdiv, + bool flatten_hierarchy, + bool visible_layers_only, + bool renderable_only, + bool face_sets, + bool use_subdiv_schema, + bool export_hair, + bool export_particles, int compression_type, - int packuv, + bool packuv, float scale, - int triangulate, + bool triangulate, int quad_method, int ngon_method) { diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 2529e687ac2..d41d04a4f11 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -289,7 +289,7 @@ static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float re UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]); } -static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, int clip, int result[2]) +static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, bool clip, int result[2]) { if (clip) UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index b1118e79354..3888fd25211 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -424,7 +424,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) } } -static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) +static bool rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) { return imapaint->missing_data == 0; } diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index da8b19a1ff6..509b6da2048 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -61,7 +61,7 @@ #include "WM_api.h" -static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, int do_data) +static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data) { if (do_data) { BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 0cca64d2d93..2edc6f4baaa 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -554,7 +554,7 @@ static float rna_View3DOverlay_GridScaleUnit_get(PointerRNA *ptr) return ED_view3d_grid_scale(scene, v3d, NULL); } -static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) +static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const bool *values) { View3D *v3d = (View3D *)(ptr->data); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index ccc118edfb6..4831f36d20a 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -665,7 +665,7 @@ static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *repor WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL); } -static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, int exact) +static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, bool exact) { if (exact) return BKE_tracking_marker_get_exact(track, framenr); @@ -707,7 +707,7 @@ static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int fram } static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track, - int framenr, int exact) + int framenr, bool exact) { if (exact) return BKE_tracking_plane_marker_get_exact(plane_track, framenr); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 089f7129316..ed381f2e966 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -123,7 +123,7 @@ static int panel_poll(const bContext *C, PanelType *pt) pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -708,7 +708,7 @@ static int menu_poll(const bContext *C, MenuType *pt) pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 95b869940c5..be8bce61910 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -61,7 +61,7 @@ const EnumPropertyItem rna_enum_icon_items[] = { #ifdef RNA_RUNTIME const char *rna_translate_ui_text( - const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate) + const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate) { /* Also return text if UI labels translation is disabled. */ if (!text || !text[0] || !translate || !BLT_translate_iface()) { @@ -97,8 +97,8 @@ const char *rna_translate_ui_text( static void rna_uiItemR( uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt, - int translate, int icon, int expand, int slider, int toggle, int icon_only, int event, - int full_event, int emboss, int index, int icon_value) + bool translate, int icon, bool expand, bool slider, bool toggle, bool icon_only, bool event, + bool full_event, bool emboss, int index, int icon_value) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); int flag = 0; @@ -128,7 +128,7 @@ static void rna_uiItemR( static void rna_uiItemMenuEnumR( uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, - const char *text_ctxt, int translate, int icon) + const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -144,7 +144,7 @@ static void rna_uiItemMenuEnumR( static void rna_uiItemEnumR_string( uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, - const char *name, const char *text_ctxt, int translate, int icon) + const char *name, const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -163,7 +163,7 @@ static void rna_uiItemEnumR_string( static void rna_uiItemPointerR( uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, - const char *name, const char *text_ctxt, int translate, int icon) + const char *name, const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -181,7 +181,7 @@ static void rna_uiItemPointerR( static PointerRNA rna_uiItemO( uiLayout *layout, const char *opname, const char *name, const char *text_ctxt, - int translate, int icon, int emboss, int depress, int icon_value) + bool translate, int icon, bool emboss, bool depress, int icon_value) { wmOperatorType *ot; @@ -207,7 +207,7 @@ static PointerRNA rna_uiItemO( static PointerRNA rna_uiItemOMenuHold( uiLayout *layout, const char *opname, const char *name, const char *text_ctxt, - int translate, int icon, int emboss, int depress, int icon_value, + bool translate, int icon, bool emboss, bool depress, int icon_value, const char *menu) { wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */ @@ -232,7 +232,7 @@ static PointerRNA rna_uiItemOMenuHold( static void rna_uiItemMenuEnumO( uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name, - const char *text_ctxt, int translate, int icon) + const char *text_ctxt, bool translate, int icon) { wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */ @@ -248,7 +248,7 @@ static void rna_uiItemMenuEnumO( } static void rna_uiItemL( - uiLayout *layout, const char *name, const char *text_ctxt, int translate, + uiLayout *layout, const char *name, const char *text_ctxt, bool translate, int icon, int icon_value) { /* Get translated name (label). */ @@ -263,7 +263,7 @@ static void rna_uiItemL( static void rna_uiItemM( uiLayout *layout, const char *menuname, const char *name, const char *text_ctxt, - int translate, int icon, int icon_value) + bool translate, int icon, int icon_value) { /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); @@ -279,7 +279,7 @@ static void rna_uiItemPopoverPanel( uiLayout *layout, bContext *C, int space_type, int region_type, const char *panel_type, const char *name, const char *text_ctxt, - int translate, int icon, int icon_value) + bool translate, int icon, int icon_value) { /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); @@ -300,7 +300,7 @@ static void rna_uiItemPopoverPanelFromGroup( static void rna_uiTemplateAnyID( uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, - const char *name, const char *text_ctxt, int translate) + const char *name, const char *text_ctxt, bool translate) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -318,7 +318,7 @@ static void rna_uiTemplateAnyID( static void rna_uiTemplatePathBuilder( uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr, - const char *name, const char *text_ctxt, int translate) + const char *name, const char *text_ctxt, bool translate) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c4e15174c88..d4ead570118 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1081,7 +1081,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot) ParameterList list; FunctionRNA *func; void *ret; - int visible; + bool visible; RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ @@ -1091,7 +1091,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot) ot->ext.call(C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -1142,7 +1142,7 @@ static bool rna_operator_check_cb(bContext *C, wmOperator *op) op->type->ext.call(C, &opr, func, &list); RNA_parameter_get_lookup(&list, "result", &ret); - result = (*(int *)ret) != 0; + result = (*(bool *)ret) != 0; RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index aff696696af..afb12f48e28 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -89,7 +89,7 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg) BKE_report(op->reports, type, msg); } -static int rna_Operator_is_repeat(wmOperator *op, bContext *C) +static bool rna_Operator_is_repeat(wmOperator *op, bContext *C) { return WM_operator_is_repeat(C, op); } @@ -101,7 +101,7 @@ static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op) } -static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator) +static bool rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator) { return WM_event_add_modal_handler(C, operator) != NULL; } @@ -204,7 +204,7 @@ static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) static wmKeyMapItem *rna_KeyMap_item_new( wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, - int any, int shift, int ctrl, int alt, int oskey, int keymodifier, int head) + bool any, bool shift, bool ctrl, bool alt, bool oskey, int keymodifier, bool head) { /* wmWindowManager *wm = CTX_wm_manager(C); */ wmKeyMapItem *kmi = NULL; @@ -242,8 +242,8 @@ static wmKeyMapItem *rna_KeyMap_item_new( static wmKeyMapItem *rna_KeyMap_item_new_modal( wmKeyMap *km, ReportList *reports, const char *propvalue_str, - int type, int value, int any, int shift, int ctrl, int alt, - int oskey, int keymodifier) + int type, int value, bool any, bool shift, bool ctrl, bool alt, + bool oskey, int keymodifier) { int modifier = 0; int propvalue = 0; @@ -283,7 +283,7 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA RNA_POINTER_INVALIDATE(kmi_ptr); } -static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) +static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal) { if (modal == 0) { return WM_keymap_find(keyconf, idname, spaceid, regionid); @@ -338,7 +338,7 @@ static PointerRNA rna_KeyConfig_find_item_from_operator( const char *idname, int opcontext, PointerRNA *properties, - int is_hotkey, + bool is_hotkey, PointerRNA *km_ptr) { char idname_bl[OP_MAX_TYPENAME]; diff --git a/source/blender/makesrna/intern/rna_wm_manipulator_api.c b/source/blender/makesrna/intern/rna_wm_manipulator_api.c index c948f84e087..16804042608 100644 --- a/source/blender/makesrna/intern/rna_wm_manipulator_api.c +++ b/source/blender/makesrna/intern/rna_wm_manipulator_api.c @@ -166,7 +166,7 @@ static PointerRNA rna_manipulator_target_set_operator( /** \name Manipulator Property Access * \{ */ -static int rna_manipulator_target_is_valid( +static bool rna_manipulator_target_is_valid( wmManipulator *mpr, ReportList *reports, const char *target_propname) { wmManipulatorProperty *mpr_prop = diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 041b2b9157f..166d71689d1 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -121,13 +121,13 @@ static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bTool } static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode( - WorkSpace *workspace, int mode, int create) + WorkSpace *workspace, int mode, bool create) { return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode}, create); } static bToolRef *rna_WorkSpace_tools_from_space_image_mode( - WorkSpace *workspace, int mode, int create) + WorkSpace *workspace, int mode, bool create) { return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode}, create); } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index cee9ad3b477..d2d78167fae 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -91,7 +91,7 @@ int PyC_AsArray_FAST( } } else if (type == &PyBool_Type) { - int *array_bool = array; + bool *array_bool = array; for (i = 0; i < length; i++) { array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index d0b0331430d..a7f55116cd4 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -263,7 +263,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc } } -static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) +static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -273,7 +273,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyGILState_STATE gilstate; bool use_gil; const bool is_write_ok = pyrna_write_check(); - int value; + bool value; BLI_assert(py_data != NULL); @@ -301,12 +301,15 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p value = false; } else { - value = PyC_Long_AsI32(ret); + int value_i = PyC_Long_AsBool(ret); - if (value == -1 && PyErr_Occurred()) { + if (value_i == -1 && PyErr_Occurred()) { PyC_Err_PrintWithFunc(py_func); value = false; } + else { + value = (bool)value_i; + } Py_DECREF(ret); } @@ -321,7 +324,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p return value; } -static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int value) +static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -420,7 +423,7 @@ static int bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struc return result; } -static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values) +static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -481,7 +484,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert } } -static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values) +static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -511,7 +514,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert self = pyrna_struct_as_instance(ptr); PyTuple_SET_ITEM(args, 0, self); - py_values = PyC_Tuple_PackArray_I32FromBool(values, len); + py_values = PyC_Tuple_PackArray_Bool(values, len); PyTuple_SET_ITEM(args, 1, py_values); ret = PyObject_CallObject(py_func, args); @@ -2097,7 +2100,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if (srna) { const char *id = NULL, *name = NULL, *description = ""; int id_len; - int def[PYRNA_STACK_ARRAY] = {0}; + bool def[PYRNA_STACK_ARRAY] = {0}; int size = 3; PropertyRNA *prop; PyObject *pydef = NULL; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index be0e9771a0a..3e1c85d7f9f 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1667,7 +1667,7 @@ static int pyrna_py_to_prop( return -1; } else { - if (data) *((int *)data) = param; + if (data) *((bool *)data) = param; else RNA_property_boolean_set(ptr, prop, param); } break; @@ -2486,9 +2486,9 @@ static PyObject *pyrna_prop_array_subscript_slice( } case PROP_BOOLEAN: { - int values_stack[PYRNA_STACK_ARRAY]; - int *values; - if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); } + bool values_stack[PYRNA_STACK_ARRAY]; + bool *values; + if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(bool) * length); } else { values = values_stack; } RNA_property_boolean_get_array(ptr, prop, values); @@ -2869,7 +2869,7 @@ static int prop_subscript_ass_array_slice__int_recursive( } static int prop_subscript_ass_array_slice__bool_recursive( - PyObject **value_items, int *value, + PyObject **value_items, bool *value, int totdim, const int dimsize[]) { const int length = dimsize[0]; @@ -2992,9 +2992,9 @@ static int prop_subscript_ass_array_slice( } case PROP_BOOLEAN: { - int values_stack[PYRNA_STACK_ARRAY]; - int *values = (length_flat > PYRNA_STACK_ARRAY) ? - (values_alloc = PyMem_MALLOC(sizeof(*values) * length_flat)) : values_stack; + bool values_stack[PYRNA_STACK_ARRAY]; + bool *values = (length_flat > PYRNA_STACK_ARRAY) ? + (values_alloc = PyMem_MALLOC(sizeof(bool) * length_flat)) : values_stack; if (start != 0 || stop != length) { /* partial assignment? - need to get the array */ @@ -4986,6 +4986,8 @@ static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, con case PROP_RAW_INT: if (attr_signed) return (f == 'i') ? 1 : 0; else return (f == 'I') ? 1 : 0; + case PROP_RAW_BOOLEAN: + return (f == '?') ? 1 : 0; case PROP_RAW_FLOAT: return (f == 'f') ? 1 : 0; case PROP_RAW_DOUBLE: @@ -5052,6 +5054,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) case PROP_RAW_INT: ((int *)array)[i] = (int)PyLong_AsLong(item); break; + case PROP_RAW_BOOLEAN: + ((bool *)array)[i] = (int)PyLong_AsLong(item) != 0; + break; case PROP_RAW_FLOAT: ((float *)array)[i] = (float)PyFloat_AsDouble(item); break; @@ -5386,7 +5391,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat case PROP_BOOLEAN: ret = PyTuple_New(len); for (a = 0; a < len; a++) - PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a])); + PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a])); break; case PROP_INT: ret = PyTuple_New(len); @@ -5429,7 +5434,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat /* see if we can coerce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: - ret = PyBool_FromLong(*(int *)data); + ret = PyBool_FromLong(*(bool *)data); break; case PROP_INT: ret = PyLong_FromLong(*(int *)data); diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 571ee0edea2..9a184df8054 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -564,7 +564,7 @@ static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char * static void py_to_bool(const struct ItemConvertArgData *UNUSED(arg), PyObject *py, char *data) { - *(int *)data = (int)PyObject_IsTrue(py); + *(bool *)data = (bool)PyObject_IsTrue(py); } static int py_float_check(PyObject *py) @@ -596,7 +596,7 @@ static void int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *v static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value) { - RNA_property_boolean_set_index(ptr, prop, index, *(int *)value); + RNA_property_boolean_set_index(ptr, prop, index, *(bool *)value); } static void convert_item_init_float( @@ -655,7 +655,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, convert_item_init_bool(ptr, prop, &convert_item); ret = py_to_array( - py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), + py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(bool), &convert_item, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); break; } @@ -885,10 +885,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) } break; } - case PROP_BOOLEAN: case PROP_INT: { - int value_i = PyLong_AsLong(value); + int value_i = PyC_Long_AsI32(value); if (value_i == -1 && PyErr_Occurred()) { PyErr_Clear(); return 0; @@ -904,10 +903,40 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) tmp_arr = tmp; } - if (type == PROP_BOOLEAN) - RNA_property_boolean_get_array(ptr, prop, tmp_arr); - else - RNA_property_int_get_array(ptr, prop, tmp_arr); + RNA_property_int_get_array(ptr, prop, tmp_arr); + + for (i = 0; i < len; i++) { + if (tmp_arr[i] == value_i) { + break; + } + } + + if (tmp_arr != tmp) + PyMem_FREE(tmp_arr); + + return i < len ? 1 : 0; + } + break; + } + case PROP_BOOLEAN: + { + int value_i = PyC_Long_AsBool(value); + if (value_i == -1 && PyErr_Occurred()) { + PyErr_Clear(); + return 0; + } + else { + bool tmp[32]; + bool *tmp_arr; + + if (len * sizeof(bool) > sizeof(tmp)) { + tmp_arr = PyMem_MALLOC(len * sizeof(bool)); + } + else { + tmp_arr = tmp; + } + + RNA_property_boolean_get_array(ptr, prop, tmp_arr); for (i = 0; i < len; i++) { if (tmp_arr[i] == value_i) { diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 0620ca6d11d..1ca889f2347 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -153,16 +153,16 @@ void RE_result_load_from_file(struct RenderResult *result, struct ReportList *re struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h, const char *layername, const char *viewname); void RE_engine_update_result(RenderEngine *engine, struct RenderResult *result); void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, const char *chan_id, const char *layername); -void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, int cancel, int highlight, int merge_results); +void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, bool cancel, bool highlight, bool merge_results); struct RenderResult *RE_engine_get_result(struct RenderEngine *engine); const char *RE_engine_active_view_get(RenderEngine *engine); void RE_engine_active_view_set(RenderEngine *engine, const char *viewname); -float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, int use_spherical_stereo); -void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, int use_spherical_stereo, float *r_modelmat); -int RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera); +float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo); +void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo, float *r_modelmat); +bool RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera); -int RE_engine_test_break(RenderEngine *engine); +bool RE_engine_test_break(RenderEngine *engine); void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info); void RE_engine_update_progress(RenderEngine *engine, float progress); void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak); diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 7a9be04d8f6..5c3f510ffca 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -263,7 +263,7 @@ void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, co render_result_add_pass(re->result, name, channels, chan_id, layername, NULL); } -void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel, int highlight, int merge_results) +void RE_engine_end_result(RenderEngine *engine, RenderResult *result, bool cancel, bool highlight, bool merge_results) { Render *re = engine->re; @@ -314,7 +314,7 @@ RenderResult *RE_engine_get_result(RenderEngine *engine) /* Cancel */ -int RE_engine_test_break(RenderEngine *engine) +bool RE_engine_test_break(RenderEngine *engine) { Render *re = engine->re; @@ -407,7 +407,7 @@ void RE_engine_active_view_set(RenderEngine *engine, const char *viewname) RE_SetActiveRenderView(re, viewname); } -float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use_spherical_stereo) +float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, bool use_spherical_stereo) { Render *re = engine->re; @@ -419,7 +419,7 @@ float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use } void RE_engine_get_camera_model_matrix( - RenderEngine *engine, Object *camera, int use_spherical_stereo, float *r_modelmat) + RenderEngine *engine, Object *camera, bool use_spherical_stereo, float *r_modelmat) { Render *re = engine->re; @@ -430,7 +430,7 @@ void RE_engine_get_camera_model_matrix( BKE_camera_multiview_model_matrix(re ? &re->r : NULL, camera, re->viewname, (float (*)[4])r_modelmat); } -int RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera) +bool RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera) { Render *re = engine->re; return BKE_camera_multiview_spherical_stereo(re ? &re->r : NULL, camera) ? 1 : 0; diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index f5630a9c530..d1f6d268835 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -81,7 +81,7 @@ bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap); bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap); wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id); -int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2); +bool WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2); /* Modal Keymap */ diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 2b0c550280d..9c435297069 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1367,7 +1367,7 @@ wmKeyMapItem *WM_key_event_operator( return wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, r_keymap); } -int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2) +bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2) { int k1type, k2type; |