[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13157] branches/blender2.5/blender/source /blender: Whole lot of changes....
Ton Roosendaal
ton at blender.org
Mon Jan 7 19:03:42 CET 2008
Revision: 13157
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13157
Author: ton
Date: 2008-01-07 19:03:41 +0100 (Mon, 07 Jan 2008)
Log Message:
-----------
Whole lot of changes.... here a shortlist:
- removed editors/area and put this all in screen
- added first python calls (note, a new c file for scriptlinks)
- added view3d editor callbacks (no drawing yet)
- added files in editors/interface
(Cmake and Scons has to be fixed, help welcome!)
- now areas/headers are being converted on file read
- note: previously saved 2.50 files will crash!!! (.B.blend)
- area regions are being drawn, first handler for cursor added (on edge)
- window duplicate and scale works correct for screen subdiv
Todos for me:
- need to fix things in syntax (function names) a bit still
- more operators for screen
- define how Context will work... still unresolved when it gets set
- docs!
Reviews of code structure is welcome!
There are also more todos now for others, but it can wait a couple of days
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenkernel/BKE_screen.h
branches/blender2.5/blender/source/blender/blenkernel/intern/screen.c
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
branches/blender2.5/blender/source/blender/editors/Makefile
branches/blender2.5/blender/source/blender/editors/include/BIF_glutil.h
branches/blender2.5/blender/source/blender/editors/include/ED_area.h
branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
branches/blender2.5/blender/source/blender/editors/interface/Makefile
branches/blender2.5/blender/source/blender/editors/screen/Makefile
branches/blender2.5/blender/source/blender/editors/screen/SConscript
branches/blender2.5/blender/source/blender/editors/screen/stubs.c
branches/blender2.5/blender/source/blender/makesdna/DNA_screen_types.h
branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
branches/blender2.5/blender/source/blender/makesdna/DNA_view3d_types.h
branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h
branches/blender2.5/blender/source/blender/nodes/intern/CMP_util.h
branches/blender2.5/blender/source/blender/nodes/intern/SHD_util.h
branches/blender2.5/blender/source/blender/python/BPY_extern.h
branches/blender2.5/blender/source/blender/windowmanager/WM_api.h
branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
branches/blender2.5/blender/source/blender/windowmanager/intern/wm.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_init_exit.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_operators.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_subwindow.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
branches/blender2.5/blender/source/blender/windowmanager/wm.h
branches/blender2.5/blender/source/blender/windowmanager/wm_event_system.h
branches/blender2.5/blender/source/blender/windowmanager/wm_event_types.h
Added Paths:
-----------
branches/blender2.5/blender/source/blender/editors/include/BIF_interface_icons.h
branches/blender2.5/blender/source/blender/editors/include/BIF_resources.h
branches/blender2.5/blender/source/blender/editors/interface/resources.c
branches/blender2.5/blender/source/blender/editors/screen/CMakeLists.txt
branches/blender2.5/blender/source/blender/editors/screen/area.c
branches/blender2.5/blender/source/blender/editors/screen/glutil.c
branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
branches/blender2.5/blender/source/blender/editors/screen/screen_intern.h
branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
branches/blender2.5/blender/source/blender/editors/screen/space.c
branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c
branches/blender2.5/blender/source/blender/editors/space_ipo/Makefile
branches/blender2.5/blender/source/blender/editors/space_view3d/Makefile
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h
branches/blender2.5/blender/source/blender/python/intern/
branches/blender2.5/blender/source/blender/python/intern/BPY_scriptlink.c
branches/blender2.5/blender/source/blender/python/intern/Makefile
branches/blender2.5/blender/source/blender/windowmanager/intern/screen_edit.c
Removed Paths:
-------------
branches/blender2.5/blender/source/blender/editors/area/
Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_screen.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_screen.h 2008-01-07 16:26:41 UTC (rev 13156)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_screen.h 2008-01-07 18:03:41 UTC (rev 13157)
@@ -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
@@ -29,12 +26,59 @@
*
* Contributor(s): none yet.
*
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
*/
#ifndef BKE_SCREEN_H
#define BKE_SCREEN_H
+struct SpaceType;
+struct ScrArea;
+struct bScreen;
+struct ARegion;
+struct wmNotifier;
+
+/* spacetype has everything stored to get an editor working, it gets initialized via
+spacetypes_init() in editors/area/spacetypes.c */
+/* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
+
+typedef struct SpaceType {
+ struct SpaceType *next, *prev;
+
+ char name[32]; /* for menus */
+ int spaceid; /* unique space identifier */
+ int iconid; /* icon lookup for menus */
+
+ struct SpaceLink *(*new)(void); /* calls init too */
+ void (*free)(struct SpaceLink *sl); /* not free sl itself */
+
+ void (*init)(struct ScrArea *); /* init is to cope with internal contextual changes, adds handlers, sets screarea regions */
+ void (*refresh)(struct bContext *, struct ScrArea *); /* refresh is for external bContext changes */
+
+ struct SpaceLink *(*duplicate)(struct SpaceLink *sl); /* after a spacedata copy, an init should result in exact same situation */
+
+ /* read and write... */
+
+} SpaceType;
+
+/* region type gets allocated and freed in spacetype init/free callback */
+/* data storage for regions is in space struct (also width/height of regions!) */
+typedef struct ARegionType {
+
+ void (*init)(const struct bContext *, struct ARegion *); /* add handlers, stuff you only do once or on area/region changes */
+ void (*refresh)(const struct bContext *, struct ARegion *); /* refresh to match contextual changes */
+ void (*draw)(const struct bContext *, struct ARegion *); /* draw entirely, windowsize changes should be handled here */
+
+ void (*listener)(struct ARegion *, struct wmNotifier *);
+} ARegionType;
+
+
+void BKE_screen_area_free(struct ScrArea *sa);
void free_screen(struct bScreen *sc);
+struct SpaceType *BKE_spacetype_from_id(int spaceid);
+void BKE_spacetype_register(struct SpaceType *st);
+void BKE_spacedata_freelist(ListBase *lb);
+void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2);
+
#endif
Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/screen.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/screen.c 2008-01-07 16:26:41 UTC (rev 13156)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/screen.c 2008-01-07 18:03:41 UTC (rev 13157)
@@ -1,9 +1,7 @@
-
-/* screen.c
- *
+/*
* $Id$
*
- * ***** BEGIN GP 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
@@ -22,10 +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): Blender Foundation 2002-2008
*
- * Contributor(s): none yet.
- *
* ***** END GPL LICENSE BLOCK *****
*/
@@ -34,20 +30,89 @@
#include <math.h>
#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
#include "BLI_blenlib.h"
#include "BKE_screen.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "BPY_extern.h"
+/* keep global; this has to be accessible outside of windowmanager */
+static ListBase spacetypes= {NULL, NULL};
+
+SpaceType *BKE_spacetype_from_id(int spaceid)
+{
+ SpaceType *st;
+
+ for(st= spacetypes.first; st; st= st->next) {
+ if(st->spaceid==spaceid)
+ return st;
+ }
+ return NULL;
+}
+
+void BKE_spacetype_register(SpaceType *st)
+{
+ BLI_addtail(&spacetypes, st);
+}
+
+void BKE_spacedata_freelist(ListBase *lb)
+{
+ SpaceLink *sl;
+
+ for (sl= lb->first; sl; sl= sl->next) {
+ SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
+
+ if(st && st->free)
+ st->free(sl);
+ }
+
+ BLI_freelistN(lb);
+}
+
+/* lb1 should be empty */
+void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
+{
+ SpaceLink *sl;
+
+ lb1->first= lb2->last= NULL; /* to be sure */
+
+ for (sl= lb2->first; sl; sl= sl->next) {
+ SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
+
+ if(st && st->duplicate)
+ BLI_addtail(lb1, st->duplicate(sl));
+ }
+}
+
+
+/* not area itself */
+void BKE_screen_area_free(ScrArea *sa)
+{
+
+ BKE_spacedata_freelist(&sa->spacedata);
+
+ BLI_freelistN(&sa->regionbase);
+
+ BLI_freelistN(&sa->panels);
+ // uiFreeBlocks(&sa->uiblocks);
+ // uiFreePanels(&sa->panels);
+
+ BPY_free_scriptlink(&sa->scriptlink);
+
+}
+
/* don't free screen itself */
void free_screen(bScreen *sc)
{
- //XXX unlink_screen(sc); /* bad level call */
-
+ ScrArea *sa;
+
+ for(sa= sc->areabase.first; sa; sa= sa->next)
+ BKE_screen_area_free(sa);
+
BLI_freelistN(&sc->vertbase);
BLI_freelistN(&sc->edgebase);
BLI_freelistN(&sc->areabase);
}
+
+
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2008-01-07 16:26:41 UTC (rev 13156)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2008-01-07 18:03:41 UTC (rev 13157)
@@ -3844,8 +3844,7 @@
link_list(fd, &(sc->edgebase));
link_list(fd, &(sc->areabase));
- sc->mainwin= sc->subwinactive= NULL;
- sc->handlers.first= sc->handlers.last= NULL;
+ sc->mainwin= sc->subwinactive= 0; /* indices */
/* 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 */
@@ -3884,6 +3883,7 @@
sa->handlers.first= sa->handlers.last= NULL;
sa->uiblocks.first= sa->uiblocks.last= NULL;
+ sa->type= NULL; /* spacetype callbacks */
/* accident can happen when read/save new file with older version */
if(sa->spacedata.first==NULL && sa->spacetype>SPACE_NLA)
@@ -3944,7 +3944,8 @@
for(ar= sa->regionbase.first; ar; ar= ar->next) {
ar->handlers.first= ar->handlers.last= NULL;
- ar->subwin= NULL;
+ ar->swinid= 0;
+ ar->type= NULL;
}
sa->v1= newdataadr(fd, sa->v1);
@@ -4564,6 +4565,33 @@
}
}
+static void do_versions_windowmanager_2_50(bScreen *screen)
+{
+ struct ScrArea *sa;
+ struct ARegion *ar;
+
+ /* add regions */
+ for(sa= screen->areabase.first; sa; sa= sa->next) {
+ /* we keep headertype variable to convert old files only */
+ if(sa->headertype) {
+ ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(&sa->regionbase, ar);
+ ar->winrct= sa->headrct;
+ ar->regiontype= RGN_TYPE_HEADER;
+ ar->minsize= HEADERY; // DNA_screen_types.h
+ if(sa->headertype==1)
+ ar->alignment= RGN_ALIGN_BOTTOM;
+ else
+ ar->alignment= RGN_ALIGN_TOP;
+ }
+
+ ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(&sa->regionbase, ar);
+ ar->winrct= sa->winrct;
+ ar->regiontype= RGN_TYPE_WINDOW;
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7316,8 +7344,15 @@
}
}
}
-
-
+
+
+ if (main->versionfile < 250) {
+ bScreen *screen;
+
+ for(screen= main->screen.first; screen; screen= screen->id.next)
+ do_versions_windowmanager_2_50(screen);
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
Modified: branches/blender2.5/blender/source/blender/editors/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/editors/Makefile 2008-01-07 16:26:41 UTC (rev 13156)
+++ branches/blender2.5/blender/source/blender/editors/Makefile 2008-01-07 18:03:41 UTC (rev 13157)
@@ -29,6 +29,6 @@
# Bounces make to subdirectories.
SOURCEDIR = source/blender/editors
-DIRS = area datafiles screen
+DIRS = datafiles screen space_view3d
include nan_subdirs.mk
Modified: branches/blender2.5/blender/source/blender/editors/include/BIF_glutil.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/BIF_glutil.h 2008-01-07 16:26:41 UTC (rev 13156)
+++ branches/blender2.5/blender/source/blender/editors/include/BIF_glutil.h 2008-01-07 18:03:41 UTC (rev 13157)
@@ -1,19 +1,12 @@
/**
- * @file BIF_glutil.h
- *
- * OpenGL drawing utility functions.
- *
- * $Id: BIF_glutil.h 10207 2007-03-06 03:39:15Z halley $
+ * $Id: BIF_glutil.h
*
- * ***** 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
@@ -27,11 +20,9 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list