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
This commit is contained in:
2009-02-08 12:16:35 +00:00
parent fa8d5608dc
commit 8c5c7ebb0b
11 changed files with 104 additions and 36 deletions

View File

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

View File

@@ -642,11 +642,9 @@ 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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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