[Bf-blender-cvs] [c3f6227f303] master: Cleanup: Use bool instead of int
Hans Goudey
noreply at git.blender.org
Tue Jul 28 20:24:16 CEST 2020
Commit: c3f6227f303a9ee379d5b88d5952ae589cb8782c
Author: Hans Goudey
Date: Tue Jul 28 14:24:25 2020 -0400
Branches: master
https://developer.blender.org/rBc3f6227f303a9ee379d5b88d5952ae589cb8782c
Cleanup: Use bool instead of int
===================================================================
M source/blender/editors/space_buttons/buttons_context.c
===================================================================
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index f2f377c142f..9e5c630ec60 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -102,7 +102,7 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
/************************* Creating the Path ************************/
-static int buttons_context_path_scene(ButsContextPath *path)
+static bool buttons_context_path_scene(ButsContextPath *path)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
@@ -163,14 +163,14 @@ static int buttons_context_path_world(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
+static bool buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
{
FreestyleLineStyle *linestyle;
PointerRNA *ptr = &path->ptr[path->len - 1];
/* if we already have a (pinned) linestyle, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_FreestyleLineStyle)) {
- return 1;
+ return true;
}
/* if we have a view layer, use the lineset's linestyle */
if (buttons_context_path_view_layer(path, window)) {
@@ -179,24 +179,24 @@ static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *windo
if (linestyle) {
RNA_id_pointer_create(&linestyle->id, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
/* no path to a linestyle possible */
- return 0;
+ return false;
}
-static int buttons_context_path_object(ButsContextPath *path)
+static bool buttons_context_path_object(ButsContextPath *path)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
/* if we already have a (pinned) object, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
- return 1;
+ return true;
}
if (!RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) {
- return 0;
+ return false;
}
ViewLayer *view_layer = ptr->data;
@@ -206,58 +206,58 @@ static int buttons_context_path_object(ButsContextPath *path)
RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
/* no path to a object possible */
- return 0;
+ return false;
}
-static int buttons_context_path_data(ButsContextPath *path, int type)
+static bool buttons_context_path_data(ButsContextPath *path, int type)
{
Object *ob;
PointerRNA *ptr = &path->ptr[path->len - 1];
/* if we already have a data, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
(type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) {
- return 1;
+ return true;
}
if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) {
- return 1;
+ return true;
}
/* try to get an object in the path, no pinning supported here */
if (buttons_context_path_object(path)) {
@@ -267,15 +267,15 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
/* no path to data possible */
- return 0;
+ return false;
}
-static int buttons_context_path_modifier(ButsContextPath *path)
+static bool buttons_context_path_modifier(ButsContextPath *path)
{
Object *ob;
@@ -292,14 +292,14 @@ static int buttons_context_path_modifier(ButsContextPath *path)
OB_HAIR,
OB_POINTCLOUD,
OB_VOLUME)) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-static int buttons_context_path_shaderfx(ButsContextPath *path)
+static bool buttons_context_path_shaderfx(ButsContextPath *path)
{
Object *ob;
@@ -307,14 +307,14 @@ static int buttons_context_path_shaderfx(ButsContextPath *path)
ob = path->ptr[path->len - 1].data;
if (ob && ELEM(ob->type, OB_GPENCIL)) {
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
-static int buttons_context_path_material(ButsContextPath *path)
+static bool buttons_context_path_material(ButsContextPath *path)
{
Object *ob;
PointerRNA *ptr = &path->ptr[path->len - 1];
@@ -322,7 +322,7 @@ static int buttons_context_path_material(ButsContextPath *path)
/* if we already have a (pinned) material, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_Material)) {
- return 1;
+ return true;
}
/* if we have an object, use the object material slot */
if (buttons_context_path_object(path)) {
@@ -332,15 +332,15 @@ static int buttons_context_path_material(ButsContextPath *path)
ma = BKE_object_material_get(ob, ob->actcol);
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
/* no path to a material possible */
- return 0;
+ return false;
}
-static int buttons_context_path_bone(ButsContextPath *path)
+static bool buttons_context_path_bone(ButsContextPath *path)
{
bArmature *arm;
EditBone *edbo;
@@ -354,29 +354,29 @@ static int buttons_context_path_bone(ButsContextPath *path)
edbo = arm->act_edbone;
RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
else {
if (arm->act_bone) {
RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
}
/* no path to a bone possible */
- return 0;
+ return false;
}
-static int buttons_context_path_pose_bone(ButsContextPath *path)
+static bool buttons_context_path_pose_bone(ButsContextPath *path)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
/* if we already have a (pinned) PoseBone, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
- return 1;
+ return true;
}
/* if we have an armature, get the active bone */
@@ -385,7 +385,7 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
bArmature *arm = ob->data; /* path->ptr[path->len-1].data - works too */
if (ob->type != OB_ARMATURE || arm->edbo) {
- return 0;
+ return false;
}
if (arm->act_bone) {
@@ -393,16 +393,16 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
if (pchan) {
RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
}
/* no path to a bone possible */
- return 0;
+ return false;
}
-static int buttons_context_path_particle(ButsContextPath *path)
+static bool buttons_context_path_particle(ButsContextPath *path)
{
Object *ob;
ParticleSystem *psys;
@@ -410,7 +410,7 @@ static int buttons_context_path_particle(ButsContextPath *path)
/* if we already have (pinned) particle settings, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
- return 1;
+ return true;
}
/* if we have an object, get the active particle system */
if (buttons_context_path_object(path)) {
@@ -421,15 +421,15 @@ static int buttons_context_path_particle(ButsContextPath *path)
RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
/* no path to a particle system possible */
- return 0;
+ return false;
}
-static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
+static bool buttons_context_path_brush(const bContext *C, ButsContextPath *path)
{
Scene *scene;
Brush *br = NULL;
@@ -437,7 +437,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
/* if we already have a (pinned) brush, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_Brush)) {
- return 1;
+ return true;
}
/* if we have a scene, use the toolsettings brushes */
if (buttons_context_path_scene(path)) {
@@ -453,32 +453,32 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
path->len++;
- return 1;
+ return true;
}
}
/* no path to a brush possible */
- return 0;
+ return false;
}
-static int buttons_context_path_texture(const bContext *C,
- ButsContextPath *path,
- ButsContextTexture *ct)
+static bool buttons_context_path_texture(const bContext *C,
+ ButsContextPath *path,
+ ButsCont
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list