diff options
author | Ton Roosendaal <ton@blender.org> | 2009-02-08 15:16:35 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-02-08 15:16:35 +0300 |
commit | 8c5c7ebb0b42cd5f936b6adcaf28ae40ab581924 (patch) | |
tree | 496bdfa0fc877b405e8e0da4d83f3776bab8f7f9 | |
parent | fa8d5608dcfdbe35fc89875423bbe1a5dea6ddf7 (diff) |
2.5
Scene browse button now works.
Note that animsys currently executes animation for the entire
database, so multiple scenes in multiple windows don't work yet.
Various fixes:
- crash on invoking filewindow when mouse outside (active) window
- removed obsolete error prints (set screen error, copy data error)
- displist fix for loading files with curve/nurbs, the select-outline
then didnt draw immediately.
- outliner allows scene activating
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 9 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 72 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_header.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 3 |
11 files changed, 104 insertions, 36 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index ce53ac78d20..b5e2558c893 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -39,12 +39,14 @@ struct wmNotifier; struct wmEvent; struct bContext; struct SpaceType; -struct AreagionType; +struct Scene; +struct bScreen; +struct ARegion; struct uiBlock; struct rcti; /* regions */ -void ED_region_do_listen(ARegion *ar, struct wmNotifier *note); +void ED_region_do_listen(struct ARegion *ar, struct wmNotifier *note); void ED_region_do_draw(struct bContext *C, struct ARegion *ar); void ED_region_exit(struct bContext *C, struct ARegion *ar); void ED_region_pixelspace(struct ARegion *ar); @@ -79,10 +81,11 @@ void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win); void ED_screen_do_listen(struct wmWindow *win, struct wmNotifier *note); bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc); void ED_screen_set(struct bContext *C, struct bScreen *sc); +void ED_screen_set_scene(struct bContext *C, struct Scene *scene); void ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int enable); -void ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); +int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); void ED_screen_full_prevspace(struct bContext *C); /* anim */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 01ae32e78f6..bc90728f23e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -642,12 +642,10 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space) else { BKE_spacedata_freelist(&sa1->spacedata); BKE_spacedata_copylist(&sa1->spacedata, &sa2->spacedata); - - if(sa1->spacedata.first==NULL) { - printf("copy data error\n"); - } } + /* Note; SPACE_EMPTY is possible on new screens */ + /* regions */ st= BKE_spacetype_from_id(sa1->spacetype); for(ar= sa1->regionbase.first; ar; ar= ar->next) diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 800a618e89e..3f047add6d5 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -32,6 +32,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_texture_types.h" +#include "DNA_userdef_types.h" #include "BLI_blenlib.h" @@ -1234,7 +1235,6 @@ void ED_screen_set(bContext *C, bScreen *sc) break; } } - if(sc1==NULL) printf("set screen error\n"); } if (oldscreen != sc) { @@ -1259,6 +1259,65 @@ void ED_screen_set(bContext *C, bScreen *sc) } } +/* only call outside of area/region loops */ +void ED_screen_set_scene(bContext *C, Scene *scene) +{ + bScreen *sc; + bScreen *curscreen= CTX_wm_screen(C); + + for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) { + if((U.flag & USER_SCENEGLOBAL) || sc==curscreen) { + + if(scene != sc->scene) { + /* all areas endlocalview */ + // XXX ScrArea *sa= sc->areabase.first; + // while(sa) { + // endlocalview(sa); + // sa= sa->next; + // } + sc->scene= scene; + } + + } + } + + // copy_view3d_lock(0); /* space.c */ + + /* are there cameras in the views that are not in the scene? */ + for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) { + if( (U.flag & USER_SCENEGLOBAL) || sc==curscreen) { + ScrArea *sa= sc->areabase.first; + while(sa) { + SpaceLink *sl= sa->spacedata.first; + while(sl) { + if(sl->spacetype==SPACE_VIEW3D) { + View3D *v3d= (View3D*) sl; + if (!v3d->camera || !object_in_scene(v3d->camera, scene)) { + v3d->camera= scene_find_camera(sc->scene); + // XXX if (sc==curscreen) handle_view3d_lock(); + if (!v3d->camera && v3d->persp==V3D_CAMOB) + v3d->persp= V3D_PERSP; + } + } + sl= sl->next; + } + sa= sa->next; + } + } + } + + CTX_data_scene_set(C, scene); + set_scene_bg(scene); + + ED_update_for_newframe(C, 1); + +// set_radglobal(); + + /* complete redraw */ + WM_event_add_notifier(C, NC_WINDOW, NULL); + +} + /* this function toggles: if area is full then the parent will be restored */ void ed_screen_fullarea(bContext *C, ScrArea *sa) { @@ -1305,7 +1364,7 @@ void ed_screen_fullarea(bContext *C, ScrArea *sa) ED_screen_set(C, sc); free_screen(oldscreen); - free_libblock(&G.main->screen, oldscreen); + free_libblock(&CTX_data_main(C)->screen, oldscreen); } } else { @@ -1348,13 +1407,18 @@ void ed_screen_fullarea(bContext *C, ScrArea *sa) } -void ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) +int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) { + if(sa==NULL) + return 0; + if(sa->full==0) ed_screen_fullarea(C, sa); /* CTX_wm_area(C) is new area */ ED_area_newspace(C, CTX_wm_area(C), type); + + return 1; } void ED_screen_full_prevspace(bContext *C) @@ -1427,7 +1491,7 @@ void ED_update_for_newframe(const bContext *C, int mute) /* update animated texture nodes */ { Tex *tex; - for(tex= G.main->tex.first; tex; tex= tex->id.next) + for(tex= CTX_data_main(C)->tex.first; tex; tex= tex->id.next) if( tex->use_nodes && tex->nodetree ) { ntreeTexTagAnimated( tex->nodetree ); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 130d5d6ca76..160d5ccd9d8 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1025,11 +1025,12 @@ void SCREEN_OT_frame_offset(wmOperatorType *ot) static int screen_set_exec(bContext *C, wmOperator *op) { bScreen *screen= CTX_wm_screen(C); + ScrArea *sa= CTX_wm_area(C); int tot= BLI_countlist(&CTX_data_main(C)->screen); int delta= RNA_int_get(op->ptr, "delta"); /* this screen is 'fake', solve later XXX */ - if(CTX_wm_area(C)->full) + if(sa && sa->full) return OPERATOR_CANCELLED; if(delta==1) { @@ -1088,7 +1089,7 @@ void SCREEN_OT_screen_full_area(wmOperatorType *ot) ot->idname = "SCREEN_OT_screen_full_area"; ot->exec= screen_full_area_exec; - ot->poll= ED_operator_screenactive; + ot->poll= ED_operator_areaactive; ot->flag= OPTYPE_REGISTER; } @@ -1361,7 +1362,7 @@ void SCREEN_OT_area_join(wmOperatorType *ot) ot->invoke= area_join_invoke; ot->modal= area_join_modal; - ot->poll= ED_operator_screenactive; + ot->poll= ED_operator_areaactive; /* rna */ RNA_def_int(ot->srna, "x1", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX); diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c index 096374a82c4..4b750600583 100644 --- a/source/blender/editors/space_info/info_header.c +++ b/source/blender/editors/space_info/info_header.c @@ -135,7 +135,8 @@ static void scene_idpoin_handle(bContext *C, ID *id, int event) switch(event) { case UI_ID_BROWSE: - WM_event_add_notifier(C, NC_SCREEN|ND_SCENEBROWSE, CTX_wm_screen(C)); + /* exception: can't set screens inside of area/region handers */ + WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, id); break; case UI_ID_DELETE: ED_undo_push(C, ""); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 5e54a57f48d..dce23eb103f 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -100,6 +100,7 @@ #include "ED_armature.h" #include "ED_object.h" +#include "ED_screen.h" #include "outliner_intern.h" @@ -132,7 +133,6 @@ static void allqueue() {} static void BIF_undo_push() {} static void BIF_preview_changed() {} -static void set_scene() {} static void error() {} static int pupmenu() {return 0;} @@ -1665,8 +1665,7 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops sce= (Scene *)outliner_search_back(soops, te, ID_SCE); if(sce && scene != sce) { -// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - set_scene(sce); + ED_screen_set_scene(C, sce); } /* find associated base in current scene */ @@ -1845,8 +1844,7 @@ static int tree_element_active_world(Scene *scene, SpaceOops *soops, TreeElement if(set) { // make new scene active if(sce && scene != sce) { -// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - set_scene(sce); + // XXX ED_screen_set_scene(C, sce); } } @@ -2188,8 +2186,7 @@ static int do_outliner_mouse_event(bContext *C, Scene *scene, ARegion *ar, Space /* editmode? */ if(te->idcode==ID_SCE) { if(scene!=(Scene *)tselem->id) { -// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - set_scene((Scene *)tselem->id); + ED_screen_set_scene(C, (Scene *)tselem->id); } } else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) { @@ -2853,7 +2850,7 @@ static void outliner_do_object_operation(Scene *scene, SpaceOops *soops, ListBas // when objects selected in other scenes... dunno if that should be allowed Scene *sce= (Scene *)outliner_search_back(soops, te, ID_SCE); if(sce && scene != sce) { - set_scene(sce); +// XXX ED_screen_set_scene(C, sce); } operation_cb(te, NULL, tselem); @@ -2974,7 +2971,7 @@ void outliner_operation_menu(Scene *scene, ARegion *ar, SpaceOops *soops) Scene *sce= scene; // to be able to delete, scenes are set... outliner_do_object_operation(scene, soops, &soops->tree, object_select_cb); if(scene != sce) { - set_scene(sce); +// XXX ED_screen_set_scene(C, sce); } str= "Select Objects"; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index dd101231b49..85edf6cf5fb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4906,10 +4906,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } + /* bad exception, solve this! otherwise outline shows too late */ + if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { + cu= ob->data; + /* still needed for curves hidden in other layers. depgraph doesnt handle that yet */ + if (cu->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0); + } + /* draw outline for selected solid objects, mesh does itself */ if((v3d->flag & V3D_SELECT_OUTLINE) && ob->type!=OB_MESH) { if(dt>OB_WIRE && dt<OB_TEXTURE && ob!=scene->obedit && (flag && DRAW_SCENESET)==0) { if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) { + drawSolidSelect(scene, v3d, rv3d, base); } } @@ -4925,7 +4933,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; case OB_FONT: cu= ob->data; - if (cu->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0); if(cu->editfont) { draw_textcurs(cu->editfont->textcurs); @@ -5017,8 +5024,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) case OB_CURVE: case OB_SURF: cu= ob->data; - /* still needed for curves hidden in other layers. depgraph doesnt handle that yet */ - if (cu->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0); if(cu->editnurb) { drawnurb(scene, v3d, rv3d, base, cu->editnurb->first, dt); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 7e209bc8693..30ef1be1dbf 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -542,7 +542,6 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext } else if(member == CTX_DATA_ACTIVE_PCHAN) { Object *obact= OBACT; - bArmature *arm= (obact) ? obact->data : NULL; bPoseChannel *pchan; pchan= get_active_posechannel(obact); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index b982c3e1f0e..780bb46ece4 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -580,10 +580,7 @@ static void view3d_view_alignviewmenu(bContext *C, uiMenuItem *head, void *arg_u { } -static void view3d_view_camerasmenu(bContext *C, uiMenuItem *head, void *arg_unused) -{ - -} + static void view3d_viewmenu(bContext *C, uiMenuItem *head, void *arg_unused) { ScrArea *sa= CTX_wm_area(C); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index def9d7351ac..dcca2fa60c9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -32,7 +32,7 @@ #include "DNA_listBase.h" #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" -#include "DNA_userdef_types.h" /* U.flag & TWOBUTTONMOUSE */ +#include "DNA_userdef_types.h" #include "MEM_guardedalloc.h" @@ -131,7 +131,6 @@ void wm_event_do_notifiers(bContext *C) return; /* cache & catch WM level notifiers, such as frame change, scene/screen set */ - /* XXX todo, multiwindow scenes */ for(win= wm->windows.first; win; win= win->next) { int do_anim= 0; @@ -144,7 +143,10 @@ void wm_event_do_notifiers(bContext *C) ED_screen_set(C, note->reference); // XXX hrms, think this over! } else if(note->category==NC_SCENE) { - if(note->data==ND_FRAME) + if(note->data==ND_SCENEBROWSE) { + ED_screen_set_scene(C, note->reference); // XXX hrms, think this over! + } + else if(note->data==ND_FRAME) do_anim= 1; } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b9bdabcdbfd..c54d738822f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -357,7 +357,8 @@ static int wm_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceFile *sfile; - ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE); + if(0==ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE)) + return OPERATOR_CANCELLED; /* settings for filebrowser */ sfile= (SpaceFile*)CTX_wm_space_data(C); |