67
69
#include "outliner_intern.h"
69
71
/* ****************************************************** */
70
/* Outliner Selection (grey-blue highlight for rows) */
72
/* Outliner Selection (gray-blue highlight for rows) */
72
74
static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
75
77
TreeStoreElem *tselem;
78
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
79
tselem= TREESTORE(te);
80
for (te = lb->first; te && *index >= 0; te = te->next, (*index)--) {
81
tselem = TREESTORE(te);
81
83
/* if we've encountered the right item, set its 'Outliner' selection status */
83
85
/* this should be the last one, so no need to do anything with index */
84
if ((te->flag & TE_ICONROW)==0) {
86
if ((te->flag & TE_ICONROW) == 0) {
85
87
/* -1 value means toggle testing for now... */
86
88
if (*selecting == -1) {
87
89
if (tselem->flag & TSE_SELECTED)
93
95
/* set selection */
102
else if (TSELEM_OPEN(tselem,soops)) {
104
else if (TSELEM_OPEN(tselem, soops)) {
103
105
/* Only try selecting sub-elements if we haven't hit the right element yet
106
* Index must be reduced before supplying it to the sub-tree to try to do
107
* selection, however, we need to increment it again for the next loop to
108
* Index must be reduced before supplying it to the sub-tree to try to do
109
* selection, however, we need to increment it again for the next loop to
111
113
change |= outliner_select(soops, &te->subtree, index, selecting);
126
128
/* paranoia check */
127
if (te->idcode!=ID_SCE)
129
if (te->idcode != ID_SCE)
129
sce= (Scene *)tselem->id;
131
sce = (Scene *)tselem->id;
132
sce->r.actlay= tselem->nr;
133
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce);
134
sce->r.actlay = tselem->nr;
135
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, sce);
136
return sce->r.actlay==tselem->nr;
138
return sce->r.actlay == tselem->nr;
141
143
static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
143
TreeStoreElem *tselem= TREESTORE(te);
145
TreeStoreElem *tselem = TREESTORE(te);
148
150
/* if id is not object, we search back */
149
if (te->idcode==ID_OB) ob= (Object *)tselem->id;
151
if (te->idcode == ID_OB) ob = (Object *)tselem->id;
151
ob= (Object *)outliner_search_back(soops, te, ID_OB);
152
if (ob==OBACT) return 0;
153
ob = (Object *)outliner_search_back(soops, te, ID_OB);
154
if (ob == OBACT) return 0;
154
if (ob==NULL) return 0;
156
if (ob == NULL) return 0;
156
sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
158
sce = (Scene *)outliner_search_back(soops, te, ID_SCE);
157
159
if (sce && scene != sce) {
158
160
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
161
163
/* find associated base in current scene */
162
base= object_in_scene(ob, scene);
164
base = BKE_scene_base_find(scene, ob);
166
168
/* swap select */
167
169
if (base->flag & SELECT)
168
170
ED_base_object_select(base, BA_DESELECT);
173
175
/* deleselect all */
174
scene_deselect_all(scene);
176
BKE_scene_base_deselect_all(scene);
175
177
ED_base_object_select(base, BA_SELECT);
178
180
ED_base_object_activate(C, base); /* adds notifier */
179
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
181
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
183
if (ob!=scene->obedit)
184
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
185
if (ob != scene->obedit)
186
ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
194
196
/* we search for the object parent */
195
ob= (Object *)outliner_search_back(soops, te, ID_OB);
197
ob = (Object *)outliner_search_back(soops, te, ID_OB);
196
198
// note: ob->matbits can be NULL when a local object points to a library mesh.
197
if (ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0; // just paranoia
199
if (ob == NULL || ob != OBACT || ob->matbits == NULL) return 0; // just paranoia
199
201
/* searching in ob mat array? */
201
if (tes->idcode==ID_OB) {
203
if (tes->idcode == ID_OB) {
203
ob->actcol= te->index+1;
204
ob->matbits[te->index]= 1; // make ob material active too
205
ob->actcol = te->index + 1;
206
ob->matbits[te->index] = 1; // make ob material active too
207
if (ob->actcol == te->index+1)
209
if (ob->actcol == te->index + 1)
208
210
if (ob->matbits[te->index]) return 1;
211
213
/* or we search for obdata material */
214
ob->actcol= te->index+1;
215
ob->matbits[te->index]= 0; // make obdata material active too
216
ob->actcol = te->index + 1;
217
ob->matbits[te->index] = 0; // make obdata material active too
218
if (ob->actcol == te->index+1)
219
if (ob->matbits[te->index]==0) return 1;
220
if (ob->actcol == te->index + 1)
221
if (ob->matbits[te->index] == 0) return 1;
223
WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
225
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
230
232
TreeElement *tep;
231
233
TreeStoreElem /* *tselem,*/ *tselemp;
233
SpaceButs *sbuts=NULL;
235
if (ob==NULL) return 0; // no active object
237
/*tselem= TREESTORE(te);*/ /*UNUSED*/
235
SpaceButs *sbuts = NULL;
237
if (ob == NULL) return 0; // no active object
239
/*tselem = TREESTORE(te);*/ /*UNUSED*/
239
241
/* find buttons area (note, this is undefined really still, needs recode in blender) */
240
242
/* XXX removed finding sbuts */
242
244
/* where is texture linked to? */
244
tselemp= TREESTORE(tep);
246
tselemp = TREESTORE(tep);
246
if (tep->idcode==ID_WO) {
247
World *wrld= (World *)tselemp->id;
248
if (tep->idcode == ID_WO) {
249
World *wrld = (World *)tselemp->id;
251
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
252
// XXX sbuts->texfrom= 1;
253
// XXX sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c
254
// XXX sbuts->texfrom = 1;
254
256
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
255
wrld->texact= te->index;
257
wrld->texact = te->index;
257
259
else if (tselemp->id == (ID *)(scene->world)) {
258
if (wrld->texact==te->index) return 1;
260
if (wrld->texact == te->index) return 1;
261
else if (tep->idcode==ID_LA) {
262
Lamp *la= (Lamp *)tselemp->id;
263
else if (tep->idcode == ID_LA) {
264
Lamp *la = (Lamp *)tselemp->id;
265
// XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
266
// XXX sbuts->texfrom= 2;
267
// XXX sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c
268
// XXX sbuts->texfrom = 2;
268
270
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
269
la->texact= te->index;
271
la->texact = te->index;
272
274
if (tselemp->id == ob->data) {
273
if (la->texact==te->index) return 1;
275
if (la->texact == te->index) return 1;
277
else if (tep->idcode==ID_MA) {
278
Material *ma= (Material *)tselemp->id;
279
else if (tep->idcode == ID_MA) {
280
Material *ma = (Material *)tselemp->id;
281
//sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
282
// XXX sbuts->texfrom= 0;
283
//sbuts->tabo = TAB_SHADING_TEX; // hack from header_buttonswin.c
284
// XXX sbuts->texfrom = 0;
284
286
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
285
ma->texact= (char)te->index;
287
ma->texact = (char)te->index;
287
289
/* also set active material */
288
ob->actcol= tep->index+1;
290
ob->actcol = tep->index + 1;
290
else if (tep->flag & TE_ACTIVE) { // this is active material
291
if (ma->texact==te->index) return 1;
292
else if (tep->flag & TE_ACTIVE) { // this is active material
293
if (ma->texact == te->index) return 1;
328
330
static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
330
332
TreeElement *tep;
331
TreeStoreElem *tselem=NULL;
333
TreeStoreElem *tselem = NULL;
336
tselem= TREESTORE(tep);
337
sce= (Scene *)tselem->id;
338
tselem = TREESTORE(tep);
339
if (tselem->type == 0)
340
sce = (Scene *)tselem->id;
340
if (set) { // make new scene active
343
if (set) { // make new scene active
341
344
if (sce && scene != sce) {
342
345
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
346
if (tep==NULL || tselem->id == (ID *)scene) {
349
if (tep == NULL || tselem->id == (ID *)scene) {
348
351
// XXX extern_set_butspace(F8KEY, 0);
361
364
/* id in tselem is object */
362
ob= (Object *)tselem->id;
365
ob = (Object *)tselem->id;
364
BLI_assert(te->index+1 >= 0);
365
ob->actdef= te->index+1;
367
BLI_assert(te->index + 1 >= 0);
368
ob->actdef = te->index + 1;
367
370
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
368
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
371
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
372
if (ob->actdef== te->index+1) return 1;
375
if (ob->actdef == te->index + 1) return 1;
377
380
static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
379
Object *ob= (Object *)tselem->id;
382
Object *ob = (Object *)tselem->id;
383
ob->pose->active_group= te->index+1;
384
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
386
ob->pose->active_group = te->index + 1;
387
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
388
if (ob==OBACT && ob->pose) {
389
if (ob->pose->active_group== te->index+1) return 1;
391
if (ob == OBACT && ob->pose) {
392
if (ob->pose->active_group == te->index + 1) return 1;
395
398
static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
397
Object *ob= (Object *)tselem->id;
398
bArmature *arm= ob->data;
399
bPoseChannel *pchan= te->directdata;
400
Object *ob = (Object *)tselem->id;
401
bArmature *arm = ob->data;
402
bPoseChannel *pchan = te->directdata;
402
405
if (!(pchan->bone->flag & BONE_HIDDEN_P)) {
404
if (set==2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
405
else ED_pose_deselectall(ob, 0); // 0 = deselect
407
if (set == 2) ED_pose_deselectall(ob, 2); // 2 = clear active tag
408
else ED_pose_deselectall(ob, 0); // 0 = deselect
407
if (set==2 && (pchan->bone->flag & BONE_SELECTED)) {
410
if (set == 2 && (pchan->bone->flag & BONE_SELECTED)) {
408
411
pchan->bone->flag &= ~BONE_SELECTED;
411
414
pchan->bone->flag |= BONE_SELECTED;
412
arm->act_bone= pchan->bone;
415
arm->act_bone = pchan->bone;
415
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, ob);
418
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
420
if (ob==OBACT && ob->pose) {
423
if (ob == OBACT && ob->pose) {
421
424
if (pchan->bone->flag & BONE_SELECTED) return 1;
427
430
static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set)
429
bArmature *arm= (bArmature *)tselem->id;
430
Bone *bone= te->directdata;
432
bArmature *arm = (bArmature *)tselem->id;
433
Bone *bone = te->directdata;
433
436
if (!(bone->flag & BONE_HIDDEN_P)) {
434
if (set==2) ED_pose_deselectall(OBACT, 2); // 2 is clear active tag
435
else ED_pose_deselectall(OBACT, 0);
439
if (set == 2) ED_pose_deselectall(ob, 2); // 2 is clear active tag
440
else ED_pose_deselectall(ob, 0);
437
if (set==2 && (bone->flag & BONE_SELECTED)) {
443
if (set == 2 && (bone->flag & BONE_SELECTED)) {
438
444
bone->flag &= ~BONE_SELECTED;
441
447
bone->flag |= BONE_SELECTED;
448
arm->act_bone = bone;
445
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, OBACT);
451
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
451
if (ob && ob->data==arm) {
457
if (ob && ob->data == arm) {
452
458
if (bone->flag & BONE_SELECTED) return 1;
460
466
static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
463
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
464
arm->act_edbone= ebone;
469
ebone->flag |= BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL;
470
arm->act_edbone = ebone;
465
471
// flush to parent?
466
472
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
469
ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
475
ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
470
476
// flush to parent?
471
477
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
474
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
480
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, scene->obedit);
476
482
static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
478
bArmature *arm= scene->obedit->data;
479
EditBone *ebone= te->directdata;
484
bArmature *arm = scene->obedit->data;
485
EditBone *ebone = te->directdata;
482
488
if (!(ebone->flag & BONE_HIDDEN_A)) {
483
ED_armature_deselect_all(scene->obedit, 0); // deselect
489
ED_armature_deselect_all(scene->obedit, 0); // deselect
484
490
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
489
495
if (!(ebone->flag & BONE_HIDDEN_A)) {
490
496
if (!(ebone->flag & BONE_SELECTED)) {
491
497
tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
520
526
static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
523
Object *ob= (Object *)tselem->id;
529
Object *ob = (Object *)tselem->id;
525
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
531
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_EDITED, ob);
527
533
// XXX extern_set_butspace(F7KEY, 0);
551
557
static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
553
Object *ob= (Object *)tselem->id;
554
Base *base= object_in_scene(ob, scene);
559
Object *ob = (Object *)tselem->id;
560
Base *base = BKE_scene_base_find(scene, ob);
557
563
if (scene->obedit)
558
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
564
ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
560
566
if (ob->mode & OB_MODE_POSE)
561
567
ED_armature_exit_posemode(C, base);
571
static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
577
static int tree_element_active_sequence(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
573
Sequence *seq= (Sequence*) te->directdata;
579
Sequence *seq = (Sequence *) te->directdata;
580
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
576
// XXX select_single_seq(seq, 1);
583
/* only check on setting */
584
if (BLI_findindex(ed->seqbasep, seq) != -1) {
586
BKE_sequencer_active_set(scene, NULL);
588
ED_sequencer_deselect_all(scene);
590
if (set == 2 && seq->flag & SELECT) {
591
seq->flag &= ~SELECT;
595
BKE_sequencer_active_set(scene, seq);
599
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
579
if (seq->flag & SELECT)
602
if (ed->act_seq == seq && seq->flag & SELECT) {
585
609
static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
587
611
Sequence *seq, *p;
588
Editing *ed= seq_give_editing(scene, FALSE);
612
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
590
seq= (Sequence*)te->directdata;
614
seq = (Sequence *)te->directdata;
592
616
if (seq->flag & SELECT)
597
621
// XXX select_single_seq(seq, 1);
598
p= ed->seqbasep->first;
622
p = ed->seqbasep->first;
600
624
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
605
629
// if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
606
630
// XXX select_single_seq(p, 0);
651
675
/* generic call for non-id data to make/check active in UI */
652
676
/* Context can be NULL when set==0 */
653
int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set)
677
int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
678
TreeElement *te, TreeStoreElem *tselem, int set)
655
switch(tselem->type) {
680
switch (tselem->type) {
656
681
case TSE_DEFGROUP:
657
682
return tree_element_active_defgroup(C, scene, te, tselem, set);
691
716
/* ================================================ */
693
static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
718
static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops,
719
TreeElement *te, int extend, const float mval[2])
696
if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
697
TreeStoreElem *tselem= TREESTORE(te);
722
if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
723
TreeStoreElem *tselem = TREESTORE(te);
700
726
/* open close icon */
701
if ((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close
702
if ( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
727
if ((te->flag & TE_ICONROW) == 0) { // hidden icon, no open/close
728
if (mval[0] > te->xs && mval[0] < te->xs + UI_UNIT_X)
720
746
/* name and first icon */
721
else if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
747
else if (mval[0] > te->xs + UI_UNIT_X && mval[0] < te->xend) {
723
749
/* always makes active object */
724
if (tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
725
tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0));
750
if (tselem->type != TSE_SEQUENCE && tselem->type != TSE_SEQ_STRIP && tselem->type != TSE_SEQUENCE_DUP)
751
tree_element_set_active_object(C, scene, soops, te, 1 + (extend != 0 && tselem->type == 0));
727
if (tselem->type==0) { // the lib blocks
753
if (tselem->type == 0) { // the lib blocks
729
if (te->idcode==ID_SCE) {
730
if (scene!=(Scene *)tselem->id) {
755
if (te->idcode == ID_SCE) {
756
if (scene != (Scene *)tselem->id) {
731
757
ED_screen_set_scene(C, CTX_wm_screen(C), (Scene *)tselem->id);
734
else if (te->idcode==ID_GR) {
735
Group *gr= (Group *)tselem->id;
760
else if (te->idcode == ID_GR) {
761
Group *gr = (Group *)tselem->id;
736
762
GroupObject *gob;
740
for (gob= gr->gobject.first; gob; gob= gob->next) {
766
for (gob = gr->gobject.first; gob; gob = gob->next) {
741
767
if (gob->ob->flag & SELECT) {
747
for (gob= gr->gobject.first; gob; gob= gob->next) {
748
ED_base_object_select(object_in_scene(gob->ob, scene), sel);
773
for (gob = gr->gobject.first; gob; gob = gob->next) {
774
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), sel);
752
scene_deselect_all(scene);
778
BKE_scene_base_deselect_all(scene);
754
for (gob= gr->gobject.first; gob; gob= gob->next) {
780
for (gob = gr->gobject.first; gob; gob = gob->next) {
755
781
if ((gob->ob->flag & SELECT) == 0)
756
ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
782
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT);
760
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
786
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
762
788
else if (ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
763
789
WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
765
else { // rest of types
791
else { // rest of types
766
792
tree_element_active(C, scene, soops, te, 1);
770
else tree_element_type_active(C, scene, soops, te, tselem, 1+(extend!=0));
796
else tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0));
776
for (te= te->subtree.first; te; te= te->next) {
802
for (te = te->subtree.first; te; te = te->next) {
777
803
if (do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
782
808
/* event can enterkey, then it opens/closes */
783
809
static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
785
Scene *scene= CTX_data_scene(C);
786
ARegion *ar= CTX_wm_region(C);
787
SpaceOops *soops= CTX_wm_space_outliner(C);
811
Scene *scene = CTX_data_scene(C);
812
ARegion *ar = CTX_wm_region(C);
813
SpaceOops *soops = CTX_wm_space_outliner(C);
790
int extend= RNA_boolean_get(op->ptr, "extend");
792
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
794
if ( !ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
795
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
796
(fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
816
int extend = RNA_boolean_get(op->ptr, "extend");
818
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval + 1);
820
if (!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
821
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
822
(fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
798
824
return OPERATOR_CANCELLED;
801
for (te= soops->tree.first; te; te= te->next) {
827
for (te = soops->tree.first; te; te = te->next) {
802
828
if (do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
806
832
ED_undo_push(C, "Outliner click event");
835
short selecting = -1;
812
838
/* get row number - 100 here is just a dummy value since we don't need the column */
813
839
UI_view2d_listview_view_to_cell(&ar->v2d, 1000, UI_UNIT_Y, 0.0f, OL_Y_OFFSET,
814
fmval[0], fmval[1], NULL, &row);
840
fmval[0], fmval[1], NULL, &row);
816
842
/* select relevant row */
817
843
if (outliner_select(soops, &soops->tree, &row, &selecting)) {
870
896
static int outliner_border_select_exec(bContext *C, wmOperator *op)
872
Scene *scene= CTX_data_scene(C);
873
SpaceOops *soops= CTX_wm_space_outliner(C);
874
ARegion *ar= CTX_wm_region(C);
898
Scene *scene = CTX_data_scene(C);
899
SpaceOops *soops = CTX_wm_space_outliner(C);
900
ARegion *ar = CTX_wm_region(C);
878
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
880
rect.xmin = RNA_int_get(op->ptr, "xmin");
881
rect.ymin = RNA_int_get(op->ptr, "ymin");
904
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
906
WM_operator_properties_border_to_rcti(op, &rect);
882
908
UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
884
rect.xmax = RNA_int_get(op->ptr, "xmax");
885
rect.ymax = RNA_int_get(op->ptr, "ymax");
886
909
UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
888
for (te= soops->tree.first; te; te= te->next) {
911
for (te = soops->tree.first; te; te = te->next) {
889
912
outliner_item_border_select(scene, soops, &rectf, te, gesture_mode);
892
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
915
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
893
916
ED_region_tag_redraw(ar);
895
918
return OPERATOR_FINISHED;