diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-09 18:34:26 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-09 18:34:26 +0300 |
commit | 1045026ea23c8dac9b74f3cb2f2b4dc24a5d88af (patch) | |
tree | afe212a7fc073f0469ecffd010d146160eed3902 | |
parent | cb490561d3a7db02d612800a1610c79f2e4eccaa (diff) |
More housecleaning (BASACT > BASACT_NEW)
12 files changed, 40 insertions, 33 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 1cd80327b42..2437a6bff28 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1683,14 +1683,14 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); - BaseLegacy *base = BASACT, *newbase = NULL; + Base *base = BASACT_NEW, *newbase = NULL; Object *obt; /* add new target object */ obt = BKE_object_add(bmain, scene, sl, OB_EMPTY, NULL); /* set layers OK */ - newbase = BASACT; + newbase = BASACT_NEW; newbase->lay = base->lay; obt->lay = newbase->lay; @@ -1709,8 +1709,8 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob } /* restore, BKE_object_add sets active */ - BASACT = base; - base->flag_legacy |= SELECT; + BASACT_NEW = base; + base->flag |= BASE_SELECTED; /* make our new target the new object */ *tar_ob = obt; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 961278c2c83..37232456f48 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -403,6 +403,7 @@ void ED_object_select_linked_by_id(bContext *C, ID *id) static int object_select_linked_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *ob; int nr = RNA_enum_get(op->ptr, "type"); bool changed = false, extend; @@ -417,7 +418,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - ob = OBACT; + ob = OBACT_NEW; if (ob == NULL) { BKE_report(op->reports, RPT_ERROR, "No active object"); return OPERATOR_CANCELLED; @@ -814,6 +815,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList static int object_select_grouped_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *ob; const int type = RNA_enum_get(op->ptr, "type"); bool changed = false, extend; @@ -829,7 +831,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - ob = OBACT; + ob = OBACT_NEW; if (ob == NULL) { BKE_report(op->reports, RPT_ERROR, "No active object"); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c index f05122e3020..12b97504dc7 100644 --- a/source/blender/editors/space_clip/tracking_ops_orient.c +++ b/source/blender/editors/space_clip/tracking_ops_orient.c @@ -88,6 +88,7 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip) static Object *get_orientation_object(bContext *C) { Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; @@ -98,7 +99,7 @@ static Object *get_orientation_object(bContext *C) object = get_camera_with_movieclip(scene, clip); } else { - object = OBACT; + object = OBACT_NEW; } if (object != NULL && object->parent != NULL) { @@ -112,7 +113,7 @@ static int set_orientation_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); if (sc != NULL) { - Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); MovieClip *clip = ED_space_clip_get_clip(sc); if (clip != NULL) { MovieTracking *tracking = &clip->tracking; @@ -121,7 +122,7 @@ static int set_orientation_poll(bContext *C) return true; } else { - return OBACT != NULL; + return OBACT_NEW != NULL; } } } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 325c635dcf3..761bcf3d807 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2686,7 +2686,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, BaseLegacy /* called from drawobject.c, return true if nothing was drawn * (ob_wire_col == NULL) when drawing ghost */ -bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, BaseLegacy *base, +bool draw_armature(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, const short dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_outline) { @@ -2759,10 +2759,10 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, BaseLegacy *base, draw_ghost_poses(scene, v3d, ar, base); } if ((dflag & DRAW_SCENESET) == 0) { - if (ob == OBACT) + if (ob == OBACT_NEW) arm->flag |= ARM_POSEMODE; - else if (OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) { - if (ob == modifiers_isDeformedByArmature(OBACT)) + else if (OBACT_NEW && (OBACT_NEW->mode & OB_MODE_WEIGHT_PAINT)) { + if (ob == modifiers_isDeformedByArmature(OBACT_NEW)) arm->flag |= ARM_POSEMODE; } draw_pose_paths(scene, v3d, ar, ob); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d72f908eb30..114a61c452b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7991,7 +7991,7 @@ static void drawObjectSelect(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion else if (ob->type == OB_ARMATURE) { if (!(ob->mode & OB_MODE_POSE && base == sl->basact)) { glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f); - draw_armature(scene, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); + draw_armature(scene, sl, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); } } @@ -8553,7 +8553,7 @@ void draw_object(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, Base *b } else { glLineWidth(1.0f); - empty_object = draw_armature(scene, v3d, ar, base, dt, dflag, ob_wire_col, false); + empty_object = draw_armature(scene, sl, v3d, ar, base, dt, dflag, ob_wire_col, false); } } break; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 242249af9af..4b39dc4e8dc 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -181,7 +181,7 @@ enum { int view3d_effective_drawtype(const struct View3D *v3d); /* drawarmature.c */ -bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, BaseLegacy *base, +bool draw_armature(Scene *scene, struct SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, const short dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_outline); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 1aa1bd341d7..9316465fd5c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1887,7 +1887,8 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo { TransInfo *t = arg; Scene *scene = t->scene; - Object *ob = OBACT; + SceneLayer *sl = t->sl; + Object *ob = OBACT_NEW; /* draw autokeyframing hint in the corner * - only draw if enabled (advanced users may be distracted/annoyed), diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index fbf8c9158d7..b68b3365e46 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -7887,7 +7887,8 @@ static void createTransGPencil(bContext *C, TransInfo *t) void createTransData(bContext *C, TransInfo *t) { Scene *scene = t->scene; - Object *ob = OBACT; + SceneLayer *sl = t->sl; + Object *ob = OBACT_NEW; /* if tests must match recalcData for correct updates */ if (t->options & CTX_TEXTURE) { @@ -8047,10 +8048,9 @@ void createTransData(bContext *C, TransInfo *t) * lines below just check is also visible */ Object *ob_armature = modifiers_isDeformedByArmature(ob); if (ob_armature && ob_armature->mode & OB_MODE_POSE) { - BaseLegacy *base_arm = BKE_scene_base_find(t->scene, ob_armature); + Base *base_arm = BKE_scene_layer_base_find(t->sl, ob_armature); if (base_arm) { - View3D *v3d = t->view; - if (BASE_VISIBLE(v3d, base_arm)) { + if (BASE_VISIBLE_NEW(base_arm)) { createTransPose(t, ob_armature); } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b92c075a9c7..012342c16fc 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -314,7 +314,7 @@ static bool fcu_test_selected(FCurve *fcu) /* helper for recalcData() - for Action Editor transforms */ static void recalcData_actedit(TransInfo *t) { - Scene *scene = t->scene; + SceneLayer *sl= t->sl; SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; bAnimContext ac = {NULL}; @@ -325,7 +325,7 @@ static void recalcData_actedit(TransInfo *t) /* initialize relevant anim-context 'context' data from TransInfo data */ /* NOTE: sync this with the code in ANIM_animdata_get_context() */ ac.scene = t->scene; - ac.obact = OBACT; + ac.obact = OBACT_NEW; ac.sa = t->sa; ac.ar = t->ar; ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; @@ -362,7 +362,7 @@ static void recalcData_actedit(TransInfo *t) static void recalcData_graphedit(TransInfo *t) { SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; - Scene *scene; + SceneLayer *sl = t->sl; ListBase anim_data = {NULL, NULL}; bAnimContext ac = {NULL}; @@ -373,8 +373,8 @@ static void recalcData_graphedit(TransInfo *t) /* initialize relevant anim-context 'context' data from TransInfo data */ /* NOTE: sync this with the code in ANIM_animdata_get_context() */ - scene = ac.scene = t->scene; - ac.obact = OBACT; + ac.scene = t->scene; + ac.obact = OBACT_NEW; ac.sa = t->sa; ac.ar = t->ar; ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; @@ -1773,8 +1773,8 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]) } } else if (t->flag & T_POSE) { - Scene *scene = t->scene; - Object *ob = OBACT; + SceneLayer *sl = t->sl; + Object *ob = OBACT_NEW; if (ob) { bPoseChannel *pchan = BKE_pose_channel_active(ob); if (pchan && (!select_only || (pchan->bone->flag & BONE_SELECTED))) { @@ -1793,9 +1793,10 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]) } else { /* object mode */ - Scene *scene = t->scene; - Object *ob = OBACT; - if (ob && (!select_only || (ob->flag & SELECT))) { + SceneLayer *sl = t->sl; + Object *ob = OBACT_NEW; + Base *base = BASACT_NEW; + if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) { copy_v3_v3(r_center, ob->obmat[3]); ok = true; } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 1dae055878b..33f065b4369 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1663,6 +1663,7 @@ void BIF_draw_manipulator(const bContext *C) ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); View3D *v3d = sa->spacedata.first; RegionView3D *rv3d = ar->regiondata; int totsel; @@ -1687,7 +1688,7 @@ void BIF_draw_manipulator(const bContext *C) case V3D_AROUND_ACTIVE: { bGPdata *gpd = CTX_data_gpencil_data(C); - Object *ob = OBACT; + Object *ob = OBACT_NEW; if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) && ((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) && diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 9c9cf2dba50..67f1dc6e44d 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -1016,7 +1016,6 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } else { /* we need the one selected object, if its not active */ - View3D *v3d = CTX_wm_view3d(C); base = BASACT_NEW; ob = OBACT_NEW; if (base && ((base->flag & BASE_SELECTED) != 0)) { diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 4cf4259d1de..c7b418f863b 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -2002,6 +2002,8 @@ extern const char *RE_engine_id_CYCLES; ((base->flag & BASE_VISIBLED) != 0)) #define BASE_SELECTABLE_NEW(base) \ ((base->flag & BASE_SELECTABLED) != 0) +#define BASE_VISIBLE_NEW(base) ( \ + (base->flag & BASE_VISIBLED) != 0) #define FIRSTBASE scene->base.first #define LASTBASE scene->base.last |