2011-02-18 13:05:18 +00:00
|
|
|
/*
|
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.
|
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_SCREEN_H__
|
|
|
|
#define __BKE_SCREEN_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
struct ARegion;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct GPUFXSettings;
|
2009-04-19 17:12:16 +00:00
|
|
|
struct Header;
|
2015-12-01 12:55:57 +11:00
|
|
|
struct ID;
|
2011-11-04 01:15:04 +00:00
|
|
|
struct ListBase;
|
2009-04-22 18:39:44 +00:00
|
|
|
struct Menu;
|
2011-11-04 01:15:04 +00:00
|
|
|
struct Panel;
|
|
|
|
struct Scene;
|
2008-12-18 02:56:48 +00:00
|
|
|
struct ScrArea;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ScrAreaMap;
|
2018-04-13 21:43:57 +02:00
|
|
|
struct ScrVert;
|
2008-12-18 02:56:48 +00:00
|
|
|
struct SpaceType;
|
2017-06-01 20:41:18 +02:00
|
|
|
struct TransformOrientation;
|
2011-11-04 01:15:04 +00:00
|
|
|
struct View3D;
|
2018-07-11 11:43:56 +02:00
|
|
|
struct View3DShading;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct WorkSpace;
|
2011-11-04 01:15:04 +00:00
|
|
|
struct bContext;
|
|
|
|
struct bContextDataResult;
|
|
|
|
struct bScreen;
|
|
|
|
struct uiLayout;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
struct uiList;
|
2018-07-14 23:49:00 +02:00
|
|
|
struct wmGizmoMap;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmKeyConfig;
|
|
|
|
struct wmMsgBus;
|
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;
|
2009-07-21 20:05:16 +00:00
|
|
|
|
2014-09-02 20:45:28 +10:00
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
2009-07-21 20:05:16 +00:00
|
|
|
#include "RNA_types.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2018-06-03 17:06:13 +02:00
|
|
|
/* spacetype has everything stored to get an editor working, it gets initialized via
|
2012-08-24 05:12:05 +00:00
|
|
|
* ED_spacetypes_init() in editors/space_api/spacetypes.c */
|
2008-01-07 18:03:41 +00:00
|
|
|
/* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
|
|
|
|
|
2012-05-12 20:39:39 +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;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
char name[BKE_ST_MAXNAME]; /* for menus */
|
|
|
|
int spaceid; /* unique space identifier */
|
|
|
|
int iconid; /* icon lookup for menus */
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2018-04-21 19:30:56 +02:00
|
|
|
/* Initial allocation, after this WM will call init() too. Some editors need
|
|
|
|
* area and scene data (e.g. frame range) to set their initial scrolling. */
|
2018-06-03 15:20:11 +02:00
|
|
|
struct SpaceLink *(*new)(const struct ScrArea *sa, const struct Scene *scene);
|
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 */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*free)(struct SpaceLink *sl);
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* init is to cope with file load, screen (size) changes, check handlers */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*init)(struct wmWindowManager *wm, struct ScrArea *sa);
|
2013-03-15 19:56:29 +00:00
|
|
|
/* exit is called when the area is hidden or removed */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*exit)(struct wmWindowManager *wm, struct ScrArea *sa);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* Listeners can react to bContext changes */
|
2018-07-04 15:14:57 +02:00
|
|
|
void (*listener)(struct wmWindow *win, struct ScrArea *sa,
|
|
|
|
struct wmNotifier *wmn, struct Scene *scene);
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2009-01-04 17:45:54 +00:00
|
|
|
/* refresh context, called after filereads, ED_area_tag_refresh() */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*refresh)(const struct bContext *C, struct ScrArea *sa);
|
2018-06-03 17:06:13 +02: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 */
|
2018-06-03 15:11:31 +02:00
|
|
|
struct SpaceLink *(*duplicate)(struct SpaceLink *sl);
|
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
|
|
|
|
|
|
|
/* register operator types on startup */
|
2012-05-12 20:39:39 +00:00
|
|
|
void (*operatortypes)(void);
|
2008-12-08 15:02:57 +00:00
|
|
|
/* add default items to WM keymap */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*keymap)(struct wmKeyConfig *keyconf);
|
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 */
|
2012-05-12 20:39:39 +00:00
|
|
|
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
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
/* initialize gizmo-map-types and gizmo-group-types with the region */
|
|
|
|
void (*gizmos)(void);
|
2016-10-07 16:34:55 +02:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
/* return context data */
|
2018-06-03 15:11:31 +02:00
|
|
|
int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
|
2008-12-18 02:56:48 +00:00
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
/* Used when we want to replace an ID by another (or NULL). */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*id_remap)(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
|
2018-05-29 09:19:06 +02:00
|
|
|
int (*space_subtype_get)(struct ScrArea *sa);
|
|
|
|
void (*space_subtype_set)(struct ScrArea *sa, int value);
|
|
|
|
void (*space_subtype_item_extend)(struct bContext *C, EnumPropertyItem **item, int *totitem);
|
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* region type definitions */
|
2012-05-12 20:39:39 +00:00
|
|
|
ListBase regiontypes;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* read and write... */
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* default keymaps to add */
|
2012-05-12 20:39:39 +00:00
|
|
|
int keymapflag;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
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;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
int regionid; /* unique identifier within this space, defines RGN_TYPE_xxxx */
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region type/size changes */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*init)(struct wmWindowManager *wm, struct ARegion *ar);
|
2013-03-15 19:56:29 +00:00
|
|
|
/* exit is called when the region is hidden or removed */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*exit)(struct wmWindowManager *wm, struct ARegion *ar);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* draw entirely, view changes should be handled here */
|
2018-06-03 17:06:13 +02:00
|
|
|
void (*draw)(const struct bContext *C, struct ARegion *ar);
|
2018-04-29 12:24:08 +02:00
|
|
|
/* optional, compute button layout before drawing for dynamic size */
|
2018-06-03 15:20:11 +02:00
|
|
|
void (*layout)(const struct bContext *C, struct ARegion *ar);
|
2018-04-26 12:01:44 +02:00
|
|
|
/* snap the size of the region (can be NULL for no snapping). */
|
|
|
|
int (*snap_size)(const struct ARegion *ar, int size, int axis);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* contextual changes should be handled here */
|
2018-07-04 15:14:57 +02:00
|
|
|
void (*listener)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar,
|
2018-06-03 15:20:11 +02:00
|
|
|
struct wmNotifier *wmn, const struct Scene *scene);
|
2017-11-13 19:43:34 +11:00
|
|
|
/* Optional callback to generate subscriptions. */
|
|
|
|
void (*message_subscribe)(
|
|
|
|
const struct bContext *C,
|
|
|
|
struct WorkSpace *workspace, struct Scene *scene,
|
|
|
|
struct bScreen *sc, struct ScrArea *sa, struct ARegion *ar,
|
|
|
|
struct wmMsgBus *mbus);
|
2017-05-02 09:58:01 +10:00
|
|
|
|
2012-05-12 20:39:39 +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 */
|
2018-06-03 15:11:31 +02:00
|
|
|
void *(*duplicate)(void *poin);
|
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
|
|
|
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-12-08 15:02:57 +00:00
|
|
|
/* register operator types on startup */
|
2012-05-12 20:39:39 +00:00
|
|
|
void (*operatortypes)(void);
|
2008-12-10 13:56:54 +00:00
|
|
|
/* add own items to keymap */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*keymap)(struct wmKeyConfig *keyconf);
|
2009-01-04 19:17:34 +00:00
|
|
|
/* allows default cursor per region */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
|
2009-01-04 19:17:34 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
/* return context data */
|
2018-06-03 15:11:31 +02:00
|
|
|
int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
|
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 */
|
2012-05-12 20:39:39 +00:00
|
|
|
ListBase drawcalls;
|
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
|
|
|
/* panels type definitions */
|
|
|
|
ListBase paneltypes;
|
|
|
|
|
|
|
|
/* header type definitions */
|
|
|
|
ListBase headertypes;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* hardcoded constraints, smaller than these values region is not visible */
|
2012-05-12 20:39:39 +00:00
|
|
|
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 */
|
2012-05-12 20:39:39 +00:00
|
|
|
int prefsizex, prefsizey;
|
2008-12-10 13:56:54 +00:00
|
|
|
/* default keymaps to add */
|
2012-05-12 20:39:39 +00:00
|
|
|
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 */
|
2012-05-12 20:39:39 +00:00
|
|
|
short do_lock, lock;
|
2012-05-22 14:13:33 +00:00
|
|
|
/* call cursor function on each move event */
|
|
|
|
short event_cursor;
|
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;
|
2018-06-03 17:06:13 +02:00
|
|
|
|
2013-03-15 14:32:29 +00:00
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
char label[BKE_ST_MAXNAME]; /* for panel header */
|
|
|
|
char translation_context[BKE_ST_MAXNAME];
|
|
|
|
char context[BKE_ST_MAXNAME]; /* for buttons window */
|
2013-12-17 03:21:55 +11:00
|
|
|
char category[BKE_ST_MAXNAME]; /* for category tabs */
|
2018-06-03 13:32:36 +02:00
|
|
|
char owner_id[BKE_ST_MAXNAME]; /* for work-spaces to selectively show. */
|
|
|
|
char parent_id[BKE_ST_MAXNAME]; /* parent idname for subpanels */
|
2018-07-03 19:50:00 +02:00
|
|
|
short space_type;
|
|
|
|
short region_type;
|
|
|
|
/* For popovers, 0 for default. */
|
|
|
|
int ui_units_x;
|
2009-03-29 19:44:39 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
int flag;
|
2009-06-16 01:08:39 +00:00
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
/* verify if the panel should draw or not */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(const struct bContext *C, struct PanelType *pt);
|
2009-05-19 17:13:33 +00:00
|
|
|
/* draw header (optional) */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*draw_header)(const struct bContext *C, struct Panel *pa);
|
2018-04-27 13:50:26 +02:00
|
|
|
/* draw header preset (optional) */
|
|
|
|
void (*draw_header_preset)(const struct bContext *C, struct Panel *pa);
|
2009-03-29 19:44:39 +00:00
|
|
|
/* draw entirely, view changes should be handled here */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*draw)(const struct bContext *C, struct Panel *pa);
|
2009-03-29 19:44:39 +00:00
|
|
|
|
2018-06-03 13:32:36 +02:00
|
|
|
/* sub panels */
|
|
|
|
struct PanelType *parent;
|
|
|
|
ListBase children;
|
|
|
|
|
2009-07-21 20:05:16 +00:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext;
|
2009-03-29 19:44:39 +00:00
|
|
|
} PanelType;
|
|
|
|
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
/* uilist types */
|
|
|
|
|
2013-08-29 12:55:31 +00:00
|
|
|
/* Draw an item in the uiList */
|
2018-06-03 15:11:31 +02:00
|
|
|
typedef void (*uiListDrawItemFunc)(
|
|
|
|
struct uiList *ui_list, struct bContext *C, struct uiLayout *layout, struct PointerRNA *dataptr,
|
|
|
|
struct PointerRNA *itemptr, int icon, struct PointerRNA *active_dataptr, const char *active_propname,
|
|
|
|
int index, int flt_flag);
|
2013-08-29 12:55:31 +00:00
|
|
|
|
|
|
|
/* Draw the filtering part of an uiList */
|
2018-06-03 15:11:31 +02:00
|
|
|
typedef void (*uiListDrawFilterFunc)(
|
2019-01-09 15:48:09 +01:00
|
|
|
struct uiList *ui_list, struct bContext *C, struct uiLayout *layout);
|
2013-08-29 12:55:31 +00:00
|
|
|
|
|
|
|
/* Filter items of an uiList */
|
2018-06-03 15:11:31 +02:00
|
|
|
typedef void (*uiListFilterItemsFunc)(
|
|
|
|
struct uiList *ui_list, struct bContext *C, struct PointerRNA *, const char *propname);
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
|
|
|
|
typedef struct uiListType {
|
|
|
|
struct uiListType *next, *prev;
|
|
|
|
|
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
|
|
|
|
uiListDrawItemFunc draw_item;
|
2013-08-29 12:55:31 +00:00
|
|
|
uiListDrawFilterFunc draw_filter;
|
|
|
|
uiListFilterItemsFunc filter_items;
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
|
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext;
|
|
|
|
} uiListType;
|
|
|
|
|
2009-03-29 19:44:39 +00:00
|
|
|
/* header types */
|
|
|
|
|
|
|
|
typedef struct HeaderType {
|
|
|
|
struct HeaderType *next, *prev;
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
int space_type;
|
UI: New Global Top-Bar (WIP)
== Main Features/Changes for Users
* Add horizontal bar at top of all non-temp windows, consisting out of two horizontal sub-bars.
* Upper sub-bar contains global menus (File, Render, etc.), tabs for workspaces and scene selector.
* Lower sub-bar contains object mode selector, screen-layout and render-layer selector. Later operator and/or tool settings will be placed here.
* Individual sections of the topbar are individually scrollable.
* Workspace tabs can be double- or ctrl-clicked for renaming and contain 'x' icon for deleting.
* Top-bar should scale nicely with DPI.
* The lower half of the top-bar can be hided by dragging the lower top-bar edge up. Better hiding options are planned (e.g. hide in fullscreen modes).
* Info editors at the top of the window and using the full window width with be replaced by the top-bar.
* In fullscreen modes, no more info editor is added on top, the top-bar replaces it.
== Technical Features/Changes
* Adds initial support for global areas
A global area is part of the window, not part of the regular screen-layout.
I've added a macro iterator to iterate over both, global and screen-layout level areas. When iterating over areas, from now on developers should always consider if they have to include global areas.
* Adds a TOPBAR editor type
The editor type is hidden in the UI editor type menu.
* Adds a variation of the ID template to display IDs as tab buttons (template_ID_tabs in BPY)
* Does various changes to RNA button creation code to improve their appearance in the horizontal top-bar.
* Adds support for dynamically sized regions. That is, regions that scale automatically to the layout bounds.
The code for this is currently a big hack (it's based on drawing the UI multiple times). This should definitely be improved.
* Adds a template for displaying operator properties optimized for the top-bar. This will probably change a lot still and is in fact disabled in code.
Since the final top-bar design depends a lot on other 2.8 designs (mainly tool-system and workspaces), we decided to not show the operator or tool settings in the top-bar for now. That means most of the lower sub-bar is empty for the time being.
NOTE: Top-bar or global area data is not written to files or SDNA. They are simply added to the window when opening Blender or reading a file. This allows us doing changes to the top-bar without having to care for compatibility.
== ToDo's
It's a bit hard to predict all the ToDo's here are the known main ones:
* Add options for the new active-tool system and for operator redo to the topbar.
* Automatically hide the top-bar in fullscreen modes.
* General visual polish.
* Top-bar drag & drop support (WIP in temp-tab_drag_drop).
* Improve dynamic regions (should also fix some layout glitches).
* Make internal terminology consistent.
* Enable topbar file writing once design is more advanced.
* Address TODO's and XXX's in code :)
Thanks @brecht for the review! And @sergey for the complaining ;)
Differential Revision: D2758
2018-04-20 17:14:03 +02:00
|
|
|
int region_type;
|
2009-03-29 19:44:39 +00:00
|
|
|
|
2018-10-29 22:55:54 +01:00
|
|
|
bool (*poll)(const struct bContext *C, struct HeaderType *ht);
|
2009-03-29 19:44:39 +00:00
|
|
|
/* draw entirely, view changes should be handled here */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*draw)(const struct bContext *C, struct Header *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 {
|
2012-05-12 20:39:39 +00:00
|
|
|
struct HeaderType *type; /* runtime */
|
|
|
|
struct uiLayout *layout; /* runtime for drawing */
|
2009-07-21 01:14:55 +00:00
|
|
|
} Header;
|
|
|
|
|
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
/* menu types */
|
|
|
|
|
|
|
|
typedef struct MenuType {
|
|
|
|
struct MenuType *next, *prev;
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
char idname[BKE_ST_MAXNAME]; /* unique name */
|
|
|
|
char label[BKE_ST_MAXNAME]; /* for button text */
|
2013-03-15 14:32:29 +00:00
|
|
|
char translation_context[BKE_ST_MAXNAME];
|
2018-03-01 01:26:02 +11:00
|
|
|
char owner_id[BKE_ST_MAXNAME]; /* optional, see: #wmOwnerID */
|
2014-02-07 07:39:44 +11:00
|
|
|
const char *description;
|
2009-04-22 18:39:44 +00:00
|
|
|
|
|
|
|
/* verify if the menu should draw or not */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(const struct bContext *C, struct MenuType *mt);
|
2009-04-22 18:39:44 +00:00
|
|
|
/* draw entirely, view changes should be handled here */
|
2018-06-03 15:11:31 +02:00
|
|
|
void (*draw)(const struct bContext *C, struct Menu *menu);
|
2009-04-22 18:39:44 +00:00
|
|
|
|
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 {
|
2012-05-12 20:39:39 +00:00
|
|
|
struct MenuType *type; /* runtime */
|
|
|
|
struct uiLayout *layout; /* runtime for drawing */
|
2009-07-21 01:14:55 +00:00
|
|
|
} 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);
|
2018-06-12 17:26:38 +02:00
|
|
|
struct ARegionType *BKE_regiontype_from_id_or_first(struct SpaceType *st, int regionid);
|
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);
|
2015-01-21 13:43:46 +11:00
|
|
|
bool BKE_spacetype_exists(int spaceid);
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_spacetypes_free(void); /* only for quitting blender */
|
2008-12-08 15:02:57 +00:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
2018-11-25 16:21:35 +01:00
|
|
|
struct ARegion *BKE_spacedata_find_region_type(
|
|
|
|
const struct SpaceLink *slink, const struct ScrArea *sa,
|
|
|
|
int region_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
|
|
|
|
2018-06-03 15:11:31 +02:00
|
|
|
void BKE_spacedata_callback_id_remap_set(
|
|
|
|
void (*func)(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id));
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID *id);
|
2015-05-04 15:07:24 +10: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);
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
|
2018-08-21 15:21:53 +02:00
|
|
|
void BKE_area_region_panels_free(struct ListBase *panels);
|
2012-05-12 20:39:39 +00:00
|
|
|
void BKE_screen_area_free(struct ScrArea *sa);
|
2018-07-14 23:49:00 +02:00
|
|
|
/* Gizmo-maps of a region need to be freed with the region. Uses callback to avoid low-level call. */
|
|
|
|
void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *));
|
|
|
|
void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *));
|
2008-12-14 17:25:46 +00:00
|
|
|
|
2018-11-25 16:21:35 +01:00
|
|
|
struct ARegion *BKE_area_find_region_type(const struct ScrArea *sa, int type);
|
2013-01-30 12:22:02 +00:00
|
|
|
struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa);
|
2015-04-27 18:53:45 +10:00
|
|
|
struct ARegion *BKE_area_find_region_xy(struct ScrArea *sa, const int regiontype, int x, int y);
|
2015-01-08 01:14:07 +11:00
|
|
|
struct ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, struct SpaceLink *sl) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
|
2011-11-04 01:15:04 +00:00
|
|
|
struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min);
|
2018-07-02 16:48:18 +02:00
|
|
|
struct ScrArea *BKE_screen_area_map_find_area_xy(const struct ScrAreaMap *areamap, const int spacetype, int x, int y);
|
2015-01-21 13:43:46 +11:00
|
|
|
struct ScrArea *BKE_screen_find_area_xy(struct bScreen *sc, const int spacetype, int x, int y);
|
2010-02-07 23:39:44 +00:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
void BKE_screen_gizmo_tag_refresh(struct bScreen *sc);
|
2017-07-31 14:35:10 +10:00
|
|
|
|
2010-04-22 19:57:18 +00:00
|
|
|
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
void BKE_screen_view3d_scene_sync(struct bScreen *sc, struct Scene *scene);
|
|
|
|
bool BKE_screen_is_fullscreen_area(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
|
|
|
bool BKE_screen_is_used(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2010-04-22 19:57:18 +00:00
|
|
|
|
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
|
|
|
|
2018-07-11 11:43:56 +02:00
|
|
|
void BKE_screen_view3d_shading_init(struct View3DShading *shading);
|
|
|
|
|
2009-09-14 12:26:34 +00:00
|
|
|
/* screen */
|
2018-06-03 17:06:13 +02:00
|
|
|
void BKE_screen_free(struct bScreen *sc);
|
UI: New Global Top-Bar (WIP)
== Main Features/Changes for Users
* Add horizontal bar at top of all non-temp windows, consisting out of two horizontal sub-bars.
* Upper sub-bar contains global menus (File, Render, etc.), tabs for workspaces and scene selector.
* Lower sub-bar contains object mode selector, screen-layout and render-layer selector. Later operator and/or tool settings will be placed here.
* Individual sections of the topbar are individually scrollable.
* Workspace tabs can be double- or ctrl-clicked for renaming and contain 'x' icon for deleting.
* Top-bar should scale nicely with DPI.
* The lower half of the top-bar can be hided by dragging the lower top-bar edge up. Better hiding options are planned (e.g. hide in fullscreen modes).
* Info editors at the top of the window and using the full window width with be replaced by the top-bar.
* In fullscreen modes, no more info editor is added on top, the top-bar replaces it.
== Technical Features/Changes
* Adds initial support for global areas
A global area is part of the window, not part of the regular screen-layout.
I've added a macro iterator to iterate over both, global and screen-layout level areas. When iterating over areas, from now on developers should always consider if they have to include global areas.
* Adds a TOPBAR editor type
The editor type is hidden in the UI editor type menu.
* Adds a variation of the ID template to display IDs as tab buttons (template_ID_tabs in BPY)
* Does various changes to RNA button creation code to improve their appearance in the horizontal top-bar.
* Adds support for dynamically sized regions. That is, regions that scale automatically to the layout bounds.
The code for this is currently a big hack (it's based on drawing the UI multiple times). This should definitely be improved.
* Adds a template for displaying operator properties optimized for the top-bar. This will probably change a lot still and is in fact disabled in code.
Since the final top-bar design depends a lot on other 2.8 designs (mainly tool-system and workspaces), we decided to not show the operator or tool settings in the top-bar for now. That means most of the lower sub-bar is empty for the time being.
NOTE: Top-bar or global area data is not written to files or SDNA. They are simply added to the window when opening Blender or reading a file. This allows us doing changes to the top-bar without having to care for compatibility.
== ToDo's
It's a bit hard to predict all the ToDo's here are the known main ones:
* Add options for the new active-tool system and for operator redo to the topbar.
* Automatically hide the top-bar in fullscreen modes.
* General visual polish.
* Top-bar drag & drop support (WIP in temp-tab_drag_drop).
* Improve dynamic regions (should also fix some layout glitches).
* Make internal terminology consistent.
* Enable topbar file writing once design is more advanced.
* Address TODO's and XXX's in code :)
Thanks @brecht for the review! And @sergey for the complaining ;)
Differential Revision: D2758
2018-04-20 17:14:03 +02:00
|
|
|
void BKE_screen_area_map_free(struct ScrAreaMap *area_map) ATTR_NONNULL();
|
2008-12-14 17:25:46 +00:00
|
|
|
|
2018-04-13 21:43:57 +02:00
|
|
|
struct ScrEdge *BKE_screen_find_edge(struct bScreen *sc, struct ScrVert *v1, struct ScrVert *v2);
|
|
|
|
void BKE_screen_sort_scrvert(struct ScrVert **v1, struct ScrVert **v2);
|
|
|
|
void BKE_screen_remove_double_scrverts(struct bScreen *sc);
|
|
|
|
void BKE_screen_remove_double_scredges(struct bScreen *sc);
|
|
|
|
void BKE_screen_remove_unused_scredges(struct bScreen *sc);
|
|
|
|
void BKE_screen_remove_unused_scrverts(struct bScreen *sc);
|
|
|
|
|
2019-02-06 21:15:39 +11:00
|
|
|
void BKE_screen_header_alignment_reset(struct bScreen *screen);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|