diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-04-30 22:43:44 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-04-30 22:48:07 +0300 |
commit | ae7db030dab0f350442fc7b69529bdc1c5c334fa (patch) | |
tree | f36f56b331557f69a8fb4a96d3b777572b5b1083 | |
parent | 2d32372c59a03ca17a5d3edd11cc38f83b107033 (diff) |
Stop using deprecated ob->flag & SELECT
We still have base->flag_legacy & BA_WAS_SEL for the few cases we really
need to have a per-object selection check (used in the transform code).
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 10 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_anim_viz.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_utils.c | 2 |
4 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 0767e2a7148..9bc9865631f 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -36,6 +36,7 @@ #include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_utildefines.h" #include "BLI_listbase.h" @@ -657,7 +658,7 @@ Object *modifiers_isDeformedByArmature(Object *ob) for (; md; md = md->next) { if (md->type == eModifierType_Armature) { amd = (ArmatureModifierData *)md; - if (amd->object && (amd->object->flag & SELECT)) { + if (amd->object && (amd->object->base_flag & BASE_SELECTED)) { return amd->object; } } @@ -680,7 +681,7 @@ Object *modifiers_isDeformedByMeshDeform(Object *ob) for (; md; md = md->next) { if (md->type == eModifierType_MeshDeform) { mdmd = (MeshDeformModifierData *)md; - if (mdmd->object && (mdmd->object->flag & SELECT)) { + if (mdmd->object && (mdmd->object->base_flag & BASE_SELECTED)) { return mdmd->object; } } @@ -706,7 +707,7 @@ Object *modifiers_isDeformedByLattice(Object *ob) for (; md; md = md->next) { if (md->type == eModifierType_Lattice) { lmd = (LatticeModifierData *)md; - if (lmd->object && (lmd->object->flag & SELECT)) { + if (lmd->object && (lmd->object->base_flag & BASE_SELECTED)) { return lmd->object; } } @@ -732,7 +733,7 @@ Object *modifiers_isDeformedByCurve(Object *ob) for (; md; md = md->next) { if (md->type == eModifierType_Curve) { cmd = (CurveModifierData *)md; - if (cmd->object && (cmd->object->flag & SELECT)) { + if (cmd->object && (cmd->object->base_flag & BASE_SELECTED)) { return cmd->object; } } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 632e9cb53b8..0e488dea758 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1417,6 +1417,10 @@ static void rigidbody_update_sim_ob( return; } + ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); + Base *base = BKE_view_layer_base_find(view_layer, ob); + const bool is_selected = base ? (base->flag & BASE_SELECTED) != 0 : false; + if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) { Mesh *mesh = ob->runtime.mesh_deform_eval; if (mesh) { @@ -1445,13 +1449,13 @@ static void rigidbody_update_sim_ob( /* Make transformed objects temporarily kinmatic * so that they can be moved by the user during simulation. */ - if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) { + if (is_selected && (G.moving & G_TRANSFORM_OBJ)) { RB_body_set_kinematic_state(rbo->shared->physics_object, true); RB_body_set_mass(rbo->shared->physics_object, 0.0f); } /* update rigid body location and rotation for kinematic bodies */ - if (rbo->flag & RBO_FLAG_KINEMATIC || (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ)) { + if (rbo->flag & RBO_FLAG_KINEMATIC || (is_selected && (G.moving & G_TRANSFORM_OBJ)) { RB_body_activate(rbo->shared->physics_object); RB_body_set_loc_rot(rbo->shared->physics_object, loc, rot); } @@ -1677,7 +1681,7 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) /* use rigid body transform after cache start frame if objects is not being transformed */ if (BKE_rigidbody_check_sim_running(rbw, ctime) && - !(ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ)) { + !(ob->base_flag & BASE_SELECTED && G.moving & G_TRANSFORM_OBJ)) { float mat[4][4], size_mat[4][4], size[3]; normalize_qt(rbo->orn); // RB_TODO investigate why quaternion isn't normalized at this point diff --git a/source/blender/draw/intern/draw_anim_viz.c b/source/blender/draw/intern/draw_anim_viz.c index 8ff2916b040..e851a3aa0bf 100644 --- a/source/blender/draw/intern/draw_anim_viz.c +++ b/source/blender/draw/intern/draw_anim_viz.c @@ -184,7 +184,7 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl, struct DRWTextStore *dt = DRW_text_cache_ensure(); int txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | DRW_TEXT_CACHE_ASCII; int cfra = (int)DEG_get_ctime(draw_ctx->depsgraph); - bool sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT); + bool sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->base_flag & BASE_SELECTED); bool show_keyframes = (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) != 0; int sfra, efra, stepsize; diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c index 06a755c30bd..dbca0bbf97b 100644 --- a/source/blender/editors/object/object_utils.c +++ b/source/blender/editors/object/object_utils.c @@ -133,7 +133,7 @@ bool ED_object_calc_active_center(Object *ob, const bool select_only, float r_ce return false; } else { - if (!select_only || (ob->flag & SELECT)) { + if (!select_only || (ob->base_flag & BASE_SELECTED)) { copy_v3_v3(r_center, ob->obmat[3]); return true; } |