Main fix for outliner, but still need changes

Fix outliner related crashes. Basically in some functions bContext was
not passed around, so CTX_data_scene_layer(C) was crashing.

Right now we still rely on ob->flag SELECT in some places. In order to use the base flag we will need to bring back the Bases to the outliner.
This commit is contained in:
Dalai Felinto
2017-02-09 17:51:25 +01:00
parent 1bcf199d2e
commit d82bb1f634
5 changed files with 89 additions and 86 deletions

View File

@@ -1287,6 +1287,7 @@ void BKE_scene_base_unlink(Scene *sce, BaseLegacy *base)
sce->basact = NULL;
}
/* deprecated, use BKE_scene_layer_base_deselect_all */
void BKE_scene_base_deselect_all(Scene *sce)
{
BaseLegacy *b;

View File

@@ -295,6 +295,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
Object *obedit = CTX_data_edit_object(C);
BLI_mempool *ts = soops->treestore;
TreeStoreElem *tselem = tsep;
@@ -356,7 +357,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
ED_armature_bone_rename(obedit->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT_NEW);
}
break;
}
@@ -368,8 +369,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
char newname[sizeof(bone->name)];
/* always make current object active */
tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT;
tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT_NEW;
/* restore bone name */
BLI_strncpy(newname, bone->name, sizeof(bone->name));
@@ -385,8 +386,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
char newname[sizeof(pchan->name)];
/* always make current pose-bone active */
tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT;
tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT_NEW;
BLI_assert(ob->type == OB_ARMATURE);
@@ -1132,7 +1133,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
}
}
static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, SpaceOops *soops, ListBase *lb, int level,
static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, SceneLayer *sl, SpaceOops *soops, ListBase *lb, int level,
int xmax, int *offsx, int ys)
{
TreeElement *te;
@@ -1153,17 +1154,17 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
/* active blocks get white circle */
if (tselem->type == 0) {
if (te->idcode == ID_OB) {
active = (OBACT == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE;
active = (OBACT_NEW == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE;
}
else if (scene->obedit && scene->obedit->data == tselem->id) {
active = OL_DRAWSEL_NORMAL;
}
else {
active = tree_element_active(C, scene, soops, te, OL_SETSEL_NONE, false);
active = tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NONE, false);
}
}
else {
active = tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false);
active = tree_element_type_active(NULL, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false);
}
if (active != OL_DRAWSEL_NONE) {
@@ -1192,7 +1193,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
/* this tree element always has same amount of branches, so don't draw */
if (tselem->type != TSE_R_LAYER)
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level + 1, xmax, offsx, ys);
outliner_draw_iconrow(C, block, scene, sl, soops, &te->subtree, level + 1, xmax, offsx, ys);
}
}
@@ -1216,7 +1217,7 @@ static void outliner_set_coord_tree_element(TreeElement *te, int startx, int sta
static void outliner_draw_tree_element(
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ARegion *ar, SpaceOops *soops,
bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, SceneLayer *sl, ARegion *ar, SpaceOops *soops,
TreeElement *te, int startx, int *starty, TreeElement **te_edit)
{
TreeElement *ten;
@@ -1252,13 +1253,13 @@ static void outliner_draw_tree_element(
else if (te->idcode == ID_OB) {
Object *ob = (Object *)tselem->id;
if (ob == OBACT || (ob->flag & SELECT)) {
if (ob == OBACT_NEW || (ob->flag & SELECT)) {
char col[4] = {0, 0, 0, 0};
/* outliner active ob: always white text, circle color now similar to view3d */
active = OL_DRAWSEL_ACTIVE;
if (ob == OBACT) {
if (ob == OBACT_NEW) {
if (ob->flag & SELECT) {
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
col[3] = alpha;
@@ -1279,14 +1280,14 @@ static void outliner_draw_tree_element(
active = OL_DRAWSEL_ACTIVE;
}
else {
if (tree_element_active(C, scene, soops, te, OL_SETSEL_NONE, false)) {
if (tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NONE, false)) {
rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
active = OL_DRAWSEL_ACTIVE;
}
}
}
else {
if (tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false) != OL_DRAWSEL_NONE) {
if (tree_element_type_active(NULL, scene, sl, soops, te, tselem, OL_SETSEL_NONE, false) != OL_DRAWSEL_NONE) {
active = OL_DRAWSEL_ACTIVE;
}
rgba_float_args_set(color, 0.85f, 0.85f, 1.0f, alpha);
@@ -1394,7 +1395,7 @@ static void outliner_draw_tree_element(
glEnable(GL_BLEND);
glPixelTransferf(GL_ALPHA_SCALE, 0.5);
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, 0, xmax, &tempx, *starty);
outliner_draw_iconrow(C, block, scene, sl, soops, &te->subtree, 0, xmax, &tempx, *starty);
glPixelTransferf(GL_ALPHA_SCALE, 1.0);
glDisable(GL_BLEND);
@@ -1411,7 +1412,7 @@ static void outliner_draw_tree_element(
*starty -= UI_UNIT_Y;
for (ten = te->subtree.first; ten; ten = ten->next) {
outliner_draw_tree_element(C, block, fstyle, scene, ar, soops, ten, startx + UI_UNIT_X, starty, te_edit);
outliner_draw_tree_element(C, block, fstyle, scene, sl, ar, soops, ten, startx + UI_UNIT_X, starty, te_edit);
}
}
else {
@@ -1563,7 +1564,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
}
static void outliner_draw_tree(
bContext *C, uiBlock *block, Scene *scene, ARegion *ar,
bContext *C, uiBlock *block, Scene *scene, SceneLayer *sl, ARegion *ar,
SpaceOops *soops, const bool has_restrict_icons,
TreeElement **te_edit)
{
@@ -1603,7 +1604,7 @@ static void outliner_draw_tree(
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
for (TreeElement *te = soops->tree.first; te; te = te->next) {
outliner_draw_tree_element(C, block, fstyle, scene, ar, soops, te, startx, &starty, te_edit);
outliner_draw_tree_element(C, block, fstyle, scene, sl, ar, soops, te, startx, &starty, te_edit);
}
if (has_restrict_icons) {
@@ -1734,7 +1735,7 @@ void draw_outliner(const bContext *C)
/* draw outliner stuff (background, hierarchy lines and names) */
outliner_back(ar);
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops, has_restrict_icons, &te_edit);
outliner_draw_tree((bContext *)C, block, scene, sl, ar, soops, has_restrict_icons, &te_edit);
if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */

View File

@@ -1003,14 +1003,14 @@ static int outliner_open_back(TreeElement *te)
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOops *so = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
TreeElement *te;
int xdelta, ytop;
Object *obact = OBACT;
Object *obact = OBACT_NEW;
if (!obact)
return OPERATOR_CANCELLED;

View File

@@ -151,9 +151,9 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
/* outliner_select.c -------------------------------------------- */
eOLDrawState tree_element_type_active(
struct bContext *C, struct Scene *scene, struct SpaceOops *soops,
struct bContext *C, struct Scene *scene, struct SceneLayer *sl, struct SpaceOops *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive);
eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops,
eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, struct SceneLayer *sl, SpaceOops *soops,
TreeElement *te, const eOLSetState set, const bool handle_all_types);
int outliner_item_activate_or_toggle_closed(struct bContext *C, int x, int y, bool extend, bool recursive);

View File

@@ -74,7 +74,7 @@
/* Outliner Element Selection/Activation on Click */
static eOLDrawState tree_element_active_renderlayer(
bContext *C, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
bContext *C, Scene *UNUSED(scene), SceneLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
{
Scene *sce;
@@ -136,12 +136,12 @@ static void do_outliner_ebone_select_recursive(bArmature *arm, EditBone *ebone_p
}
static eOLDrawState tree_element_set_active_object(
bContext *C, Scene *scene, SpaceOops *soops,
bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *soops,
TreeElement *te, const eOLSetState set, bool recursive)
{
TreeStoreElem *tselem = TREESTORE(te);
Scene *sce;
BaseLegacy *base;
Base *base;
Object *ob = NULL;
/* if id is not object, we search back */
@@ -150,7 +150,7 @@ static eOLDrawState tree_element_set_active_object(
}
else {
ob = (Object *)outliner_search_back(soops, te, ID_OB);
if (ob == OBACT) {
if (ob == OBACT_NEW) {
return OL_DRAWSEL_NONE;
}
}
@@ -170,15 +170,15 @@ static eOLDrawState tree_element_set_active_object(
if (base) {
if (set == OL_SETSEL_EXTEND) {
/* swap select */
if (base->flag_legacy & SELECT)
ED_base_object_select(base, BA_DESELECT);
if (base->flag & BASE_SELECTED)
ED_object_base_select(base, BA_DESELECT);
else
ED_base_object_select(base, BA_SELECT);
ED_object_base_select(base, BA_SELECT);
}
else {
/* deleselect all */
BKE_scene_base_deselect_all(scene);
ED_base_object_select(base, BA_SELECT);
BKE_scene_layer_base_deselect_all(sl);
ED_object_base_select(base, BA_SELECT);
}
if (recursive) {
@@ -187,7 +187,7 @@ static eOLDrawState tree_element_set_active_object(
}
if (C) {
ED_base_object_activate(C, base); /* adds notifier */
ED_object_base_activate(C, base); /* adds notifier */
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
@@ -199,7 +199,7 @@ static eOLDrawState tree_element_set_active_object(
}
static eOLDrawState tree_element_active_material(
bContext *C, Scene *scene, SpaceOops *soops,
bContext *C, Scene* UNUSED(scene), SceneLayer *sl, SpaceOops *soops,
TreeElement *te, const eOLSetState set)
{
TreeElement *tes;
@@ -208,7 +208,7 @@ static eOLDrawState tree_element_active_material(
/* we search for the object parent */
ob = (Object *)outliner_search_back(soops, te, ID_OB);
// note: ob->matbits can be NULL when a local object points to a library mesh.
if (ob == NULL || ob != OBACT || ob->matbits == NULL) {
if (ob == NULL || ob != OBACT_NEW || ob->matbits == NULL) {
return OL_DRAWSEL_NONE; /* just paranoia */
}
@@ -252,12 +252,12 @@ static eOLDrawState tree_element_active_material(
}
static eOLDrawState tree_element_active_texture(
bContext *C, Scene *scene, SpaceOops *UNUSED(soops),
bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *UNUSED(soops),
TreeElement *te, const eOLSetState set)
{
TreeElement *tep;
TreeStoreElem /* *tselem,*/ *tselemp;
Object *ob = OBACT;
Object *ob = OBACT_NEW;
SpaceButs *sbuts = NULL;
if (ob == NULL) {
@@ -339,14 +339,14 @@ static eOLDrawState tree_element_active_texture(
static eOLDrawState tree_element_active_lamp(
bContext *UNUSED(C), Scene *scene, SpaceOops *soops,
bContext *UNUSED(C), Scene *UNUSED(scene), SceneLayer *sl, SpaceOops *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob;
/* we search for the object parent */
ob = (Object *)outliner_search_back(soops, te, ID_OB);
if (ob == NULL || ob != OBACT) {
if (ob == NULL || ob != OBACT_NEW) {
/* just paranoia */
return OL_DRAWSEL_NONE;
}
@@ -362,7 +362,7 @@ static eOLDrawState tree_element_active_lamp(
}
static eOLDrawState tree_element_active_camera(
bContext *UNUSED(C), Scene *scene, SpaceOops *soops,
bContext *UNUSED(C), Scene *scene, SceneLayer *UNUSED(sl), SpaceOops *soops,
TreeElement *te, const eOLSetState set)
{
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
@@ -375,7 +375,7 @@ static eOLDrawState tree_element_active_camera(
}
static eOLDrawState tree_element_active_world(
bContext *C, Scene *scene, SpaceOops *UNUSED(soops),
bContext *C, Scene *scene, SceneLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
TreeElement *te, const eOLSetState set)
{
TreeElement *tep;
@@ -408,7 +408,7 @@ static eOLDrawState tree_element_active_world(
}
static eOLDrawState tree_element_active_defgroup(
bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
bContext *C, SceneLayer *sl, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
{
Object *ob;
@@ -422,7 +422,7 @@ static eOLDrawState tree_element_active_defgroup(
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
}
else {
if (ob == OBACT)
if (ob == OBACT_NEW)
if (ob->actdef == te->index + 1) {
return OL_DRAWSEL_NORMAL;
}
@@ -431,7 +431,7 @@ static eOLDrawState tree_element_active_defgroup(
}
static eOLDrawState tree_element_active_posegroup(
bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
bContext *C, Scene *UNUSED(scene), SceneLayer *sl, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
{
Object *ob = (Object *)tselem->id;
@@ -442,7 +442,7 @@ static eOLDrawState tree_element_active_posegroup(
}
}
else {
if (ob == OBACT && ob->pose) {
if (ob == OBACT_NEW && ob->pose) {
if (ob->pose->active_group == te->index + 1) {
return OL_DRAWSEL_NORMAL;
}
@@ -452,7 +452,7 @@ static eOLDrawState tree_element_active_posegroup(
}
static eOLDrawState tree_element_active_posechannel(
bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
bContext *C, Scene *UNUSED(scene), SceneLayer *sl, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
{
Object *ob = (Object *)tselem->id;
bArmature *arm = ob->data;
@@ -486,7 +486,7 @@ static eOLDrawState tree_element_active_posechannel(
}
}
else {
if (ob == OBACT && ob->pose) {
if (ob == OBACT_NEW && ob->pose) {
if (pchan->bone->flag & BONE_SELECTED) {
return OL_DRAWSEL_NORMAL;
}
@@ -496,14 +496,14 @@ static eOLDrawState tree_element_active_posechannel(
}
static eOLDrawState tree_element_active_bone(
bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
bContext *C, SceneLayer *sl, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
{
bArmature *arm = (bArmature *)tselem->id;
Bone *bone = te->directdata;
if (set != OL_SETSEL_NONE) {
if (!(bone->flag & BONE_HIDDEN_P)) {
Object *ob = OBACT;
Object *ob = OBACT_NEW;
if (ob) {
if (set != OL_SETSEL_EXTEND) {
/* single select forces all other bones to get unselected */
@@ -532,7 +532,7 @@ static eOLDrawState tree_element_active_bone(
}
}
else {
Object *ob = OBACT;
Object *ob = OBACT_NEW;
if (ob && ob->data == arm) {
if (bone->flag & BONE_SELECTED) {
@@ -605,7 +605,7 @@ static eOLDrawState tree_element_active_ebone(
}
static eOLDrawState tree_element_active_modifier(
bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
bContext *C, Scene *UNUSED(scene), SceneLayer *UNUSED(sl), TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
if (set != OL_SETSEL_NONE) {
Object *ob = (Object *)tselem->id;
@@ -633,7 +633,7 @@ static eOLDrawState tree_element_active_psys(
}
static int tree_element_active_constraint(
bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
bContext *C, Scene *UNUSED(scene), SceneLayer *UNUSED(sl), TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
if (set != OL_SETSEL_NONE) {
Object *ob = (Object *)tselem->id;
@@ -646,7 +646,7 @@ static int tree_element_active_constraint(
}
static eOLDrawState tree_element_active_text(
bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops),
bContext *UNUSED(C), Scene *UNUSED(scene), SceneLayer *UNUSED(sl), SpaceOops *UNUSED(soops),
TreeElement *UNUSED(te), int UNUSED(set))
{
// XXX removed
@@ -654,10 +654,8 @@ static eOLDrawState tree_element_active_text(
}
static eOLDrawState tree_element_active_pose(
bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
bContext *C, Scene *scene, SceneLayer *sl, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
TODO_LAYER_CONTEXT; /* we may need to pass SceneLayer instead of Scene here */
SceneLayer *sl = CTX_data_scene_layer(C);
Object *ob = (Object *)tselem->id;
Base *base = BKE_scene_layer_base_find(sl, ob);
@@ -740,7 +738,7 @@ static eOLDrawState tree_element_active_sequence_dup(
}
static eOLDrawState tree_element_active_keymap_item(
bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set)
bContext *UNUSED(C), Scene *UNUSED(scene), SceneLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set)
{
wmKeyMapItem *kmi = te->directdata;
@@ -759,7 +757,7 @@ static eOLDrawState tree_element_active_keymap_item(
/* ---------------------------------------------- */
/* generic call for ID data check or make/check active in UI */
eOLDrawState tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te,
eOLDrawState tree_element_active(bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *soops, TreeElement *te,
const eOLSetState set, const bool handle_all_types)
{
switch (te->idcode) {
@@ -767,21 +765,21 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tr
* selection. See do_outliner_item_activate. */
case ID_OB:
if (handle_all_types) {
return tree_element_set_active_object(C, scene, soops, te, set, false);
return tree_element_set_active_object(C, scene, sl, soops, te, set, false);
}
break;
case ID_MA:
return tree_element_active_material(C, scene, soops, te, set);
return tree_element_active_material(C, scene, sl, soops, te, set);
case ID_WO:
return tree_element_active_world(C, scene, soops, te, set);
return tree_element_active_world(C, scene, sl, soops, te, set);
case ID_LA:
return tree_element_active_lamp(C, scene, soops, te, set);
return tree_element_active_lamp(C, scene, sl, soops, te, set);
case ID_TE:
return tree_element_active_texture(C, scene, soops, te, set);
return tree_element_active_texture(C, scene, sl, soops, te, set);
case ID_TXT:
return tree_element_active_text(C, scene, soops, te, set);
return tree_element_active_text(C, scene, sl, soops, te, set);
case ID_CA:
return tree_element_active_camera(C, scene, soops, te, set);
return tree_element_active_camera(C, scene, sl, soops, te, set);
}
return OL_DRAWSEL_NONE;
}
@@ -792,46 +790,46 @@ eOLDrawState tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tr
* \note Context can be NULL when ``(set == OL_SETSEL_NONE)``
*/
eOLDrawState tree_element_type_active(
bContext *C, Scene *scene, SpaceOops *soops,
bContext *C, Scene *scene, SceneLayer *sl, SpaceOops *soops,
TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
{
switch (tselem->type) {
case TSE_DEFGROUP:
return tree_element_active_defgroup(C, scene, te, tselem, set);
return tree_element_active_defgroup(C, sl, te, tselem, set);
case TSE_BONE:
return tree_element_active_bone(C, scene, te, tselem, set, recursive);
return tree_element_active_bone(C, sl, te, tselem, set, recursive);
case TSE_EBONE:
return tree_element_active_ebone(C, scene, te, tselem, set, recursive);
case TSE_MODIFIER:
return tree_element_active_modifier(C, te, tselem, set);
return tree_element_active_modifier(C, scene, sl, te, tselem, set);
case TSE_LINKED_OB:
if (set != OL_SETSEL_NONE) {
tree_element_set_active_object(C, scene, soops, te, set, false);
tree_element_set_active_object(C, scene, sl, soops, te, set, false);
}
else if (tselem->id == (ID *)OBACT) {
else if (tselem->id == (ID *)OBACT_NEW) {
return OL_DRAWSEL_NORMAL;
}
break;
case TSE_LINKED_PSYS:
return tree_element_active_psys(C, scene, te, tselem, set);
case TSE_POSE_BASE:
return tree_element_active_pose(C, scene, te, tselem, set);
return tree_element_active_pose(C, scene, sl, te, tselem, set);
case TSE_POSE_CHANNEL:
return tree_element_active_posechannel(C, scene, te, tselem, set, recursive);
return tree_element_active_posechannel(C, scene, sl, te, tselem, set, recursive);
case TSE_CONSTRAINT:
return tree_element_active_constraint(C, te, tselem, set);
return tree_element_active_constraint(C, scene, sl, te, tselem, set);
case TSE_R_LAYER:
return tree_element_active_renderlayer(C, te, tselem, set);
return tree_element_active_renderlayer(C, scene, sl, te, tselem, set);
case TSE_POSEGRP:
return tree_element_active_posegroup(C, scene, te, tselem, set);
return tree_element_active_posegroup(C, scene, sl, te, tselem, set);
case TSE_SEQUENCE:
return tree_element_active_sequence(C, scene, te, tselem, set);
case TSE_SEQUENCE_DUP:
return tree_element_active_sequence_dup(scene, te, tselem, set);
case TSE_KEYMAP_ITEM:
return tree_element_active_keymap_item(C, te, tselem, set);
return tree_element_active_keymap_item(C, scene, sl, te, tselem, set);
case TSE_GP_LAYER:
//return tree_element_active_gplayer(C, scene, te, tselem, set);
//return tree_element_active_gplayer(C, scene, s, te, tselem, set);
break;
}
@@ -845,13 +843,14 @@ static void outliner_item_activate(
const bool extend, const bool recursive)
{
Scene *scene = CTX_data_scene(C);
SceneLayer *sl = CTX_data_scene_layer(C);
TreeStoreElem *tselem = TREESTORE(te);
/* always makes active object, except for some specific types.
* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects, we do not want
* to switch out of edit mode (see T48328 for details). */
if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, TSE_EBONE)) {
tree_element_set_active_object(C, scene, soops, te,
tree_element_set_active_object(C, scene, sl, soops, te,
(extend && tselem->type == 0) ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
recursive && tselem->type == 0);
}
@@ -877,15 +876,17 @@ static void outliner_item_activate(
}
for (gob = gr->gobject.first; gob; gob = gob->next) {
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), sel);
ED_object_base_select(BKE_scene_layer_base_find(sl, gob->ob), sel);
}
}
else {
BKE_scene_base_deselect_all(scene);
BKE_scene_layer_base_deselect_all(sl);
for (gob = gr->gobject.first; gob; gob = gob->next) {
if ((gob->ob->flag & SELECT) == 0)
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT);
Base *base = BKE_scene_layer_base_find(sl, gob->ob);
if ((base->flag & BASE_SELECTED) == 0) {
ED_object_base_select(base, BA_SELECT);
}
}
}
@@ -895,12 +896,12 @@ static void outliner_item_activate(
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
}
else { // rest of types
tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, false);
tree_element_active(C, scene, sl, soops, te, OL_SETSEL_NORMAL, false);
}
}
else {
tree_element_type_active(C, scene, soops, te, tselem,
tree_element_type_active(C, scene, sl, soops, te, tselem,
extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
recursive);
}