Cleanup: Editors/Object, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/object` module.

No functional changes.
This commit is contained in:
Sybren A. Stüvel
2020-07-03 15:42:22 +02:00
parent 19483125f8
commit de7c9f41e6
17 changed files with 356 additions and 511 deletions

View File

@@ -1642,7 +1642,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
ob->id.name + 2);
continue;
}
else if (is_indirectly_used && ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0) {
if (is_indirectly_used && ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0) {
BKE_reportf(op->reports,
RPT_WARNING,
"Cannot delete object '%s' from scene '%s', indirectly used objects need at "
@@ -1866,7 +1866,7 @@ static bool dupliobject_cmp(const void *a_, const void *b_)
if (a->persistent_id[i] != b->persistent_id[i]) {
return true;
}
else if (a->persistent_id[i] == INT_MAX) {
if (a->persistent_id[i] == INT_MAX) {
break;
}
}
@@ -1891,7 +1891,7 @@ static bool dupliobject_instancer_cmp(const void *a_, const void *b_)
if (a->persistent_id[i] != b->persistent_id[i]) {
return true;
}
else if (a->persistent_id[i] == INT_MAX) {
if (a->persistent_id[i] == INT_MAX) {
break;
}
}
@@ -3097,9 +3097,7 @@ static bool object_join_poll(bContext *C)
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_ARMATURE, OB_GPENCIL)) {
return ED_operator_screenactive(C);
}
else {
return false;
}
return false;
}
static int object_join_exec(bContext *C, wmOperator *op)
@@ -3110,11 +3108,11 @@ static int object_join_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
else if (BKE_object_obdata_is_libdata(ob)) {
if (BKE_object_obdata_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}
else if (ob->type == OB_GPENCIL) {
if (ob->type == OB_GPENCIL) {
bGPdata *gpd = (bGPdata *)ob->data;
if ((!gpd) || GPENCIL_ANY_MODE(gpd)) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in this mode");
@@ -3125,13 +3123,13 @@ static int object_join_exec(bContext *C, wmOperator *op)
if (ob->type == OB_MESH) {
return ED_mesh_join_objects_exec(C, op);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
return ED_curve_join_objects_exec(C, op);
}
else if (ob->type == OB_ARMATURE) {
if (ob->type == OB_ARMATURE) {
return ED_armature_join_objects_exec(C, op);
}
else if (ob->type == OB_GPENCIL) {
if (ob->type == OB_GPENCIL) {
return ED_gpencil_join_objects_exec(C, op);
}
@@ -3172,9 +3170,7 @@ static bool join_shapes_poll(bContext *C)
if (ob->type == OB_MESH) {
return ED_operator_screenactive(C);
}
else {
return false;
}
return false;
}
static int join_shapes_exec(bContext *C, wmOperator *op)
@@ -3185,7 +3181,7 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
else if (BKE_object_obdata_is_libdata(ob)) {
if (BKE_object_obdata_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}

View File

@@ -434,14 +434,12 @@ static bool bake_object_check(ViewLayer *view_layer, Object *ob, ReportList *rep
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not a mesh", ob->id.name + 2);
return false;
}
else {
Mesh *me = (Mesh *)ob->data;
if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
BKE_reportf(
reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
return false;
}
Mesh *me = (Mesh *)ob->data;
if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
BKE_reportf(
reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
return false;
}
for (i = 0; i < ob->totcol; i++) {
@@ -542,14 +540,11 @@ static bool bake_pass_filter_check(eScenePassType pass_type,
return false;
}
else {
BKE_report(reports,
RPT_ERROR,
"Combined bake pass requires Emit, or a light pass with "
"Direct or Indirect contributions enabled");
return false;
}
break;
BKE_report(reports,
RPT_ERROR,
"Combined bake pass requires Emit, or a light pass with "
"Direct or Indirect contributions enabled");
return false;
case SCE_PASS_DIFFUSE_COLOR:
case SCE_PASS_GLOSSY_COLOR:
case SCE_PASS_TRANSM_COLOR:
@@ -1071,10 +1066,7 @@ static int bake(Render *re,
(normal_swizzle[2] == R_BAKE_POSZ)) {
break;
}
else {
RE_bake_normal_world_to_world(
pixel_array_low, num_pixels, depth, result, normal_swizzle);
}
RE_bake_normal_world_to_world(pixel_array_low, num_pixels, depth, result, normal_swizzle);
break;
}
case R_BAKE_SPACE_OBJECT: {

View File

@@ -816,9 +816,7 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, const wmEvent *UN
if (edit_constraint_invoke_properties(C, op)) {
return stretchto_reset_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot)
@@ -873,9 +871,7 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return limitdistance_reset_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
@@ -953,9 +949,7 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return childof_set_inverse_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot)
@@ -1004,9 +998,7 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, const wmEve
if (edit_constraint_invoke_properties(C, op)) {
return childof_clear_inverse_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
@@ -1131,9 +1123,7 @@ static int followpath_path_animate_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return followpath_path_animate_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_followpath_path_animate(wmOperatorType *ot)
@@ -1214,9 +1204,7 @@ static int objectsolver_set_inverse_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return objectsolver_set_inverse_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot)
@@ -1272,9 +1260,7 @@ static int objectsolver_clear_inverse_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return objectsolver_clear_inverse_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_objectsolver_clear_inverse(wmOperatorType *ot)
@@ -1423,10 +1409,8 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
/* couldn't remove due to some invalid data */
return OPERATOR_CANCELLED;
}
/* couldn't remove due to some invalid data */
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_delete(wmOperatorType *ot)
@@ -1476,9 +1460,7 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, const wmEven
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_down_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_down(wmOperatorType *ot)
@@ -1532,9 +1514,7 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_up_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_up(wmOperatorType *ot)
@@ -1592,9 +1572,7 @@ static int constraint_move_to_index_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_to_index_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_to_index(wmOperatorType *ot)
@@ -1908,8 +1886,7 @@ static bool get_new_constraint_target(
break;
}
else if (((!only_curve) || (ob->type == OB_CURVE)) &&
((!only_mesh) || (ob->type == OB_MESH))) {
if (((!only_curve) || (ob->type == OB_CURVE)) && ((!only_mesh) || (ob->type == OB_MESH))) {
/* set target */
*tar_ob = ob;
found = true;

View File

@@ -254,16 +254,12 @@ static const EnumPropertyItem *dt_layers_select_itemf(bContext *C,
if (reverse_transfer) {
return dt_layers_select_src_itemf(C, ptr, prop, r_free);
}
else {
return dt_layers_select_dst_itemf(C, ptr, prop, r_free);
}
}
else if (reverse_transfer) {
return dt_layers_select_dst_itemf(C, ptr, prop, r_free);
}
else {
return dt_layers_select_src_itemf(C, ptr, prop, r_free);
if (reverse_transfer) {
return dt_layers_select_dst_itemf(C, ptr, prop, r_free);
}
return dt_layers_select_src_itemf(C, ptr, prop, r_free);
}
/* Note: rna_enum_dt_mix_mode_items enum is from rna_modifier.c */
@@ -381,7 +377,7 @@ static bool data_transfer_exec_is_object_valid(wmOperator *op,
me->id.tag &= ~LIB_TAG_DOIT;
return true;
}
else if (!ID_IS_LINKED(me) && !ID_IS_OVERRIDE_LIBRARY(me)) {
if (!ID_IS_LINKED(me) && !ID_IS_OVERRIDE_LIBRARY(me)) {
/* Do not apply transfer operation more than once. */
/* XXX This is not nice regarding vgroups, which are half-Object data... :/ */
BKE_reportf(
@@ -857,9 +853,7 @@ static int datalayout_transfer_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return datalayout_transfer_exec(C, op);
}
else {
return WM_menu_invoke(C, op, event);
}
return WM_menu_invoke(C, op, event);
}
void OBJECT_OT_datalayout_transfer(wmOperatorType *ot)

View File

@@ -156,9 +156,7 @@ static bool object_hide_poll(bContext *C)
if (CTX_wm_space_outliner(C) != NULL) {
return ED_outliner_collections_editor_poll(C);
}
else {
return ED_operator_view3d_active(C);
}
return ED_operator_view3d_active(C);
}
static int object_hide_view_clear_exec(bContext *C, wmOperator *op)
@@ -1634,15 +1632,14 @@ static bool move_to_collection_poll(bContext *C)
if (CTX_wm_space_outliner(C) != NULL) {
return ED_outliner_collections_editor_poll(C);
}
else {
View3D *v3d = CTX_wm_view3d(C);
if (v3d && v3d->localvd) {
return false;
}
View3D *v3d = CTX_wm_view3d(C);
return ED_operator_objectmode(C);
if (v3d && v3d->localvd) {
return false;
}
return ED_operator_objectmode(C);
}
static int move_to_collection_exec(bContext *C, wmOperator *op)

View File

@@ -245,7 +245,7 @@ static int gpencil_modifier_apply_obdata(
if (ELEM(NULL, ob, ob->data)) {
return 0;
}
else if (mti->bakeModifier == NULL) {
if (mti->bakeModifier == NULL) {
BKE_report(reports, RPT_ERROR, "Not implemented");
return 0;
}
@@ -487,13 +487,12 @@ static bool gpencil_edit_modifier_invoke_properties(bContext *C,
RNA_string_set(op->ptr, "modifier", md->name);
return true;
}
else {
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
if (r_retval != NULL) {
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
}
return false;
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
if (r_retval != NULL) {
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
}
return false;
}
}
@@ -555,9 +554,7 @@ static int gpencil_modifier_remove_invoke(bContext *C, wmOperator *op, const wmE
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_remove_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_gpencil_modifier_remove(wmOperatorType *ot)
@@ -599,9 +596,7 @@ static int gpencil_modifier_move_up_invoke(bContext *C, wmOperator *op, const wm
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_move_up_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_gpencil_modifier_move_up(wmOperatorType *ot)
@@ -642,9 +637,7 @@ static int gpencil_modifier_move_down_invoke(bContext *C, wmOperator *op, const
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_move_down_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_gpencil_modifier_move_down(wmOperatorType *ot)
@@ -691,9 +684,7 @@ static int gpencil_modifier_move_to_index_invoke(bContext *C, wmOperator *op, co
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_move_to_index_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_gpencil_modifier_move_to_index(wmOperatorType *ot)
@@ -753,9 +744,7 @@ static int gpencil_modifier_apply_invoke(bContext *C, wmOperator *op, const wmEv
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_apply_exec(C, op);
}
else {
return retval;
}
return retval;
}
static const EnumPropertyItem gpencil_modifier_apply_as_items[] = {
@@ -814,9 +803,7 @@ static int gpencil_modifier_copy_invoke(bContext *C, wmOperator *op, const wmEve
if (gpencil_edit_modifier_invoke_properties(C, op, event, &retval)) {
return gpencil_modifier_copy_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_gpencil_modifier_copy(wmOperatorType *ot)

View File

@@ -649,9 +649,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_hook_add_selob(wmOperatorType *ot)
@@ -690,9 +688,7 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_hook_add_newob(wmOperatorType *ot)

View File

@@ -830,12 +830,12 @@ bool ED_object_modifier_apply(Main *bmain,
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in edit mode");
return false;
}
else if (ID_REAL_USERS(ob->data) > 1) {
if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
return false;
}
else if ((ob->mode & OB_MODE_SCULPT) && (find_multires_modifier_before(scene, md)) &&
(BKE_modifier_is_same_topology(md) == false)) {
if ((ob->mode & OB_MODE_SCULPT) && (find_multires_modifier_before(scene, md)) &&
(BKE_modifier_is_same_topology(md) == false)) {
BKE_report(reports,
RPT_ERROR,
"Constructive modifier cannot be applied to multi-res data in sculpt mode");
@@ -1078,13 +1078,11 @@ bool edit_modifier_invoke_properties(bContext *C,
RNA_string_set(op->ptr, "modifier", md->name);
return true;
}
else {
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
if (r_retval != NULL) {
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
}
return false;
BLI_assert(r_retval != NULL); /* We need the return value in this case. */
if (r_retval != NULL) {
*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
}
return false;
}
}
@@ -1159,9 +1157,7 @@ static int modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent *ev
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_remove_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_modifier_remove(wmOperatorType *ot)
@@ -1207,9 +1203,7 @@ static int modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *e
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_move_up_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
@@ -1254,9 +1248,7 @@ static int modifier_move_down_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_move_down_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
@@ -1307,9 +1299,7 @@ static int modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEv
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_move_to_index_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_modifier_move_to_index(wmOperatorType *ot)
@@ -1355,7 +1345,7 @@ static bool modifier_apply_poll(bContext *C)
CTX_wm_operator_poll_msg_set(C, "Modifiers cannot be applied to multi-user data");
return false;
}
else if (md != NULL) {
if (md != NULL) {
if ((ob->mode & OB_MODE_SCULPT) && (find_multires_modifier_before(scene, md)) &&
(BKE_modifier_is_same_topology(md) == false)) {
CTX_wm_operator_poll_msg_set(
@@ -1404,9 +1394,7 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *eve
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_apply_exec(C, op);
}
else {
return retval;
}
return retval;
}
static const EnumPropertyItem modifier_apply_as_items[] = {
@@ -1473,9 +1461,7 @@ static int modifier_convert_invoke(bContext *C, wmOperator *op, const wmEvent *U
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return modifier_convert_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_modifier_convert(wmOperatorType *ot)
@@ -1520,9 +1506,7 @@ static int modifier_copy_invoke(bContext *C, wmOperator *op, const wmEvent *even
if (edit_modifier_invoke_properties(C, op, event, &retval)) {
return modifier_copy_exec(C, op);
}
else {
return retval;
}
return retval;
}
void OBJECT_OT_modifier_copy(wmOperatorType *ot)
@@ -1579,9 +1563,7 @@ static int multires_higher_levels_delete_invoke(bContext *C,
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_higher_levels_delete_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
@@ -1657,9 +1639,7 @@ static int multires_subdivide_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_subdivide_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
@@ -1734,9 +1714,7 @@ static int multires_reshape_invoke(bContext *C, wmOperator *op, const wmEvent *U
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_reshape_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_reshape(wmOperatorType *ot)
@@ -1915,9 +1893,7 @@ static int multires_base_apply_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_base_apply_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
@@ -1969,9 +1945,7 @@ static int multires_unsubdivide_invoke(bContext *C, wmOperator *op, const wmEven
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_unsubdivide_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_unsubdivide(wmOperatorType *ot)
@@ -2027,9 +2001,7 @@ static int multires_rebuild_subdiv_invoke(bContext *C,
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return multires_rebuild_subdiv_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_multires_rebuild_subdiv(wmOperatorType *ot)
@@ -2406,9 +2378,7 @@ static int skin_armature_create_invoke(bContext *C, wmOperator *op, const wmEven
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return skin_armature_create_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_skin_armature_create(wmOperatorType *ot)
@@ -2485,9 +2455,7 @@ static int correctivesmooth_bind_invoke(bContext *C, wmOperator *op, const wmEve
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return correctivesmooth_bind_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_correctivesmooth_bind(wmOperatorType *ot)
@@ -2562,9 +2530,7 @@ static int meshdeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UN
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return meshdeform_bind_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
@@ -2618,9 +2584,7 @@ static int explode_refresh_invoke(bContext *C, wmOperator *op, const wmEvent *UN
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return explode_refresh_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_explode_refresh(wmOperatorType *ot)
@@ -2822,9 +2786,7 @@ static int ocean_bake_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return ocean_bake_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_ocean_bake(wmOperatorType *ot)
@@ -2901,9 +2863,7 @@ static int laplaciandeform_bind_invoke(bContext *C, wmOperator *op, const wmEven
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return laplaciandeform_bind_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
@@ -2970,9 +2930,7 @@ static int surfacedeform_bind_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_modifier_invoke_properties(C, op, NULL, NULL)) {
return surfacedeform_bind_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_surfacedeform_bind(wmOperatorType *ot)

View File

@@ -359,7 +359,7 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
}
else if (ID_IS_LINKED(ob)) {
if (ID_IS_LINKED(ob)) {
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION);
uiLayout *layout = UI_popup_menu_layout(pup);
@@ -374,12 +374,10 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* this invoke just calls another instance of this operator... */
return OPERATOR_INTERFACE;
}
else {
/* error.. cannot continue */
BKE_report(
op->reports, RPT_ERROR, "Can only make proxy for a referenced object or collection");
return OPERATOR_CANCELLED;
}
/* error.. cannot continue */
BKE_report(op->reports, RPT_ERROR, "Can only make proxy for a referenced object or collection");
return OPERATOR_CANCELLED;
}
static int make_proxy_exec(bContext *C, wmOperator *op)
@@ -708,36 +706,34 @@ bool ED_object_parent_set(ReportList *reports,
if (par->type != OB_CURVE) {
return 0;
}
Curve *cu = par->data;
Curve *cu_eval = parent_eval->data;
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
cu_eval->flag |= CU_PATH | CU_FOLLOW;
/* force creation of path data */
BKE_displist_make_curveTypes(depsgraph, scene, par, false, false);
}
else {
Curve *cu = par->data;
Curve *cu_eval = parent_eval->data;
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
cu_eval->flag |= CU_PATH | CU_FOLLOW;
/* force creation of path data */
BKE_displist_make_curveTypes(depsgraph, scene, par, false, false);
}
else {
cu->flag |= CU_FOLLOW;
cu_eval->flag |= CU_FOLLOW;
}
cu->flag |= CU_FOLLOW;
cu_eval->flag |= CU_FOLLOW;
}
/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */
if (partype == PAR_FOLLOW) {
/* get or create F-Curve */
bAction *act = ED_id_action_ensure(bmain, &cu->id);
FCurve *fcu = ED_action_fcurve_ensure(bmain, act, NULL, NULL, "eval_time", 0);
/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */
if (partype == PAR_FOLLOW) {
/* get or create F-Curve */
bAction *act = ED_id_action_ensure(bmain, &cu->id);
FCurve *fcu = ED_action_fcurve_ensure(bmain, act, NULL, NULL, "eval_time", 0);
/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */
if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) {
add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu);
}
/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */
if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) {
add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu);
}
}
/* fall back on regular parenting now (for follow only) */
if (partype == PAR_FOLLOW) {
partype = PAR_OBJECT;
}
/* fall back on regular parenting now (for follow only) */
if (partype == PAR_FOLLOW) {
partype = PAR_OBJECT;
}
}
else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
@@ -755,188 +751,185 @@ bool ED_object_parent_set(ReportList *reports,
BKE_report(reports, RPT_ERROR, "Loop in parents");
return false;
}
else {
Object workob;
/* apply transformation of previous parenting */
if (keep_transform) {
/* was removed because of bug [#23577],
* but this can be handy in some cases too [#32616], so make optional */
BKE_object_apply_mat4(ob, ob->obmat, false, false);
}
Object workob;
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
ob->parent = par;
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
}
/* handle types */
if (pchan) {
BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
}
else {
ob->parsubstr[0] = 0;
}
if (partype == PAR_PATH_CONST) {
/* don't do anything here, since this is not technically "parenting" */
}
else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm)) {
/* partype is now set to PAROBJECT so that invisible 'virtual'
* modifiers don't need to be created.
* NOTE: the old (2.4x) method was to set ob->partype = PARSKEL,
* creating the virtual modifiers.
*/
ob->partype = PAROBJECT; /* note, dna define, not operator property */
/* ob->partype = PARSKEL; */ /* note, dna define, not operator property */
/* BUT, to keep the deforms, we need a modifier,
* and then we need to set the object that it uses
* - We need to ensure that the modifier we're adding doesn't already exist,
* so we check this by assuming that the parent is selected too.
*/
/* XXX currently this should only happen for meshes, curves, surfaces,
* and lattices - this stuff isn't available for metas yet */
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
ModifierData *md;
switch (partype) {
case PAR_CURVE: /* curve deform */
if (BKE_modifiers_is_deformed_by_curve(ob) != par) {
md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
if (md) {
((CurveModifierData *)md)->object = par;
}
if (par->runtime.curve_cache && par->runtime.curve_cache->path == NULL) {
DEG_id_tag_update(&par->id, ID_RECALC_GEOMETRY);
}
}
break;
case PAR_LATTICE: /* lattice deform */
if (BKE_modifiers_is_deformed_by_lattice(ob) != par) {
md = ED_object_modifier_add(
reports, bmain, scene, ob, NULL, eModifierType_Lattice);
if (md) {
((LatticeModifierData *)md)->object = par;
}
}
break;
default: /* armature deform */
if (BKE_modifiers_is_deformed_by_armature(ob) != par) {
md = ED_object_modifier_add(
reports, bmain, scene, ob, NULL, eModifierType_Armature);
if (md) {
((ArmatureModifierData *)md)->object = par;
}
}
break;
}
}
}
else if (partype == PAR_BONE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
if (pchan->bone) {
pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
pchan_eval->bone->flag &= ~BONE_RELATIVE_PARENTING;
}
}
else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
if (pchan->bone) {
pchan->bone->flag |= BONE_RELATIVE_PARENTING;
pchan_eval->bone->flag |= BONE_RELATIVE_PARENTING;
}
}
else if (partype == PAR_VERTEX) {
ob->partype = PARVERT1;
ob->par1 = vert_par[0];
}
else if (partype == PAR_VERTEX_TRI) {
ob->partype = PARVERT3;
copy_v3_v3_int(&ob->par1, vert_par);
}
else {
ob->partype = PAROBJECT; /* note, dna define, not operator property */
}
/* constraint */
if (partype == PAR_PATH_CONST) {
bConstraint *con;
bFollowPathConstraint *data;
float cmat[4][4], vec[3];
con = BKE_constraint_add_for_object(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
data = con->data;
data->tar = par;
BKE_constraint_target_matrix_get(
depsgraph, scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
copy_v3_v3(ob->loc, vec);
}
else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE_NAME) {
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_NAME, false);
}
else if (partype == PAR_ARMATURE_ENVELOPE) {
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
}
else if (partype == PAR_ARMATURE_AUTO) {
WM_cursor_wait(1);
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
WM_cursor_wait(0);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else if (pararm && (ob->type == OB_GPENCIL) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE) {
ED_gpencil_add_armature(C, reports, ob, par);
}
else if (partype == PAR_ARMATURE_NAME) {
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_NAME);
}
else if ((partype == PAR_ARMATURE_AUTO) || (partype == PAR_ARMATURE_ENVELOPE)) {
WM_cursor_wait(1);
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_AUTO);
WM_cursor_wait(0);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else if ((ob->type == OB_GPENCIL) && (par->type == OB_LATTICE)) {
/* Add Lattice modifier */
if (partype == PAR_LATTICE) {
ED_gpencil_add_lattice_modifier(C, reports, ob, par);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
/* calculate inverse parent matrix */
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
/* apply transformation of previous parenting */
if (keep_transform) {
/* was removed because of bug [#23577],
* but this can be handy in some cases too [#32616], so make optional */
BKE_object_apply_mat4(ob, ob->obmat, false, false);
}
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
ob->parent = par;
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
}
/* handle types */
if (pchan) {
BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
}
else {
ob->parsubstr[0] = 0;
}
if (partype == PAR_PATH_CONST) {
/* don't do anything here, since this is not technically "parenting" */
}
else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm)) {
/* partype is now set to PAROBJECT so that invisible 'virtual'
* modifiers don't need to be created.
* NOTE: the old (2.4x) method was to set ob->partype = PARSKEL,
* creating the virtual modifiers.
*/
ob->partype = PAROBJECT; /* note, dna define, not operator property */
/* ob->partype = PARSKEL; */ /* note, dna define, not operator property */
/* BUT, to keep the deforms, we need a modifier,
* and then we need to set the object that it uses
* - We need to ensure that the modifier we're adding doesn't already exist,
* so we check this by assuming that the parent is selected too.
*/
/* XXX currently this should only happen for meshes, curves, surfaces,
* and lattices - this stuff isn't available for metas yet */
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
ModifierData *md;
switch (partype) {
case PAR_CURVE: /* curve deform */
if (BKE_modifiers_is_deformed_by_curve(ob) != par) {
md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
if (md) {
((CurveModifierData *)md)->object = par;
}
if (par->runtime.curve_cache && par->runtime.curve_cache->path == NULL) {
DEG_id_tag_update(&par->id, ID_RECALC_GEOMETRY);
}
}
break;
case PAR_LATTICE: /* lattice deform */
if (BKE_modifiers_is_deformed_by_lattice(ob) != par) {
md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
if (md) {
((LatticeModifierData *)md)->object = par;
}
}
break;
default: /* armature deform */
if (BKE_modifiers_is_deformed_by_armature(ob) != par) {
md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
if (md) {
((ArmatureModifierData *)md)->object = par;
}
}
break;
}
}
}
else if (partype == PAR_BONE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
if (pchan->bone) {
pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
pchan_eval->bone->flag &= ~BONE_RELATIVE_PARENTING;
}
}
else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
if (pchan->bone) {
pchan->bone->flag |= BONE_RELATIVE_PARENTING;
pchan_eval->bone->flag |= BONE_RELATIVE_PARENTING;
}
}
else if (partype == PAR_VERTEX) {
ob->partype = PARVERT1;
ob->par1 = vert_par[0];
}
else if (partype == PAR_VERTEX_TRI) {
ob->partype = PARVERT3;
copy_v3_v3_int(&ob->par1, vert_par);
}
else {
ob->partype = PAROBJECT; /* note, dna define, not operator property */
}
/* constraint */
if (partype == PAR_PATH_CONST) {
bConstraint *con;
bFollowPathConstraint *data;
float cmat[4][4], vec[3];
con = BKE_constraint_add_for_object(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
data = con->data;
data->tar = par;
BKE_constraint_target_matrix_get(
depsgraph, scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
copy_v3_v3(ob->loc, vec);
}
else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE_NAME) {
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_NAME, false);
}
else if (partype == PAR_ARMATURE_ENVELOPE) {
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
}
else if (partype == PAR_ARMATURE_AUTO) {
WM_cursor_wait(1);
ED_object_vgroup_calc_from_armature(
reports, depsgraph, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
WM_cursor_wait(0);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else if (pararm && (ob->type == OB_GPENCIL) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE) {
ED_gpencil_add_armature(C, reports, ob, par);
}
else if (partype == PAR_ARMATURE_NAME) {
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_NAME);
}
else if ((partype == PAR_ARMATURE_AUTO) || (partype == PAR_ARMATURE_ENVELOPE)) {
WM_cursor_wait(1);
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_AUTO);
WM_cursor_wait(0);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else if ((ob->type == OB_GPENCIL) && (par->type == OB_LATTICE)) {
/* Add Lattice modifier */
if (partype == PAR_LATTICE) {
ED_gpencil_add_lattice_modifier(C, reports, ob, par);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
/* calculate inverse parent matrix */
BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
return true;
@@ -1124,9 +1117,7 @@ static bool parent_set_poll_property(const bContext *UNUSED(C),
if (ELEM(type, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO)) {
return true;
}
else {
return false;
}
return false;
}
return true;
@@ -2331,7 +2322,7 @@ static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEve
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
}
else if (ID_IS_LINKED(obact)) {
if (ID_IS_LINKED(obact)) {
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION);
uiLayout *layout = UI_popup_menu_layout(pup);
@@ -2346,13 +2337,12 @@ static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEve
/* This invoke just calls another instance of this operator... */
return OPERATOR_INTERFACE;
}
else {
/* Error.. cannot continue. */
BKE_report(op->reports,
RPT_ERROR,
"Can only make library override for a referenced object or collection");
return OPERATOR_CANCELLED;
}
/* Error.. cannot continue. */
BKE_report(op->reports,
RPT_ERROR,
"Can only make library override for a referenced object or collection");
return OPERATOR_CANCELLED;
}
static int make_override_library_exec(bContext *C, wmOperator *op)

View File

@@ -1042,7 +1042,7 @@ static bool quadriflow_poll_property(const bContext *C, wmOperator *op, const Pr
if (STREQ(prop_id, "target_edge_length") && mode != QUADRIFLOW_REMESH_EDGE_LENGTH) {
return false;
}
else if (STREQ(prop_id, "target_faces")) {
if (STREQ(prop_id, "target_faces")) {
if (mode != QUADRIFLOW_REMESH_FACES) {
/* Make sure we can edit the target_faces value even if it doesn't start as EDITABLE */
float area = RNA_float_get(op->ptr, "mesh_area");

View File

@@ -218,13 +218,9 @@ static int get_base_select_priority(Base *base)
if (base->flag & BASE_SELECTABLE) {
return 3;
}
else {
return 2;
}
}
else {
return 1;
return 2;
}
return 1;
}
/**
@@ -251,13 +247,12 @@ Base *ED_object_find_first_by_data_id(ViewLayer *view_layer, ID *id)
if (base->flag & BASE_SELECTED) {
return base;
}
else {
int priority_test = get_base_select_priority(base);
if (priority_test > priority_best) {
priority_best = priority_test;
base_best = base;
}
int priority_test = get_base_select_priority(base);
if (priority_test > priority_best) {
priority_best = priority_test;
base_best = base;
}
}
}
@@ -671,7 +666,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
// object_select_all_by_ipo(C, ob->ipo)
return OPERATOR_CANCELLED;
}
else if (nr == OBJECT_SELECT_LINKED_OBDATA) {
if (nr == OBJECT_SELECT_LINKED_OBDATA) {
if (ob->data == NULL) {
return OPERATOR_CANCELLED;
}
@@ -855,7 +850,7 @@ static bool select_grouped_collection(bContext *C, Object *ob)
if (!collection_count) {
return 0;
}
else if (collection_count == 1) {
if (collection_count == 1) {
collection = ob_collections[0];
CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
@@ -998,7 +993,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList
BKE_report(reports, RPT_ERROR, "No active Keying Set to use");
return false;
}
else if (ANIM_validate_keyingset(C, NULL, ks) != 0) {
if (ANIM_validate_keyingset(C, NULL, ks) != 0) {
if (ks->paths.first == NULL) {
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
BKE_report(reports,
@@ -1160,14 +1155,12 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else if (any_visible == false) {
if (any_visible == false) {
/* TODO(campbell): Looks like we could remove this,
* if not comment should say why its needed. */
return OPERATOR_PASS_THROUGH;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_select_all(wmOperatorType *ot)
@@ -1386,9 +1379,7 @@ static int object_select_more_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_select_more(wmOperatorType *ot)
@@ -1419,9 +1410,7 @@ static int object_select_less_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_select_less(wmOperatorType *ot)

View File

@@ -367,13 +367,12 @@ static int edit_shaderfx_invoke_properties(bContext *C, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "shaderfx")) {
return true;
}
else {
PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", &RNA_ShaderFx);
if (ptr.data) {
fx = ptr.data;
RNA_string_set(op->ptr, "shaderfx", fx->name);
return true;
}
PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", &RNA_ShaderFx);
if (ptr.data) {
fx = ptr.data;
RNA_string_set(op->ptr, "shaderfx", fx->name);
return true;
}
return false;
@@ -418,9 +417,7 @@ static int shaderfx_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UN
if (edit_shaderfx_invoke_properties(C, op)) {
return shaderfx_remove_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_shaderfx_remove(wmOperatorType *ot)
@@ -460,9 +457,7 @@ static int shaderfx_move_up_invoke(bContext *C, wmOperator *op, const wmEvent *U
if (edit_shaderfx_invoke_properties(C, op)) {
return shaderfx_move_up_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_shaderfx_move_up(wmOperatorType *ot)
@@ -502,9 +497,7 @@ static int shaderfx_move_down_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_shaderfx_invoke_properties(C, op)) {
return shaderfx_move_down_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_shaderfx_move_down(wmOperatorType *ot)
@@ -550,9 +543,7 @@ static int shaderfx_move_to_index_invoke(bContext *C, wmOperator *op, const wmEv
if (edit_shaderfx_invoke_properties(C, op)) {
return shaderfx_move_to_index_exec(C, op);
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_shaderfx_move_to_index(wmOperatorType *ot)

View File

@@ -305,9 +305,7 @@ static int shape_key_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_shape_key_remove(wmOperatorType *ot)

View File

@@ -1002,10 +1002,8 @@ static int object_transform_apply_exec(bContext *C, wmOperator *op)
if (loc || rot || sca) {
return apply_objects_internal(C, op->reports, loc, rot, sca, do_props);
}
else {
/* allow for redo */
return OPERATOR_FINISHED;
}
/* allow for redo */
return OPERATOR_FINISHED;
}
void OBJECT_OT_transform_apply(wmOperatorType *ot)
@@ -2036,7 +2034,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
object_transform_axis_target_free_data(op);
return OPERATOR_FINISHED;
}
else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
object_transform_axis_target_cancel(C, op);
return OPERATOR_CANCELLED;
}

View File

@@ -131,20 +131,18 @@ bool ED_object_calc_active_center(Object *ob, const bool select_only, float r_ce
}
return false;
}
else if (ob->mode & OB_MODE_POSE) {
if (ob->mode & OB_MODE_POSE) {
if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) {
mul_m4_v3(ob->obmat, r_center);
return true;
}
return false;
}
else {
if (!select_only || (ob->base_flag & BASE_SELECTED)) {
copy_v3_v3(r_center, ob->obmat[3]);
return true;
}
return false;
if (!select_only || (ob->base_flag & BASE_SELECTED)) {
copy_v3_v3(r_center, ob->obmat[3]);
return true;
}
return false;
}
/** \} */

View File

@@ -86,13 +86,11 @@ static bool vertex_group_use_vert_sel(Object *ob)
if (ob->mode == OB_MODE_EDIT) {
return true;
}
else if ((ob->type == OB_MESH) &&
((Mesh *)ob->data)->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL)) {
if ((ob->type == OB_MESH) &&
((Mesh *)ob->data)->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL)) {
return true;
}
else {
return false;
}
return false;
}
static Lattice *vgroup_edit_lattice(Object *ob)
@@ -189,7 +187,7 @@ bool ED_vgroup_parray_alloc(ID *id,
return true;
}
else if (me->dvert) {
if (me->dvert) {
MVert *mvert = me->mvert;
MDeformVert *dvert = me->dvert;
int i;
@@ -2115,15 +2113,13 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2)
if (dw1->weight < dw2->weight) {
return 1;
}
else if (dw1->weight > dw2->weight) {
if (dw1->weight > dw2->weight) {
return -1;
}
else if (&dw1 < &dw2) {
if (&dw1 < &dw2) {
return 1; /* compare address for stable sort algorithm */
}
else {
return -1;
}
return -1;
}
/* Used for limiting the number of influencing bones per vertex when exporting
@@ -2719,23 +2715,17 @@ static bool vertex_group_vert_poll_ex(bContext *C,
if (BKE_object_is_in_editmode_vgroup(ob)) {
return true;
}
else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (needs_select) {
if (BKE_object_is_in_wpaint_select_vert(ob)) {
return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Vertex select needs to be enabled in weight paint mode");
return false;
}
}
else {
return true;
CTX_wm_operator_poll_msg_set(C, "Vertex select needs to be enabled in weight paint mode");
return false;
}
return true;
}
else {
return false;
}
return false;
}
#if 0
@@ -3181,9 +3171,7 @@ static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
/** \} */
@@ -3229,10 +3217,9 @@ static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
/* allow to adjust settings */
return OPERATOR_FINISHED;
}
/* allow to adjust settings */
return OPERATOR_FINISHED;
}
/** \} */
@@ -3723,11 +3710,10 @@ static int vertex_group_limit_total_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
/* note, would normally return canceled, except we want the redo
* UI to show up for users to change */
return OPERATOR_FINISHED;
}
/* note, would normally return canceled, except we want the redo
* UI to show up for users to change */
return OPERATOR_FINISHED;
}
void OBJECT_OT_vertex_group_limit_total(wmOperatorType *ot)
@@ -4501,9 +4487,7 @@ static int vertex_weight_normalize_active_vertex_exec(bContext *C, wmOperator *U
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void OBJECT_OT_vertex_weight_normalize_active_vertex(wmOperatorType *ot)

View File

@@ -119,7 +119,7 @@ static int volume_import_exec(bContext *C, wmOperator *op)
BKE_id_delete(bmain, &volume->id);
continue;
}
else if (BKE_volume_is_points_only(volume)) {
if (BKE_volume_is_points_only(volume)) {
BKE_reportf(op->reports,
RPT_WARNING,
"Volume \"%s\" contains points, only voxel grids are supported",