2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
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
|
2008-04-16 22:40:48 +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.
|
|
|
|
*
|
2008-01-07 18:03:41 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
#ifndef BKE_SCREEN_H
|
|
|
|
#define BKE_SCREEN_H
|
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_screen.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
struct ARegion;
|
2008-12-18 02:56:48 +00:00
|
|
|
struct bContext;
|
|
|
|
struct bContextDataResult;
|
|
|
|
struct bScreen;
|
|
|
|
struct ListBase;
|
2009-03-29 19:44:39 +00:00
|
|
|
struct Panel;
|
2009-04-19 17:12:16 +00:00
|
|
|
struct Header;
|
2009-04-22 18:39:44 +00:00
|
|
|
struct Menu;
|
2008-12-18 02:56:48 +00:00
|
|
|
struct ScrArea;
|
|
|
|
struct SpaceType;
|
2009-12-04 01:25:43 +00:00
|
|
|
struct Scene;
|
2008-01-07 18:03:41 +00:00
|
|
|
struct wmNotifier;
|
2008-12-15 16:54:47 +00:00
|
|
|
struct wmWindow;
|
2008-12-18 02:56:48 +00:00
|
|
|
struct wmWindowManager;
|
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
|
|
|
struct wmKeyConfig;
|
2009-03-29 19:44:39 +00:00
|
|
|
struct uiLayout;
|
|
|
|
struct uiMenuItem;
|
2009-07-21 20:05:16 +00:00
|
|
|
|
|
|
|
#include "RNA_types.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* spacetype has everything stored to get an editor working, it gets initialized via
|
2008-12-08 15:02:57 +00:00
|
|
|
ED_spacetypes_init() in editors/area/spacetypes.c */
|
2008-01-07 18:03:41 +00:00
|
|
|
/* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
|
|
|
|
|
2009-12-22 10:04:15 +00:00
|
|
|
#define BKE_ST_MAXNAME 64
|
2008-12-08 15:02:57 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
typedef struct SpaceType {
|
|
|
|
struct SpaceType *next, *prev;
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
char name[BKE_ST_MAXNAME]; /* for menus */
|
2008-01-07 18:03:41 +00:00
|
|
|
int spaceid; /* unique space identifier */
|
|
|
|
int iconid; /* icon lookup for menus */
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* initial allocation, after this WM will call init() too */
|
2008-12-22 10:09:56 +00:00
|
|
|
struct SpaceLink *(*new)(const struct bContext *C);
|
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
|
|
|
/* not free spacelink itself */
|
|
|
|
void (*free)(struct SpaceLink *);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* init is to cope with file load, screen (size) changes, check handlers */
|
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
|
|
|
void (*init)(struct wmWindowManager *, struct ScrArea *);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* Listeners can react to bContext changes */
|
2009-01-04 17:45:54 +00:00
|
|
|
void (*listener)(struct ScrArea *, struct wmNotifier *);
|
|
|
|
|
|
|
|
/* refresh context, called after filereads, ED_area_tag_refresh() */
|
|
|
|
void (*refresh)(const struct bContext *, struct ScrArea *);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
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
|
|
|
/* after a spacedata copy, an init should result in exact same situation */
|
|
|
|
struct SpaceLink *(*duplicate)(struct SpaceLink *);
|
|
|
|
|
|
|
|
/* register operator types on startup */
|
|
|
|
void (*operatortypes)(void);
|
2008-12-08 15:02:57 +00:00
|
|
|
/* add default items to WM keymap */
|
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 (*keymap)(struct wmKeyConfig *);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* on startup, define dropboxes for spacetype+regions */
|
|
|
|
void (*dropboxes)(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
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
/* return context data */
|
2009-03-19 19:03:38 +00:00
|
|
|
int (*context)(const struct bContext *, const char*, struct bContextDataResult *);
|
2008-12-18 02:56:48 +00:00
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* region type definitions */
|
|
|
|
ListBase regiontypes;
|
|
|
|
|
2009-07-02 11:23:19 +00:00
|
|
|
/* tool shelf definitions */
|
|
|
|
ListBase toolshelf;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* read and write... */
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* default keymaps to add */
|
|
|
|
int keymapflag;
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
} SpaceType;
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* region types are also defined using spacetypes_init, via a callback */
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
typedef struct ARegionType {
|
2008-12-08 15:02:57 +00:00
|
|
|
struct ARegionType *next, *prev;
|
|
|
|
|
2011-03-25 17:11:32 +00:00
|
|
|
int regionid; /* unique identifier within this space, defines RGN_TYPE_xxxx */
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region type/size changes */
|
|
|
|
void (*init)(struct wmWindowManager *, struct ARegion *);
|
|
|
|
/* draw entirely, view changes should be handled here */
|
|
|
|
void (*draw)(const struct bContext *, struct ARegion *);
|
|
|
|
/* contextual changes should be handled here */
|
2008-01-07 18:03:41 +00:00
|
|
|
void (*listener)(struct ARegion *, struct wmNotifier *);
|
2008-12-10 13:56:54 +00:00
|
|
|
|
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
|
|
|
void (*free)(struct ARegion *);
|
2008-12-08 15:02:57 +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
|
|
|
/* split region, copy data optionally */
|
|
|
|
void *(*duplicate)(void *);
|
|
|
|
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* register operator types on startup */
|
|
|
|
void (*operatortypes)(void);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* add own items to keymap */
|
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 (*keymap)(struct wmKeyConfig *);
|
2009-01-04 19:17:34 +00:00
|
|
|
/* allows default cursor per region */
|
|
|
|
void (*cursor)(struct wmWindow *, struct ScrArea *, struct ARegion *ar);
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
/* return context data */
|
2009-03-19 19:03:38 +00:00
|
|
|
int (*context)(const struct bContext *, const char *, struct bContextDataResult *);
|
2008-12-18 02:56:48 +00:00
|
|
|
|
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
|
|
|
/* custom drawing callbacks */
|
|
|
|
ListBase drawcalls;
|
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
/* panels type definitions */
|
|
|
|
ListBase paneltypes;
|
|
|
|
|
|
|
|
/* header type definitions */
|
|
|
|
ListBase headertypes;
|
2009-07-02 11:23:19 +00:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* hardcoded constraints, smaller than these values region is not visible */
|
|
|
|
int minsizex, minsizey;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* when new region opens (region prefsizex/y are zero then */
|
|
|
|
int prefsizex, prefsizey;
|
2008-12-10 13:56:54 +00:00
|
|
|
/* default keymaps to add */
|
|
|
|
int keymapflag;
|
2011-03-25 17:11:32 +00:00
|
|
|
/* return without drawing. lock is set by region definition, and copied to do_lock by render. can become flag */
|
|
|
|
short do_lock, lock;
|
2008-01-07 18:03:41 +00:00
|
|
|
} ARegionType;
|
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
/* panel types */
|
|
|
|
|
|
|
|
typedef struct PanelType {
|
|
|
|
struct PanelType *next, *prev;
|
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
char label[BKE_ST_MAXNAME]; /* for panel header */
|
|
|
|
char context[BKE_ST_MAXNAME]; /* for buttons window */
|
2009-04-19 17:12:16 +00:00
|
|
|
int space_type;
|
|
|
|
int region_type;
|
2009-03-29 19:44:39 +00:00
|
|
|
|
2009-06-16 01:08:39 +00:00
|
|
|
int flag;
|
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
/* verify if the panel should draw or not */
|
2009-04-19 13:37:59 +00:00
|
|
|
int (*poll)(const struct bContext *, struct PanelType *);
|
2009-05-19 17:13:33 +00:00
|
|
|
/* draw header (optional) */
|
|
|
|
void (*draw_header)(const struct bContext *, struct Panel *);
|
2009-03-29 19:44:39 +00:00
|
|
|
/* draw entirely, view changes should be handled here */
|
|
|
|
void (*draw)(const struct bContext *, struct Panel *);
|
|
|
|
|
2009-07-21 20:05:16 +00:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext;
|
2009-03-29 19:44:39 +00:00
|
|
|
} PanelType;
|
|
|
|
|
|
|
|
/* header types */
|
|
|
|
|
|
|
|
typedef struct HeaderType {
|
|
|
|
struct HeaderType *next, *prev;
|
|
|
|
|
2009-04-19 17:12:16 +00:00
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
int space_type;
|
2009-03-29 19:44:39 +00:00
|
|
|
|
|
|
|
/* draw entirely, view changes should be handled here */
|
2009-04-19 17:12:16 +00:00
|
|
|
void (*draw)(const struct bContext *, struct Header *);
|
2009-03-29 19:44:39 +00:00
|
|
|
|
2009-07-21 20:05:16 +00:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext;
|
2009-03-29 19:44:39 +00:00
|
|
|
} HeaderType;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-07-21 01:14:55 +00:00
|
|
|
typedef struct Header {
|
|
|
|
struct HeaderType *type; /* runtime */
|
|
|
|
struct uiLayout *layout; /* runtime for drawing */
|
|
|
|
} Header;
|
|
|
|
|
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
/* menu types */
|
|
|
|
|
|
|
|
typedef struct MenuType {
|
|
|
|
struct MenuType *next, *prev;
|
|
|
|
|
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
char label[BKE_ST_MAXNAME]; /* for button text */
|
|
|
|
|
|
|
|
/* verify if the menu should draw or not */
|
|
|
|
int (*poll)(const struct bContext *, struct MenuType *);
|
|
|
|
/* draw entirely, view changes should be handled here */
|
|
|
|
void (*draw)(const struct bContext *, struct Menu *);
|
|
|
|
|
2009-07-21 20:05:16 +00:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext;
|
2009-04-22 18:39:44 +00:00
|
|
|
} MenuType;
|
|
|
|
|
2009-07-21 01:14:55 +00:00
|
|
|
typedef struct Menu {
|
|
|
|
struct MenuType *type; /* runtime */
|
|
|
|
struct uiLayout *layout; /* runtime for drawing */
|
|
|
|
} Menu;
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* spacetypes */
|
2008-01-07 18:03:41 +00:00
|
|
|
struct SpaceType *BKE_spacetype_from_id(int 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
|
|
|
struct ARegionType *BKE_regiontype_from_id(struct SpaceType *st, int regionid);
|
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
|
|
|
const struct ListBase *BKE_spacetypes_list(void);
|
2008-01-07 18:03:41 +00:00
|
|
|
void BKE_spacetype_register(struct SpaceType *st);
|
2008-12-08 15:02:57 +00:00
|
|
|
void BKE_spacetypes_free(void); /* only for quitting blender */
|
|
|
|
|
|
|
|
/* spacedata */
|
2008-01-07 18:03:41 +00:00
|
|
|
void BKE_spacedata_freelist(ListBase *lb);
|
|
|
|
void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2);
|
2011-03-25 17:11:32 +00:00
|
|
|
void BKE_spacedata_draw_locks(int set);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-14 17:25:46 +00:00
|
|
|
/* area/regions */
|
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
|
|
|
struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
|
|
|
|
void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
|
2009-09-14 12:26:34 +00:00
|
|
|
void BKE_screen_area_free(struct ScrArea *sa);
|
2008-12-14 17:25:46 +00:00
|
|
|
|
2010-02-07 23:39:44 +00:00
|
|
|
struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
|
|
|
|
|
2010-04-22 19:57:18 +00:00
|
|
|
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
|
|
|
|
void BKE_screen_view3d_scene_sync(struct bScreen *sc);
|
|
|
|
void BKE_screen_view3d_main_sync(ListBase *screen_lb, struct Scene *scene);
|
|
|
|
|
2011-05-20 04:14:29 +00:00
|
|
|
/* zoom factor conversion */
|
|
|
|
float BKE_screen_view3d_zoom_to_fac(float camzoom);
|
|
|
|
float BKE_screen_view3d_zoom_from_fac(float zoomfac);
|
2010-04-22 19:57:18 +00:00
|
|
|
|
2009-09-14 12:26:34 +00:00
|
|
|
/* screen */
|
2008-12-14 17:25:46 +00:00
|
|
|
void free_screen(struct bScreen *sc);
|
2009-12-04 01:25:43 +00:00
|
|
|
unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene *scene);
|
2008-12-14 17:25:46 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|