Cleanup: remove redundant checks which have already been tested
Note that these changes are limited simple cases as these kinds of changes could allow for errors when refactoring code when the known state is not so obvious.
This commit is contained in:
parent
bda8887e0c
commit
4443c4082e
|
@ -1522,7 +1522,7 @@ void BKE_rigidbody_remove_object(Main *bmain, Scene *scene, Object *ob, const bo
|
|||
if (rbw) {
|
||||
|
||||
/* remove object from array */
|
||||
if (rbw && rbw->objects) {
|
||||
if (rbw->objects) {
|
||||
for (i = 0; i < rbw->numbodies; i++) {
|
||||
if (rbw->objects[i] == ob) {
|
||||
rbw->objects[i] = NULL;
|
||||
|
|
|
@ -3787,9 +3787,7 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
|
|||
SEQ_ALL_BEGIN (scene->ed, seq) {
|
||||
if (seq->scene_sound == NULL) {
|
||||
if (seq->sound != NULL) {
|
||||
if (seq->scene_sound == NULL) {
|
||||
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
|
||||
}
|
||||
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
|
||||
}
|
||||
else if (seq->type == SEQ_TYPE_SCENE) {
|
||||
if (seq->scene != NULL) {
|
||||
|
|
|
@ -3287,7 +3287,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
|
|||
gpencil_guide_event_handling(C, op, event, p);
|
||||
}
|
||||
|
||||
if (ob && (ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
|
||||
if ((ob->type == OB_GPENCIL) && ((p->gpd->flag & GP_DATA_STROKE_PAINTMODE) == 0)) {
|
||||
/* FIXME: use the mode switching operator, this misses notifiers, messages. */
|
||||
/* Just set paintmode flag... */
|
||||
p->gpd->flag |= GP_DATA_STROKE_PAINTMODE;
|
||||
|
|
|
@ -1536,24 +1536,22 @@ static void gpencil_primitive_strength(tGPDprimitive *tgpi, bool reset)
|
|||
Brush *brush = tgpi->brush;
|
||||
BrushGpencilSettings *brush_settings = brush->gpencil_settings;
|
||||
|
||||
if (brush) {
|
||||
if (reset) {
|
||||
brush_settings->draw_strength = tgpi->brush_strength;
|
||||
tgpi->brush_strength = 0.0f;
|
||||
}
|
||||
else {
|
||||
if (tgpi->brush_strength == 0.0f) {
|
||||
tgpi->brush_strength = brush_settings->draw_strength;
|
||||
}
|
||||
float move[2];
|
||||
sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
|
||||
float adjust = (move[1] > 0.0f) ? 0.01f : -0.01f;
|
||||
brush_settings->draw_strength += adjust * fabsf(len_manhattan_v2(move));
|
||||
}
|
||||
|
||||
/* limit low limit because below 0.2f the stroke is invisible */
|
||||
CLAMP(brush_settings->draw_strength, 0.2f, 1.0f);
|
||||
if (reset) {
|
||||
brush_settings->draw_strength = tgpi->brush_strength;
|
||||
tgpi->brush_strength = 0.0f;
|
||||
}
|
||||
else {
|
||||
if (tgpi->brush_strength == 0.0f) {
|
||||
tgpi->brush_strength = brush_settings->draw_strength;
|
||||
}
|
||||
float move[2];
|
||||
sub_v2_v2v2(move, tgpi->mval, tgpi->mvalo);
|
||||
float adjust = (move[1] > 0.0f) ? 0.01f : -0.01f;
|
||||
brush_settings->draw_strength += adjust * fabsf(len_manhattan_v2(move));
|
||||
}
|
||||
|
||||
/* limit low limit because below 0.2f the stroke is invisible */
|
||||
CLAMP(brush_settings->draw_strength, 0.2f, 1.0f);
|
||||
}
|
||||
|
||||
/* brush size */
|
||||
|
|
|
@ -2140,9 +2140,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
|
|||
BLI_smallhash_release(&faces);
|
||||
BLI_smallhash_release(&kfes);
|
||||
BLI_smallhash_release(&kfvs);
|
||||
if (results) {
|
||||
MEM_freeN(results);
|
||||
}
|
||||
MEM_freeN(results);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -2570,14 +2570,14 @@ static int convert_proxy_to_override_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* Remove the instance empty from this scene, the items now have an overridden collection
|
||||
* instead. */
|
||||
if (success && is_override_instancing_object) {
|
||||
if (is_override_instancing_object) {
|
||||
ED_object_base_free_and_unlink(bmain, scene, ob_proxy_group);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS | ID_RECALC_COPY_ON_WRITE);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
|
||||
return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_convert_proxy_to_override(wmOperatorType *ot)
|
||||
|
|
|
@ -611,9 +611,7 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect
|
|||
float fy = rect->ymin;
|
||||
|
||||
/* material preview only needs monoscopy (view 0) */
|
||||
if (re) {
|
||||
RE_AcquiredResultGet32(re, &rres, (uint *)rect_byte, 0);
|
||||
}
|
||||
RE_AcquiredResultGet32(re, &rres, (uint *)rect_byte, 0);
|
||||
|
||||
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
immDrawPixelsTex(
|
||||
|
|
|
@ -99,7 +99,7 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports)
|
|||
return;
|
||||
}
|
||||
|
||||
if (selected && !WM_jobs_is_running(wm_job)) {
|
||||
if (!WM_jobs_is_running(wm_job)) {
|
||||
G.is_break = false;
|
||||
WM_jobs_start(CTX_wm_manager(C), wm_job);
|
||||
}
|
||||
|
|
|
@ -1381,7 +1381,7 @@ static void uv_select_linked_multi(Scene *scene,
|
|||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
|
||||
bool add_to_stack = true;
|
||||
if (uv_sync_select && !select_faces) {
|
||||
if (uv_sync_select) {
|
||||
/* Special case, vertex/edge & sync select being enabled.
|
||||
*
|
||||
* Without this, a second linked select will 'grow' each time as each new
|
||||
|
@ -1392,6 +1392,7 @@ static void uv_select_linked_multi(Scene *scene,
|
|||
* - The only other fully selected face is connected or,
|
||||
* - There are no connected fully selected faces UV-connected to this loop.
|
||||
*/
|
||||
BLI_assert(!select_faces);
|
||||
if (uvedit_face_select_test(scene, l->f, cd_loop_uv_offset)) {
|
||||
/* pass */
|
||||
}
|
||||
|
|
|
@ -69,9 +69,7 @@ bool GpencilImporterSVG::read()
|
|||
params_.ob = create_object();
|
||||
if (params_.ob == nullptr) {
|
||||
std::cout << "Unable to create new object.\n";
|
||||
if (svg_data) {
|
||||
nsvgDelete(svg_data);
|
||||
}
|
||||
nsvgDelete(svg_data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static blender::bke::cryptomatte::CryptomatteSessionPtr cryptomatte_init_from_no
|
|||
BLI_assert(GS(scene->id.name) == ID_SCE);
|
||||
|
||||
if (use_meta_data) {
|
||||
Render *render = (scene) ? RE_GetSceneRender(scene) : nullptr;
|
||||
Render *render = RE_GetSceneRender(scene);
|
||||
RenderResult *render_result = render ? RE_AcquireResultRead(render) : nullptr;
|
||||
if (render_result) {
|
||||
session = blender::bke::cryptomatte::CryptomatteSessionPtr(
|
||||
|
|
|
@ -501,7 +501,7 @@ void WM_exit_ex(bContext *C, const bool do_python)
|
|||
if ((has_edited &&
|
||||
BLO_write_file(
|
||||
bmain, filename, fileflags, &(const struct BlendFileWriteParams){0}, NULL)) ||
|
||||
(undo_memfile && BLO_memfile_write_file(undo_memfile, filename))) {
|
||||
(BLO_memfile_write_file(undo_memfile, filename))) {
|
||||
printf("Saved session recovery to '%s'\n", filename);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue