2008-01-07 18:03:41 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2008-01-07 18:03:41 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
2007-12-24 18:38:03 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
2007-12-24 18:38:03 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:40:57 +00:00
|
|
|
/** \file blender/blenkernel/intern/screen.c
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
2011-05-20 08:52:52 +00:00
|
|
|
#include "BLI_winstuff.h"
|
2011-02-27 20:40:57 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-09-14 12:26:34 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "DNA_space_types.h"
|
2009-09-14 12:26:34 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
2008-12-08 15:02:57 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
#include "BKE_screen.h"
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* ************ Spacetype/regiontype handling ************** */
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* keep global; this has to be accessible outside of windowmanager */
|
|
|
|
|
static ListBase spacetypes= {NULL, NULL};
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* not SpaceType itself */
|
|
|
|
|
static void spacetype_free(SpaceType *st)
|
|
|
|
|
{
|
2.5
New: Custom region draw callbacks.
For Martin: an example is now in space_view3d/view3d_edit.c
On middlemouse rotate view, it draws a small square in center.
It works likes this:
#include "ED_space_api.h"
handle= ED_region_draw_cb_activate(region->type, drawfunc, type)
and to stop it:
ED_region_draw_cb_exit(region->type, handle)
drawfunc is of type (const bContext *C, ARegion *ar)
currently it gets called only as type REGION_DRAW_POST, later we
can add more (PRE, POST_XRAY, POST_2D, etc).
For correct usage, these calls should return leaving view transform
unaltered.
2009-01-09 15:04:52 +00:00
|
|
|
ARegionType *art;
|
2009-04-19 13:37:59 +00:00
|
|
|
PanelType *pt;
|
2009-04-22 18:39:44 +00:00
|
|
|
HeaderType *ht;
|
2.5
New: Custom region draw callbacks.
For Martin: an example is now in space_view3d/view3d_edit.c
On middlemouse rotate view, it draws a small square in center.
It works likes this:
#include "ED_space_api.h"
handle= ED_region_draw_cb_activate(region->type, drawfunc, type)
and to stop it:
ED_region_draw_cb_exit(region->type, handle)
drawfunc is of type (const bContext *C, ARegion *ar)
currently it gets called only as type REGION_DRAW_POST, later we
can add more (PRE, POST_XRAY, POST_2D, etc).
For correct usage, these calls should return leaving view transform
unaltered.
2009-01-09 15:04:52 +00:00
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
for(art= st->regiontypes.first; art; art= art->next) {
|
2.5
New: Custom region draw callbacks.
For Martin: an example is now in space_view3d/view3d_edit.c
On middlemouse rotate view, it draws a small square in center.
It works likes this:
#include "ED_space_api.h"
handle= ED_region_draw_cb_activate(region->type, drawfunc, type)
and to stop it:
ED_region_draw_cb_exit(region->type, handle)
drawfunc is of type (const bContext *C, ARegion *ar)
currently it gets called only as type REGION_DRAW_POST, later we
can add more (PRE, POST_XRAY, POST_2D, etc).
For correct usage, these calls should return leaving view transform
unaltered.
2009-01-09 15:04:52 +00:00
|
|
|
BLI_freelistN(&art->drawcalls);
|
2009-04-19 13:37:59 +00:00
|
|
|
|
|
|
|
|
for(pt= art->paneltypes.first; pt; pt= pt->next)
|
2009-07-21 20:05:16 +00:00
|
|
|
if(pt->ext.free)
|
|
|
|
|
pt->ext.free(pt->ext.data);
|
2009-04-19 13:37:59 +00:00
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
for(ht= art->headertypes.first; ht; ht= ht->next)
|
2009-07-21 20:05:16 +00:00
|
|
|
if(ht->ext.free)
|
|
|
|
|
ht->ext.free(ht->ext.data);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
BLI_freelistN(&art->paneltypes);
|
|
|
|
|
BLI_freelistN(&art->headertypes);
|
|
|
|
|
}
|
2.5
New: Custom region draw callbacks.
For Martin: an example is now in space_view3d/view3d_edit.c
On middlemouse rotate view, it draws a small square in center.
It works likes this:
#include "ED_space_api.h"
handle= ED_region_draw_cb_activate(region->type, drawfunc, type)
and to stop it:
ED_region_draw_cb_exit(region->type, handle)
drawfunc is of type (const bContext *C, ARegion *ar)
currently it gets called only as type REGION_DRAW_POST, later we
can add more (PRE, POST_XRAY, POST_2D, etc).
For correct usage, these calls should return leaving view transform
unaltered.
2009-01-09 15:04:52 +00:00
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
BLI_freelistN(&st->regiontypes);
|
2009-07-02 11:23:19 +00:00
|
|
|
BLI_freelistN(&st->toolshelf);
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_spacetypes_free(void)
|
|
|
|
|
{
|
2008-12-14 17:25:46 +00:00
|
|
|
SpaceType *st;
|
2008-12-08 15:02:57 +00:00
|
|
|
|
2008-12-14 17:25:46 +00:00
|
|
|
for(st= spacetypes.first; st; st= st->next) {
|
2008-12-08 15:02:57 +00:00
|
|
|
spacetype_free(st);
|
2008-12-14 11:39:00 +00:00
|
|
|
}
|
2008-12-08 15:02:57 +00:00
|
|
|
|
|
|
|
|
BLI_freelistN(&spacetypes);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
|
|
|
|
|
{
|
|
|
|
|
ARegionType *art;
|
|
|
|
|
|
|
|
|
|
for(art= st->regiontypes.first; art; art= art->next)
|
|
|
|
|
if(art->regionid==regionid)
|
|
|
|
|
return art;
|
|
|
|
|
|
2009-07-26 18:18:14 +00:00
|
|
|
printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
return st->regiontypes.first;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
const ListBase *BKE_spacetypes_list(void)
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
{
|
|
|
|
|
return &spacetypes;
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
void BKE_spacetype_register(SpaceType *st)
|
|
|
|
|
{
|
2008-12-08 15:02:57 +00:00
|
|
|
SpaceType *stype;
|
|
|
|
|
|
|
|
|
|
/* sanity check */
|
|
|
|
|
stype= BKE_spacetype_from_id(st->spaceid);
|
|
|
|
|
if(stype) {
|
|
|
|
|
printf("error: redefinition of spacetype %s\n", stype->name);
|
|
|
|
|
spacetype_free(stype);
|
|
|
|
|
MEM_freeN(stype);
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
BLI_addtail(&spacetypes, st);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* ***************** Space handling ********************** */
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
void BKE_spacedata_freelist(ListBase *lb)
|
|
|
|
|
{
|
2008-12-14 17:25:46 +00:00
|
|
|
SpaceLink *sl;
|
|
|
|
|
ARegion *ar;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-14 17:25:46 +00:00
|
|
|
for (sl= lb->first; sl; sl= sl->next) {
|
2008-01-07 18:03:41 +00:00
|
|
|
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
|
|
|
|
|
|
2008-12-14 17:25:46 +00:00
|
|
|
/* free regions for pushed spaces */
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
for(ar=sl->regionbase.first; ar; ar=ar->next)
|
|
|
|
|
BKE_area_region_free(st, ar);
|
|
|
|
|
|
2008-12-11 19:35:27 +00:00
|
|
|
BLI_freelistN(&sl->regionbase);
|
2008-12-14 11:55:49 +00:00
|
|
|
|
|
|
|
|
if(st && st->free)
|
|
|
|
|
st->free(sl);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_freelistN(lb);
|
|
|
|
|
}
|
|
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
|
2008-12-14 17:25:46 +00:00
|
|
|
{
|
|
|
|
|
ARegion *newar= MEM_dupallocN(ar);
|
2008-12-26 13:11:04 +00:00
|
|
|
Panel *pa, *newpa, *patab;
|
2008-12-14 17:25:46 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
newar->prev= newar->next= NULL;
|
2008-12-14 17:25:46 +00:00
|
|
|
newar->handlers.first= newar->handlers.last= NULL;
|
|
|
|
|
newar->uiblocks.first= newar->uiblocks.last= NULL;
|
|
|
|
|
newar->swinid= 0;
|
|
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
/* use optional regiondata callback */
|
|
|
|
|
if(ar->regiondata) {
|
|
|
|
|
ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
|
2008-12-26 13:11:04 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
if(art && art->duplicate)
|
|
|
|
|
newar->regiondata= art->duplicate(ar->regiondata);
|
|
|
|
|
else
|
|
|
|
|
newar->regiondata= MEM_dupallocN(ar->regiondata);
|
|
|
|
|
}
|
2009-07-29 22:57:53 +00:00
|
|
|
|
|
|
|
|
if(ar->v2d.tab_offset)
|
|
|
|
|
newar->v2d.tab_offset= MEM_dupallocN(ar->v2d.tab_offset);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
|
2008-12-26 13:11:04 +00:00
|
|
|
newar->panels.first= newar->panels.last= NULL;
|
|
|
|
|
BLI_duplicatelist(&newar->panels, &ar->panels);
|
|
|
|
|
|
|
|
|
|
/* copy panel pointers */
|
|
|
|
|
for(newpa= newar->panels.first; newpa; newpa= newpa->next) {
|
|
|
|
|
patab= newar->panels.first;
|
|
|
|
|
pa= ar->panels.first;
|
|
|
|
|
while(patab) {
|
|
|
|
|
if(newpa->paneltab == pa) {
|
|
|
|
|
newpa->paneltab = patab;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
patab= patab->next;
|
|
|
|
|
pa= pa->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-12-14 17:25:46 +00:00
|
|
|
|
|
|
|
|
return newar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* from lb2 to lb1, lb1 is supposed to be free'd */
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
|
2008-12-14 17:25:46 +00:00
|
|
|
{
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
/* to be sure */
|
|
|
|
|
lb1->first= lb1->last= NULL;
|
|
|
|
|
|
|
|
|
|
for(ar= lb2->first; ar; ar= ar->next) {
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ARegion *arnew= BKE_area_region_copy(st, ar);
|
2008-12-14 17:25:46 +00:00
|
|
|
BLI_addtail(lb1, arnew);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* lb1 should be empty */
|
|
|
|
|
void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
|
|
|
|
|
{
|
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
2009-03-11 20:25:31 +00:00
|
|
|
lb1->first= lb1->last= NULL; /* to be sure */
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
|
for (sl= lb2->first; sl; sl= sl->next) {
|
|
|
|
|
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
|
|
|
|
|
|
2008-12-14 17:25:46 +00:00
|
|
|
if(st && st->duplicate) {
|
|
|
|
|
SpaceLink *slnew= st->duplicate(sl);
|
|
|
|
|
|
|
|
|
|
BLI_addtail(lb1, slnew);
|
|
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
region_copylist(st, &slnew->regionbase, &sl->regionbase);
|
2008-12-14 17:25:46 +00:00
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-25 17:11:32 +00:00
|
|
|
/* facility to set locks for drawing to survive (render) threads accessing drawing data */
|
|
|
|
|
/* lock can become bitflag too */
|
|
|
|
|
/* should be replaced in future by better local data handling for threads */
|
|
|
|
|
void BKE_spacedata_draw_locks(int set)
|
|
|
|
|
{
|
|
|
|
|
SpaceType *st;
|
|
|
|
|
|
|
|
|
|
for(st= spacetypes.first; st; st= st->next) {
|
|
|
|
|
ARegionType *art;
|
|
|
|
|
|
|
|
|
|
for(art= st->regiontypes.first; art; art= art->next) {
|
|
|
|
|
if(set)
|
|
|
|
|
art->do_lock= art->lock;
|
|
|
|
|
else
|
|
|
|
|
art->do_lock= 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
/* not region itself */
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
void BKE_area_region_free(SpaceType *st, ARegion *ar)
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
{
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
if(st) {
|
|
|
|
|
ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
|
|
|
|
|
|
|
|
|
|
if(art && art->free)
|
|
|
|
|
art->free(ar);
|
2009-01-25 20:22:05 +00:00
|
|
|
|
|
|
|
|
if(ar->regiondata)
|
|
|
|
|
printf("regiondata free error\n");
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
2009-01-23 20:36:47 +00:00
|
|
|
else if(ar->type && ar->type->free)
|
|
|
|
|
ar->type->free(ar);
|
2009-07-29 22:57:53 +00:00
|
|
|
|
|
|
|
|
if(ar->v2d.tab_offset) {
|
|
|
|
|
MEM_freeN(ar->v2d.tab_offset);
|
|
|
|
|
ar->v2d.tab_offset= NULL;
|
|
|
|
|
}
|
2009-01-23 20:36:47 +00:00
|
|
|
|
2011-09-17 07:14:39 +00:00
|
|
|
BLI_freelistN(&ar->panels);
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
|
/* not area itself */
|
|
|
|
|
void BKE_screen_area_free(ScrArea *sa)
|
|
|
|
|
{
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
SpaceType *st= BKE_spacetype_from_id(sa->spacetype);
|
|
|
|
|
ARegion *ar;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
for(ar=sa->regionbase.first; ar; ar=ar->next)
|
|
|
|
|
BKE_area_region_free(st, ar);
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
BLI_freelistN(&sa->regionbase);
|
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
BKE_spacedata_freelist(&sa->spacedata);
|
|
|
|
|
|
2008-01-17 05:33:54 +00:00
|
|
|
BLI_freelistN(&sa->actionzones);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2002-11-25 12:02:15 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* don't free screen itself */
|
|
|
|
|
void free_screen(bScreen *sc)
|
|
|
|
|
{
|
2008-12-11 23:05:18 +00:00
|
|
|
ScrArea *sa, *san;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
ARegion *ar;
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
for(ar=sc->regionbase.first; ar; ar=ar->next)
|
|
|
|
|
BKE_area_region_free(NULL, ar);
|
|
|
|
|
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
BLI_freelistN(&sc->regionbase);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-11 23:05:18 +00:00
|
|
|
for(sa= sc->areabase.first; sa; sa= san) {
|
|
|
|
|
san= sa->next;
|
2008-01-07 18:03:41 +00:00
|
|
|
BKE_screen_area_free(sa);
|
2008-12-11 23:05:18 +00:00
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_freelistN(&sc->vertbase);
|
|
|
|
|
BLI_freelistN(&sc->edgebase);
|
|
|
|
|
BLI_freelistN(&sc->areabase);
|
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-09-14 12:26:34 +00:00
|
|
|
/* for depsgraph */
|
2009-12-04 01:25:43 +00:00
|
|
|
unsigned int BKE_screen_visible_layers(bScreen *screen, Scene *scene)
|
2009-09-14 12:26:34 +00:00
|
|
|
{
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
unsigned int layer= 0;
|
|
|
|
|
|
2009-12-04 01:25:43 +00:00
|
|
|
if(screen) {
|
|
|
|
|
/* get all used view3d layers */
|
|
|
|
|
for(sa= screen->areabase.first; sa; sa= sa->next)
|
|
|
|
|
if(sa->spacetype==SPACE_VIEW3D)
|
|
|
|
|
layer |= ((View3D *)sa->spacedata.first)->lay;
|
|
|
|
|
}
|
2009-09-14 12:26:34 +00:00
|
|
|
|
|
|
|
|
if(!layer)
|
2009-12-04 01:25:43 +00:00
|
|
|
return scene->lay;
|
2009-09-14 12:26:34 +00:00
|
|
|
|
|
|
|
|
return layer;
|
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2010-02-07 23:39:44 +00:00
|
|
|
/* ***************** Utilities ********************** */
|
|
|
|
|
|
|
|
|
|
/* Find a region of the specified type from the given area */
|
|
|
|
|
ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
|
|
|
|
|
{
|
|
|
|
|
if (sa) {
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
for (ar=sa->regionbase.first; ar; ar= ar->next) {
|
|
|
|
|
if (ar->regiontype == type)
|
|
|
|
|
return ar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-04-22 19:57:18 +00:00
|
|
|
|
2011-11-04 01:15:04 +00:00
|
|
|
/* note, using this function is generally a last resort, you really want to be
|
|
|
|
|
* using the context when you can - campbell
|
|
|
|
|
* -1 for any type */
|
|
|
|
|
struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *sa, *big= NULL;
|
|
|
|
|
int size, maxsize= 0;
|
|
|
|
|
|
|
|
|
|
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
|
if ((spacetype == -1) || sa->spacetype == spacetype) {
|
2011-11-04 04:27:46 +00:00
|
|
|
if (min <= sa->winx && min <= sa->winy) {
|
2011-11-04 01:15:04 +00:00
|
|
|
size= sa->winx*sa->winy;
|
|
|
|
|
if (size > maxsize) {
|
|
|
|
|
maxsize= size;
|
|
|
|
|
big= sa;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return big;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-22 19:57:18 +00:00
|
|
|
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
int bit;
|
|
|
|
|
|
|
|
|
|
if(v3d->scenelock && v3d->localvd==NULL) {
|
|
|
|
|
v3d->lay= scene->lay;
|
|
|
|
|
v3d->camera= scene->camera;
|
|
|
|
|
|
|
|
|
|
if(v3d->camera==NULL) {
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
for(ar=v3d->regionbase.first; ar; ar= ar->next) {
|
|
|
|
|
if(ar->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
|
RegionView3D *rv3d= ar->regiondata;
|
|
|
|
|
if(rv3d->persp==RV3D_CAMOB)
|
|
|
|
|
rv3d->persp= RV3D_PERSP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if((v3d->lay & v3d->layact) == 0) {
|
|
|
|
|
for(bit= 0; bit<32; bit++) {
|
|
|
|
|
if(v3d->lay & (1<<bit)) {
|
|
|
|
|
v3d->layact= 1<<bit;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_screen_view3d_scene_sync(bScreen *sc)
|
|
|
|
|
{
|
|
|
|
|
/* are there cameras in the views that are not in the scene? */
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
for(sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
|
BKE_screen_view3d_sync(v3d, sc->scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
bScreen *sc;
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
|
|
/* from scene copy to the other views */
|
|
|
|
|
for(sc=screen_lb->first; sc; sc=sc->id.next) {
|
|
|
|
|
if(sc->scene!=scene)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for(sa=sc->areabase.first; sa; sa=sa->next)
|
|
|
|
|
for(sl=sa->spacedata.first; sl; sl=sl->next)
|
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D)
|
|
|
|
|
BKE_screen_view3d_sync((View3D*)sl, scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-25 17:11:32 +00:00
|
|
|
|
2011-05-20 04:14:29 +00:00
|
|
|
/* magic zoom calculation, no idea what
|
|
|
|
|
* it signifies, if you find out, tell me! -zr
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* simple, its magic dude!
|
|
|
|
|
* well, to be honest, this gives a natural feeling zooming
|
|
|
|
|
* with multiple keypad presses (ton)
|
|
|
|
|
*/
|
|
|
|
|
float BKE_screen_view3d_zoom_to_fac(float camzoom)
|
|
|
|
|
{
|
|
|
|
|
return powf(((float)M_SQRT2 + camzoom/50.0f), 2.0f) / 4.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
|
|
|
|
|
{
|
|
|
|
|
return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f);
|
|
|
|
|
}
|