2008-12-14 10:52:48 +00:00
|
|
|
/**
|
2009-08-19 12:35:40 +00:00
|
|
|
* $Id$
|
2008-12-14 10:52:48 +00:00
|
|
|
*
|
|
|
|
|
* ***** 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 "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2008-12-14 10:52:48 +00:00
|
|
|
#include "BLI_rand.h"
|
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-14 10:52:48 +00:00
|
|
|
#include "BKE_colortools.h"
|
|
|
|
|
#include "BKE_screen.h"
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2008-12-14 10:52:48 +00:00
|
|
|
|
|
|
|
|
#include "ED_space_api.h"
|
|
|
|
|
#include "ED_screen.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_markers.h"
|
2009-08-19 12:35:40 +00:00
|
|
|
#include "ED_object.h"
|
2008-12-14 10:52:48 +00:00
|
|
|
|
|
|
|
|
#include "info_intern.h" // own include
|
|
|
|
|
|
|
|
|
|
/* ******************** default callbacks for info space ***************** */
|
|
|
|
|
|
2008-12-22 10:09:56 +00:00
|
|
|
static SpaceLink *info_new(const bContext *C)
|
2008-12-14 10:52:48 +00:00
|
|
|
{
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
SpaceInfo *sinfo;
|
|
|
|
|
|
|
|
|
|
sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo");
|
|
|
|
|
sinfo->spacetype= SPACE_INFO;
|
|
|
|
|
|
|
|
|
|
/* header */
|
|
|
|
|
ar= MEM_callocN(sizeof(ARegion), "header for info");
|
|
|
|
|
|
|
|
|
|
BLI_addtail(&sinfo->regionbase, ar);
|
|
|
|
|
ar->regiontype= RGN_TYPE_HEADER;
|
|
|
|
|
ar->alignment= RGN_ALIGN_BOTTOM;
|
|
|
|
|
|
|
|
|
|
/* main area */
|
|
|
|
|
ar= MEM_callocN(sizeof(ARegion), "main area for info");
|
|
|
|
|
|
|
|
|
|
BLI_addtail(&sinfo->regionbase, ar);
|
|
|
|
|
ar->regiontype= RGN_TYPE_WINDOW;
|
|
|
|
|
|
|
|
|
|
return (SpaceLink *)sinfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* not spacelink itself */
|
|
|
|
|
static void info_free(SpaceLink *sl)
|
|
|
|
|
{
|
|
|
|
|
// SpaceInfo *sinfo= (SpaceInfo*) sl;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* spacetype; init callback */
|
|
|
|
|
static void info_init(struct wmWindowManager *wm, ScrArea *sa)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static SpaceLink *info_duplicate(SpaceLink *sl)
|
|
|
|
|
{
|
|
|
|
|
SpaceInfo *sinfon= MEM_dupallocN(sl);
|
|
|
|
|
|
|
|
|
|
/* clear or remove stuff from old */
|
|
|
|
|
|
|
|
|
|
return (SpaceLink *)sinfon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
|
|
|
|
static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
|
{
|
2009-07-15 19:19:43 +00:00
|
|
|
ED_region_panels_init(wm, ar);
|
2008-12-14 10:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void info_main_area_draw(const bContext *C, ARegion *ar)
|
|
|
|
|
{
|
2009-07-29 22:57:53 +00:00
|
|
|
ED_region_panels(C, ar, 1, NULL, -1);
|
2008-12-14 10:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void info_operatortypes(void)
|
|
|
|
|
{
|
2009-06-30 19:20:45 +00:00
|
|
|
WM_operatortype_append(FILE_OT_pack_all);
|
|
|
|
|
WM_operatortype_append(FILE_OT_unpack_all);
|
|
|
|
|
WM_operatortype_append(FILE_OT_make_paths_relative);
|
|
|
|
|
WM_operatortype_append(FILE_OT_make_paths_absolute);
|
|
|
|
|
WM_operatortype_append(FILE_OT_report_missing_files);
|
|
|
|
|
WM_operatortype_append(FILE_OT_find_missing_files);
|
2008-12-14 10:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void info_keymap(struct wmKeyConfig *keyconf)
|
2008-12-14 10:52:48 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
|
|
|
|
static void info_header_area_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
|
{
|
2009-06-30 19:20:45 +00:00
|
|
|
ED_region_header_init(ar);
|
2008-12-14 10:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void info_header_area_draw(const bContext *C, ARegion *ar)
|
|
|
|
|
{
|
2009-06-30 19:20:45 +00:00
|
|
|
ED_region_header(C, ar);
|
2008-12-14 10:52:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
|
|
|
|
{
|
|
|
|
|
/* context changes */
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-04 17:40:50 +00:00
|
|
|
static void info_header_listener(ARegion *ar, wmNotifier *wmn)
|
|
|
|
|
{
|
|
|
|
|
/* context changes */
|
|
|
|
|
switch(wmn->category) {
|
2009-02-18 13:29:54 +00:00
|
|
|
case NC_SCREEN:
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
if(ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
|
2009-02-18 13:29:54 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
|
break;
|
2009-02-04 17:40:50 +00:00
|
|
|
case NC_SCENE:
|
|
|
|
|
if(wmn->data==ND_RENDER_RESULT)
|
|
|
|
|
ED_region_tag_redraw(ar);
|
2009-02-18 13:29:54 +00:00
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
|
|
|
|
if(wmn->data == ND_SPACE_INFO)
|
|
|
|
|
ED_region_tag_redraw(ar);
|
2009-08-19 12:35:40 +00:00
|
|
|
break;
|
2009-02-04 17:40:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-14 10:52:48 +00:00
|
|
|
/* only called once, from space/spacetypes.c */
|
|
|
|
|
void ED_spacetype_info(void)
|
|
|
|
|
{
|
|
|
|
|
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype info");
|
|
|
|
|
ARegionType *art;
|
|
|
|
|
|
|
|
|
|
st->spaceid= SPACE_INFO;
|
2009-12-19 22:37:51 +00:00
|
|
|
strncpy(st->name, "Info", BKE_ST_MAXNAME);
|
2008-12-14 10:52:48 +00:00
|
|
|
|
|
|
|
|
st->new= info_new;
|
|
|
|
|
st->free= info_free;
|
|
|
|
|
st->init= info_init;
|
|
|
|
|
st->duplicate= info_duplicate;
|
|
|
|
|
st->operatortypes= info_operatortypes;
|
|
|
|
|
st->keymap= info_keymap;
|
|
|
|
|
|
|
|
|
|
/* regions: main window */
|
|
|
|
|
art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
|
|
|
|
|
art->regionid = RGN_TYPE_WINDOW;
|
|
|
|
|
art->init= info_main_area_init;
|
|
|
|
|
art->draw= info_main_area_draw;
|
|
|
|
|
art->listener= info_main_area_listener;
|
2009-07-15 19:19:43 +00:00
|
|
|
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
|
2008-12-14 10:52:48 +00:00
|
|
|
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
/* regions: header */
|
|
|
|
|
art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
|
|
|
|
|
art->regionid = RGN_TYPE_HEADER;
|
|
|
|
|
art->minsizey= HEADERY;
|
2009-11-27 06:24:09 +00:00
|
|
|
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
|
2009-02-04 17:40:50 +00:00
|
|
|
art->listener= info_header_listener;
|
2008-12-14 10:52:48 +00:00
|
|
|
art->init= info_header_area_init;
|
|
|
|
|
art->draw= info_header_area_draw;
|
|
|
|
|
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BKE_spacetype_register(st);
|
|
|
|
|
}
|
|
|
|
|
|