diff options
author | Ton Roosendaal <ton@blender.org> | 2008-01-07 21:03:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-01-07 21:03:41 +0300 |
commit | 1363134dee60ce96ab0772b72283fb405b6a75ed (patch) | |
tree | ece7c62b984d1ebfa8fd1fe1890332c75efa234d /source/blender/editors/space_view3d | |
parent | 1005d99ea5190f34c56f6b30d5eca6bf738a78e8 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/Makefile | 52 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 196 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 44 |
3 files changed, 292 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/Makefile b/source/blender/editors/space_view3d/Makefile new file mode 100644 index 00000000000..0631cf010b8 --- /dev/null +++ b/source/blender/editors/space_view3d/Makefile @@ -0,0 +1,52 @@ +# +# $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_view3d +DIR = $(OCGDIR)/blender/$(LIBNAME) + +include nan_compile.mk + +CFLAGS += $(LEVEL_1_C_WARNINGS) + +CPPFLAGS += -I$(OPENGL_HEADERS) + +# not very neat.... +CPPFLAGS += -I../../windowmanager +CPPFLAGS += -I../../blenloader +CPPFLAGS += -I../../blenkernel +CPPFLAGS += -I../../blenlib +CPPFLAGS += -I../../makesdna +CPPFLAGS += -I../../imbuf +CPPFLAGS += -I../../python +CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include + +# own include + +CPPFLAGS += -I../include diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c new file mode 100644 index 00000000000..9a08c7cd016 --- /dev/null +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -0,0 +1,196 @@ +/** + * $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) 2008 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <string.h> +#include <stdio.h> + +#include "DNA_object_types.h" +#include "DNA_space_types.h" +#include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "DNA_view3d_types.h" + +#include "MEM_guardedalloc.h" + +#include "BLI_blenlib.h" +#include "BLI_arithb.h" +#include "BLI_rand.h" + +#include "BKE_global.h" +#include "BKE_screen.h" + +#include "ED_area.h" + +#include "BIF_gl.h" + +#include "view3d_intern.h" // own include + +/* ******************** default callbacks for view3d space ***************** */ + +static SpaceLink *view3d_new(void) +{ + View3D *vd; + + vd= MEM_callocN(sizeof(View3D), "initview3d"); + + vd->spacetype= SPACE_VIEW3D; + vd->blockscale= 0.7f; + vd->viewquat[0]= 1.0f; + vd->viewquat[1]= vd->viewquat[2]= vd->viewquat[3]= 0.0f; + vd->persp= 1; + vd->drawtype= OB_WIRE; + vd->view= 7; + vd->dist= 10.0; + vd->lens= 35.0f; + vd->near= 0.01f; + vd->far= 500.0f; + vd->grid= 1.0f; + vd->gridlines= 16; + vd->gridsubdiv = 10; + + vd->lay= vd->layact= 1; + if(G.scene) { + vd->lay= vd->layact= G.scene->lay; + vd->camera= G.scene->camera; + } + vd->scenelock= 1; + vd->gridflag |= V3D_SHOW_X; + vd->gridflag |= V3D_SHOW_Y; + vd->gridflag |= V3D_SHOW_FLOOR; + vd->gridflag &= ~V3D_SHOW_Z; + + vd->depths= NULL; + + return (SpaceLink *)vd; +} + +/* not spacelink itself */ +static void view3d_free(SpaceLink *sl) +{ + View3D *vd= (View3D *) sl; + + if(vd->bgpic) { + if(vd->bgpic->ima) vd->bgpic->ima->id.us--; + MEM_freeN(vd->bgpic); + } + + if(vd->localvd) MEM_freeN(vd->localvd); + if(vd->clipbb) MEM_freeN(vd->clipbb); + if(vd->depths) { + if(vd->depths->depths) MEM_freeN(vd->depths->depths); + MEM_freeN(vd->depths); + vd->depths= NULL; + } + +// XXX retopo_free_view_data(vd); + + if(vd->properties_storage) MEM_freeN(vd->properties_storage); + if(vd->ri) { +// XXX BIF_view3d_previewrender_free(vd); + } + +} + + +/* spacetype; init callback */ +static void view3d_init(ScrArea *sa) +{ + ARegion *ar; + + /* link area to SpaceXXX struct */ + + /* define how many regions, the order and types */ + + /* add types to regions */ + for(ar= sa->regionbase.first; ar; ar= ar->next) { + static ARegionType art={NULL, NULL, NULL, NULL}; + + /* for time being; register 1 type */ + ar->type= &art; + + } +} + +/* spacetype; context changed */ +static void view3d_refresh(bContext *C, ScrArea *sa) +{ + +} + +static SpaceLink *view3d_duplicate(SpaceLink *sl) +{ + View3D *v3do= (View3D *)sl; + View3D *v3dn= MEM_dupallocN(sl); + + /* clear or remove stuff from old */ + +// XXX BIF_view3d_previewrender_free(v3do); + v3do->depths= NULL; + v3do->retopo_view_data= NULL; + + if(v3do->localvd) { +// XXX restore_localviewdata(v3do); + v3do->localvd= NULL; + v3do->properties_storage= NULL; + v3do->localview= 0; + v3do->lay &= 0xFFFFFF; + } + + /* copy or clear inside new stuff */ + + if(v3dn->bgpic) { + v3dn->bgpic= MEM_dupallocN(v3dn->bgpic); + if(v3dn->bgpic->ima) v3dn->bgpic->ima->id.us++; + } + v3dn->clipbb= MEM_dupallocN(v3dn->clipbb); + v3dn->ri= NULL; + v3dn->properties_storage= NULL; + + return (SpaceLink *)v3dn; +} + +/* only called once, from screen/spacetypes.c */ +void ED_spacetype_view3d(void) +{ + static SpaceType st; + + st.spaceid= SPACE_VIEW3D; + + st.new= view3d_new; + st.free= view3d_free; + st.init= view3d_init; + st.refresh= view3d_refresh; + st.duplicate= view3d_duplicate; + + BKE_spacetype_register(&st); + + +} + + + diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h new file mode 100644 index 00000000000..32c3e51c112 --- /dev/null +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -0,0 +1,44 @@ +/** + * $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) 2008 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef ED_VIEW3D_INTERN_H +#define ED_VIEW3D_INTERN_H + +/* internal exports only */ + +typedef struct ViewDepths { + unsigned short w, h; + float *depths; + double depth_range[2]; + + char damaged; +} ViewDepths; + + + +#endif /* ED_VIEW3D_INTERN_H */ + |