From 87ceff3d1b5805658622a314a84620b52ab98c7d Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 23 Jun 2020 11:30:46 +0200 Subject: Preferences: New experimental settings for particle system and hair This replaces the cmake options `WITH_NEW_OBJECT_TYPES` and `WITH_NEW_SIMULATION_TYPE` with two experimental userpref settings: * `use_new_particle_system`: Enables the point cloud type and the simulation editor. * `use_new_hair_type`: Only displays the add-operator in the add menu for now. Note, in the current state you can't do anything productive with the new particle system or the new hair type. Features will be added step by step in the upcoming weeks and months. Reviewers: brecht Differential Revision: https://developer.blender.org/D8096 --- source/blender/editors/space_buttons/buttons_context.c | 6 ------ 1 file changed, 6 deletions(-) (limited to '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 7e6088bc3cc..ba618083620 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -251,14 +251,12 @@ static int buttons_context_path_data(ButsContextPath *path, int type) else if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { return 1; } -#ifdef WITH_NEW_OBJECT_TYPES else if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { return 1; } else if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { return 1; } -#endif else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { return 1; } @@ -796,10 +794,8 @@ const char *buttons_context_dir[] = { "line_style", "collection", "gpencil", -#ifdef WITH_NEW_OBJECT_TYPES "hair", "pointcloud", -#endif "volume", NULL, }; @@ -878,7 +874,6 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_LightProbe); return 1; } -#ifdef WITH_NEW_OBJECT_TYPES else if (CTX_data_equals(member, "hair")) { set_pointer_type(path, result, &RNA_Hair); return 1; @@ -887,7 +882,6 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_PointCloud); return 1; } -#endif else if (CTX_data_equals(member, "volume")) { set_pointer_type(path, result, &RNA_Volume); return 1; -- cgit v1.2.3 From b61ecb785c96a7959ddc91c0efe68d1eb9358c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Jul 2020 16:34:57 +0200 Subject: Cleanup: Explicit return in each `else if` block in `buttons_context()` This is a similar change as in rB4283da83cc9. No functional changes. --- source/blender/editors/space_buttons/buttons_context.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '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 ba618083620..f4141fd31f8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -956,6 +956,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "texture_slot")) { ButsContextTexture *ct = sbuts->texuser; @@ -1039,6 +1040,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md); return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "soft_body")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); @@ -1049,6 +1051,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md); return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "fluid")) { @@ -1060,6 +1063,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ob->id, &RNA_FluidModifier, md); return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "collision")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); @@ -1070,6 +1074,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md); return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "brush")) { set_pointer_type(path, result, &RNA_Brush); @@ -1084,6 +1089,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md); return 1; } + return -1; /* found but not available */ } else if (CTX_data_equals(member, "line_style")) { set_pointer_type(path, result, &RNA_FreestyleLineStyle); -- cgit v1.2.3 From 33a74941c5fd4efb6eefcaace3315d3e2b65681f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Jul 2020 17:30:31 +0200 Subject: Cleanup: Editors, Clang-Tidy else-after-return fixes This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors` module. No functional changes. --- .../editors/space_buttons/buttons_context.c | 168 ++++++++++----------- 1 file changed, 81 insertions(+), 87 deletions(-) (limited to '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 f4141fd31f8..f2f377c142f 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -146,7 +146,7 @@ static int buttons_context_path_world(ButsContextPath *path) return 1; } /* if we have a scene, use the scene's world */ - else if (buttons_context_path_scene(path)) { + if (buttons_context_path_scene(path)) { scene = path->ptr[path->len - 1].data; world = scene->world; @@ -155,9 +155,8 @@ static int buttons_context_path_world(ButsContextPath *path) path->len++; return 1; } - else { - return 1; - } + + return 1; } /* no path to a world possible */ @@ -174,7 +173,7 @@ static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *windo return 1; } /* if we have a view layer, use the lineset's linestyle */ - else if (buttons_context_path_view_layer(path, window)) { + if (buttons_context_path_view_layer(path, window)) { ViewLayer *view_layer = path->ptr[path->len - 1].data; linestyle = BKE_linestyle_active_from_view_layer(view_layer); if (linestyle) { @@ -223,45 +222,45 @@ static int buttons_context_path_data(ButsContextPath *path, int type) if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Curve) && - (type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) { + if (RNA_struct_is_a(ptr->type, &RNA_Curve) && + (type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) { + if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) { + if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) { + if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) { + if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) { + if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) { + if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) { + if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { + if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { + if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { + if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { return 1; } - else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { + if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { return 1; } /* try to get an object in the path, no pinning supported here */ - else if (buttons_context_path_object(path)) { + if (buttons_context_path_object(path)) { ob = path->ptr[path->len - 1].data; if (ob && (type == -1 || type == ob->type)) { @@ -326,7 +325,7 @@ static int buttons_context_path_material(ButsContextPath *path) return 1; } /* if we have an object, use the object material slot */ - else if (buttons_context_path_object(path)) { + if (buttons_context_path_object(path)) { ob = path->ptr[path->len - 1].data; if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { @@ -388,14 +387,13 @@ static int buttons_context_path_pose_bone(ButsContextPath *path) if (ob->type != OB_ARMATURE || arm->edbo) { return 0; } - else { - if (arm->act_bone) { - bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name); - if (pchan) { - RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]); - path->len++; - return 1; - } + + if (arm->act_bone) { + bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name); + if (pchan) { + RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]); + path->len++; + return 1; } } } @@ -442,7 +440,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) return 1; } /* if we have a scene, use the toolsettings brushes */ - else if (buttons_context_path_scene(path)) { + if (buttons_context_path_scene(path)) { scene = path->ptr[path->len - 1].data; if (scene) { @@ -661,10 +659,10 @@ static int buttons_shading_new_context(const bContext *C, int flag) if (flag & (1 << BCONTEXT_MATERIAL)) { return BCONTEXT_MATERIAL; } - else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) { + if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) { return BCONTEXT_DATA; } - else if (flag & (1 << BCONTEXT_WORLD)) { + if (flag & (1 << BCONTEXT_WORLD)) { return BCONTEXT_WORLD; } @@ -825,72 +823,72 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return 1; } - else if (CTX_data_equals(member, "scene")) { + if (CTX_data_equals(member, "scene")) { /* Do not return one here if scene not found in path, * in this case we want to get default context scene! */ return set_pointer_type(path, result, &RNA_Scene); } - else if (CTX_data_equals(member, "world")) { + if (CTX_data_equals(member, "world")) { set_pointer_type(path, result, &RNA_World); return 1; } - else if (CTX_data_equals(member, "object")) { + if (CTX_data_equals(member, "object")) { set_pointer_type(path, result, &RNA_Object); return 1; } - else if (CTX_data_equals(member, "mesh")) { + if (CTX_data_equals(member, "mesh")) { set_pointer_type(path, result, &RNA_Mesh); return 1; } - else if (CTX_data_equals(member, "armature")) { + if (CTX_data_equals(member, "armature")) { set_pointer_type(path, result, &RNA_Armature); return 1; } - else if (CTX_data_equals(member, "lattice")) { + if (CTX_data_equals(member, "lattice")) { set_pointer_type(path, result, &RNA_Lattice); return 1; } - else if (CTX_data_equals(member, "curve")) { + if (CTX_data_equals(member, "curve")) { set_pointer_type(path, result, &RNA_Curve); return 1; } - else if (CTX_data_equals(member, "meta_ball")) { + if (CTX_data_equals(member, "meta_ball")) { set_pointer_type(path, result, &RNA_MetaBall); return 1; } - else if (CTX_data_equals(member, "light")) { + if (CTX_data_equals(member, "light")) { set_pointer_type(path, result, &RNA_Light); return 1; } - else if (CTX_data_equals(member, "camera")) { + if (CTX_data_equals(member, "camera")) { set_pointer_type(path, result, &RNA_Camera); return 1; } - else if (CTX_data_equals(member, "speaker")) { + if (CTX_data_equals(member, "speaker")) { set_pointer_type(path, result, &RNA_Speaker); return 1; } - else if (CTX_data_equals(member, "lightprobe")) { + if (CTX_data_equals(member, "lightprobe")) { set_pointer_type(path, result, &RNA_LightProbe); return 1; } - else if (CTX_data_equals(member, "hair")) { + if (CTX_data_equals(member, "hair")) { set_pointer_type(path, result, &RNA_Hair); return 1; } - else if (CTX_data_equals(member, "pointcloud")) { + if (CTX_data_equals(member, "pointcloud")) { set_pointer_type(path, result, &RNA_PointCloud); return 1; } - else if (CTX_data_equals(member, "volume")) { + if (CTX_data_equals(member, "volume")) { set_pointer_type(path, result, &RNA_Volume); return 1; } - else if (CTX_data_equals(member, "material")) { + if (CTX_data_equals(member, "material")) { set_pointer_type(path, result, &RNA_Material); return 1; } - else if (CTX_data_equals(member, "texture")) { + if (CTX_data_equals(member, "texture")) { ButsContextTexture *ct = sbuts->texuser; if (ct) { @@ -899,7 +897,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if (CTX_data_equals(member, "material_slot")) { + if (CTX_data_equals(member, "material_slot")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr) { @@ -917,7 +915,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if (CTX_data_equals(member, "texture_user")) { + if (CTX_data_equals(member, "texture_user")) { ButsContextTexture *ct = sbuts->texuser; if (!ct) { @@ -931,7 +929,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if (CTX_data_equals(member, "texture_user_property")) { + if (CTX_data_equals(member, "texture_user_property")) { ButsContextTexture *ct = sbuts->texuser; if (!ct) { @@ -945,7 +943,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if (CTX_data_equals(member, "texture_node")) { + if (CTX_data_equals(member, "texture_node")) { ButsContextTexture *ct = sbuts->texuser; if (ct) { @@ -958,7 +956,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return -1; /* found but not available */ } - else if (CTX_data_equals(member, "texture_slot")) { + if (CTX_data_equals(member, "texture_slot")) { ButsContextTexture *ct = sbuts->texuser; PointerRNA *ptr; @@ -985,23 +983,23 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } - else if (CTX_data_equals(member, "bone")) { + if (CTX_data_equals(member, "bone")) { set_pointer_type(path, result, &RNA_Bone); return 1; } - else if (CTX_data_equals(member, "edit_bone")) { + if (CTX_data_equals(member, "edit_bone")) { set_pointer_type(path, result, &RNA_EditBone); return 1; } - else if (CTX_data_equals(member, "pose_bone")) { + if (CTX_data_equals(member, "pose_bone")) { set_pointer_type(path, result, &RNA_PoseBone); return 1; } - else if (CTX_data_equals(member, "particle_system")) { + if (CTX_data_equals(member, "particle_system")) { set_pointer_type(path, result, &RNA_ParticleSystem); return 1; } - else if (CTX_data_equals(member, "particle_system_editable")) { + if (CTX_data_equals(member, "particle_system_editable")) { if (PE_poll((bContext *)C)) { set_pointer_type(path, result, &RNA_ParticleSystem); } @@ -1010,7 +1008,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return 1; } - else if (CTX_data_equals(member, "particle_settings")) { + if (CTX_data_equals(member, "particle_settings")) { /* only available when pinned */ PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings); @@ -1018,20 +1016,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, ptr->data); return 1; } - else { - /* get settings from active particle system instead */ - ptr = get_pointer_type(path, &RNA_ParticleSystem); - if (ptr && ptr->data) { - ParticleSettings *part = ((ParticleSystem *)ptr->data)->part; - CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part); - return 1; - } + /* get settings from active particle system instead */ + ptr = get_pointer_type(path, &RNA_ParticleSystem); + + if (ptr && ptr->data) { + ParticleSettings *part = ((ParticleSystem *)ptr->data)->part; + CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part); + return 1; } + set_pointer_type(path, result, &RNA_ParticleSettings); return 1; } - else if (CTX_data_equals(member, "cloth")) { + if (CTX_data_equals(member, "cloth")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { @@ -1042,7 +1040,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return -1; /* found but not available */ } - else if (CTX_data_equals(member, "soft_body")) { + if (CTX_data_equals(member, "soft_body")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { @@ -1054,7 +1052,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return -1; /* found but not available */ } - else if (CTX_data_equals(member, "fluid")) { + if (CTX_data_equals(member, "fluid")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { @@ -1065,7 +1063,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return -1; /* found but not available */ } - else if (CTX_data_equals(member, "collision")) { + if (CTX_data_equals(member, "collision")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { @@ -1076,11 +1074,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return -1; /* found but not available */ } - else if (CTX_data_equals(member, "brush")) { + if (CTX_data_equals(member, "brush")) { set_pointer_type(path, result, &RNA_Brush); return 1; } - else if (CTX_data_equals(member, "dynamic_paint")) { + if (CTX_data_equals(member, "dynamic_paint")) { PointerRNA *ptr = get_pointer_type(path, &RNA_Object); if (ptr && ptr->data) { @@ -1091,19 +1089,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r } return -1; /* found but not available */ } - else if (CTX_data_equals(member, "line_style")) { + if (CTX_data_equals(member, "line_style")) { set_pointer_type(path, result, &RNA_FreestyleLineStyle); return 1; } - else if (CTX_data_equals(member, "gpencil")) { + if (CTX_data_equals(member, "gpencil")) { set_pointer_type(path, result, &RNA_GreasePencil); return 1; } - else { - return 0; /* not found */ - } - - return -1; /* found but not available */ + return 0; /* not found */ } /************************* Drawing the Path ************************/ @@ -1154,13 +1148,13 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) ptr->type == &RNA_Scene)) { continue; } - else if ((!ELEM(sbuts->mainb, - BCONTEXT_RENDER, - BCONTEXT_OUTPUT, - BCONTEXT_SCENE, - BCONTEXT_VIEW_LAYER, - BCONTEXT_WORLD) && - ptr->type == &RNA_ViewLayer)) { + if ((!ELEM(sbuts->mainb, + BCONTEXT_RENDER, + BCONTEXT_OUTPUT, + BCONTEXT_SCENE, + BCONTEXT_VIEW_LAYER, + BCONTEXT_WORLD) && + ptr->type == &RNA_ViewLayer)) { continue; } -- cgit v1.2.3 From c3f6227f303a9ee379d5b88d5952ae589cb8782c Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 28 Jul 2020 14:24:25 -0400 Subject: Cleanup: Use bool instead of int --- .../editors/space_buttons/buttons_context.c | 132 ++++++++++----------- 1 file changed, 66 insertions(+), 66 deletions(-) (limited to '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, + ButsContextTexture *ct) { PointerRNA *ptr = &path->ptr[path->len - 1]; ID *id; if (!ct) { - return 0; + return false; } /* if we already have a (pinned) texture, we're done */ if (RNA_struct_is_a(ptr->type, &RNA_Texture)) { - return 1; + return true; } if (!ct->user) { - return 0; + return false; } id = ct->user->id; @@ -503,7 +503,7 @@ static int buttons_context_path_texture(const bContext *C, path->len++; } - return 1; + return true; } #ifdef WITH_FREESTYLE @@ -532,7 +532,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *vie } #endif -static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) +static bool buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) { /* Note we don't use CTX_data here, instead we get it from the window. * Otherwise there is a loop reading the context that we are setting. */ @@ -627,27 +627,27 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found = buttons_context_path_pose_bone(path); break; default: - found = 0; + found = false; break; } return found; } -static int buttons_shading_context(const bContext *C, int mainb) +static bool buttons_shading_context(const bContext *C, int mainb) { wmWindow *window = CTX_wm_window(C); ViewLayer *view_layer = WM_window_get_active_view_layer(window); Object *ob = OBACT(view_layer); if (ELEM(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE)) { - return 1; + return true; } if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA)) { - return 1; + return true; } - return 0; + return false; } static int buttons_shading_new_context(const bContext *C, int flag) -- cgit v1.2.3 From 4089b07aa05c68fcbefa0b8b6c574173953e1c85 Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 30 Jul 2020 18:14:48 +0200 Subject: Cleanup: Remove pre 2.80 headers Review: D8341 --- source/blender/editors/space_buttons/buttons_context.c | 1 - 1 file changed, 1 deletion(-) (limited to '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..16256f6c97e 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -56,7 +56,6 @@ #include "RNA_access.h" #include "ED_armature.h" -#include "ED_buttons.h" #include "ED_physics.h" #include "ED_screen.h" -- cgit v1.2.3