From 463cf8e3328bf8a00117567a59343a90ec17ee3d Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 24 Dec 2007 18:53:37 +0000 Subject: Part 4 of the event refactor branch: all changes in existing files, Makefiles especially, and of course the windowmanager DNA! --- source/blender/blenlib/intern/Makefile | 4 +- source/blender/blenlib/intern/freetypefont.c | 9 +- source/blender/blenloader/BLO_readfile.h | 8 +- source/blender/blenloader/BLO_writefile.h | 8 +- source/blender/blenloader/intern/readfile.c | 132 ++++++++++++------ source/blender/blenloader/intern/writefile.c | 85 +++++++----- source/blender/ftfont/intern/Makefile | 3 +- source/blender/imbuf/intern/thumbs.c | 2 + source/blender/imbuf/intern/writeimage.c | 2 + source/blender/makesdna/DNA_ID.h | 9 +- source/blender/makesdna/DNA_screen_types.h | 32 +++-- source/blender/makesdna/DNA_windowmanager_types.h | 159 ++++++++++++++++++++++ source/blender/makesdna/intern/makesdna.c | 5 +- source/blender/nodes/Makefile | 18 ++- source/blender/nodes/intern/CMP_nodes/Makefile | 3 +- source/blender/nodes/intern/SHD_nodes/Makefile | 3 +- source/blender/python/BPY_extern.h | 136 ++++++++++++++++++ source/blender/quicktime/apple/Makefile | 2 +- source/blender/radiosity/intern/source/Makefile | 2 +- source/blender/render/intern/source/Makefile | 2 +- 20 files changed, 509 insertions(+), 115 deletions(-) create mode 100644 source/blender/makesdna/DNA_windowmanager_types.h create mode 100644 source/blender/python/BPY_extern.h diff --git a/source/blender/blenlib/intern/Makefile b/source/blender/blenlib/intern/Makefile index 68148a1eb37..6247311b0d9 100644 --- a/source/blender/blenlib/intern/Makefile +++ b/source/blender/blenlib/intern/Makefile @@ -36,7 +36,7 @@ DIR = $(OCGDIR)/blender/$(LIBNAME) include nan_compile.mk -# CPPFLAGS += $(LEVEL_2_CPP_WARNINGS) +CFLAGS += $(LEVEL_1_C_WARNINGS) # path to SDNA types CPPFLAGS += -I../../makesdna @@ -49,7 +49,7 @@ CPPFLAGS += -I$(NAN_FREETYPE)/include CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2 # path to blenkernel CPPFLAGS += -I$(SRCHOME)/blender/blenkernel -CPPFLAGS += -I../../include/ +CPPFLAGS += -I../../editors/include/ # path to zlib CPPFLAGS += -I$(NAN_ZLIB)/include diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 7fbd4bac485..2e6aca3989b 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -55,6 +55,7 @@ #include "BIF_toolbox.h" #include "BKE_global.h" +#include "BKE_font.h" #include "BKE_utildefines.h" #include "DNA_vfont_types.h" @@ -283,13 +284,7 @@ int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode) struct TmpFont *tf; // Find the correct FreeType font - tf= G.ttfdata.first; - while(tf) - { - if(tf->vfont == vfont) - break; - tf= tf->next; - } + tf= vfont_find_tmpfont(vfont); // What, no font found. Something strange here if(!tf) return FALSE; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 09edfe90d02..b24f9127fef 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -87,7 +87,7 @@ typedef struct BlendFileData { int fileflags; int displaymode; int globalf; - + struct bScreen* curscreen; struct Scene* curscene; @@ -236,8 +236,10 @@ BLO_blendhandle_close( char *BLO_gethome(void); int BLO_has_bfile_extension(char *str); -void BLO_library_append(struct SpaceFile *sfile, char *dir, int idcode); -void BLO_library_append_(BlendHandle **libfiledata, struct direntry* filelist, int totfile, char *dir, char* file, short flag, int idcode); + +void BLO_library_append(struct SpaceFile *sfile, char *dir, int idcode, struct Scene *scene); +void BLO_library_append_(BlendHandle **libfiledata, struct direntry* filelist, int totfile, + char *dir, char* file, short flag, int idcode, struct Scene *scene); void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcode, short flag, struct Scene *scene); BlendFileData* blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r); diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index cfa2fd7b0f6..c9aef97ac83 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -35,10 +35,12 @@ #define BLO_WRITEFILE_H struct MemFile; +struct bContext; -extern int BLO_write_file(char *dir, int write_flags, char **error_r); -extern int BLO_write_file_mem(struct MemFile *compare, struct MemFile *current, int write_flags, char **error_r); -extern void BLO_write_runtime(char *file, char *exename); +extern int BLO_write_file(struct bContext *C, char *dir, int write_flags, char **error_r); +extern int BLO_write_file_mem(struct bContext *C, struct MemFile *compare, struct MemFile *current, + int write_flags, char **error_r); +extern void BLO_write_runtime(struct bContext *C, char *file, char *exename); #endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 553ab0eb168..da1ec9ac538 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -20,9 +20,8 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Blender Foundation * * ***** END GPL LICENSE BLOCK ***** * @@ -101,6 +100,7 @@ #include "DNA_userdef_types.h" #include "DNA_vfont_types.h" #include "DNA_world_types.h" +#include "DNA_windowmanager_types.h" #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" @@ -109,8 +109,6 @@ #include "BDR_sculptmode.h" -#include "BKE_bad_level_calls.h" // for reopen_text build_seqar (from WHILE_SEQ) set_rects_butspace check_imasel_copy - #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_colortools.h" @@ -3492,6 +3490,42 @@ static void lib_link_screen_sequence_ipos(Main *main) } } +/* ************ READ WM ***************** */ + +static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) +{ + wmWindow *win; + + wm->id.us= 1; + link_list(fd, &(wm->windows)); + + for(win= wm->windows.first; win; win= win->next) { + win->ghostwin= NULL; + win->eventstate= NULL; + + win->queue.first= win->queue.last= NULL; + win->handlers.first= win->handlers.last= NULL; + } + + wm->operators.first= wm->operators.last= NULL; + wm->windowkeymap.first= wm->windowkeymap.last= NULL; + wm->screenkeymap.first= wm->screenkeymap.last= NULL; + + wm->initialized= 0; +} + +static void lib_link_windowmanager(FileData *fd, Main *main) +{ + wmWindowManager *wm; + + for(wm= main->wm.first; wm; wm= wm->id.next) { + wmWindow *win; + for(win= wm->windows.first; win; win= win->next) { + win->screen= newlibadr(fd, NULL, win->screen); + } + } +} + /* ************ READ SCREEN ***************** */ /* note: file read without screens option G_FILE_NO_UI; @@ -3811,7 +3845,9 @@ static void direct_link_screen(FileData *fd, bScreen *sc) link_list(fd, &(sc->edgebase)); link_list(fd, &(sc->areabase)); sc->winakt= 0; - + + sc->handlers.first= sc->handlers.last= NULL; + /* hacky patch... but people have been saving files with the verse-blender, causing the handler to keep running for ever, with no means to disable it */ for(a=0; aspacedata)); link_list(fd, &(sa->panels)); + sa->handlers.first= sa->handlers.last= NULL; + sa->regionbase.first= sa->regionbase.last= NULL; + /* accident can happen when read/save new file with older version */ if(sa->spacedata.first==NULL && sa->spacetype>SPACE_NLA) sa->spacetype= SPACE_EMPTY; @@ -4129,6 +4168,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID /* init pointers direct data */ switch( GS(id->name) ) { + case ID_WM: + direct_link_windowmanager(fd, (wmWindowManager *)id); + break; case ID_SCR: direct_link_screen(fd, (bScreen *)id); break; @@ -4218,16 +4260,36 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID return (bhead); } -static void link_global(FileData *fd, BlendFileData *bfd, FileGlobal *fg) +/* note, this has to be kept for reading older files... */ +/* also version info is written here */ +static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) { - // this is nonsense... make it struct once (ton) + FileGlobal *fg= read_struct(fd, bhead, "Global"); + + /* copy to bfd handle */ + bfd->main->subversionfile= fg->subversion; + bfd->main->minversionfile= fg->minversion; + bfd->main->minsubversionfile= fg->minsubversion; + bfd->winpos= fg->winpos; bfd->fileflags= fg->fileflags; bfd->displaymode= fg->displaymode; bfd->globalf= fg->globalf; - bfd->curscreen= newlibadr(fd, 0, fg->curscreen); - bfd->curscene= newlibadr(fd, 0, fg->curscene); + bfd->curscreen= fg->curscreen; + bfd->curscene= fg->curscene; + + MEM_freeN(fg); + + return blo_nextbhead(fd, bhead); +} + +/* note, this has to be kept for reading older files... */ +static void link_global(FileData *fd, BlendFileData *bfd) +{ + + bfd->curscreen= newlibadr(fd, 0, bfd->curscreen); + bfd->curscene= newlibadr(fd, 0, bfd->curscene); // this happens in files older than 2.35 if(bfd->curscene==NULL) { if(bfd->curscreen) bfd->curscene= bfd->curscreen->scene; @@ -7269,6 +7331,7 @@ static void lib_link_all(FileData *fd, Main *main) { oldnewmap_sort(fd); + lib_link_windowmanager(fd, main); lib_link_screen(fd, main); lib_link_scene(fd, main); lib_link_object(fd, main); @@ -7299,6 +7362,7 @@ static void lib_link_all(FileData *fd, Main *main) lib_link_library(fd, main); /* only init users */ } + static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) { Link *link; @@ -7332,20 +7396,15 @@ BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r) while(bhead) { switch(bhead->code) { - case GLOB: case DATA: case DNA1: case TEST: case REND: - if (bhead->code==GLOB) { - fg= read_struct(fd, bhead, "Global"); - /* set right away */ - bfd->main->subversionfile= fg->subversion; - bfd->main->minversionfile= fg->minversion; - bfd->main->minsubversionfile= fg->minsubversion; - } bhead = blo_nextbhead(fd, bhead); break; + case GLOB: + bhead= read_global(bfd, fd, bhead); + break; case USER: bhead= read_userdef(bfd, fd, bhead); break; @@ -7380,11 +7439,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r) lib_link_all(fd, bfd->main); lib_verify_nodetree(bfd->main); - if(fg) - link_global(fd, bfd, fg); /* as last */ - - /* removed here: check for existance of curscreen/scene, moved to kernel setup_app */ - MEM_freeN(fg); + link_global(fd, bfd); /* as last */ return bfd; } @@ -8165,10 +8220,9 @@ static void append_named_part(FileData *fd, Main *mainvar, Scene *scene, char *n if(id==NULL) ob= mainvar->object.last; else ob= (Object *)id; - /* this is bad code... G.vd nor G.scene should be used on this level... */ + /* XXX use context to find view3d->lay */ if((flag & FILE_ACTIVELAY)) { - if(G.vd) ob->lay= G.vd->layact; - else ob->lay = G.scene->lay; + scene->lay; } base->lay= ob->lay; base->object= ob; @@ -8210,7 +8264,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) /* common routine to append/link something from a library */ -static Library* library_append( Scene *scene, char* file, char *dir, int idcode, +static Library* library_append(Scene *scene, char* file, char *dir, int idcode, int totsel, FileData *fd, struct direntry* filelist, int totfile, short flag) { Main *mainl; @@ -8279,27 +8333,29 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode, /* this is a version of BLO_library_append needed by the BPython API, so * scripts can load data from .blend files -- see Blender.Library module.*/ -/* append to G.scene */ +/* append to scene */ /* this should probably be moved into the Python code anyway */ void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcode, short flag, Scene *scene ) { /* try to append the requested object */ - library_append( scene, name, dir, idcode, 0, (FileData *)bh, NULL, 0, flag ); + library_append(scene, name, dir, idcode, 0, (FileData *)bh, NULL, 0, flag ); /* do we need to do this? */ - DAG_scene_sort(G.scene); + DAG_scene_sort(scene); } -/* append to G.scene */ +/* append to scene */ /* dir is a full path */ -void BLO_library_append(SpaceFile *sfile, char *dir, int idcode) +void BLO_library_append(SpaceFile *sfile, char *dir, int idcode, Scene *scene) { - BLO_library_append_(&sfile->libfiledata, sfile->filelist, sfile->totfile, dir, sfile->file, sfile->flag, idcode); + BLO_library_append_(&sfile->libfiledata, sfile->filelist, sfile->totfile, + dir, sfile->file, sfile->flag, idcode, scene); } -void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, int totfile, char *dir, char* file, short flag, int idcode) +void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, int totfile, + char *dir, char* file, short flag, int idcode, Scene *scene) { FileData *fd= (FileData*) (*libfiledata); Library *curlib; @@ -8332,9 +8388,9 @@ void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, i } /* now we have or selected, or an indicated file */ - if(flag & FILE_AUTOSELECT) scene_deselect_all(G.scene); + if(flag & FILE_AUTOSELECT) scene_deselect_all(scene); - curlib = library_append( G.scene, file, dir, idcode, totsel, fd, filelist, totfile,flag ); + curlib = library_append(scene, file, dir, idcode, totsel, fd, filelist, totfile,flag ); /* patch to prevent switch_endian happens twice */ if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { @@ -8349,7 +8405,7 @@ void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, i INIT_MINMAX(min, max); - centerbase= (G.scene->base.first); + centerbase= (scene->base.first); while(centerbase) { if(centerbase->object->id.lib==curlib && centerbase->object->parent==NULL) { VECCOPY(vec, centerbase->object->loc); @@ -8362,10 +8418,10 @@ void BLO_library_append_(BlendHandle** libfiledata, struct direntry* filelist, i centerloc[0]= (min[0]+max[0])/2; centerloc[1]= (min[1]+max[1])/2; centerloc[2]= (min[2]+max[2])/2; - curs = G.scene->cursor; + curs = scene->cursor; VECSUB(centerloc,curs,centerloc); - centerbase= (G.scene->base.first); + centerbase= (scene->base.first); while(centerbase) { if(centerbase->object->id.lib==curlib && centerbase->object->parent==NULL) { ob= centerbase->object; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index d19c634e610..1fe8258ab3b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -4,15 +4,12 @@ * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,9 +23,8 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Blender Foundation * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -74,10 +70,6 @@ Any case: direct data is ALWAYS after the lib block - write USER if filename is ~/.B.blend */ -/* for version 2.2+ -Important to know is that 'streaming' has been added to files, for Blender Publisher -*/ - #ifdef HAVE_CONFIG_H #include @@ -100,8 +92,6 @@ Important to know is that 'streaming' has been added to files, for Blender Publi #include #include -#include "nla.h" // __NLA is defined - #include "DNA_armature_types.h" #include "DNA_action_types.h" #include "DNA_actuator_types.h" @@ -147,13 +137,13 @@ Important to know is that 'streaming' has been added to files, for Blender Publi #include "DNA_vfont_types.h" #include "DNA_userdef_types.h" #include "DNA_world_types.h" +#include "DNA_windowmanager_types.h" #include "MEM_guardedalloc.h" // MEM_freeN #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BKE_action.h" -#include "BKE_bad_level_calls.h" // build_seqar (from WHILE_SEQ) free_oops error #include "BKE_blender.h" #include "BKE_curve.h" #include "BKE_customdata.h" @@ -475,14 +465,14 @@ static void write_scriptlink(WriteData *wd, ScriptLink *slink) writedata(wd, DATA, sizeof(short)*slink->totscript, slink->flag); } -static void write_renderinfo(WriteData *wd) /* for renderdeamon */ +static void write_renderinfo(bContext *C, WriteData *wd) /* for renderdeamon */ { Scene *sce; int data[8]; sce= G.main->scene.first; while(sce) { - if(sce->id.lib==0 && ( sce==G.scene || (sce->r.scemode & R_BG_RENDER)) ) { + if(sce->id.lib==0 && ( sce==C->scene || (sce->r.scemode & R_BG_RENDER)) ) { data[0]= sce->r.sfra; data[1]= sce->r.efra; @@ -1511,6 +1501,19 @@ static void write_scenes(WriteData *wd, ListBase *scebase) mywrite(wd, MYWRITE_FLUSH, 0); } +static void write_windowmanagers(WriteData *wd, ListBase *lb) +{ + wmWindowManager *wm; + wmWindow *win; + + for(wm= lb->first; wm; wm= wm->id.next) { + writestruct(wd, ID_WM, "wmWindowManager", 1, wm); + + for(win= wm->windows.first; win; win= win->next) + writestruct(wd, DATA, "wmWindow", 1, win); + } +} + static void write_screens(WriteData *wd, ListBase *scrbase) { bScreen *sc; @@ -1878,13 +1881,17 @@ static void write_brushes(WriteData *wd, ListBase *idbase) } } -static void write_global(WriteData *wd) +/* context is usually defined by WM, two cases where no WM is available: +/* - for forward compatibility, curscreen has to be saved */ +/* - for undofile, curscene needs to be saved */ +/* XXX still remap G */ +static void write_global(bContext *C, WriteData *wd) { FileGlobal fg; char subvstr[8]; - fg.curscreen= G.curscreen; - fg.curscene= G.scene; + fg.curscreen= C->screen; + fg.curscene= C->scene; fg.displaymode= G.displaymode; fg.winpos= G.winpos; fg.fileflags= (G.fileflags & ~G_FILE_NO_UI); // prevent to save this, is not good convention, and feature with concerns... @@ -1901,7 +1908,8 @@ static void write_global(WriteData *wd) } /* if MemFile * there's filesave to memory */ -static int write_file_handle(int handle, MemFile *compare, MemFile *current, int write_user_block, int write_flags) +static int write_file_handle(bContext *C, int handle, MemFile *compare, MemFile *current, + int write_user_block, int write_flags) { BHead bhead; ListBase mainlist; @@ -1915,11 +1923,14 @@ static int write_file_handle(int handle, MemFile *compare, MemFile *current, int sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (G.order==B_ENDIAN)?'V':'v', G.version); mywrite(wd, buf, 12); - write_renderinfo(wd); - write_global(wd); + write_renderinfo(C, wd); + write_global(C, wd); - if(current==NULL) - write_screens (wd, &G.main->screen); /* no UI save in undo */ + /* no UI save in undo */ + if(current==NULL) { + write_windowmanagers(wd, &G.main->wm); + write_screens (wd, &G.main->screen); + } write_scenes (wd, &G.main->scene); write_curves (wd, &G.main->curve); write_mballs (wd, &G.main->mball); @@ -1949,7 +1960,7 @@ static int write_file_handle(int handle, MemFile *compare, MemFile *current, int if (write_user_block) { write_userdef(wd); } - + /* dna as last, because (to be implemented) test for which structs are written */ writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data); @@ -1965,7 +1976,7 @@ static int write_file_handle(int handle, MemFile *compare, MemFile *current, int } /* return: success (1) */ -int BLO_write_file(char *dir, int write_flags, char **error_r) +int BLO_write_file(bContext *C, char *dir, int write_flags, char **error_r) { char userfilename[FILE_MAXDIR+FILE_MAXFILE]; char tempname[FILE_MAXDIR+FILE_MAXFILE]; @@ -1983,7 +1994,7 @@ int BLO_write_file(char *dir, int write_flags, char **error_r) write_user_block= BLI_streq(dir, userfilename); - err= write_file_handle(file, NULL,NULL, write_user_block, write_flags); + err= write_file_handle(C, file, NULL,NULL, write_user_block, write_flags); close(file); if(!err) { @@ -2020,11 +2031,11 @@ int BLO_write_file(char *dir, int write_flags, char **error_r) } /* return: success (1) */ -int BLO_write_file_mem(MemFile *compare, MemFile *current, int write_flags, char **error_r) +int BLO_write_file_mem(bContext *C, MemFile *compare, MemFile *current, int write_flags, char **error_r) { int err; - err= write_file_handle(0, compare, current, 0, write_flags); + err= write_file_handle(C, 0, compare, current, 0, write_flags); if(err==0) return 1; return 0; @@ -2122,7 +2133,8 @@ cleanup: return 1; } -void BLO_write_runtime(char *file, char *exename) { +void BLO_write_runtime(bContext *C, char *file, char *exename) +{ char gamename[FILE_MAXDIR+FILE_MAXFILE]; int outfd = -1; char *cause= NULL; @@ -2140,7 +2152,7 @@ void BLO_write_runtime(char *file, char *exename) { outfd= open(gamename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); if (outfd != -1) { - write_file_handle(outfd, NULL,NULL, 0, G.fileflags); + write_file_handle(C, outfd, NULL,NULL, 0, G.fileflags); if (write(outfd, " ", 1) != 1) { cause= "Unable to write to output file"; @@ -2160,7 +2172,8 @@ cleanup: #else /* !__APPLE__ */ -static int handle_append_runtime(int handle, char *exename, char **cause_r) { +static int handle_append_runtime(int handle, char *exename, char **cause_r) +{ char *cause= NULL, *runtime= get_runtime_path(exename); unsigned char buf[1024]; int count, progfd= -1; @@ -2196,7 +2209,8 @@ cleanup: return 1; } -static int handle_write_msb_int(int handle, int i) { +static int handle_write_msb_int(int handle, int i) +{ unsigned char buf[4]; buf[0]= (i>>24)&0xFF; buf[1]= (i>>16)&0xFF; @@ -2206,7 +2220,8 @@ static int handle_write_msb_int(int handle, int i) { return (write(handle, buf, 4)==4); } -void BLO_write_runtime(char *file, char *exename) { +void BLO_write_runtime(bContext *C, char *file, char *exename) +{ int outfd= open(file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); char *cause= NULL; int datastart; @@ -2220,7 +2235,7 @@ void BLO_write_runtime(char *file, char *exename) { datastart= lseek(outfd, 0, SEEK_CUR); - write_file_handle(outfd, NULL,NULL, 0, G.fileflags); + write_file_handle(C, outfd, NULL,NULL, 0, G.fileflags); if (!handle_write_msb_int(outfd, datastart) || (write(outfd, "BRUNTIME", 8)!=8)) { cause= "Unable to write to output file"; diff --git a/source/blender/ftfont/intern/Makefile b/source/blender/ftfont/intern/Makefile index 4668241c5c8..9a593ef8174 100644 --- a/source/blender/ftfont/intern/Makefile +++ b/source/blender/ftfont/intern/Makefile @@ -42,12 +42,11 @@ CFLAGS += $(LEVEL_1_C_WARNINGS) CPPFLAGS += -I../../makesdna CPPFLAGS += -I../../blenkernel CPPFLAGS += -I../../blenlib -CPPFLAGS += -I../../include +CPPFLAGS += -I../../editors/include CPPFLAGS += -I$(NAN_FTGL)/include CPPFLAGS += -I$(NAN_FTGL)/include/FTGL CPPFLAGS += -I$(NAN_GETTEXT)/include CPPFLAGS += -I$(NAN_FREETYPE)/include -CPPFLAGS += -I$(OPENGL_HEADERS) ifeq ($(OS), windows) CPPFLAGS += -I$(NAN_ICONV)/include ifeq ($(FREE_WINDOWS), true) diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 131d2ef38f7..9097fb84dcd 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -27,6 +27,8 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include + #include "BKE_global.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index ccca8e9f859..8b0a2aa5603 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -36,6 +36,8 @@ #include #endif +#include + #include "BKE_global.h" #include "BLI_blenlib.h" diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 57aec75700f..3b078e2bd68 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -77,11 +77,11 @@ typedef struct IDProperty { #define IDP_FLOAT 2 #define IDP_ARRAY 5 #define IDP_GROUP 6 -/*the ID link property type hasn't been implemented yet, this will require - some cleanup of blenkernel, most likely.*/ +/* the ID link property type hasn't been implemented yet, this will require + some cleanup of blenkernel, most likely.*/ #define IDP_ID 7 -/*add any future new id property types here.*/ +/* add any future new id property types here.*/ /* watch it: Sequence has identical beginning. */ /** @@ -89,6 +89,8 @@ typedef struct IDProperty { * provides a common handle to place all data in double-linked lists. * */ +#define MAX_ID_NAME 24 + /* There's a nasty circular dependency here.... void* to the rescue! I * really wonder why this is needed. */ typedef struct ID { @@ -184,6 +186,7 @@ typedef struct PreviewImage { #define ID_NT MAKE_ID2('N', 'T') #define ID_BR MAKE_ID2('B', 'R') #define ID_PA MAKE_ID2('P', 'A') +#define ID_WM MAKE_ID2('W', 'M') /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 65374983af5..7b34ee2482d 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -3,15 +3,12 @@ * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -25,11 +22,10 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. + * + * Contributor(s): Blender Foundation * - * Contributor(s): none yet. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #ifndef DNA_SCREEN_TYPES_H #define DNA_SCREEN_TYPES_H @@ -44,14 +40,17 @@ struct Scene; typedef struct bScreen { ID id; + ListBase vertbase, edgebase, areabase; struct Scene *scene; short startx, endx, starty, endy; /* framebuffer coords */ short sizex, sizey; short scenenr, screennr; /* only for pupmenu */ - short full, pad; + short full, winid; /* win id from WM, starts with 1 */ short mainwin, winakt; short handler[8]; /* similar to space handler now */ + + ListBase handlers; } bScreen; typedef struct ScrVert { @@ -82,6 +81,7 @@ typedef unsigned short dna_ushort_fix; typedef struct Panel { /* the part from uiBlock that needs saved in file */ struct Panel *next, *prev; + char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */ char drawname[64]; /* panelname is identifier for restoring location */ short ofsx, ofsy, sizex, sizey; @@ -95,6 +95,7 @@ typedef struct Panel { /* the part from uiBlock that needs saved in file */ typedef struct ScrArea { struct ScrArea *next, *prev; + ScrVert *v1, *v2, *v3, *v4; bScreen *full; /* if area==full, this is the parent */ float winmat[4][4]; @@ -115,8 +116,19 @@ typedef struct ScrArea { ListBase spacedata; ListBase uiblocks; ListBase panels; + ListBase regionbase; + ListBase handlers; } ScrArea; +typedef struct ARegion { + struct ARegion *next, *prev; + + rcti winrct; + + ListBase handlers; + +} ARegion; + #define MAXWIN 128 /* area->flag */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h new file mode 100644 index 00000000000..dd05e5ee397 --- /dev/null +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -0,0 +1,159 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef DNA_WINDOWMANAGER_TYPES_H +#define DNA_WINDOWMANAGER_TYPES_H + +#include "DNA_listBase.h" +#include "DNA_vec_types.h" + +#include "DNA_ID.h" + +/* defined here: */ +struct wmWindowManager; +struct wmWindow; + +struct wmEvent; +struct wmOperatorType; +struct wmOperator; + +/* forwards */ +struct bContext; +struct wmLocal; +struct bScreen; +struct uiBlock; + +/* windowmanager is saved, tag WMAN */ +typedef struct wmWindowManager { + ID id; + + struct wmWindow *windrawable, *winactive; /* separate active from drawable */ + ListBase windows; + + int initialized; /* set on file read */ + int pad; + + ListBase operators; /* operator registry */ + + /* custom keymaps */ + ListBase windowkeymap; + ListBase screenkeymap; + +} wmWindowManager; + + +/* the savable part, rest of data is local in ghostwinlay */ +typedef struct wmWindow { + struct wmWindow *next, *prev; + + void *ghostwin; /* dont want to include ghost.h stuff */ + void *timer; + int timer_event; + + int winid; /* winid also in screens, is for retrieving this window after read */ + + struct bScreen *screen; /* active screen */ + char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */ + + short posx, posy, sizex, sizey; /* window coords */ + short windowstate; /* borderless, full */ + short monitor; /* multiscreen... no idea how to store yet */ + short active; /* set to 1 if an active window, for quick rejects */ + short cursor; /* mouse cursor */ + + struct wmEvent *eventstate; /* storage for event system */ + + ListBase queue; /* events */ + ListBase handlers; +} wmWindow; + +# +# +typedef struct wmOperatorType { + struct wmOperatorType *next, *prev; + + char *name; /* text for ui, undo */ + char *idname; /* unique identifier */ + + /* this callback alters UI, adds handlers, uses cb's below */ + int (*interactive)(struct bContext *, struct wmOperator *, struct wmEvent *event); + + void (*init)(struct bContext *, struct wmOperator *); + int (*exec)(struct bContext *, struct wmOperator *); + void (*exit)(struct bContext *, struct wmOperator *); + + int (*poll)(struct bContext *); + + void *(*uiBlock)(struct wmOperator *); /* panel for redo or repeat */ + + char *customname; /* dna name */ + void *customdata; /* defaults */ + + short flag; + +} wmOperatorType; + +#define OP_MAX_TYPENAME 64 + +/* partial copy of the event, for matching by eventhandler */ +typedef struct wmKeymapItem { + struct wmKeymapItem *next, *prev; + + char idname[64]; /* used to retrieve operator type pointer */ + + short type; /* event code itself */ + short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */ + short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ + short keymodifier; /* rawkey modifier */ + + short pad; +} wmKeymapItem; + + +/* this one is the operator itself, stored in files for macros etc */ +/* operator + operatortype should be able to redo entirely, but for different contextes */ +typedef struct wmOperator { + struct wmOperator *next, *prev; + + wmOperatorType *type; + char idname[64]; /* used to retrieve type pointer */ + + /* default storage (lazy?) */ + void *argv1, *argv2; + float argf1, argf2; + int arg1, arg2; + + /* custom storage, dna pointer */ + void *customdata; /* XXX dynamic properties! */ + + +} wmOperator; + + + +#endif /* DNA_WINDOWMANAGER_TYPES_H */ + diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index f696c45b315..efc2c8b1f34 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -130,6 +130,7 @@ char *includefiles[] = { "DNA_particle_types.h", // if you add files here, please add them at the end // of makesdna.c (this file) as well + "DNA_windowmanager_types.h", // empty string to indicate end of includefiles "" @@ -517,7 +518,7 @@ int convert_include(char *filename) overslaan= 0; while(countbut_refs); + BPy_Free_DrawButtonsList(); + } + some_drawspace_pylist = PyList_New(0); + BPy_Set_DrawButtonsList(some_drawspace_pylist); + + Also, BPy_Free_DrawButtonsList() must be called as necassary when a drawspace + with python callbacks is destroyed. + + This is necassary to avoid blender buttons storing invalid pointers to freed + python data.*/ + void BPy_Set_DrawButtonsList(void *list); + void BPy_Free_DrawButtonsList(void); + + void BPY_pyconstraint_eval(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets); + void BPY_pyconstraint_settings(void *arg1, void *arg2); + void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct); + void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con); + int BPY_is_pyconstraint(struct Text *text); + + void BPY_start_python( int argc, char **argv ); + void BPY_end_python( void ); + void BPY_post_start_python( void ); + void init_syspath( int first_time ); + void syspath_append( char *dir ); + + int BPY_Err_getLinenumber( void ); + const char *BPY_Err_getFilename( void ); + + int BPY_txt_do_python_Text( struct Text *text ); + int BPY_menu_do_python( short menutype, int event ); + void BPY_run_python_script( char *filename ); + void BPY_free_compiled_text( struct Text *text ); + + void BPY_clear_bad_scriptlinks( struct Text *byebye ); + int BPY_has_onload_script( void ); + void BPY_do_all_scripts( short event ); + int BPY_check_all_scriptlinks( struct Text *text ); + void BPY_do_pyscript( struct ID *id, short event ); + void BPY_free_scriptlink( struct ScriptLink *slink ); + void BPY_copy_scriptlink( struct ScriptLink *scriptlink ); + + int BPY_is_spacehandler(struct Text *text, char spacetype); + int BPY_del_spacehandler(struct Text *text, struct ScrArea *sa); + int BPY_add_spacehandler(struct Text *txt, struct ScrArea *sa,char spacetype); + int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa); + void BPY_screen_free_spacehandlers(struct bScreen *sc); + int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event, + unsigned short space_event); + + void BPY_pydriver_update(void); + float BPY_pydriver_eval(struct IpoDriver *driver); + struct Object **BPY_pydriver_get_objects(struct IpoDriver *driver); + + int BPY_button_eval(char *expr, double *value); + +/* format importer hook */ + int BPY_call_importloader( char *name ); + + void BPY_spacescript_do_pywin_draw( struct SpaceScript *sc ); + void BPY_spacescript_do_pywin_event( struct SpaceScript *sc, + unsigned short event, short val, char ascii ); + void BPY_clear_script( struct Script *script ); + void BPY_free_finished_script( struct Script *script ); + +/* void BPY_Err_Handle(struct Text *text); */ +/* void BPY_clear_bad_scriptlink(struct ID *id, struct Text *byebye); */ +/* void BPY_clear_bad_scriptlist(struct ListBase *, struct Text *byebye); */ +/* int BPY_spacetext_is_pywin(struct SpaceText *st); */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* BPY_EXTERN_H */ diff --git a/source/blender/quicktime/apple/Makefile b/source/blender/quicktime/apple/Makefile index 4620714563e..338247b5bf7 100644 --- a/source/blender/quicktime/apple/Makefile +++ b/source/blender/quicktime/apple/Makefile @@ -54,7 +54,7 @@ CPPFLAGS += -I.. # stuff needed by quicktime_[import|export].c CPPFLAGS += -I../../blenloader -I../../imbuf/intern -I../../imbuf -CPPFLAGS += -I../../blenlib -I../../makesdna -I../../include -I../../avi +CPPFLAGS += -I../../blenlib -I../../makesdna -I../../editors/include -I../../avi CPPFLAGS += -I../../blenkernel -I../../render/extern/include diff --git a/source/blender/radiosity/intern/source/Makefile b/source/blender/radiosity/intern/source/Makefile index 7791866eeaa..ebec0e1eaef 100644 --- a/source/blender/radiosity/intern/source/Makefile +++ b/source/blender/radiosity/intern/source/Makefile @@ -51,6 +51,6 @@ CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # first /include is my own includes, second are the external includes # third is the external interface. there should be a nicer way to say this -CPPFLAGS += -I../include -I../../../include -I../../extern/include +CPPFLAGS += -I../include -I../../../editors/include -I../../extern/include CPPFLAGS += -I../../../render/extern/include CPPFLAGS += -I../../../render/intern/include diff --git a/source/blender/render/intern/source/Makefile b/source/blender/render/intern/source/Makefile index 95835f212e8..19ef0d9b5d1 100644 --- a/source/blender/render/intern/source/Makefile +++ b/source/blender/render/intern/source/Makefile @@ -52,7 +52,7 @@ CPPFLAGS += -I../../../yafray CPPFLAGS += -I../../../../kernel/gen_messaging CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # not very neat: the rest of blender.. -CPPFLAGS += -I../../../include +CPPFLAGS += -I../../../editors/include CPPFLAGS += $(NAN_SDLCFLAGS) ifeq ($(WITH_QUICKTIME), true) -- cgit v1.2.3