diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-31 07:07:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-31 07:07:14 +0400 |
commit | 81f5c9ed9b8193864f1c6160aed9eef9338f0d27 (patch) | |
tree | de71a52d3ed2c5a1fd47a846af5d68e1c571e606 /source/blender/editors/space_view3d/view3d_select.c | |
parent | 50ca81154e5ead104723ba137942e92cb860ace8 (diff) | |
parent | 792452a7e53aa92361145e415491943bc91d8a6e (diff) |
svn merge ^/trunk/blender -r42991:43009
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 44264bd0355..0048d67b4fd 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1328,6 +1328,25 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) return basact; } +static void deselect_all_tracks(MovieTracking *tracking) +{ + MovieTrackingObject *object; + + object= tracking->objects.first; + while(object) { + ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object); + MovieTrackingTrack *track= tracksbase->first; + + while(track) { + BKE_tracking_deselect_track(track, TRACK_AREA_ALL); + + track= track->next; + } + + object= object->next; + } +} + /* mval is region coords */ static int mouse_select(bContext *C, const int mval[2], short extend, short obcenter, short enumerate) { @@ -1399,27 +1418,41 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce if(basact->object->type==OB_CAMERA) { if(BASACT==basact) { int i, hitresult; - MovieTrackingTrack *track; + int changed= 0; for (i=0; i< hits; i++) { hitresult= buffer[3+(i*4)]; /* if there's bundles in buffer select bundles first, so non-camera elements should be ignored in buffer */ - if(basact->selcol != (hitresult & 0xFFFF)) + if(basact->selcol != (hitresult & 0xFFFF)) { continue; + } /* index of bundle is 1<<16-based. if there's no "bone" index in hight word, this buffer value belongs to camera,. not to bundle */ if(buffer[4*i+3] & 0xFFFF0000) { MovieClip *clip= object_get_movieclip(scene, basact->object, 0); - int selected; - track= BKE_tracking_indexed_track(&clip->tracking, hitresult >> 16); + MovieTracking *tracking= &clip->tracking; + ListBase *tracksbase; + MovieTrackingTrack *track; + + track= BKE_tracking_indexed_track(&clip->tracking, hitresult >> 16, &tracksbase); + + if(TRACK_SELECTED(track) && extend) { + changed= 0; + BKE_tracking_deselect_track(track, TRACK_AREA_ALL); + } + else { + int oldsel= TRACK_SELECTED(track) ? 1 : 0; + if(!extend) + deselect_all_tracks(tracking); - selected= (track->flag&SELECT) || (track->pat_flag&SELECT) || (track->search_flag&SELECT); + BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, extend); - if(selected && extend) BKE_tracking_deselect_track(track, TRACK_AREA_ALL); - else BKE_tracking_select_track(&clip->tracking, track, TRACK_AREA_ALL, extend); + if(oldsel!=(TRACK_SELECTED(track) ? 1 : 0)) + changed= 1; + } basact->flag|= SELECT; basact->object->flag= basact->flag; @@ -1432,6 +1465,12 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce break; } } + + if(!changed) { + /* fallback to regular object selection if no new bundles were selected, + allows to select object parented to reconstruction object */ + basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, 0); + } } } else if(ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) { /* then bone is found */ |