Cleanup: Use true and false for booleans

This commit is contained in:
Hans Goudey 2020-12-22 14:58:57 -06:00
parent 4b46afae09
commit 8d3d4c8840
Notes: blender-bot 2023-09-08 04:55:43 +02:00
Referenced by issue #83375, Blender 2.91 multi scene and engine render crash
1 changed files with 12 additions and 16 deletions

View File

@ -710,14 +710,13 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
ob->mode = OB_MODE_EDIT;
if (ob->type == OB_MESH) {
BMEditMesh *em;
ok = 1;
ok = true;
const bool use_key_index = mesh_needs_keyindex(bmain, ob->data);
EDBM_mesh_make(ob, scene->toolsettings->selectmode, use_key_index);
em = BKE_editmesh_from_object(ob);
BMEditMesh *em = BKE_editmesh_from_object(ob);
if (LIKELY(em)) {
/* order doesn't matter */
EDBM_mesh_normals_update(em);
@ -728,7 +727,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
}
else if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
ok = 1;
ok = true;
ED_armature_to_edit(arm);
/* To ensure all goes in rest-position and without striding. */
@ -740,7 +739,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
}
else if (ob->type == OB_FONT) {
ok = 1;
ok = true;
ED_curve_editfont_make(ob);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_TEXT, scene);
@ -748,7 +747,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
else if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
ok = 1;
ok = true;
ED_mball_editmball_make(ob);
mb->needs_flush_to_id = 0;
@ -756,13 +755,13 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_MBALL, scene);
}
else if (ob->type == OB_LATTICE) {
ok = 1;
ok = true;
BKE_editlattice_make(ob);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_LATTICE, scene);
}
else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
ok = 1;
ok = true;
ED_curve_editnurb_make(ob);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_CURVE, scene);
@ -849,12 +848,12 @@ static bool editmode_toggle_poll(bContext *C)
/* covers proxies too */
if (ELEM(NULL, ob, ob->data) || ID_IS_LINKED(ob->data) || ID_IS_OVERRIDE_LIBRARY(ob) ||
ID_IS_OVERRIDE_LIBRARY(ob->data)) {
return 0;
return false;
}
/* if hidden but in edit mode, we still display */
if ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT)) {
return 0;
return false;
}
return OB_TYPE_SUPPORT_EDITMODE(ob->type);
@ -1509,14 +1508,13 @@ static const EnumPropertyItem *object_mode_set_itemsf(bContext *C,
{
const EnumPropertyItem *input = rna_enum_object_mode_items;
EnumPropertyItem *item = NULL;
Object *ob;
int totitem = 0;
if (!C) { /* needed for docs */
return rna_enum_object_mode_items;
}
ob = CTX_data_active_object(C);
Object *ob = CTX_data_active_object(C);
if (ob) {
const bool use_mode_particle_edit = (BLI_listbase_is_empty(&ob->particlesystem) == false) ||
(ob->soft != NULL) ||
@ -1743,8 +1741,6 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "collection_index");
const bool is_link = STREQ(op->idname, "OBJECT_OT_link_to_collection");
const bool is_new = RNA_boolean_get(op->ptr, "is_new");
Collection *collection;
ListBase objects = {NULL};
if (!RNA_property_is_set(op->ptr, prop)) {
BKE_report(op->reports, RPT_ERROR, "No collection selected");
@ -1752,13 +1748,13 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
}
int collection_index = RNA_property_int_get(op->ptr, prop);
collection = BKE_collection_from_index(scene, collection_index);
Collection *collection = BKE_collection_from_index(scene, collection_index);
if (collection == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unexpected error, collection not found");
return OPERATOR_CANCELLED;
}
objects = selected_objects_get(C);
ListBase objects = selected_objects_get(C);
if (is_new) {
char new_collection_name[MAX_NAME];