2.5
Resolved cyclic calls for editors. Now there's a space_api/ module, here you can use functions calling other editor modules. The functions in the module are only used by the WindowManager module to initialize space types. Note for sconzers and MSVC and cmake: the proper linking order for editors is: - space_api - space_xxx - object / mesh / transform / etc - interface - util / datafiles - screen
This commit is contained in:
@@ -230,19 +230,19 @@ ifeq ($(WITH_OPENEXR), true)
|
||||
COMLIB += $(NAN_OPENEXR_LIBS)
|
||||
endif
|
||||
|
||||
# silly: libed_screen.a twice :(
|
||||
# note: space_api.a in begin of editors, screen.a in end
|
||||
PULIB = $(NAN_MOTO)/lib/libmoto.a
|
||||
PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
|
||||
PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
|
||||
PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
|
||||
PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
|
||||
PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
|
||||
PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
|
||||
PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
|
||||
PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
|
||||
PULIB += $(OCGDIR)/blender/ed_util/libed_util.a
|
||||
PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a
|
||||
PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
|
||||
PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
|
||||
PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
|
||||
PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
|
||||
PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
# Bounces make to subdirectories.
|
||||
|
||||
SOURCEDIR = source/blender/editors
|
||||
DIRS = datafiles screen space_outliner space_time space_view3d interface util
|
||||
DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api
|
||||
|
||||
include nan_subdirs.mk
|
||||
|
||||
@@ -3,6 +3,7 @@ Import ('env')
|
||||
|
||||
|
||||
SConscript(['datafiles/SConscript',
|
||||
'space_api/SConscript',
|
||||
'util/SConscript',
|
||||
'interface/SConscript',
|
||||
'mesh/SConscript',
|
||||
|
||||
@@ -500,4 +500,53 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ED_newspace(ScrArea *sa, int type)
|
||||
{
|
||||
if(sa->spacetype != type) {
|
||||
SpaceType *st= BKE_spacetype_from_id(type);
|
||||
SpaceLink *slold= sa->spacedata.first;
|
||||
SpaceLink *sl;
|
||||
|
||||
sa->spacetype= type;
|
||||
sa->butspacetype= type;
|
||||
|
||||
/* check previously stored space */
|
||||
for (sl= sa->spacedata.first; sl; sl= sl->next)
|
||||
if(sl->spacetype==type)
|
||||
break;
|
||||
|
||||
/* old spacedata... happened during work on 2.50, remove */
|
||||
if(sl && sl->regionbase.first==NULL) {
|
||||
st->free(sl);
|
||||
MEM_freeN(sl);
|
||||
sl= NULL;
|
||||
}
|
||||
|
||||
if (sl) {
|
||||
|
||||
/* swap regions */
|
||||
slold->regionbase= sa->regionbase;
|
||||
sa->regionbase= sl->regionbase;
|
||||
sl->regionbase.first= sl->regionbase.last= NULL;
|
||||
|
||||
/* put in front of list */
|
||||
BLI_remlink(&sa->spacedata, sl);
|
||||
BLI_addhead(&sa->spacedata, sl);
|
||||
}
|
||||
else {
|
||||
/* new space */
|
||||
if(st) {
|
||||
sl= st->new();
|
||||
BLI_addhead(&sa->spacedata, sl);
|
||||
|
||||
/* swap regions */
|
||||
slold->regionbase= sa->regionbase;
|
||||
sa->regionbase= sl->regionbase;
|
||||
sl->regionbase.first= sl->regionbase.last= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
50
source/blender/editors/space_api/Makefile
Normal file
50
source/blender/editors/space_api/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
|
||||
#
|
||||
# ***** 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.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
#
|
||||
# Makes module object directory and bounces make to subdirectories.
|
||||
|
||||
LIBNAME = ed_space
|
||||
DIR = $(OCGDIR)/blender/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
CFLAGS += $(LEVEL_1_C_WARNINGS)
|
||||
|
||||
CPPFLAGS += -I$(NAN_GLEW)/include
|
||||
CPPFLAGS += -I$(OPENGL_HEADERS)
|
||||
|
||||
# not very neat....
|
||||
CPPFLAGS += -I../../blenkernel
|
||||
CPPFLAGS += -I../../blenlib
|
||||
CPPFLAGS += -I../../makesdna
|
||||
CPPFLAGS += -I../../makesrna
|
||||
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
|
||||
|
||||
# own include
|
||||
|
||||
CPPFLAGS += -I../include
|
||||
15
source/blender/editors/space_api/SConscript
Normal file
15
source/blender/editors/space_api/SConscript
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('*.c')
|
||||
|
||||
incs = '../include ../../blenlib ../../blenkernel ../../makesdna'
|
||||
incs += ' ../../windowmanager ../../python ../../makesrna'
|
||||
incs += ' #/intern/guardedalloc #/extern/glew/include'
|
||||
|
||||
defs = ''
|
||||
|
||||
if not env['WITH_BF_PYTHON']:
|
||||
defs += 'DISABLE_PYTHON'
|
||||
|
||||
env.BlenderLib ( 'bf_editors_space_api', sources, Split(incs), Split(defs), libtype=['core','intern'], priority=[30, 35] )
|
||||
@@ -31,72 +31,16 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "ED_area.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
/* */
|
||||
|
||||
void ED_newspace(ScrArea *sa, int type)
|
||||
{
|
||||
if(sa->spacetype != type) {
|
||||
SpaceType *st= BKE_spacetype_from_id(type);
|
||||
SpaceLink *slold= sa->spacedata.first;
|
||||
SpaceLink *sl;
|
||||
|
||||
sa->spacetype= type;
|
||||
sa->butspacetype= type;
|
||||
|
||||
/* check previously stored space */
|
||||
for (sl= sa->spacedata.first; sl; sl= sl->next)
|
||||
if(sl->spacetype==type)
|
||||
break;
|
||||
|
||||
/* old spacedata... happened during work on 2.50, remove */
|
||||
if(sl && sl->regionbase.first==NULL) {
|
||||
st->free(sl);
|
||||
MEM_freeN(sl);
|
||||
sl= NULL;
|
||||
}
|
||||
|
||||
if (sl) {
|
||||
|
||||
/* swap regions */
|
||||
slold->regionbase= sa->regionbase;
|
||||
sa->regionbase= sl->regionbase;
|
||||
sl->regionbase.first= sl->regionbase.last= NULL;
|
||||
|
||||
/* put in front of list */
|
||||
BLI_remlink(&sa->spacedata, sl);
|
||||
BLI_addhead(&sa->spacedata, sl);
|
||||
}
|
||||
else {
|
||||
/* new space */
|
||||
if(st) {
|
||||
sl= st->new();
|
||||
BLI_addhead(&sa->spacedata, sl);
|
||||
|
||||
/* swap regions */
|
||||
slold->regionbase= sa->regionbase;
|
||||
sa->regionbase= sl->regionbase;
|
||||
sl->regionbase.first= sl->regionbase.last= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
@@ -35,13 +37,9 @@
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_area.h"
|
||||
|
||||
#include "screen_intern.h" /* own module include */
|
||||
|
||||
ARegionType *ED_regiontype_from_id(SpaceType *st, int regionid)
|
||||
{
|
||||
@@ -386,7 +386,7 @@ void do_time_buttons(bContext *C, void *arg, int event)
|
||||
|
||||
switch(event) {
|
||||
case B_NEWSPACE:
|
||||
//ED_newspace(C->area, C->area->butspacetype); // XXX for ton (breaks compiling, so disabled for now) - Aligorith
|
||||
ED_newspace(C->area, C->area->butspacetype);
|
||||
WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
|
||||
break;
|
||||
case B_REDRAWALL:
|
||||
|
||||
Reference in New Issue
Block a user