More housecleaning (BASACT > BASACT_NEW)

This commit is contained in:
Dalai Felinto 2017-02-09 16:34:26 +01:00
parent cb490561d3
commit 1045026ea2
12 changed files with 40 additions and 33 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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),

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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)) &&

View File

@ -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)) {

View File

@ -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