2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-01-07 18:03:41 +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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-01-07 18:03:41 +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.
|
2008-01-07 18:03:41 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup edscr
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2009-02-15 13:09:19 +00:00
|
|
|
#include <math.h>
|
2009-10-28 18:03:04 +00:00
|
|
|
#include <string.h>
|
2009-02-15 13:09:19 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2009-07-24 13:34:45 +00:00
|
|
|
#include "BLI_dlrbTree.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_math.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2012-05-19 09:46:41 +00:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
#include "DNA_anim_types.h"
|
2009-02-04 17:40:50 +00:00
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
|
#include "DNA_curve_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_lattice_types.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
|
#include "DNA_meta_types.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "DNA_node_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
2012-02-12 11:42:17 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_workspace_types.h"
|
2009-02-04 17:40:50 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2018-11-07 15:37:31 +01:00
|
|
|
#include "BKE_editmesh.h"
|
2018-05-22 16:18:09 +02:00
|
|
|
#include "BKE_fcurve.h"
|
2011-04-07 15:48:33 +00:00
|
|
|
#include "BKE_global.h"
|
2016-12-01 16:43:57 +01:00
|
|
|
#include "BKE_icons.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BKE_main.h"
|
2018-11-07 15:37:31 +01:00
|
|
|
#include "BKE_mask.h"
|
2011-09-14 01:48:55 +00:00
|
|
|
#include "BKE_object.h"
|
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
|
|
|
#include "BKE_report.h"
|
2009-08-15 16:43:03 +00:00
|
|
|
#include "BKE_scene.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "BKE_screen.h"
|
2009-08-09 21:16:39 +00:00
|
|
|
#include "BKE_sound.h"
|
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
|
|
|
#include "BKE_workspace.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2018-02-06 17:28:00 +11:00
|
|
|
#include "DEG_depsgraph.h"
|
2019-06-04 16:52:48 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
2018-02-06 17:28:00 +11:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
#include "ED_anim_api.h"
|
2012-07-25 12:15:22 +00:00
|
|
|
#include "ED_armature.h"
|
|
|
|
|
#include "ED_clip.h"
|
2010-12-20 05:26:25 +00:00
|
|
|
#include "ED_image.h"
|
2012-07-25 12:15:22 +00:00
|
|
|
#include "ED_keyframes_draw.h"
|
2019-07-16 15:06:25 +02:00
|
|
|
#include "ED_mesh.h"
|
2009-07-02 03:32:57 +00:00
|
|
|
#include "ED_object.h"
|
2012-07-25 12:15:22 +00:00
|
|
|
#include "ED_screen.h"
|
2008-11-19 16:28:11 +00:00
|
|
|
#include "ED_screen_types.h"
|
2012-07-25 12:15:22 +00:00
|
|
|
#include "ED_sequencer.h"
|
2018-04-02 15:02:08 +02:00
|
|
|
#include "ED_undo.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "ED_util.h"
|
2011-03-08 07:44:30 +00:00
|
|
|
#include "ED_view3d.h"
|
2009-02-04 17:40:50 +00:00
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
#include "RNA_define.h"
|
2018-11-29 18:13:01 +11:00
|
|
|
#include "RNA_enum_types.h"
|
2008-11-21 19:14:38 +00:00
|
|
|
|
2009-01-15 18:28:40 +00:00
|
|
|
#include "UI_interface.h"
|
2010-12-17 19:05:34 +00:00
|
|
|
#include "UI_resources.h"
|
2015-06-29 20:46:23 +10:00
|
|
|
#include "UI_view2d.h"
|
2009-10-28 18:03:04 +00:00
|
|
|
|
2020-09-07 19:35:56 +02:00
|
|
|
#include "GPU_capabilities.h"
|
2020-07-18 07:49:25 -07:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
#include "screen_intern.h" /* own module include */
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
#define KM_MODAL_CANCEL 1
|
|
|
|
|
#define KM_MODAL_APPLY 2
|
2018-01-18 11:22:58 +11:00
|
|
|
#define KM_MODAL_SNAP_ON 3
|
|
|
|
|
#define KM_MODAL_SNAP_OFF 4
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Public Poll API
|
|
|
|
|
* \{ */
|
2008-01-10 17:38:17 +00:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_regionactive(bContext *C)
|
2009-02-19 23:53:40 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_window(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_screen(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_region(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2009-02-19 23:53:40 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_areaactive(bContext *C)
|
2.5 getting-back-into-coding commit :)
- cleaned up join and split operations. Most noticable is operator callback
design, which should make a design based on user-less exec() first, then
wrap invoke() and modal() around it. The exec() should be callable with
only Context and properties.
- split now works again; and inversed as previously, if you drag from a
triangle (action zone) inside area it subdivides area as expected.
- dragging from triangle outside area, over an edge, joins areas
- split has been simplified, it had too many options... it could just work
simpler (now)
- 'action zone' now is an operator itself, a widget sending an ACTIONZONE event,
which can be handled by others (so other gestures can be added in action zone
too)
Still evaluating:
- context gets set where?
- code structure confuses... what are proper functions for operators?
- what is WM... should low level screen stuff more there?
- when do you send event, notifier?
- files grow to large, will clean
Oh yeah and docs, docs, docs. Coming! :)
2008-11-17 18:54:03 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_window(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_screen(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_area(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2.5 getting-back-into-coding commit :)
- cleaned up join and split operations. Most noticable is operator callback
design, which should make a design based on user-less exec() first, then
wrap invoke() and modal() around it. The exec() should be callable with
only Context and properties.
- split now works again; and inversed as previously, if you drag from a
triangle (action zone) inside area it subdivides area as expected.
- dragging from triangle outside area, over an edge, joins areas
- split has been simplified, it had too many options... it could just work
simpler (now)
- 'action zone' now is an operator itself, a widget sending an ACTIONZONE event,
which can be handled by others (so other gestures can be added in action zone
too)
Still evaluating:
- context gets set where?
- code structure confuses... what are proper functions for operators?
- what is WM... should low level screen stuff more there?
- when do you send event, notifier?
- files grow to large, will clean
Oh yeah and docs, docs, docs. Coming! :)
2008-11-17 18:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_screenactive(bContext *C)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_window(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_screen(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-07 15:48:33 +00:00
|
|
|
/* XXX added this to prevent anim state to change during renders */
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool ED_operator_screenactive_norender(bContext *C)
|
2011-04-07 15:48:33 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (G.is_rendering) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_window(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_wm_screen(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2011-04-07 15:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
2.5 getting-back-into-coding commit :)
- cleaned up join and split operations. Most noticable is operator callback
design, which should make a design based on user-less exec() first, then
wrap invoke() and modal() around it. The exec() should be callable with
only Context and properties.
- split now works again; and inversed as previously, if you drag from a
triangle (action zone) inside area it subdivides area as expected.
- dragging from triangle outside area, over an edge, joins areas
- split has been simplified, it had too many options... it could just work
simpler (now)
- 'action zone' now is an operator itself, a widget sending an ACTIONZONE event,
which can be handled by others (so other gestures can be added in action zone
too)
Still evaluating:
- context gets set where?
- code structure confuses... what are proper functions for operators?
- what is WM... should low level screen stuff more there?
- when do you send event, notifier?
- files grow to large, will clean
Oh yeah and docs, docs, docs. Coming! :)
2008-11-17 18:54:03 +00:00
|
|
|
/* when mouse is over area-edge */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_screen_mainwinactive(bContext *C)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_window(C) == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-10-16 21:56:58 -05:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (screen == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (screen->active_region != NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_scene(bContext *C)
|
2018-05-24 16:40:33 +02:00
|
|
|
{
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (scene) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2018-05-24 16:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_scene_editable(bContext *C)
|
2009-01-01 14:57:04 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (scene && !ID_IS_LINKED(scene)) {
|
2019-08-08 17:16:54 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-08-08 17:16:54 +02:00
|
|
|
return false;
|
2009-01-01 14:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_objectmode(bContext *C)
|
2010-11-12 17:35:51 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
Object *obact = CTX_data_active_object(C);
|
2010-11-12 17:35:51 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (scene == NULL || ID_IS_LINKED(scene)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (CTX_data_edit_object(C)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-11-12 17:35:51 +00:00
|
|
|
/* add a check for ob->mode too? */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obact && (obact->mode != OB_MODE_OBJECT)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2010-11-12 17:35:51 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-22 02:48:11 +11:00
|
|
|
static bool ed_spacetype_test(bContext *C, int type)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ED_operator_areaactive(C)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
|
2008-12-26 19:07:31 +00:00
|
|
|
return sl && (sl->spacetype == type);
|
|
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2008-12-26 19:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_view3d_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_VIEW3D);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_region_view3d_active(bContext *C)
|
2010-09-27 10:44:46 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_region_view3d(C)) {
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-11-04 15:59:09 +00:00
|
|
|
|
2010-09-27 12:21:23 +00:00
|
|
|
CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
|
2014-04-01 11:34:00 +11:00
|
|
|
return false;
|
2010-09-27 10:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-04 15:59:09 +00:00
|
|
|
/* generic for any view2d which uses anim_ops */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_animview_active(bContext *C)
|
2010-11-04 15:59:09 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ED_operator_areaactive(C)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH))) {
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-11-04 15:59:09 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-28 15:31:20 +00:00
|
|
|
CTX_wm_operator_poll_msg_set(C, "expected a timeline/animation area to be active");
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2010-11-04 15:59:09 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_outliner_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
2009-03-26 14:05:33 +00:00
|
|
|
return ed_spacetype_test(C, SPACE_OUTLINER);
|
2008-12-26 19:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_outliner_active_no_editobject(bContext *C)
|
2010-09-27 21:22:20 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ed_spacetype_test(C, SPACE_OUTLINER)) {
|
2010-09-27 21:22:20 +00:00
|
|
|
Object *ob = ED_object_active_context(C);
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ob && ob == obedit) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2010-09-27 21:22:20 +00:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2010-09-27 21:22:20 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_file_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_FILE);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_action_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_ACTION);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_buttons_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
2019-02-16 10:44:15 +11:00
|
|
|
return ed_spacetype_test(C, SPACE_PROPERTIES);
|
2008-12-26 19:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_node_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (snode && snode->edittree) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2008-12-26 19:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_node_editable(bContext *C)
|
2013-06-05 19:06:33 +00:00
|
|
|
{
|
|
|
|
|
SpaceNode *snode = CTX_wm_space_node(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (snode && snode->edittree && !ID_IS_LINKED(snode->edittree)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2013-06-05 19:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_graphedit_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
2019-02-16 16:42:11 +11:00
|
|
|
return ed_spacetype_test(C, SPACE_GRAPH);
|
2008-12-26 19:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_sequencer_active(bContext *C)
|
2008-12-26 19:07:31 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_SEQ);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_sequencer_active_editable(bContext *C)
|
2014-02-26 13:21:48 +11:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_SEQ) && ED_operator_scene_editable(C);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_image_active(bContext *C)
|
2009-02-04 17:40:50 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_IMAGE);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_nla_active(bContext *C)
|
NLA SoC: Operators for 'tweaking' strip actions (TAB-Key for both)
In this commit, I've introduced the mechanism by which actions already referenced by strips used in the NLA can be edited (or 'tweaked'). To use, simply select a strip you wish to edit, and hit that TAB key to start tweaking that strip's action, and hit TAB again once you're done.
What happens when you enter 'tweak mode':
1) The action of the active strip temporarily becomes the 'active action' of the AnimData block. You are now able to edit this in one of the Animation Editors (DopeSheet/Action, Graph Editors) as per normal (i.e. sliding keyframes around, inserting keyframes, etc.). The 'action-line' will therefore get drawn immediately above the active track containing the active strip, so that it's clear that that's what we're editing.
2) All the NLA-tracks (and all the strips within them) that occur after the track that the active strip lived in get disabled while you're in tweakmode. This is equivalent to travelling back to an earlier state in a construction history stack.
3) The active NLA track also gets disabled while in tweakmode, since it would otherwise interfere with the correct functioning of the tweaking for the action of interest.
4) The 'real' active action (i.e. the one displaced by the active strip's action) gets put into temp storage, and will be restored after you exit tweakmode.
5) Any strips which also reference the action being tweaked will get highlighted in red shading to indicate that you may be making some changes to the action which you don't really want to make for the other users too.
Please note though, that this is only a rough prototype of this functionality, with some niceties still to come. i.e.:
* NLA-tracks after the active track should still get drawn above the 'tweaking action line', but perhaps with different appearance?
* Various tools will still need awareness of this to prevent corrupting operations from taking place. How to proceed is still undecided...
* When exiting tweak-mode, the strip the action came from still needs some form of syncing with the modified action... there are a few tricky issues here that will need to be solved
* Evaluation code doesn't totally take this into account yet...
---
Also, fixed a number of bugs with various code (notably selection, and also a few drawing bugs)
2009-06-05 05:18:07 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_NLA);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_info_active(bContext *C)
|
2010-11-11 13:36:57 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_INFO);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_console_active(bContext *C)
|
2010-11-11 13:36:57 +00:00
|
|
|
{
|
|
|
|
|
return ed_spacetype_test(C, SPACE_CONSOLE);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 17:04:48 +10:00
|
|
|
static bool ed_object_hidden(const Object *ob)
|
2012-11-21 03:33:34 +00:00
|
|
|
{
|
|
|
|
|
/* if hidden but in edit mode, we still display, can happen with animation */
|
2019-05-14 17:45:47 -03:00
|
|
|
return ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
|
2012-11-21 03:33:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_object_active(bContext *C)
|
2009-01-01 13:15:35 +00:00
|
|
|
{
|
2010-09-06 22:10:51 +00:00
|
|
|
Object *ob = ED_object_active_context(C);
|
2018-04-05 18:20:27 +02:00
|
|
|
return ((ob != NULL) && !ed_object_hidden(ob));
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 13:09:06 +10:00
|
|
|
bool ED_operator_object_active_editable_ex(bContext *UNUSED(C), const Object *ob)
|
2020-05-18 17:04:48 +10:00
|
|
|
{
|
|
|
|
|
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob));
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_object_active_editable(bContext *C)
|
2009-12-04 06:33:01 +00:00
|
|
|
{
|
2010-03-31 00:55:01 +00:00
|
|
|
Object *ob = ED_object_active_context(C);
|
2020-07-15 13:09:06 +10:00
|
|
|
return ED_operator_object_active_editable_ex(C, ob);
|
2009-12-04 06:33:01 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-13 14:29:04 +02:00
|
|
|
/** Object must be editable and fully local (i.e. not an override). */
|
2020-08-30 13:32:22 +10:00
|
|
|
bool ED_operator_object_active_local_editable_ex(bContext *C, const Object *ob)
|
|
|
|
|
{
|
|
|
|
|
return ED_operator_object_active_editable_ex(C, ob) && !ID_IS_OVERRIDE_LIBRARY(ob);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-13 14:29:04 +02:00
|
|
|
bool ED_operator_object_active_local_editable(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
Object *ob = ED_object_active_context(C);
|
2020-07-15 13:09:06 +10:00
|
|
|
return ED_operator_object_active_editable_ex(C, ob) && !ID_IS_OVERRIDE_LIBRARY(ob);
|
2020-07-13 14:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_object_active_editable_mesh(bContext *C)
|
2010-11-04 15:59:09 +00:00
|
|
|
{
|
|
|
|
|
Object *ob = ED_object_active_context(C);
|
2018-04-05 18:20:27 +02:00
|
|
|
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_MESH) &&
|
2020-07-01 14:45:27 +02:00
|
|
|
!ID_IS_LINKED(ob->data) && !ID_IS_OVERRIDE_LIBRARY(ob->data));
|
2009-12-04 06:33:01 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_object_active_editable_font(bContext *C)
|
2011-03-15 08:38:08 +00:00
|
|
|
{
|
|
|
|
|
Object *ob = ED_object_active_context(C);
|
2020-07-01 14:45:27 +02:00
|
|
|
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT) &&
|
|
|
|
|
!ID_IS_LINKED(ob->data) && !ID_IS_OVERRIDE_LIBRARY(ob->data));
|
2011-03-15 08:38:08 +00:00
|
|
|
}
|
|
|
|
|
|
2019-07-16 15:06:25 +02:00
|
|
|
bool ED_operator_editable_mesh(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
Mesh *mesh = ED_mesh_context(C);
|
2020-07-01 14:45:27 +02:00
|
|
|
return (mesh != NULL) && !ID_IS_LINKED(mesh) && !ID_IS_OVERRIDE_LIBRARY(mesh);
|
2019-07-16 15:06:25 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editmesh(bContext *C)
|
2009-01-01 13:15:35 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_MESH) {
|
2013-04-16 05:59:48 +00:00
|
|
|
return NULL != BKE_editmesh_from_object(obedit);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editmesh_view3d(bContext *C)
|
2009-12-06 17:38:39 +00:00
|
|
|
{
|
|
|
|
|
return ED_operator_editmesh(C) && ED_operator_view3d_active(C);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editmesh_region_view3d(bContext *C)
|
2010-09-27 05:44:15 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-10-08 11:33:10 +00:00
|
|
|
|
|
|
|
|
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2010-09-27 05:44:15 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 23:31:19 +05:30
|
|
|
bool ED_operator_editmesh_auto_smooth(bContext *C)
|
2018-05-25 22:24:24 +05:30
|
|
|
{
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
if (obedit && obedit->type == OB_MESH && (((Mesh *)(obedit->data))->flag & ME_AUTOSMOOTH)) {
|
|
|
|
|
return NULL != BKE_editmesh_from_object(obedit);
|
|
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2018-05-25 22:24:24 +05:30
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editarmature(bContext *C)
|
2009-02-01 18:07:02 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_ARMATURE) {
|
2009-02-01 18:07:02 +00:00
|
|
|
return NULL != ((bArmature *)obedit->data)->edbo;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-02-01 18:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
2012-09-06 23:10:01 +00:00
|
|
|
/**
|
|
|
|
|
* \brief check for pose mode (no mixed modes)
|
|
|
|
|
*
|
2013-02-06 14:02:19 +00:00
|
|
|
* We want to enable most pose operations in weight paint mode,
|
2015-02-23 12:23:13 +01:00
|
|
|
* when it comes to transforming bones, but managing bones layers/groups
|
2012-09-06 23:10:01 +00:00
|
|
|
* can be left for pose mode only. (not weight paint mode)
|
|
|
|
|
*/
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_posemode_exclusive(bContext *C)
|
2012-09-06 23:10:01 +00:00
|
|
|
{
|
|
|
|
|
Object *obact = CTX_data_active_object(C);
|
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
if (obact && !(obact->mode & OB_MODE_EDIT)) {
|
2020-10-16 21:56:58 -05:00
|
|
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
|
|
|
|
if (obpose != NULL) {
|
2018-04-05 18:20:27 +02:00
|
|
|
if (obact == obpose) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2012-09-06 23:10:01 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2012-09-06 23:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
2012-09-23 02:31:30 +00:00
|
|
|
/* allows for pinned pose objects to be used in the object buttons
|
2014-10-29 14:11:19 +01:00
|
|
|
* and the non-active pose object to be used in the 3D view */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_posemode_context(bContext *C)
|
2012-09-23 02:31:30 +00:00
|
|
|
{
|
|
|
|
|
Object *obpose = ED_pose_object_from_context(C);
|
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
if (obpose && !(obpose->mode & OB_MODE_EDIT)) {
|
|
|
|
|
if (BKE_object_pose_context_check(obpose)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2012-09-23 02:31:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2012-09-23 02:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_posemode(bContext *C)
|
2009-02-01 18:07:02 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obact = CTX_data_active_object(C);
|
2010-10-14 03:57:15 +00:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
if (obact && !(obact->mode & OB_MODE_EDIT)) {
|
2020-10-16 21:56:58 -05:00
|
|
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
|
|
|
|
if (obpose != NULL) {
|
2020-09-03 14:59:34 +02:00
|
|
|
if ((obact == obpose) || (obact->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2010-10-14 03:57:15 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-02-01 18:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_posemode_local(bContext *C)
|
2016-11-16 10:39:41 +01:00
|
|
|
{
|
|
|
|
|
if (ED_operator_posemode(C)) {
|
|
|
|
|
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
|
|
|
|
|
bArmature *arm = ob->data;
|
2017-11-06 17:17:10 +01:00
|
|
|
return !(ID_IS_LINKED(&ob->id) || ID_IS_LINKED(&arm->id));
|
2016-11-16 10:39:41 +01:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 05:26:25 +00:00
|
|
|
/* wrapper for ED_space_image_show_uvedit */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_uvedit(bContext *C)
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2010-12-20 05:26:25 +00:00
|
|
|
return ED_space_image_show_uvedit(sima, obedit);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_uvedit_space_image(bContext *C)
|
2013-04-08 10:03:51 +00:00
|
|
|
{
|
|
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
return sima && ED_space_image_show_uvedit(sima, obedit);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_uvmap(bContext *C)
|
2009-02-07 01:27:46 +00:00
|
|
|
{
|
2012-03-02 12:09:49 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
BMEditMesh *em = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (obedit && obedit->type == OB_MESH) {
|
2013-04-16 05:59:48 +00:00
|
|
|
em = BKE_editmesh_from_object(obedit);
|
2012-03-02 12:09:49 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (em && (em->bm->totface)) {
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2011-12-04 23:13:28 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
return false;
|
2009-02-07 01:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editsurfcurve(bContext *C)
|
2009-01-01 13:15:35 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) {
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
return NULL != ((Curve *)obedit->data)->editnurb;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
2008-12-26 19:07:31 +00:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editsurfcurve_region_view3d(bContext *C)
|
2010-11-21 18:50:53 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-11-21 18:50:53 +00:00
|
|
|
|
|
|
|
|
CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2010-11-21 18:50:53 +00:00
|
|
|
}
|
2008-12-26 19:07:31 +00:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editcurve(bContext *C)
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_CURVE) {
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
return NULL != ((Curve *)obedit->data)->editnurb;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editcurve_3d(bContext *C)
|
2011-11-01 11:00:08 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
if (obedit && obedit->type == OB_CURVE) {
|
|
|
|
|
Curve *cu = (Curve *)obedit->data;
|
2011-11-01 11:00:08 +00:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
return (cu->flag & CU_3D) && (NULL != cu->editnurb);
|
2011-11-01 11:00:08 +00:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2011-11-01 11:00:08 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editsurf(bContext *C)
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_SURF) {
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
return NULL != ((Curve *)obedit->data)->editnurb;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2.5: Most curve/surface editmode operators back:
* Hide, Reveal
* Separate, Duplicate, Delete
* Set Weight, Set Radius, Set Spline Type, Set Handle Type, Set Smooth
* Tilt, Clear Tilt
* Smooth, Smooth Radius
* De(select) First, De(select) Last, De(select) All, Select Inverse,
Select Linked, Select Control Point Row, Select Next, Select Previous,
Select More, Select Less, Select Random, Select Every Nth
* Switch Direction, Subdivide, Make Segment, Spin, Extrude, Toggle Cyclic
* Specials Menu
Not working correct yet:
* Add Vertex (ctrl click)
* Add Menu
2009-02-12 22:12:21 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editfont(bContext *C)
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_FONT) {
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +00:00
|
|
|
return NULL != ((Curve *)obedit->data)->editfont;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editlattice(bContext *C)
|
2009-07-03 15:23:33 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_LATTICE) {
|
2009-07-03 15:23:33 +00:00
|
|
|
return NULL != ((Lattice *)obedit->data)->editlatt;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-07-03 15:23:33 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_editmball(bContext *C)
|
2009-07-29 12:35:09 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (obedit && obedit->type == OB_MBALL) {
|
2009-07-29 12:35:09 +00:00
|
|
|
return NULL != ((MetaBall *)obedit->data)->editelems;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2009-07-29 12:35:09 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_mask(bContext *C)
|
2012-06-04 16:42:58 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
if (area && area->spacedata.first) {
|
|
|
|
|
switch (area->spacetype) {
|
2012-07-25 12:15:22 +00:00
|
|
|
case SPACE_CLIP: {
|
2020-04-03 14:23:21 +02:00
|
|
|
SpaceClip *screen = area->spacedata.first;
|
|
|
|
|
return ED_space_clip_check_show_maskedit(screen);
|
2012-07-25 12:15:22 +00:00
|
|
|
}
|
|
|
|
|
case SPACE_SEQ: {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceSeq *sseq = area->spacedata.first;
|
2012-07-25 12:15:22 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
return ED_space_sequencer_check_show_maskedit(sseq, scene);
|
|
|
|
|
}
|
|
|
|
|
case SPACE_IMAGE: {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = area->spacedata.first;
|
2017-11-23 13:51:49 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
2020-09-02 12:44:37 +10:00
|
|
|
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
|
|
|
|
|
return ED_space_image_check_show_maskedit(sima, obedit);
|
2012-07-25 12:15:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
return false;
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 12:03:56 +02:00
|
|
|
bool ED_operator_camera(bContext *C)
|
2017-10-26 21:40:37 +11:00
|
|
|
{
|
|
|
|
|
struct Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
|
|
|
|
|
return (cam != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Internal Screen Utilities
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool screen_active_editable(bContext *C)
|
2018-01-21 01:41:58 +11:00
|
|
|
{
|
|
|
|
|
if (ED_operator_screenactive(C)) {
|
|
|
|
|
/* no full window splitting allowed */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_screen(C)->state != SCREENNORMAL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2018-01-21 01:41:58 +11:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2018-01-21 01:41:58 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Action Zone Operator
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* operator state vars used:
|
2012-03-03 16:31:46 +00:00
|
|
|
* none
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* functions:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2019-04-10 08:40:49 +02:00
|
|
|
* apply() set action-zone event
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exit() free customdata
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exec() never used
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
|
|
|
|
* invoke() check if in zone
|
2012-03-03 16:31:46 +00:00
|
|
|
* add customdata, put mouseco and area in it
|
|
|
|
|
* add modal handler
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* modal() accept modal events while doing it
|
|
|
|
|
* call apply() with gesture info, active window, nonactive window
|
|
|
|
|
* call exit() and remove handler when LMB confirm
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2008-11-19 16:28:11 +00:00
|
|
|
|
|
|
|
|
typedef struct sActionzoneData {
|
|
|
|
|
ScrArea *sa1, *sa2;
|
|
|
|
|
AZone *az;
|
2009-03-05 23:19:44 +00:00
|
|
|
int x, y, gesture_dir, modifier;
|
2008-11-19 16:28:11 +00:00
|
|
|
} sActionzoneData;
|
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* quick poll to save operators to be created and handled */
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool actionzone_area_poll(bContext *C)
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2019-02-21 17:04:20 +01:00
|
|
|
bScreen *screen = WM_window_get_active_screen(win);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-02-21 17:04:20 +01:00
|
|
|
if (screen && win && win->eventstate) {
|
2013-06-28 05:39:05 +00:00
|
|
|
const int *xy = &win->eventstate->x;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (AZone *, az, &area->actionzones) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
}
|
2019-02-21 17:04:20 +01:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2014-10-14 15:05:44 -03:00
|
|
|
/* the debug drawing of the click_rect is in area_draw_azone_fullscreen, keep both in sync */
|
|
|
|
|
static void fullscreen_click_rcti_init(
|
2019-08-15 19:46:29 +10:00
|
|
|
rcti *rect, const short UNUSED(x1), const short UNUSED(y1), const short x2, const short y2)
|
2014-10-14 15:05:44 -03:00
|
|
|
{
|
2019-08-15 19:46:29 +10:00
|
|
|
BLI_rcti_init(rect, x2 - U.widget_unit, x2, y2 - U.widget_unit, y2);
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
|
|
|
|
|
2019-04-24 06:10:50 +10:00
|
|
|
static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
|
|
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
const ARegion *region = az->region;
|
2019-04-24 06:10:50 +10:00
|
|
|
*r_rect_clip = az->rect;
|
|
|
|
|
if (az->type == AZONE_REGION) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->overlap && (region->v2d.keeptot != V2D_KEEPTOT_STRICT) &&
|
2019-04-29 13:47:11 +10:00
|
|
|
/* Only when this isn't hidden (where it's displayed as an button that expands). */
|
2020-03-06 16:56:42 +01:00
|
|
|
((az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) == 0)) {
|
2019-04-24 06:10:50 +10:00
|
|
|
/* A floating region to be resized, clip by the visible region. */
|
|
|
|
|
switch (az->edge) {
|
|
|
|
|
case AE_TOP_TO_BOTTOMRIGHT:
|
|
|
|
|
case AE_BOTTOM_TO_TOPLEFT: {
|
|
|
|
|
r_rect_clip->xmin = max_ii(
|
|
|
|
|
r_rect_clip->xmin,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->winrct.xmin +
|
|
|
|
|
UI_view2d_view_to_region_x(®ion->v2d, region->v2d.tot.xmin)) -
|
2019-04-24 06:10:50 +10:00
|
|
|
UI_REGION_OVERLAP_MARGIN);
|
|
|
|
|
r_rect_clip->xmax = min_ii(
|
|
|
|
|
r_rect_clip->xmax,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->winrct.xmin +
|
|
|
|
|
UI_view2d_view_to_region_x(®ion->v2d, region->v2d.tot.xmax)) +
|
2019-04-24 06:10:50 +10:00
|
|
|
UI_REGION_OVERLAP_MARGIN);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
case AE_LEFT_TO_TOPRIGHT:
|
|
|
|
|
case AE_RIGHT_TO_TOPLEFT: {
|
|
|
|
|
r_rect_clip->ymin = max_ii(
|
|
|
|
|
r_rect_clip->ymin,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->winrct.ymin +
|
|
|
|
|
UI_view2d_view_to_region_y(®ion->v2d, region->v2d.tot.ymin)) -
|
2019-04-24 06:10:50 +10:00
|
|
|
UI_REGION_OVERLAP_MARGIN);
|
|
|
|
|
r_rect_clip->ymax = min_ii(
|
|
|
|
|
r_rect_clip->ymax,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->winrct.ymin +
|
|
|
|
|
UI_view2d_view_to_region_y(®ion->v2d, region->v2d.tot.ymax)) +
|
2019-04-24 06:10:50 +10:00
|
|
|
UI_REGION_OVERLAP_MARGIN);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const bool test_only)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
AZone *az = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
for (az = area->actionzones.first; az; az = az->next) {
|
2019-04-24 06:10:50 +10:00
|
|
|
rcti az_rect_clip;
|
|
|
|
|
if (BLI_rcti_isect_pt_v(&az->rect, xy) &&
|
|
|
|
|
/* Check clipping if this is clipped */
|
|
|
|
|
(!azone_clipped_rect_calc(az, &az_rect_clip) || BLI_rcti_isect_pt_v(&az_rect_clip, xy))) {
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (az->type == AZONE_AREA) {
|
2019-01-04 15:09:11 +01:00
|
|
|
break;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (az->type == AZONE_REGION) {
|
2009-09-16 17:43:09 +00:00
|
|
|
break;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (az->type == AZONE_FULLSCREEN) {
|
2014-10-14 15:05:44 -03:00
|
|
|
rcti click_rect;
|
|
|
|
|
fullscreen_click_rcti_init(&click_rect, az->x1, az->y1, az->x2, az->y2);
|
2018-06-20 15:32:46 +02:00
|
|
|
const bool click_isect = BLI_rcti_isect_pt_v(&click_rect, xy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:32:46 +02:00
|
|
|
if (test_only) {
|
|
|
|
|
if (click_isect) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-20 15:32:46 +02:00
|
|
|
if (click_isect) {
|
2014-10-14 15:05:44 -03:00
|
|
|
az->alpha = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 17:18:10 +01:00
|
|
|
const int mouse_sq = square_i(xy[0] - az->x2) + square_i(xy[1] - az->y2);
|
|
|
|
|
const int spot_sq = square_i(AZONESPOTW);
|
|
|
|
|
const int fadein_sq = square_i(AZONEFADEIN);
|
|
|
|
|
const int fadeout_sq = square_i(AZONEFADEOUT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:58:46 +02:00
|
|
|
if (mouse_sq < spot_sq) {
|
2018-06-20 15:32:46 +02:00
|
|
|
az->alpha = 1.0f;
|
|
|
|
|
}
|
2018-06-20 15:58:46 +02:00
|
|
|
else if (mouse_sq < fadein_sq) {
|
2018-06-20 15:32:46 +02:00
|
|
|
az->alpha = 1.0f;
|
|
|
|
|
}
|
2018-06-20 15:58:46 +02:00
|
|
|
else if (mouse_sq < fadeout_sq) {
|
|
|
|
|
az->alpha = 1.0f -
|
|
|
|
|
((float)(mouse_sq - fadein_sq)) / ((float)(fadeout_sq - fadein_sq));
|
2018-06-20 15:32:46 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
az->alpha = 0.0f;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:32:46 +02:00
|
|
|
/* fade in/out but no click */
|
|
|
|
|
az = NULL;
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:32:46 +02:00
|
|
|
/* XXX force redraw to show/hide the action zone */
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
2018-06-20 15:32:46 +02:00
|
|
|
break;
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-05-07 01:31:18 +02:00
|
|
|
else if (az->type == AZONE_REGION_SCROLL) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = az->region;
|
|
|
|
|
View2D *v2d = ®ion->v2d;
|
2018-11-07 18:14:21 +11:00
|
|
|
int scroll_flag = 0;
|
|
|
|
|
const int isect_value = UI_view2d_mouse_in_scrollers_ex(
|
2020-03-06 16:56:42 +01:00
|
|
|
region, v2d, xy[0], xy[1], &scroll_flag);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-07 18:14:21 +11:00
|
|
|
/* Check if we even have scroll bars. */
|
|
|
|
|
if (((az->direction == AZ_SCROLL_HOR) && !(scroll_flag & V2D_SCROLL_HORIZONTAL)) ||
|
|
|
|
|
((az->direction == AZ_SCROLL_VERT) && !(scroll_flag & V2D_SCROLL_VERTICAL))) {
|
|
|
|
|
/* no scrollbars, do nothing. */
|
|
|
|
|
}
|
|
|
|
|
else if (test_only) {
|
2018-06-20 15:50:54 +02:00
|
|
|
if (isect_value != 0) {
|
|
|
|
|
break;
|
2018-05-07 01:31:18 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-05-07 01:31:18 +02:00
|
|
|
else {
|
2018-06-20 15:50:54 +02:00
|
|
|
bool redraw = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:50:54 +02:00
|
|
|
if (isect_value == 'h') {
|
|
|
|
|
if (az->direction == AZ_SCROLL_HOR) {
|
|
|
|
|
az->alpha = 1.0f;
|
|
|
|
|
v2d->alpha_hor = 255;
|
|
|
|
|
redraw = true;
|
|
|
|
|
}
|
2018-05-07 01:31:18 +02:00
|
|
|
}
|
2018-06-20 15:50:54 +02:00
|
|
|
else if (isect_value == 'v') {
|
|
|
|
|
if (az->direction == AZ_SCROLL_VERT) {
|
|
|
|
|
az->alpha = 1.0f;
|
|
|
|
|
v2d->alpha_vert = 255;
|
|
|
|
|
redraw = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
const int local_xy[2] = {xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin};
|
2018-06-20 15:50:54 +02:00
|
|
|
float dist_fac = 0.0f, alpha = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:50:54 +02:00
|
|
|
if (az->direction == AZ_SCROLL_HOR) {
|
|
|
|
|
dist_fac = BLI_rcti_length_y(&v2d->hor, local_xy[1]) / AZONEFADEIN;
|
|
|
|
|
CLAMP(dist_fac, 0.0f, 1.0f);
|
|
|
|
|
alpha = 1.0f - dist_fac;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:50:54 +02:00
|
|
|
v2d->alpha_hor = alpha * 255;
|
|
|
|
|
}
|
|
|
|
|
else if (az->direction == AZ_SCROLL_VERT) {
|
|
|
|
|
dist_fac = BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
|
|
|
|
|
CLAMP(dist_fac, 0.0f, 1.0f);
|
|
|
|
|
alpha = 1.0f - dist_fac;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:50:54 +02:00
|
|
|
v2d->alpha_vert = alpha * 255;
|
|
|
|
|
}
|
|
|
|
|
az->alpha = alpha;
|
|
|
|
|
redraw = true;
|
2018-05-07 01:31:18 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-20 15:50:54 +02:00
|
|
|
if (redraw) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw_no_rebuild(region);
|
2018-06-20 15:50:54 +02:00
|
|
|
}
|
|
|
|
|
/* Don't return! */
|
2018-05-07 01:31:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-01-04 21:40:16 +01:00
|
|
|
else if (!test_only && !IS_EQF(az->alpha, 0.0f)) {
|
|
|
|
|
if (az->type == AZONE_FULLSCREEN) {
|
|
|
|
|
az->alpha = 0.0f;
|
2020-04-03 13:25:03 +02:00
|
|
|
area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
|
|
|
|
|
ED_area_tag_redraw_no_rebuild(area);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
|
|
|
|
else if (az->type == AZONE_REGION_SCROLL) {
|
|
|
|
|
if (az->direction == AZ_SCROLL_VERT) {
|
2020-03-06 16:56:42 +01:00
|
|
|
az->alpha = az->region->v2d.alpha_vert = 0;
|
2020-04-03 13:25:03 +02:00
|
|
|
area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw_no_rebuild(az->region);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
|
|
|
|
else if (az->direction == AZ_SCROLL_HOR) {
|
2020-03-06 16:56:42 +01:00
|
|
|
az->alpha = az->region->v2d.alpha_hor = 0;
|
2020-04-03 13:25:03 +02:00
|
|
|
area->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw_no_rebuild(az->region);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2020-09-08 13:54:39 -05:00
|
|
|
BLI_assert(false);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return az;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-10 08:40:49 +02:00
|
|
|
/* Finds an action-zone by position in entire screen so azones can overlap. */
|
2020-04-03 14:23:21 +02:00
|
|
|
static AZone *screen_actionzone_find_xy(bScreen *screen, const int xy[2])
|
2019-02-21 17:04:20 +01:00
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
2020-04-03 13:25:03 +02:00
|
|
|
AZone *az = area_actionzone_refresh_xy(area, xy, true);
|
2019-02-21 17:04:20 +01:00
|
|
|
if (az != NULL) {
|
|
|
|
|
return az;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns the area that the azone belongs to */
|
2020-04-03 14:23:21 +02:00
|
|
|
static ScrArea *screen_actionzone_area(bScreen *screen, const AZone *az)
|
2019-02-21 17:04:20 +01:00
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (AZone *, zone, &area->actionzones) {
|
2019-02-21 17:04:20 +01:00
|
|
|
if (zone == az) {
|
|
|
|
|
return area;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
|
2018-06-20 15:32:46 +02:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
return area_actionzone_refresh_xy(area, xy, true);
|
2018-06-20 15:32:46 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
AZone *ED_area_azones_update(ScrArea *area, const int xy[2])
|
2018-06-20 15:32:46 +02:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
return area_actionzone_refresh_xy(area, xy, false);
|
2018-06-20 15:32:46 +02:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static void actionzone_exit(wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (op->customdata) {
|
2008-11-19 16:28:11 +00:00
|
|
|
MEM_freeN(op->customdata);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = NULL;
|
2020-01-03 16:25:50 +11:00
|
|
|
|
|
|
|
|
G.moving &= ~G_TRANSFORM_WM;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* send EVT_ACTIONZONE event */
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void actionzone_apply(bContext *C, wmOperator *op, int type)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
sActionzoneData *sad = op->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->modifier = RNA_int_get(op->ptr, "modifier");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
wmEvent event;
|
2013-07-29 08:29:04 +00:00
|
|
|
wm_event_init_from_window(win, &event);
|
|
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (type == AZONE_AREA) {
|
2012-05-08 11:48:19 +00:00
|
|
|
event.type = EVT_ACTIONZONE_AREA;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (type == AZONE_FULLSCREEN) {
|
2014-10-14 15:05:44 -03:00
|
|
|
event.type = EVT_ACTIONZONE_FULLSCREEN;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
event.type = EVT_ACTIONZONE_REGION;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2014-10-14 15:05:44 -03:00
|
|
|
|
2015-04-05 06:22:49 +10:00
|
|
|
event.val = KM_NOTHING;
|
2020-10-21 20:43:25 +11:00
|
|
|
event.is_repeat = false;
|
2012-05-08 11:48:19 +00:00
|
|
|
event.customdata = op->customdata;
|
2014-04-01 11:34:00 +11:00
|
|
|
event.customdatafree = true;
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
wm_event_add(win, &event);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
|
|
|
|
AZone *az = screen_actionzone_find_xy(screen, &event->x);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-29 19:29:41 +10:00
|
|
|
/* Quick escape - Scroll azones only hide/unhide the scroll-bars,
|
|
|
|
|
* they have their own handling. */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL)) {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-10 08:40:49 +02:00
|
|
|
/* ok we do the action-zone */
|
2020-10-16 21:56:58 -05:00
|
|
|
sActionzoneData *sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
|
2020-04-03 14:23:21 +02:00
|
|
|
sad->sa1 = screen_actionzone_area(screen, az);
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->az = az;
|
|
|
|
|
sad->x = event->x;
|
|
|
|
|
sad->y = event->y;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* region azone directly reacts on mouse clicks */
|
2014-10-14 15:05:44 -03:00
|
|
|
if (ELEM(sad->az->type, AZONE_REGION, AZONE_FULLSCREEN)) {
|
|
|
|
|
actionzone_apply(C, op, sad->az->type);
|
2010-10-14 12:24:08 +00:00
|
|
|
actionzone_exit(op);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2020-01-03 16:25:50 +11:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
BLI_assert(ELEM(sad->az->type, AZONE_AREA, AZONE_REGION_SCROLL));
|
|
|
|
|
|
|
|
|
|
/* add modal handler */
|
|
|
|
|
G.moving |= G_TRANSFORM_WM;
|
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2012-05-08 11:48:19 +00:00
|
|
|
sActionzoneData *sad = op->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2008-11-19 16:28:11 +00:00
|
|
|
case MOUSEMOVE: {
|
2013-09-04 05:06:38 +00:00
|
|
|
const int delta_x = (event->x - sad->x);
|
|
|
|
|
const int delta_y = (event->y - sad->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-23 14:44:40 +01:00
|
|
|
/* Movement in dominant direction. */
|
2020-03-06 17:18:10 +01:00
|
|
|
const int delta_max = max_ii(abs(delta_x), abs(delta_y));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-21 17:22:51 +01:00
|
|
|
/* Movement in dominant direction before action taken. */
|
|
|
|
|
const int join_threshold = (0.6 * U.widget_unit);
|
|
|
|
|
const int split_threshold = (1.2 * U.widget_unit);
|
|
|
|
|
const int area_threshold = (0.1 * U.widget_unit);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-23 14:44:40 +01:00
|
|
|
/* Calculate gesture cardinal direction. */
|
2020-03-06 17:18:10 +01:00
|
|
|
if (delta_y > abs(delta_x)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->gesture_dir = 'n';
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 17:18:10 +01:00
|
|
|
else if (delta_x >= abs(delta_y)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->gesture_dir = 'e';
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 17:18:10 +01:00
|
|
|
else if (delta_y < -abs(delta_x)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->gesture_dir = 's';
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->gesture_dir = 'w';
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
bool is_gesture;
|
2013-09-04 05:25:29 +00:00
|
|
|
if (sad->az->type == AZONE_AREA) {
|
2019-02-21 17:22:51 +01:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
rcti screen_rect;
|
2018-05-23 22:38:25 +02:00
|
|
|
WM_window_screen_rect_calc(win, &screen_rect);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-21 17:22:51 +01:00
|
|
|
/* Have we dragged off the zone and are not on an edge? */
|
|
|
|
|
if ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
|
2019-02-26 14:31:14 +11:00
|
|
|
(screen_geom_area_map_find_active_scredge(
|
2020-04-03 14:23:21 +02:00
|
|
|
AREAMAP_FROM_SCREEN(screen), &screen_rect, event->x, event->y) == NULL)) {
|
2019-02-21 17:22:51 +01:00
|
|
|
/* Are we still in same area? */
|
2020-04-03 14:23:21 +02:00
|
|
|
if (BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y) == sad->sa1) {
|
2019-02-21 17:22:51 +01:00
|
|
|
/* Same area, so possible split. */
|
|
|
|
|
WM_cursor_set(
|
2019-09-26 14:31:50 +02:00
|
|
|
win, (ELEM(sad->gesture_dir, 'n', 's')) ? WM_CURSOR_H_SPLIT : WM_CURSOR_V_SPLIT);
|
2019-02-21 17:22:51 +01:00
|
|
|
is_gesture = (delta_max > split_threshold);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-08-01 13:53:25 +10:00
|
|
|
/* Different area, so possible join. */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad->gesture_dir == 'n') {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_N_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (sad->gesture_dir == 's') {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_S_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (sad->gesture_dir == 'e') {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_E_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_W_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-02-21 17:22:51 +01:00
|
|
|
is_gesture = (delta_max > join_threshold);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(CTX_wm_window(C), WM_CURSOR_CROSS);
|
2019-02-21 17:22:51 +01:00
|
|
|
is_gesture = false;
|
|
|
|
|
}
|
2013-09-04 05:25:29 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2019-02-21 17:22:51 +01:00
|
|
|
is_gesture = (delta_max > area_threshold);
|
2013-09-04 05:25:29 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* gesture is large enough? */
|
2013-09-04 05:25:29 +00:00
|
|
|
if (is_gesture) {
|
|
|
|
|
/* second area, for join when (sa1 != sa2) */
|
2020-04-03 14:23:21 +02:00
|
|
|
sad->sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y);
|
2008-11-19 16:28:11 +00:00
|
|
|
/* apply sends event */
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
actionzone_apply(C, op, sad->az->type);
|
2010-10-14 12:24:08 +00:00
|
|
|
actionzone_exit(op);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
break;
|
2013-09-04 05:06:38 +00:00
|
|
|
}
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2010-10-14 12:24:08 +00:00
|
|
|
actionzone_exit(op);
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2012-10-21 05:46:41 +00:00
|
|
|
case LEFTMOUSE:
|
2010-10-14 12:24:08 +00:00
|
|
|
actionzone_exit(op);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
|
2011-06-06 11:04:54 +00:00
|
|
|
{
|
|
|
|
|
actionzone_exit(op);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_actionzone(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2013-01-27 07:23:58 +00:00
|
|
|
ot->name = "Handle Area Action Zones";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Handle area action zones for mouse actions/gestures";
|
|
|
|
|
ot->idname = "SCREEN_OT_actionzone";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = actionzone_invoke;
|
|
|
|
|
ot->modal = actionzone_modal;
|
|
|
|
|
ot->poll = actionzone_area_poll;
|
|
|
|
|
ot->cancel = actionzone_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-02-26 13:48:41 +11:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-10-20 07:56:04 +00:00
|
|
|
RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2019-08-23 09:03:57 +10:00
|
|
|
/** \} */
|
|
|
|
|
|
2019-08-22 13:19:11 -07:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Area edge detection utility
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static ScrEdge *screen_area_edge_from_cursor(const bContext *C,
|
|
|
|
|
const int cursor[2],
|
|
|
|
|
ScrArea **r_sa1,
|
|
|
|
|
ScrArea **r_sa2)
|
|
|
|
|
{
|
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2019-08-22 13:19:11 -07:00
|
|
|
rcti window_rect;
|
|
|
|
|
WM_window_rect_calc(win, &window_rect);
|
2020-10-16 21:56:58 -05:00
|
|
|
ScrEdge *actedge = screen_geom_area_map_find_active_scredge(
|
2020-04-03 14:23:21 +02:00
|
|
|
AREAMAP_FROM_SCREEN(screen), &window_rect, cursor[0], cursor[1]);
|
2019-08-22 13:19:11 -07:00
|
|
|
*r_sa1 = NULL;
|
|
|
|
|
*r_sa2 = NULL;
|
|
|
|
|
if (actedge == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
int borderwidth = (4 * UI_DPI_FAC);
|
|
|
|
|
ScrArea *sa1, *sa2;
|
|
|
|
|
if (screen_geom_edge_is_horizontal(actedge)) {
|
2020-04-03 14:23:21 +02:00
|
|
|
sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0], cursor[1] + borderwidth);
|
|
|
|
|
sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0], cursor[1] - borderwidth);
|
2019-08-22 13:19:11 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2020-04-03 14:23:21 +02:00
|
|
|
sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0] + borderwidth, cursor[1]);
|
|
|
|
|
sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, cursor[0] - borderwidth, cursor[1]);
|
2019-08-22 13:19:11 -07:00
|
|
|
}
|
|
|
|
|
bool isGlobal = ((sa1 && ED_area_is_global(sa1)) || (sa2 && ED_area_is_global(sa2)));
|
|
|
|
|
if (!isGlobal) {
|
|
|
|
|
*r_sa1 = sa1;
|
|
|
|
|
*r_sa2 = sa2;
|
|
|
|
|
}
|
|
|
|
|
return actedge;
|
|
|
|
|
}
|
2018-01-21 01:41:58 +11:00
|
|
|
|
2019-08-23 09:03:57 +10:00
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Swap Area Operator
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-03-23 11:51:19 +01:00
|
|
|
/* operator state vars used:
|
|
|
|
|
* sa1 start area
|
|
|
|
|
* sa2 area to swap with
|
|
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* functions:
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2019-04-10 08:40:49 +02:00
|
|
|
* init() set custom data for operator, based on action-zone event custom data
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
|
|
|
|
* cancel() cancel the operator
|
|
|
|
|
*
|
|
|
|
|
* exit() cleanup, send notifier
|
|
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2019-04-10 08:40:49 +02:00
|
|
|
* invoke() gets called on shift+lmb drag in action-zone
|
2019-08-22 13:19:11 -07:00
|
|
|
* exec() execute without any user interaction, based on properties
|
2012-03-03 16:31:46 +00:00
|
|
|
* call init(), add handler
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* modal() accept modal events while doing it
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2009-03-11 20:22:06 +00:00
|
|
|
|
|
|
|
|
typedef struct sAreaSwapData {
|
|
|
|
|
ScrArea *sa1, *sa2;
|
|
|
|
|
} sAreaSwapData;
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
static bool area_swap_init(wmOperator *op, const wmEvent *event)
|
2009-03-11 20:22:06 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sActionzoneData *sad = event->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad == NULL || sad->sa1 == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaSwapData *sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
|
2012-05-08 11:48:19 +00:00
|
|
|
sd->sa1 = sad->sa1;
|
|
|
|
|
sd->sa2 = sad->sa2;
|
|
|
|
|
op->customdata = sd;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void area_swap_exit(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2013-09-06 22:34:29 +00:00
|
|
|
WM_cursor_modal_restore(CTX_wm_window(C));
|
2019-04-22 09:19:45 +10:00
|
|
|
if (op->customdata) {
|
2009-03-11 20:22:06 +00:00
|
|
|
MEM_freeN(op->customdata);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = NULL;
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void area_swap_cancel(bContext *C, wmOperator *op)
|
2009-03-11 20:22:06 +00:00
|
|
|
{
|
|
|
|
|
area_swap_exit(C, op);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-03-11 20:22:06 +00:00
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!area_swap_init(op, event)) {
|
2009-03-11 20:22:06 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-03-11 20:22:06 +00:00
|
|
|
/* add modal handler */
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_SWAP_AREA);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-03-11 20:22:06 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-03-11 20:22:06 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sActionzoneData *sad = op->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2009-03-11 20:22:06 +00:00
|
|
|
case MOUSEMOVE:
|
|
|
|
|
/* second area, for join */
|
2015-01-21 13:43:46 +11:00
|
|
|
sad->sa2 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
|
2009-03-11 20:22:06 +00:00
|
|
|
break;
|
|
|
|
|
case LEFTMOUSE: /* release LMB */
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->val == KM_RELEASE) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!sad->sa2 || sad->sa1 == sad->sa2) {
|
2013-10-30 23:08:53 +00:00
|
|
|
area_swap_cancel(C, op);
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
2010-04-06 09:36:35 +00:00
|
|
|
|
2010-01-16 22:56:52 +00:00
|
|
|
ED_area_tag_redraw(sad->sa1);
|
|
|
|
|
ED_area_tag_redraw(sad->sa2);
|
|
|
|
|
|
2010-04-06 09:36:35 +00:00
|
|
|
ED_area_swapspace(C, sad->sa1, sad->sa2);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-04-06 09:36:35 +00:00
|
|
|
area_swap_exit(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-03-11 20:22:06 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2013-10-30 23:08:53 +00:00
|
|
|
area_swap_cancel(C, op);
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-22 13:19:11 -07:00
|
|
|
static int area_swap_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *sa1, *sa2;
|
|
|
|
|
int cursor[2];
|
|
|
|
|
RNA_int_get_array(op->ptr, "cursor", cursor);
|
|
|
|
|
screen_area_edge_from_cursor(C, cursor, &sa1, &sa2);
|
|
|
|
|
if (sa1 == NULL || sa2 == NULL) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
ED_area_swapspace(C, sa1, sa2);
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void SCREEN_OT_area_swap(wmOperatorType *ot)
|
2009-03-11 20:22:06 +00:00
|
|
|
{
|
2013-01-27 07:23:58 +00:00
|
|
|
ot->name = "Swap Areas";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Swap selected areas screen positions";
|
|
|
|
|
ot->idname = "SCREEN_OT_area_swap";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = area_swap_invoke;
|
|
|
|
|
ot->modal = area_swap_modal;
|
2019-08-22 13:19:11 -07:00
|
|
|
ot->exec = area_swap_exec;
|
|
|
|
|
ot->poll = screen_active_editable;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->cancel = area_swap_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = OPTYPE_BLOCKING;
|
2019-08-22 13:19:11 -07:00
|
|
|
|
|
|
|
|
/* rna */
|
|
|
|
|
RNA_def_int_vector(
|
|
|
|
|
ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
|
2009-03-11 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Area Duplicate Operator
|
|
|
|
|
*
|
|
|
|
|
* Create new window from area.
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
|
|
|
|
/* operator callback */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-10-16 21:56:58 -05:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2021-02-22 11:37:25 -08:00
|
|
|
if (event && event->customdata) {
|
2009-06-04 14:32:10 +00:00
|
|
|
sActionzoneData *sad = event->customdata;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad == NULL) {
|
2012-05-08 11:48:19 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
area = sad->sa1;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-04-18 16:28:36 +00:00
|
|
|
|
2021-02-22 11:37:25 -08:00
|
|
|
/* Create new window. No need to set space_type since it will be copied over. */
|
|
|
|
|
wmWindow *newwin = WM_window_open(C,
|
|
|
|
|
"Blender",
|
|
|
|
|
area->totrct.xmin,
|
|
|
|
|
area->totrct.ymin,
|
|
|
|
|
area->winx,
|
|
|
|
|
area->winy,
|
|
|
|
|
SPACE_EMPTY,
|
|
|
|
|
true,
|
|
|
|
|
false,
|
|
|
|
|
WIN_ALIGN_ABSOLUTE);
|
2015-10-07 00:27:27 +11:00
|
|
|
|
2021-02-22 11:37:25 -08:00
|
|
|
if (newwin) {
|
|
|
|
|
/* copy area to new screen */
|
|
|
|
|
bScreen *newsc = WM_window_get_active_screen(newwin);
|
|
|
|
|
ED_area_data_copy((ScrArea *)newsc->areabase.first, area, true);
|
|
|
|
|
ED_area_tag_redraw((ScrArea *)newsc->areabase.first);
|
|
|
|
|
|
|
|
|
|
/* screen, areas init */
|
|
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2015-04-06 10:40:12 -03:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
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
|
|
|
|
2021-02-22 11:37:25 -08:00
|
|
|
if (event && event->customdata) {
|
2010-10-14 12:24:08 +00:00
|
|
|
actionzone_exit(op);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2021-02-22 11:37:25 -08:00
|
|
|
return newwin ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
static void SCREEN_OT_area_dupli(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Duplicate Area into New Window";
|
|
|
|
|
ot->description = "Duplicate selected area into new window";
|
|
|
|
|
ot->idname = "SCREEN_OT_area_dupli";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = area_dupli_invoke;
|
|
|
|
|
ot->poll = ED_operator_areaactive;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Move Area Edge Operator
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* operator state vars used:
|
2012-05-08 11:48:19 +00:00
|
|
|
* x, y mouse coord near edge
|
2012-03-03 16:31:46 +00:00
|
|
|
* delta movement of edge
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* functions:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* init() set default property values, find edge based on mouse coords, test
|
|
|
|
|
* if the edge can be moved, select edges, calculate min and max movement
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* apply() apply delta on selection
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exit() cleanup, send notifier
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* cancel() cancel moving
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exec() execute without any user interaction, based on properties
|
|
|
|
|
* call init(), apply(), exit()
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* invoke() gets called on mouse click near edge
|
|
|
|
|
* call init(), add handler
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* modal() accept modal events while doing it
|
|
|
|
|
* call apply() with delta motion
|
|
|
|
|
* call exit() and remove handler
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2008-11-19 16:28:11 +00:00
|
|
|
|
|
|
|
|
typedef struct sAreaMoveData {
|
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 bigger, smaller, origval, step;
|
2008-11-19 16:28:11 +00:00
|
|
|
char dir;
|
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
|
|
|
enum AreaMoveSnapType {
|
|
|
|
|
/* Snapping disabled */
|
|
|
|
|
SNAP_NONE = 0,
|
2018-06-02 03:17:51 -03:00
|
|
|
/* Snap to an invisible grid with a unit defined in AREAGRID */
|
|
|
|
|
SNAP_AREAGRID,
|
2018-07-13 08:18:18 +02:00
|
|
|
/* Snap to fraction (half, third.. etc) and adjacent edges. */
|
|
|
|
|
SNAP_FRACTION_AND_ADJACENT,
|
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
|
|
|
/* Snap to either bigger or smaller, nothing in-between (used for
|
|
|
|
|
* global areas). This has priority over other snap types, if it is
|
2018-07-13 08:18:18 +02:00
|
|
|
* used, toggling SNAP_FRACTION_AND_ADJACENT doesn't work. */
|
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
|
|
|
SNAP_BIGGER_SMALLER_ONLY,
|
|
|
|
|
} snap_type;
|
2008-11-19 16:28:11 +00:00
|
|
|
} sAreaMoveData;
|
|
|
|
|
|
2013-11-25 13:40:58 +01:00
|
|
|
/* helper call to move area-edge, sets limits
|
2018-05-23 22:38:25 +02:00
|
|
|
* need window bounds in order to get correct limits */
|
2020-04-03 14:23:21 +02:00
|
|
|
static void area_move_set_limits(wmWindow *win,
|
|
|
|
|
bScreen *screen,
|
|
|
|
|
int dir,
|
|
|
|
|
int *bigger,
|
|
|
|
|
int *smaller,
|
|
|
|
|
bool *use_bigger_smaller_snap)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
/* we check all areas and test for free space with MINSIZE */
|
2012-05-08 11:48:19 +00:00
|
|
|
*bigger = *smaller = 100000;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
if (use_bigger_smaller_snap != NULL) {
|
|
|
|
|
*use_bigger_smaller_snap = false;
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) {
|
2018-06-30 16:51:31 +02:00
|
|
|
int size_min = ED_area_global_min_size_y(area) - 1;
|
|
|
|
|
int size_max = ED_area_global_max_size_y(area) - 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-23 14:44:40 +01:00
|
|
|
size_min = max_ii(size_min, 0);
|
2019-04-18 21:13:22 +02:00
|
|
|
BLI_assert(size_min <= size_max);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
/* logic here is only tested for lower edge :) */
|
|
|
|
|
/* left edge */
|
|
|
|
|
if ((area->v1->editflag && area->v2->editflag)) {
|
|
|
|
|
*smaller = area->v4->vec.x - size_max;
|
|
|
|
|
*bigger = area->v4->vec.x - size_min;
|
|
|
|
|
*use_bigger_smaller_snap = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* top edge */
|
2020-07-03 16:01:15 +02:00
|
|
|
if ((area->v2->editflag && area->v3->editflag)) {
|
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
|
|
|
*smaller = area->v1->vec.y + size_min;
|
|
|
|
|
*bigger = area->v1->vec.y + size_max;
|
|
|
|
|
*use_bigger_smaller_snap = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* right edge */
|
2020-07-03 16:01:15 +02:00
|
|
|
if ((area->v3->editflag && area->v4->editflag)) {
|
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
|
|
|
*smaller = area->v1->vec.x + size_min;
|
|
|
|
|
*bigger = area->v1->vec.x + size_max;
|
|
|
|
|
*use_bigger_smaller_snap = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* lower edge */
|
2020-07-03 16:01:15 +02:00
|
|
|
if ((area->v4->editflag && area->v1->editflag)) {
|
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
|
|
|
*smaller = area->v2->vec.y - size_max;
|
|
|
|
|
*bigger = area->v2->vec.y - size_min;
|
|
|
|
|
*use_bigger_smaller_snap = true;
|
|
|
|
|
return;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
rcti window_rect;
|
2018-06-28 20:15:09 +02:00
|
|
|
WM_window_rect_calc(win, &window_rect);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
2012-05-08 11:48:19 +00:00
|
|
|
if (dir == 'h') {
|
2020-10-16 21:56:58 -05:00
|
|
|
int areamin = ED_area_headersize();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v1->vec.y > window_rect.ymin) {
|
2013-11-25 13:40:58 +01:00
|
|
|
areamin += U.pixelsize;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v2->vec.y < (window_rect.ymax - 1)) {
|
2013-11-25 13:40:58 +01:00
|
|
|
areamin += U.pixelsize;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int y1 = screen_geom_area_height(area) - areamin;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* if top or down edge selected, test height */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v1->editflag && area->v4->editflag) {
|
2012-10-24 05:06:40 +00:00
|
|
|
*bigger = min_ii(*bigger, y1);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->v2->editflag && area->v3->editflag) {
|
2012-10-24 05:06:40 +00:00
|
|
|
*smaller = min_ii(*smaller, y1);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-16 21:56:58 -05:00
|
|
|
int areamin = AREAMINX;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v1->vec.x > window_rect.xmin) {
|
2013-11-25 13:40:58 +01:00
|
|
|
areamin += U.pixelsize;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v4->vec.x < (window_rect.xmax - 1)) {
|
2013-11-25 13:40:58 +01:00
|
|
|
areamin += U.pixelsize;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int x1 = screen_geom_area_width(area) - areamin;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* if left or right edge selected, test width */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v1->editflag && area->v2->editflag) {
|
2012-10-24 05:06:40 +00:00
|
|
|
*bigger = min_ii(*bigger, x1);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
else if (area->v3->editflag && area->v4->editflag) {
|
2012-10-24 05:06:40 +00:00
|
|
|
*smaller = min_ii(*smaller, x1);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* validate selection inside screen, set variables OK */
|
2020-09-08 13:54:39 -05:00
|
|
|
/* return false: init failed */
|
|
|
|
|
static bool area_move_init(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2013-11-25 13:40:58 +01:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* required properties */
|
2020-10-16 21:56:58 -05:00
|
|
|
int x = RNA_int_get(op->ptr, "x");
|
|
|
|
|
int y = RNA_int_get(op->ptr, "y");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* setup */
|
2020-10-16 21:56:58 -05:00
|
|
|
ScrEdge *actedge = screen_geom_find_active_scredge(win, screen, x, y);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (actedge == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaMoveData *md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = md;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-30 01:56:07 +02:00
|
|
|
md->dir = screen_geom_edge_is_horizontal(actedge) ? 'h' : 'v';
|
2019-04-22 09:19:45 +10:00
|
|
|
if (md->dir == 'h') {
|
2012-05-08 11:48:19 +00:00
|
|
|
md->origval = actedge->v1->vec.y;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
md->origval = actedge->v1->vec.x;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-30 01:56:07 +02:00
|
|
|
screen_geom_select_connected_edge(win, actedge);
|
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
|
|
|
/* now all vertices with 'flag == 1' are the ones that can be moved. Move this to editflag */
|
2020-04-03 14:23:21 +02:00
|
|
|
ED_screen_verts_iter(win, screen, v1)
|
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
|
|
|
{
|
2012-12-15 16:22:18 +00:00
|
|
|
v1->editflag = v1->flag;
|
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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
bool use_bigger_smaller_snap = false;
|
2020-04-03 14:23:21 +02:00
|
|
|
area_move_set_limits(win, screen, md->dir, &md->bigger, &md->smaller, &use_bigger_smaller_snap);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-02 03:17:51 -03:00
|
|
|
md->snap_type = use_bigger_smaller_snap ? SNAP_BIGGER_SMALLER_ONLY : SNAP_AREAGRID;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 14:23:21 +02:00
|
|
|
static int area_snap_calc_location(const bScreen *screen,
|
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
|
|
|
const enum AreaMoveSnapType snap_type,
|
|
|
|
|
const int delta,
|
|
|
|
|
const int origval,
|
|
|
|
|
const int dir,
|
2018-01-18 11:22:58 +11:00
|
|
|
const int bigger,
|
|
|
|
|
const int smaller)
|
|
|
|
|
{
|
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
|
|
|
BLI_assert(snap_type != SNAP_NONE);
|
2018-07-13 08:14:16 +02:00
|
|
|
int m_cursor_final = -1;
|
|
|
|
|
const int m_cursor = origval + delta;
|
|
|
|
|
const int m_span = (float)(bigger + smaller);
|
|
|
|
|
const int m_min = origval - smaller;
|
|
|
|
|
// const int axis_max = axis_min + m_span;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-02 03:17:51 -03:00
|
|
|
switch (snap_type) {
|
|
|
|
|
case SNAP_AREAGRID:
|
2018-07-13 08:14:16 +02:00
|
|
|
m_cursor_final = m_cursor;
|
2020-11-06 12:30:59 +11:00
|
|
|
if (!ELEM(delta, bigger, -smaller)) {
|
2018-07-13 08:14:16 +02:00
|
|
|
m_cursor_final -= (m_cursor % AREAGRID);
|
|
|
|
|
CLAMP(m_cursor_final, origval - smaller, origval + bigger);
|
2018-06-02 03:17:51 -03:00
|
|
|
}
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-02 03:17:51 -03:00
|
|
|
case SNAP_BIGGER_SMALLER_ONLY:
|
2018-07-13 08:14:16 +02:00
|
|
|
m_cursor_final = (m_cursor >= bigger) ? bigger : smaller;
|
2018-06-02 03:17:51 -03:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-13 08:18:18 +02:00
|
|
|
case SNAP_FRACTION_AND_ADJACENT: {
|
2018-06-02 03:17:51 -03:00
|
|
|
const int axis = (dir == 'v') ? 0 : 1;
|
2018-07-13 08:14:16 +02:00
|
|
|
int snap_dist_best = INT_MAX;
|
2018-06-02 03:17:51 -03:00
|
|
|
{
|
2018-07-12 16:55:16 +02:00
|
|
|
const float div_array[] = {
|
|
|
|
|
/* Middle. */
|
|
|
|
|
1.0f / 2.0f,
|
|
|
|
|
/* Thirds. */
|
|
|
|
|
1.0f / 3.0f,
|
|
|
|
|
2.0f / 3.0f,
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Quarters. */
|
2018-07-12 16:55:16 +02:00
|
|
|
1.0f / 4.0f,
|
|
|
|
|
3.0f / 4.0f,
|
|
|
|
|
/* Eighth. */
|
|
|
|
|
1.0f / 8.0f,
|
|
|
|
|
3.0f / 8.0f,
|
|
|
|
|
5.0f / 8.0f,
|
|
|
|
|
7.0f / 8.0f,
|
|
|
|
|
};
|
|
|
|
|
/* Test the snap to the best division. */
|
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(div_array); i++) {
|
2018-07-13 08:14:16 +02:00
|
|
|
const int m_cursor_test = m_min + round_fl_to_int(m_span * div_array[i]);
|
|
|
|
|
const int snap_dist_test = abs(m_cursor - m_cursor_test);
|
|
|
|
|
if (snap_dist_best >= snap_dist_test) {
|
|
|
|
|
snap_dist_best = snap_dist_test;
|
|
|
|
|
m_cursor_final = m_cursor_test;
|
2018-06-02 03:17:51 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (const ScrVert *, v1, &screen->vertbase) {
|
2018-06-02 03:17:51 -03:00
|
|
|
if (!v1->editflag) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const int v_loc = (&v1->vec.x)[!axis];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (const ScrVert *, v2, &screen->vertbase) {
|
2018-06-02 03:17:51 -03:00
|
|
|
if (v2->editflag) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-01-18 11:22:58 +11:00
|
|
|
if (v_loc == (&v2->vec.x)[!axis]) {
|
|
|
|
|
const int v_loc2 = (&v2->vec.x)[axis];
|
|
|
|
|
/* Do not snap to the vertices at the ends. */
|
|
|
|
|
if ((origval - smaller) < v_loc2 && v_loc2 < (origval + bigger)) {
|
2018-07-13 08:14:16 +02:00
|
|
|
const int snap_dist_test = abs(m_cursor - v_loc2);
|
|
|
|
|
if (snap_dist_best >= snap_dist_test) {
|
|
|
|
|
snap_dist_best = snap_dist_test;
|
|
|
|
|
m_cursor_final = v_loc2;
|
2018-01-18 11:22:58 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-06-02 03:17:51 -03:00
|
|
|
break;
|
2018-01-18 11:22:58 +11:00
|
|
|
}
|
2018-06-02 21:38:31 +02:00
|
|
|
case SNAP_NONE:
|
|
|
|
|
break;
|
2018-01-18 11:22:58 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-30 16:51:31 +02:00
|
|
|
BLI_assert(ELEM(snap_type, SNAP_BIGGER_SMALLER_ONLY) ||
|
2018-07-13 08:14:16 +02:00
|
|
|
IN_RANGE_INCL(m_cursor_final, origval - smaller, origval + bigger));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-13 08:14:16 +02:00
|
|
|
return m_cursor_final;
|
2018-01-18 11:22:58 +11:00
|
|
|
}
|
|
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* moves selected screen edge amount of delta, used by split & move */
|
2018-01-18 11:22:58 +11:00
|
|
|
static void area_move_apply_do(const bContext *C,
|
|
|
|
|
int delta,
|
|
|
|
|
const int origval,
|
|
|
|
|
const int dir,
|
|
|
|
|
const int bigger,
|
|
|
|
|
const int smaller,
|
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
|
|
|
const enum AreaMoveSnapType snap_type)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
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
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2018-06-29 02:04:46 +02:00
|
|
|
short final_loc = -1;
|
2018-01-18 11:22:58 +11:00
|
|
|
bool doredraw = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-30 16:51:31 +02:00
|
|
|
if (snap_type != SNAP_BIGGER_SMALLER_ONLY) {
|
|
|
|
|
CLAMP(delta, -smaller, bigger);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
if (snap_type == SNAP_NONE) {
|
2018-01-18 11:22:58 +11:00
|
|
|
final_loc = origval + delta;
|
|
|
|
|
}
|
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
|
|
|
else {
|
2020-04-03 14:23:21 +02:00
|
|
|
final_loc = area_snap_calc_location(screen, snap_type, delta, origval, dir, bigger, smaller);
|
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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-18 11:22:58 +11:00
|
|
|
BLI_assert(final_loc != -1);
|
|
|
|
|
short axis = (dir == 'v') ? 0 : 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 14:23:21 +02:00
|
|
|
ED_screen_verts_iter(win, screen, v1)
|
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
|
|
|
{
|
2012-12-15 09:45:34 +00:00
|
|
|
if (v1->editflag) {
|
2018-01-18 11:22:58 +11:00
|
|
|
short oldval = (&v1->vec.x)[axis];
|
|
|
|
|
(&v1->vec.x)[axis] = final_loc;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-18 11:22:58 +11:00
|
|
|
if (oldval == final_loc) {
|
|
|
|
|
/* nothing will change to the other vertices either. */
|
|
|
|
|
break;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2018-01-18 11:22:58 +11:00
|
|
|
doredraw = true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-11-25 13:40:58 +01:00
|
|
|
/* only redraw if we actually moved a screen vert, for AREAGRID */
|
|
|
|
|
if (doredraw) {
|
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
|
|
|
bool redraw_all = false;
|
2020-05-10 15:42:06 +02:00
|
|
|
ED_screen_areas_iter (win, screen, area) {
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->v1->editflag || area->v2->editflag || area->v3->editflag || area->v4->editflag) {
|
|
|
|
|
if (ED_area_is_global(area)) {
|
2018-08-17 17:32:36 +02:00
|
|
|
/* Snap to minimum or maximum for global areas. */
|
2020-04-03 13:25:03 +02:00
|
|
|
int height = round_fl_to_int(screen_geom_area_height(area) / UI_DPI_FAC);
|
|
|
|
|
if (abs(height - area->global->size_min) < abs(height - area->global->size_max)) {
|
|
|
|
|
area->global->cur_fixed_height = area->global->size_min;
|
2018-08-17 17:32:36 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
area->global->cur_fixed_height = area->global->size_max;
|
2018-08-17 17:32:36 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 14:23:21 +02:00
|
|
|
screen->do_refresh = true;
|
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
|
|
|
redraw_all = true;
|
|
|
|
|
}
|
2020-06-17 20:21:15 +02:00
|
|
|
ED_area_tag_redraw_no_rebuild(area);
|
2018-01-18 11:22:58 +11:00
|
|
|
}
|
2013-11-25 13:40:58 +01:00
|
|
|
}
|
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
|
|
|
if (redraw_all) {
|
2020-05-10 15:42:06 +02:00
|
|
|
ED_screen_areas_iter (win, screen, area) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-17 17:32:36 +02:00
|
|
|
ED_screen_global_areas_sync(win);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-11-25 13:40:58 +01:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* redraw everything */
|
2016-12-01 16:43:57 +01:00
|
|
|
/* Update preview thumbnail */
|
2020-04-03 14:23:21 +02:00
|
|
|
BKE_icon_changed(screen->id.icon_id);
|
2013-11-25 13:40:58 +01:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void area_move_apply(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaMoveData *md = op->customdata;
|
2018-01-18 11:22:58 +11:00
|
|
|
int delta = RNA_int_get(op->ptr, "delta");
|
|
|
|
|
|
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
|
|
|
area_move_apply_do(C, delta, md->origval, md->dir, md->bigger, md->smaller, md->snap_type);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void area_move_exit(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (op->customdata) {
|
2008-11-19 16:28:11 +00:00
|
|
|
MEM_freeN(op->customdata);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* this makes sure aligned edges will result in aligned grabbing */
|
2018-04-13 21:43:57 +02:00
|
|
|
BKE_screen_remove_double_scrverts(CTX_wm_screen(C));
|
|
|
|
|
BKE_screen_remove_double_scredges(CTX_wm_screen(C));
|
2018-11-28 13:50:15 +11:00
|
|
|
|
|
|
|
|
G.moving &= ~G_TRANSFORM_WM;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int area_move_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!area_move_init(C, op)) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_move_apply(C, op);
|
|
|
|
|
area_move_exit(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* interaction callback */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2008-11-24 15:51:55 +00:00
|
|
|
RNA_int_set(op->ptr, "x", event->x);
|
|
|
|
|
RNA_int_set(op->ptr, "y", event->y);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!area_move_init(C, op)) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* add temp handler */
|
2020-01-03 16:25:50 +11:00
|
|
|
G.moving |= G_TRANSFORM_WM;
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void area_move_cancel(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-24 15:51:55 +00:00
|
|
|
RNA_int_set(op->ptr, "delta", 0);
|
2008-11-19 16:28:11 +00:00
|
|
|
area_move_apply(C, op);
|
|
|
|
|
area_move_exit(C, op);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* modal callback for while moving edges */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaMoveData *md = op->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* execute the events */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2008-11-19 16:28:11 +00:00
|
|
|
case MOUSEMOVE: {
|
2020-10-16 21:56:58 -05:00
|
|
|
int x = RNA_int_get(op->ptr, "x");
|
|
|
|
|
int y = RNA_int_get(op->ptr, "y");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int delta = (md->dir == 'v') ? event->x - x : event->y - y;
|
2008-11-24 15:51:55 +00:00
|
|
|
RNA_int_set(op->ptr, "delta", delta);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_move_apply(C, op);
|
|
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
case EVT_MODAL_MAP: {
|
|
|
|
|
switch (event->val) {
|
|
|
|
|
case KM_MODAL_APPLY:
|
|
|
|
|
area_move_exit(C, op);
|
|
|
|
|
return OPERATOR_FINISHED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
case KM_MODAL_CANCEL:
|
2013-10-30 23:08:53 +00:00
|
|
|
area_move_cancel(C, op);
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-18 11:22:58 +11:00
|
|
|
case KM_MODAL_SNAP_ON:
|
2018-06-02 03:17:51 -03:00
|
|
|
if (md->snap_type != SNAP_BIGGER_SMALLER_ONLY) {
|
2018-07-13 08:18:18 +02:00
|
|
|
md->snap_type = SNAP_FRACTION_AND_ADJACENT;
|
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
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-18 11:22:58 +11:00
|
|
|
case KM_MODAL_SNAP_OFF:
|
2018-06-02 03:17:51 -03:00
|
|
|
if (md->snap_type != SNAP_BIGGER_SMALLER_ONLY) {
|
|
|
|
|
md->snap_type = SNAP_AREAGRID;
|
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
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_area_move(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2013-01-27 07:23:58 +00:00
|
|
|
ot->name = "Move Area Edges";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Move selected area edges";
|
|
|
|
|
ot->idname = "SCREEN_OT_area_move";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = area_move_exec;
|
|
|
|
|
ot->invoke = area_move_invoke;
|
|
|
|
|
ot->cancel = area_move_cancel;
|
|
|
|
|
ot->modal = area_move_modal;
|
|
|
|
|
ot->poll = ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-02-26 13:48:41 +11:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
/* rna */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
|
|
|
|
|
RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
|
|
|
|
|
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Split Area Operator
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-03-23 11:51:19 +01:00
|
|
|
/*
|
|
|
|
|
* operator state vars:
|
2012-03-03 16:31:46 +00:00
|
|
|
* fac spit point
|
|
|
|
|
* dir direction 'v' or 'h'
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* operator customdata:
|
2012-05-08 11:48:19 +00:00
|
|
|
* area pointer to (active) area
|
2018-03-23 11:51:19 +01:00
|
|
|
* x, y last used mouse pos
|
2012-03-03 16:31:46 +00:00
|
|
|
* (more, see below)
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* functions:
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* init() set default property values, find area based on context
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
|
|
|
|
* apply() split area based on state vars
|
|
|
|
|
*
|
|
|
|
|
* exit() cleanup, send notifier
|
|
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* cancel() remove duplicated area
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exec() execute without any user interaction, based on state vars
|
|
|
|
|
* call init(), apply(), exit()
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* invoke() gets called on mouse click in action-widget
|
|
|
|
|
* call init(), add modal handler
|
|
|
|
|
* call apply() with initial motion
|
2018-03-23 11:51:19 +01:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* modal() accept modal events while doing it
|
|
|
|
|
* call move-areas code with delta motion
|
|
|
|
|
* call exit() or cancel() and remove handler
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
typedef struct sAreaSplitData {
|
2012-05-08 11:48:19 +00:00
|
|
|
int origval; /* for move areas */
|
|
|
|
|
int bigger, smaller; /* constraints for moving new edge */
|
|
|
|
|
int delta; /* delta move edge */
|
|
|
|
|
int origmin, origsize; /* to calculate fac, for property storage */
|
|
|
|
|
int previewmode; /* draw previewline, then split */
|
2018-01-19 17:14:27 +11:00
|
|
|
void *draw_callback; /* call `ED_screen_draw_split_preview` */
|
2018-01-18 11:22:58 +11:00
|
|
|
bool do_snap;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
ScrEdge *nedge; /* new edge */
|
|
|
|
|
ScrArea *sarea; /* start area */
|
|
|
|
|
ScrArea *narea; /* new area */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
} sAreaSplitData;
|
|
|
|
|
|
2018-01-19 17:14:27 +11:00
|
|
|
static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
|
|
|
|
|
{
|
|
|
|
|
const wmOperator *op = userdata;
|
|
|
|
|
|
|
|
|
|
sAreaSplitData *sd = op->customdata;
|
|
|
|
|
if (sd->sarea) {
|
|
|
|
|
int dir = RNA_enum_get(op->ptr, "direction");
|
|
|
|
|
float fac = RNA_float_get(op->ptr, "factor");
|
|
|
|
|
|
|
|
|
|
ED_screen_draw_split_preview(sd->sarea, dir, fac);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
/* generic init, menu case, doesn't need active area */
|
2020-09-08 13:54:39 -05:00
|
|
|
static bool area_split_menu_init(bContext *C, wmOperator *op)
|
2011-03-02 14:09:54 +00:00
|
|
|
{
|
|
|
|
|
/* custom data */
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = sd;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
sd->sarea = CTX_wm_area(C);
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* generic init, no UI stuff here, assumes active area */
|
2020-09-08 13:54:39 -05:00
|
|
|
static bool area_split_init(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* required context */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* required properties */
|
2020-10-16 21:56:58 -05:00
|
|
|
int dir = RNA_enum_get(op->ptr, "direction");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* minimal size */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (dir == 'v' && area->winx < 2 * AREAMINX) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-10-16 21:56:58 -05:00
|
|
|
if (dir == 'h' && area->winy < 2 * ED_area_headersize()) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* custom data */
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = sd;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
sd->sarea = area;
|
2018-06-02 03:17:51 -03:00
|
|
|
if (dir == 'v') {
|
2020-04-03 13:25:03 +02:00
|
|
|
sd->origmin = area->v1->vec.x;
|
|
|
|
|
sd->origsize = area->v4->vec.x - sd->origmin;
|
2018-06-02 03:17:51 -03:00
|
|
|
}
|
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
sd->origmin = area->v1->vec.y;
|
|
|
|
|
sd->origsize = area->v2->vec.y - sd->origmin;
|
2018-06-02 03:17:51 -03:00
|
|
|
}
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
/* with area as center, sb is located at: 0=W, 1=N, 2=E, 3=S */
|
2008-11-19 16:28:11 +00:00
|
|
|
/* used with split operator */
|
2020-04-03 13:25:03 +02:00
|
|
|
static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *area, ScrArea *sb)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrVert *sav1 = area->v1;
|
|
|
|
|
ScrVert *sav2 = area->v2;
|
|
|
|
|
ScrVert *sav3 = area->v3;
|
|
|
|
|
ScrVert *sav4 = area->v4;
|
2012-05-08 11:48:19 +00:00
|
|
|
ScrVert *sbv1 = sb->v1;
|
|
|
|
|
ScrVert *sbv2 = sb->v2;
|
|
|
|
|
ScrVert *sbv3 = sb->v3;
|
|
|
|
|
ScrVert *sbv4 = sb->v4;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (sav1 == sbv4 && sav2 == sbv3) { /* area to right of sb = W */
|
2018-04-13 21:43:57 +02:00
|
|
|
return BKE_screen_find_edge(screen, sav1, sav2);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (sav2 == sbv1 && sav3 == sbv4) { /* area to bottom of sb = N */
|
2018-04-13 21:43:57 +02:00
|
|
|
return BKE_screen_find_edge(screen, sav2, sav3);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (sav3 == sbv2 && sav4 == sbv1) { /* area to left of sb = E */
|
2018-04-13 21:43:57 +02:00
|
|
|
return BKE_screen_find_edge(screen, sav3, sav4);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (sav1 == sbv2 && sav4 == sbv3) { /* area on top of sb = S*/
|
2018-04-13 21:43:57 +02:00
|
|
|
return BKE_screen_find_edge(screen, sav1, sav4);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
/* do the split, return success */
|
2020-09-08 13:54:39 -05:00
|
|
|
static bool area_split_apply(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2018-06-30 15:36:00 +02:00
|
|
|
const wmWindow *win = CTX_wm_window(C);
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
float fac = RNA_float_get(op->ptr, "factor");
|
|
|
|
|
int dir = RNA_enum_get(op->ptr, "direction");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-04-03 14:23:21 +02:00
|
|
|
sd->narea = area_split(win, screen, sd->sarea, dir, fac, 0); /* 0 = no merge */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
if (sd->narea == NULL) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
sd->nedge = area_findsharededge(screen, sd->sarea, sd->narea);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
/* select newly created edge, prepare for moving edge */
|
|
|
|
|
ED_screen_verts_iter(win, screen, sv)
|
|
|
|
|
{
|
|
|
|
|
sv->editflag = 0;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
sd->nedge->v1->editflag = 1;
|
|
|
|
|
sd->nedge->v2->editflag = 1;
|
2010-01-16 22:56:52 +00:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
if (dir == 'h') {
|
|
|
|
|
sd->origval = sd->nedge->v1->vec.y;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sd->origval = sd->nedge->v1->vec.x;
|
|
|
|
|
}
|
2010-07-25 01:39:47 +00:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
ED_area_tag_redraw(sd->sarea);
|
|
|
|
|
ED_area_tag_redraw(sd->narea);
|
2016-12-01 16:43:57 +01:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
|
/* Update preview thumbnail */
|
|
|
|
|
BKE_icon_changed(screen->id.icon_id);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
return true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void area_split_exit(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
if (op->customdata) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sd->sarea) {
|
2012-03-24 06:38:07 +00:00
|
|
|
ED_area_tag_redraw(sd->sarea);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
if (sd->narea) {
|
2012-03-24 06:38:07 +00:00
|
|
|
ED_area_tag_redraw(sd->narea);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-01-16 22:56:52 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sd->draw_callback) {
|
2018-01-19 17:14:27 +11:00
|
|
|
WM_draw_cb_exit(CTX_wm_window(C), sd->draw_callback);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-01-19 17:14:27 +11:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
MEM_freeN(op->customdata);
|
|
|
|
|
op->customdata = NULL;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-09-06 22:34:29 +00:00
|
|
|
WM_cursor_modal_restore(CTX_wm_window(C));
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* this makes sure aligned edges will result in aligned grabbing */
|
2018-04-13 21:43:57 +02:00
|
|
|
BKE_screen_remove_double_scrverts(CTX_wm_screen(C));
|
|
|
|
|
BKE_screen_remove_double_scredges(CTX_wm_screen(C));
|
2020-01-03 16:25:50 +11:00
|
|
|
|
|
|
|
|
G.moving &= ~G_TRANSFORM_WM;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 00:39:06 +11:00
|
|
|
static void area_split_preview_update_cursor(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
int dir = RNA_enum_get(op->ptr, "direction");
|
2019-10-24 09:17:55 -07:00
|
|
|
WM_cursor_set(win, dir == 'h' ? WM_CURSOR_H_SPLIT : WM_CURSOR_V_SPLIT);
|
2018-01-21 00:39:06 +11:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
|
|
|
|
|
/* UI callback, adds new handler */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2013-11-25 13:40:58 +01:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-23 16:36:41 +00:00
|
|
|
/* no full window splitting allowed */
|
2020-04-03 14:23:21 +02:00
|
|
|
BLI_assert(screen->state == SCREENNORMAL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-02 12:24:21 +02:00
|
|
|
PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
|
|
|
|
|
PropertyRNA *prop_factor = RNA_struct_find_property(op->ptr, "factor");
|
|
|
|
|
PropertyRNA *prop_cursor = RNA_struct_find_property(op->ptr, "cursor");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int dir;
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->type == EVT_ACTIONZONE_AREA) {
|
|
|
|
|
sActionzoneData *sad = event->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-14 06:17:14 +00:00
|
|
|
if (sad == NULL || sad->modifier > 0) {
|
2009-03-05 23:19:44 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* verify *sad itself */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad->sa1 == NULL || sad->az == NULL) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* is this our *sad? if areas not equal it should be passed on */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-04 17:30:23 -02:00
|
|
|
/* The factor will be close to 1.0f when near the top-left and the bottom-right corners. */
|
|
|
|
|
const float factor_v = ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy;
|
|
|
|
|
const float factor_h = ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx;
|
|
|
|
|
const bool is_left = factor_v < 0.5f;
|
|
|
|
|
const bool is_bottom = factor_h < 0.5f;
|
|
|
|
|
const bool is_right = !is_left;
|
|
|
|
|
const bool is_top = !is_bottom;
|
|
|
|
|
float factor;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-04 17:30:23 -02:00
|
|
|
/* Prepare operator state vars. */
|
|
|
|
|
if (ELEM(sad->gesture_dir, 'n', 's')) {
|
2012-05-08 11:48:19 +00:00
|
|
|
dir = 'h';
|
2018-12-04 17:30:23 -02:00
|
|
|
factor = factor_h;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
dir = 'v';
|
2018-12-04 17:30:23 -02:00
|
|
|
factor = factor_v;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-04 17:30:23 -02:00
|
|
|
if ((is_top && is_left) || (is_bottom && is_right)) {
|
|
|
|
|
factor = 1.0f - factor;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-04 17:30:23 -02:00
|
|
|
RNA_property_float_set(op->ptr, prop_factor, factor);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-02 12:24:21 +02:00
|
|
|
RNA_property_enum_set(op->ptr, prop_dir, dir);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* general init, also non-UI case, adds customdata, sets area and defaults */
|
2018-07-02 12:24:21 +02:00
|
|
|
if (!area_split_init(C, op)) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (RNA_property_is_set(op->ptr, prop_dir)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
if (area == NULL) {
|
2018-07-02 12:24:21 +02:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
dir = RNA_property_enum_get(op->ptr, prop_dir);
|
|
|
|
|
if (dir == 'h') {
|
|
|
|
|
RNA_property_float_set(
|
2020-04-03 13:25:03 +02:00
|
|
|
op->ptr, prop_factor, ((float)(event->x - area->v1->vec.x)) / (float)area->winx);
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
RNA_property_float_set(
|
2020-04-03 13:25:03 +02:00
|
|
|
op->ptr, prop_factor, ((float)(event->y - area->v1->vec.y)) / (float)area->winy);
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-02 12:24:21 +02:00
|
|
|
if (!area_split_init(C, op)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
2011-03-02 14:09:54 +00:00
|
|
|
else {
|
2018-07-02 12:24:21 +02:00
|
|
|
int event_co[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
/* retrieve initial mouse coord, so we can find the active edge */
|
2018-07-02 12:24:21 +02:00
|
|
|
if (RNA_property_is_set(op->ptr, prop_cursor)) {
|
|
|
|
|
RNA_property_int_get_array(op->ptr, prop_cursor, event_co);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v2_v2_int(event_co, &event->x);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
rcti window_rect;
|
2018-07-02 16:48:18 +02:00
|
|
|
WM_window_rect_calc(win, &window_rect);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
ScrEdge *actedge = screen_geom_area_map_find_active_scredge(
|
2020-04-03 14:23:21 +02:00
|
|
|
AREAMAP_FROM_SCREEN(screen), &window_rect, event_co[0], event_co[1]);
|
2018-07-02 12:24:21 +02:00
|
|
|
if (actedge == NULL) {
|
2011-03-02 14:09:54 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-30 01:56:07 +02:00
|
|
|
dir = screen_geom_edge_is_horizontal(actedge) ? 'v' : 'h';
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-02 12:24:21 +02:00
|
|
|
RNA_property_enum_set(op->ptr, prop_dir, dir);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
/* special case, adds customdata, sets defaults */
|
2018-07-02 12:24:21 +02:00
|
|
|
if (!area_split_menu_init(C, op)) {
|
2011-03-02 14:09:54 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2018-07-02 12:24:21 +02:00
|
|
|
}
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->type == EVT_ACTIONZONE_AREA) {
|
2008-11-19 16:28:11 +00:00
|
|
|
/* do the split */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (area_split_apply(C, op)) {
|
2020-04-03 14:23:21 +02:00
|
|
|
area_move_set_limits(win, screen, dir, &sd->bigger, &sd->smaller, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
/* add temp handler for edge move or cancel */
|
2020-01-03 16:25:50 +11:00
|
|
|
G.moving |= G_TRANSFORM_WM;
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Lots of stuff; couldn't commit in parts because of refactor work.
* Changes in interface/ module
This commit brings back the way how buttons/menus work under control
of WM event system. The previous implementation extended usage of
handlers and operators in an interesting but confusing way. Better to
try it first according the design specs. :)
Most obviously:
- modal-handler operators are not stored anymore in regions/areas/windows.
such modal handlers own their operator, and should remove it themselves.
- removed code to move handlers from one queue to another.
(needs review with brecht!)
- WM fix: the API call to remove a modal handler got removed. This was a
dangerous thing anyway, and you should leave that to the event system.
Now, if a handler modal() call gets a cancel/finish return, it frees
itself in event system. WM_event_remove_modal_handler was a confusing
call anyway!
Todo:
- allow button-activate to refresh after using button
- re-enable arrow keys for menus
(do both after commit)
- review return values of operator callbacks in interface_ops.c
* Fixes in WM system
- Freeing areas/regions/windows, also on quit, now correctly closes
running modal handlers
- On starting a modal handler, the handler now stores previous area
and region context, so they send proper notifiers etc.
* Other fixes
- Area-split operator had bug, wrong minimal size checking. This
solves error when trying to split a very narrow area.
- removed DNA_USHORT_FIX from screen_types.h, gave warning
- operators didn't get ID name copied when activated, needed for
later re-use or saving.
2008-12-02 14:22:52 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2008-11-24 10:45:36 +00:00
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
sd->previewmode = 1;
|
2018-01-19 17:14:27 +11:00
|
|
|
sd->draw_callback = WM_draw_cb_activate(win, area_split_draw_cb, op);
|
2011-03-02 14:09:54 +00:00
|
|
|
/* add temp handler for edge move or cancel */
|
|
|
|
|
WM_event_add_modal_handler(C, op);
|
2018-01-21 00:39:06 +11:00
|
|
|
area_split_preview_update_cursor(C, op);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-11-24 10:45:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int area_split_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!area_split_init(C, op)) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_split_apply(C, op);
|
|
|
|
|
area_split_exit(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void area_split_cancel(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sd->previewmode) {
|
2018-04-16 17:08:27 +02:00
|
|
|
/* pass */
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
|
|
|
|
|
if (CTX_wm_area(C) == sd->narea) {
|
|
|
|
|
CTX_wm_area_set(C, NULL);
|
|
|
|
|
CTX_wm_region_set(C, NULL);
|
|
|
|
|
}
|
|
|
|
|
sd->narea = NULL;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
area_split_exit(C, op);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
|
2018-01-21 00:39:06 +11:00
|
|
|
PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
|
|
|
|
|
bool update_factor = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* execute the events */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2008-11-19 16:28:11 +00:00
|
|
|
case MOUSEMOVE:
|
2018-01-22 23:06:38 -02:00
|
|
|
update_factor = true;
|
2008-11-19 16:28:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
case LEFTMOUSE:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sd->previewmode) {
|
2011-03-02 14:09:54 +00:00
|
|
|
area_split_apply(C, op);
|
2008-11-19 16:28:11 +00:00
|
|
|
area_split_exit(C, op);
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2011-03-02 14:09:54 +00:00
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->val == KM_RELEASE) { /* mouse up */
|
2011-03-02 14:09:54 +00:00
|
|
|
area_split_exit(C, op);
|
|
|
|
|
return OPERATOR_FINISHED;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-20 00:46:55 +00:00
|
|
|
case MIDDLEMOUSE:
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_TABKEY:
|
2012-05-08 11:48:19 +00:00
|
|
|
if (sd->previewmode == 0) {
|
2018-01-21 00:39:06 +11:00
|
|
|
/* pass */
|
2011-12-20 00:46:55 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->val == KM_PRESS) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sd->sarea) {
|
2018-01-21 00:39:06 +11:00
|
|
|
int dir = RNA_property_enum_get(op->ptr, prop_dir);
|
|
|
|
|
RNA_property_enum_set(op->ptr, prop_dir, (dir == 'v') ? 'h' : 'v');
|
|
|
|
|
area_split_preview_update_cursor(C, op);
|
|
|
|
|
update_factor = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-12-20 00:46:55 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-20 00:46:55 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
case RIGHTMOUSE: /* cancel operation */
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2013-10-30 23:08:53 +00:00
|
|
|
area_split_cancel(C, op);
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_LEFTCTRLKEY:
|
2018-01-18 11:22:58 +11:00
|
|
|
sd->do_snap = event->val == KM_PRESS;
|
2018-01-21 00:39:06 +11:00
|
|
|
update_factor = true;
|
2018-01-18 11:22:58 +11:00
|
|
|
break;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-21 00:39:06 +11:00
|
|
|
if (update_factor) {
|
2018-01-22 23:06:38 -02:00
|
|
|
const int dir = RNA_property_enum_get(op->ptr, prop_dir);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
if (sd->previewmode == 0) {
|
|
|
|
|
if (sd->do_snap) {
|
|
|
|
|
const int snap_loc = area_snap_calc_location(CTX_wm_screen(C),
|
2018-07-13 08:18:18 +02:00
|
|
|
SNAP_FRACTION_AND_ADJACENT,
|
|
|
|
|
sd->delta,
|
|
|
|
|
sd->origval,
|
|
|
|
|
dir,
|
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
|
|
|
sd->bigger,
|
|
|
|
|
sd->smaller);
|
2018-01-22 23:06:38 -02:00
|
|
|
sd->delta = snap_loc - sd->origval;
|
|
|
|
|
}
|
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
|
|
|
area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, SNAP_NONE);
|
2018-01-22 23:06:38 -02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (sd->sarea) {
|
|
|
|
|
ED_area_tag_redraw(sd->sarea);
|
|
|
|
|
}
|
|
|
|
|
/* area context not set */
|
|
|
|
|
sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
if (sd->sarea) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = sd->sarea;
|
2018-01-22 23:06:38 -02:00
|
|
|
if (dir == 'v') {
|
2020-04-03 13:25:03 +02:00
|
|
|
sd->origmin = area->v1->vec.x;
|
|
|
|
|
sd->origsize = area->v4->vec.x - sd->origmin;
|
2018-01-22 23:06:38 -02:00
|
|
|
}
|
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
sd->origmin = area->v1->vec.y;
|
|
|
|
|
sd->origsize = area->v2->vec.y - sd->origmin;
|
2018-01-22 23:06:38 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
if (sd->do_snap) {
|
2020-04-03 13:25:03 +02:00
|
|
|
area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
const int snap_loc = area_snap_calc_location(CTX_wm_screen(C),
|
2018-07-13 08:18:18 +02:00
|
|
|
SNAP_FRACTION_AND_ADJACENT,
|
|
|
|
|
sd->delta,
|
|
|
|
|
sd->origval,
|
|
|
|
|
dir,
|
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
|
|
|
sd->origmin + sd->origsize,
|
|
|
|
|
-sd->origmin);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 0;
|
2018-01-22 23:06:38 -02:00
|
|
|
sd->delta = snap_loc - sd->origval;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
ED_area_tag_redraw(sd->sarea);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-23 01:00:16 -02:00
|
|
|
CTX_wm_screen(C)->do_draw = true;
|
2018-01-21 00:39:06 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-22 23:06:38 -02:00
|
|
|
float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
|
|
|
|
|
RNA_float_set(op->ptr, "factor", fac);
|
2018-01-21 00:39:06 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem prop_direction_items[] = {
|
2012-05-08 11:48:19 +00:00
|
|
|
{'h', "HORIZONTAL", 0, "Horizontal", ""},
|
|
|
|
|
{'v', "VERTICAL", 0, "Vertical", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-08 11:48:19 +00:00
|
|
|
};
|
2008-12-09 15:59:43 +00:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_area_split(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-19 09:46:41 +00:00
|
|
|
ot->name = "Split Area";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Split selected area into new windows";
|
2008-12-26 11:11:21 +00:00
|
|
|
ot->idname = "SCREEN_OT_area_split";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = area_split_exec;
|
|
|
|
|
ot->invoke = area_split_invoke;
|
|
|
|
|
ot->modal = area_split_modal;
|
|
|
|
|
ot->cancel = area_split_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = screen_active_editable;
|
2014-02-26 13:48:41 +11:00
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
/* rna */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", "");
|
|
|
|
|
RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0);
|
2018-07-02 12:24:21 +02:00
|
|
|
RNA_def_int_vector(
|
|
|
|
|
ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Scale Region Edge Operator
|
|
|
|
|
* \{ */
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
|
|
|
|
typedef struct RegionMoveData {
|
2009-09-16 17:43:09 +00:00
|
|
|
AZone *az;
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region;
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
int bigger, smaller, origval;
|
|
|
|
|
int origx, origy;
|
2009-12-10 09:25:30 +00:00
|
|
|
int maxsize;
|
2010-09-20 13:13:40 +00:00
|
|
|
AZEdge edge;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
} RegionMoveData;
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge)
|
2009-12-10 09:25:30 +00:00
|
|
|
{
|
|
|
|
|
int dist;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
/* regions in regions. */
|
|
|
|
|
if (scalear->alignment & RGN_SPLIT_PREV) {
|
2019-05-03 13:04:37 +10:00
|
|
|
const int align = RGN_ALIGN_ENUM_FROM_MASK(scalear->alignment);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
if (ELEM(align, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = scalear->prev;
|
|
|
|
|
dist = region->winy + scalear->winy - U.pixelsize;
|
2012-05-27 11:10:27 +00:00
|
|
|
}
|
2019-04-14 19:04:37 +02:00
|
|
|
else /* if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) */ {
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = scalear->prev;
|
|
|
|
|
dist = region->winx + scalear->winx - U.pixelsize;
|
2012-05-27 11:10:27 +00:00
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
}
|
2019-04-03 14:53:57 +02:00
|
|
|
else {
|
2020-11-06 12:30:59 +11:00
|
|
|
if (ELEM(edge, AE_RIGHT_TO_TOPLEFT, AE_LEFT_TO_TOPRIGHT)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
dist = BLI_rcti_size_x(&area->totrct);
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
|
|
|
|
else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
|
2020-04-03 13:25:03 +02:00
|
|
|
dist = BLI_rcti_size_y(&area->totrct);
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
/* subtractwidth of regions on opposite side
|
|
|
|
|
* prevents dragging regions into other opposite regions */
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region == scalear) {
|
2019-04-03 14:53:57 +02:00
|
|
|
continue;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == RGN_ALIGN_RIGHT) {
|
|
|
|
|
dist -= region->winx;
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == RGN_ALIGN_LEFT) {
|
|
|
|
|
dist -= region->winx;
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
|
|
|
|
else if (scalear->alignment == RGN_ALIGN_TOP &&
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->alignment == RGN_ALIGN_BOTTOM ||
|
|
|
|
|
ELEM(
|
|
|
|
|
region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
|
|
|
|
|
dist -= region->winy;
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
|
|
|
|
else if (scalear->alignment == RGN_ALIGN_BOTTOM &&
|
2020-03-06 16:56:42 +01:00
|
|
|
(region->alignment == RGN_ALIGN_TOP ||
|
|
|
|
|
ELEM(
|
|
|
|
|
region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
|
|
|
|
|
dist -= region->winy;
|
2019-04-03 14:53:57 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
dist /= UI_DPI_FAC;
|
2009-12-10 09:25:30 +00:00
|
|
|
return dist;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-18 16:34:39 +02:00
|
|
|
static bool is_split_edge(const int alignment, const AZEdge edge)
|
|
|
|
|
{
|
|
|
|
|
return ((alignment == RGN_ALIGN_BOTTOM) && (edge == AE_TOP_TO_BOTTOMRIGHT)) ||
|
|
|
|
|
((alignment == RGN_ALIGN_TOP) && (edge == AE_BOTTOM_TO_TOPLEFT)) ||
|
|
|
|
|
((alignment == RGN_ALIGN_LEFT) && (edge == AE_RIGHT_TO_TOPLEFT)) ||
|
|
|
|
|
((alignment == RGN_ALIGN_RIGHT) && (edge == AE_LEFT_TO_TOPRIGHT));
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-03 16:25:50 +11:00
|
|
|
static void region_scale_exit(wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
MEM_freeN(op->customdata);
|
|
|
|
|
op->customdata = NULL;
|
|
|
|
|
|
|
|
|
|
G.moving &= ~G_TRANSFORM_WM;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
sActionzoneData *sad = event->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->type != EVT_ACTIONZONE_REGION) {
|
2012-10-21 05:46:41 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
|
2009-12-10 03:07:04 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
AZone *az = sad->az;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (az->region) {
|
2012-05-08 11:48:19 +00:00
|
|
|
RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = rmd;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
rmd->az = az;
|
2019-08-18 16:34:39 +02:00
|
|
|
/* special case for region within region - this allows the scale of
|
|
|
|
|
* the parent region if the azone edge is not the edge splitting
|
|
|
|
|
* both regions */
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((az->region->alignment & RGN_SPLIT_PREV) && az->region->prev &&
|
|
|
|
|
!is_split_edge(RGN_ALIGN_ENUM_FROM_MASK(az->region->alignment), az->edge)) {
|
|
|
|
|
rmd->region = az->region->prev;
|
2019-08-18 16:34:39 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region = az->region;
|
2019-08-18 16:34:39 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
rmd->area = sad->sa1;
|
2012-05-08 11:48:19 +00:00
|
|
|
rmd->edge = az->edge;
|
|
|
|
|
rmd->origx = event->x;
|
|
|
|
|
rmd->origy = event->y;
|
2020-04-03 13:25:03 +02:00
|
|
|
rmd->maxsize = area_max_regionsize(rmd->area, rmd->region, rmd->edge);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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
|
|
|
/* if not set we do now, otherwise it uses type */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->sizex == 0) {
|
|
|
|
|
rmd->region->sizex = rmd->region->winx;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->sizey == 0) {
|
|
|
|
|
rmd->region->sizey = rmd->region->winy;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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
|
|
|
/* now copy to regionmovedata */
|
2020-11-06 12:30:59 +11:00
|
|
|
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->origval = rmd->region->sizex;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->origval = rmd->region->sizey;
|
2009-12-10 09:25:30 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
CLAMP(rmd->maxsize, 0, 1000);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* add temp handler */
|
2020-01-03 16:25:50 +11:00
|
|
|
G.moving |= G_TRANSFORM_WM;
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-23 12:56:48 +00:00
|
|
|
static void region_scale_validate_size(RegionMoveData *rmd)
|
|
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
|
2012-05-08 11:48:19 +00:00
|
|
|
short *size, maxsize = -1;
|
2011-12-23 12:56:48 +00:00
|
|
|
|
2020-11-06 12:30:59 +11:00
|
|
|
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
size = &rmd->region->sizex;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
size = &rmd->region->sizey;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2011-12-23 12:56:48 +00:00
|
|
|
|
2019-04-03 14:53:57 +02:00
|
|
|
maxsize = rmd->maxsize - (UI_UNIT_Y / UI_DPI_FAC);
|
2011-12-23 12:56:48 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (*size > maxsize && maxsize > 0) {
|
2012-05-08 11:48:19 +00:00
|
|
|
*size = maxsize;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2011-12-23 12:56:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd)
|
|
|
|
|
{
|
2015-06-29 20:46:23 +10:00
|
|
|
/* hidden areas may have bad 'View2D.cur' value,
|
|
|
|
|
* correct before displaying. see T45156 */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->flag & RGN_FLAG_HIDDEN) {
|
|
|
|
|
UI_view2d_curRect_validate(&rmd->region->v2d);
|
2015-06-29 20:46:23 +10:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
region_toggle_hidden(C, rmd->region, 0);
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_validate_size(rmd);
|
2019-04-18 21:13:22 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
|
|
|
|
|
if (rmd->region->regiontype == RGN_TYPE_HEADER) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ARegion *region_tool_header = BKE_area_find_region_type(rmd->area, RGN_TYPE_TOOL_HEADER);
|
2020-04-03 12:51:03 +02:00
|
|
|
if (region_tool_header != NULL) {
|
|
|
|
|
if ((region_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER) == 0 &&
|
|
|
|
|
(region_tool_header->flag & RGN_FLAG_HIDDEN) != 0) {
|
|
|
|
|
region_toggle_hidden(C, region_tool_header, 0);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-12-23 12:56:48 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
RegionMoveData *rmd = op->customdata;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
int delta;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
/* execute the events */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
case MOUSEMOVE: {
|
2020-03-06 16:56:42 +01:00
|
|
|
const float aspect = BLI_rctf_size_x(&rmd->region->v2d.cur) /
|
|
|
|
|
(BLI_rcti_size_x(&rmd->region->v2d.mask) + 1);
|
2018-06-12 22:00:22 +02:00
|
|
|
const int snap_size_threshold = (U.widget_unit * 2) / aspect;
|
2020-11-06 12:30:59 +11:00
|
|
|
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
2012-05-08 11:48:19 +00:00
|
|
|
delta = event->x - rmd->origx;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (rmd->edge == AE_LEFT_TO_TOPRIGHT) {
|
2012-05-08 11:48:19 +00:00
|
|
|
delta = -delta;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-19 15:44:47 +00:00
|
|
|
/* region sizes now get multiplied */
|
|
|
|
|
delta /= UI_DPI_FAC;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-01-03 16:40:10 +11:00
|
|
|
const int size_no_snap = rmd->origval + delta;
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizex = size_no_snap;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->type->snap_size) {
|
|
|
|
|
short sizex_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizex, 0);
|
2020-03-06 17:18:10 +01:00
|
|
|
if (abs(rmd->region->sizex - sizex_test) < snap_size_threshold) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizex = sizex_test;
|
2018-04-26 12:01:44 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
CLAMP(rmd->region->sizex, 0, rmd->maxsize);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-01-03 16:40:10 +11:00
|
|
|
if (size_no_snap < UI_UNIT_X / aspect) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizex = rmd->origval;
|
|
|
|
|
if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_toggle_hidden(C, rmd);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_toggle_hidden(C, rmd);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
|
|
|
|
|
rmd->region->sizex = rmd->origval;
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
delta = event->y - rmd->origy;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) {
|
2012-05-08 11:48:19 +00:00
|
|
|
delta = -delta;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-19 15:44:47 +00:00
|
|
|
/* region sizes now get multiplied */
|
|
|
|
|
delta /= UI_DPI_FAC;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-01-03 16:40:10 +11:00
|
|
|
const int size_no_snap = rmd->origval + delta;
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizey = size_no_snap;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->type->snap_size) {
|
|
|
|
|
short sizey_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizey, 1);
|
2020-03-06 17:18:10 +01:00
|
|
|
if (abs(rmd->region->sizey - sizey_test) < snap_size_threshold) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizey = sizey_test;
|
2018-04-26 12:01:44 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
CLAMP(rmd->region->sizey, 0, rmd->maxsize);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-05 13:48:26 +02:00
|
|
|
/* note, 'UI_UNIT_Y/4' means you need to drag the footer and execute region
|
|
|
|
|
* almost all the way down for it to become hidden, this is done
|
2011-06-05 09:00:36 +00:00
|
|
|
* otherwise its too easy to do this by accident */
|
2020-01-03 16:40:10 +11:00
|
|
|
if (size_no_snap < (UI_UNIT_Y / 4) / aspect) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rmd->region->sizey = rmd->origval;
|
|
|
|
|
if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_toggle_hidden(C, rmd);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_toggle_hidden(C, rmd);
|
2019-01-04 21:40:16 +01:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
|
|
|
|
|
rmd->region->sizey = rmd->origval;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(rmd->area);
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
break;
|
2018-04-26 12:01:44 +02:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
case LEFTMOUSE:
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->val == KM_RELEASE) {
|
2019-03-20 22:14:13 +11:00
|
|
|
if (len_manhattan_v2v2_int(&event->x, &rmd->origx) <= WM_EVENT_CURSOR_MOTION_THRESHOLD) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rmd->region->flag & RGN_FLAG_HIDDEN) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_toggle_hidden(C, rmd);
|
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (rmd->region->flag & RGN_FLAG_TOO_SMALL) {
|
2011-12-23 12:56:48 +00:00
|
|
|
region_scale_validate_size(rmd);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(rmd->area);
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2020-01-03 16:25:50 +11:00
|
|
|
|
|
|
|
|
region_scale_exit(op);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2012-10-21 07:58:38 +00:00
|
|
|
break;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
|
2011-06-06 11:04:54 +00:00
|
|
|
{
|
2020-01-03 16:25:50 +11:00
|
|
|
region_scale_exit(op);
|
2011-06-06 11:04:54 +00:00
|
|
|
}
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
|
|
|
|
static void SCREEN_OT_region_scale(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Scale Region Size";
|
|
|
|
|
ot->description = "Scale selected area";
|
|
|
|
|
ot->idname = "SCREEN_OT_region_scale";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = region_scale_invoke;
|
|
|
|
|
ot->modal = region_scale_modal;
|
|
|
|
|
ot->cancel = region_scale_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_areaactive;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-02-26 13:48:41 +11:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Frame Change Operator
|
|
|
|
|
* \{ */
|
2008-12-17 16:21:14 +00:00
|
|
|
|
2015-02-12 23:51:02 +11:00
|
|
|
static void areas_do_frame_follow(bContext *C, bool middle)
|
|
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen_ctx = CTX_wm_screen(C);
|
2015-02-12 13:08:22 +01:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (wmWindow *, window, &wm->windows) {
|
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
|
|
|
const bScreen *screen = WM_window_get_active_screen(window);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
2015-02-12 13:08:22 +01:00
|
|
|
/* do follow here if editor type supports it */
|
2020-04-03 14:23:21 +02:00
|
|
|
if ((screen_ctx->redraws_flag & TIME_FOLLOW)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((region->regiontype == RGN_TYPE_WINDOW &&
|
2020-04-03 13:25:03 +02:00
|
|
|
ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
|
|
|
|
|
(area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
float w = BLI_rctf_size_x(®ion->v2d.cur);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-12 13:08:22 +01:00
|
|
|
if (middle) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((scene->r.cfra < region->v2d.cur.xmin) ||
|
|
|
|
|
(scene->r.cfra > region->v2d.cur.xmax)) {
|
|
|
|
|
region->v2d.cur.xmax = scene->r.cfra + (w / 2);
|
|
|
|
|
region->v2d.cur.xmin = scene->r.cfra - (w / 2);
|
2015-02-12 13:08:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (scene->r.cfra < region->v2d.cur.xmin) {
|
|
|
|
|
region->v2d.cur.xmax = scene->r.cfra;
|
|
|
|
|
region->v2d.cur.xmin = region->v2d.cur.xmax - w;
|
2015-02-12 13:08:22 +01:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (scene->r.cfra > region->v2d.cur.xmax) {
|
|
|
|
|
region->v2d.cur.xmin = scene->r.cfra;
|
|
|
|
|
region->v2d.cur.xmax = region->v2d.cur.xmin + w;
|
2015-02-12 13:08:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-17 16:21:14 +00:00
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int frame_offset_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int delta = RNA_int_get(op->ptr, "delta");
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2012-02-12 11:42:17 +00:00
|
|
|
CFRA += delta;
|
|
|
|
|
FRAMENUMBER_MIN_CLAMP(CFRA);
|
2020-11-06 11:25:27 +11:00
|
|
|
SUBFRA = 0.0f;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-12 13:08:22 +01:00
|
|
|
areas_do_frame_follow(C, false);
|
|
|
|
|
|
2019-06-04 16:52:48 +02:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2014-04-30 07:48:54 +10:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-17 16:21:14 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_frame_offset(wmOperatorType *ot)
|
2008-12-17 16:21:14 +00:00
|
|
|
{
|
|
|
|
|
ot->name = "Frame Offset";
|
2008-12-26 11:11:21 +00:00
|
|
|
ot->idname = "SCREEN_OT_frame_offset";
|
2012-05-06 15:03:31 +00:00
|
|
|
ot->description = "Move current frame forward/backward by a given number";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = frame_offset_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
ot->flag = OPTYPE_UNDO_GROUPED;
|
2018-06-13 18:38:38 +02:00
|
|
|
ot->undo_group = "Frame Change";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-17 16:21:14 +00:00
|
|
|
/* rna */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
|
2008-12-17 16:21:14 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Frame Jump Operator
|
|
|
|
|
* \{ */
|
2009-08-02 07:08:51 +00:00
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int frame_jump_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
wmTimer *animtimer = CTX_wm_screen(C)->animtimer;
|
2010-10-11 10:40:34 +00:00
|
|
|
|
|
|
|
|
/* Don't change CFRA directly if animtimer is running as this can cause
|
|
|
|
|
* first/last frame not to be actually shown (bad since for example physics
|
|
|
|
|
* simulations aren't reset properly).
|
|
|
|
|
*/
|
2012-03-24 06:38:07 +00:00
|
|
|
if (animtimer) {
|
2010-10-11 10:40:34 +00:00
|
|
|
ScreenAnimData *sad = animtimer->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-10-11 10:40:34 +00:00
|
|
|
sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (RNA_boolean_get(op->ptr, "end")) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->nextfra = PEFRA;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
sad->nextfra = PSFRA;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-10-11 10:40:34 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (RNA_boolean_get(op->ptr, "end")) {
|
2012-05-08 11:48:19 +00:00
|
|
|
CFRA = PEFRA;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-08 11:48:19 +00:00
|
|
|
CFRA = PSFRA;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-02-12 13:08:22 +01:00
|
|
|
areas_do_frame_follow(C, true);
|
|
|
|
|
|
2019-06-04 16:52:48 +02:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
|
2010-02-10 23:15:12 +00:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2010-10-11 10:40:34 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-02 07:08:51 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_frame_jump(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
ot->name = "Jump to Endpoint";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Jump to first/last frame in frame range";
|
2009-08-02 07:08:51 +00:00
|
|
|
ot->idname = "SCREEN_OT_frame_jump";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = frame_jump_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
ot->flag = OPTYPE_UNDO_GROUPED;
|
2018-06-13 18:38:38 +02:00
|
|
|
ot->undo_group = "Frame Change";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-02 07:08:51 +00:00
|
|
|
/* rna */
|
2011-09-19 12:26:20 +00:00
|
|
|
RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range");
|
2009-08-02 07:08:51 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2009-08-02 07:08:51 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Jump to Key-Frame Operator
|
|
|
|
|
* \{ */
|
2009-07-24 13:34:45 +00:00
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int keyframe_jump_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
Object *ob = CTX_data_active_object(C);
|
|
|
|
|
bDopeSheet ads = {NULL};
|
2014-02-03 18:55:59 +11:00
|
|
|
const bool next = RNA_boolean_get(op->ptr, "next");
|
|
|
|
|
bool done = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-24 13:34:45 +00:00
|
|
|
/* sanity checks */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (scene == NULL) {
|
2009-07-24 13:34:45 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
float cfra = (float)(CFRA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-24 13:34:45 +00:00
|
|
|
/* init binarytree-list for getting keyframes */
|
2020-10-16 21:56:58 -05:00
|
|
|
DLRBT_Tree keys;
|
2009-07-24 13:34:45 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-26 03:36:34 +12:00
|
|
|
/* seed up dummy dopesheet context with flags to perform necessary filtering */
|
|
|
|
|
if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) {
|
|
|
|
|
/* only selected channels are included */
|
|
|
|
|
ads.filterflag |= ADS_FILTER_ONLYSEL;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-24 13:34:45 +00:00
|
|
|
/* populate tree with keyframe nodes */
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
scene_to_keylist(&ads, scene, &keys, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
if (ob) {
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
ob_to_keylist(&ads, ob, &keys, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
if (ob->type == OB_GPENCIL) {
|
|
|
|
|
const bool active = !(scene->flag & SCE_KEYS_NO_SELONLY);
|
|
|
|
|
gpencil_to_keylist(&ads, ob->data, &keys, active);
|
|
|
|
|
}
|
2015-12-13 21:03:13 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
{
|
2012-07-27 10:55:24 +00:00
|
|
|
Mask *mask = CTX_data_edit_mask(C);
|
|
|
|
|
if (mask) {
|
|
|
|
|
MaskLayer *masklay = BKE_mask_layer_active(mask);
|
|
|
|
|
mask_to_keylist(&ads, masklay, &keys);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* find matching keyframe in the right direction */
|
2020-10-16 21:56:58 -05:00
|
|
|
ActKeyColumn *ak;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (next) {
|
2017-07-17 02:24:45 +12:00
|
|
|
ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2017-07-17 02:24:45 +12:00
|
|
|
ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-07-17 02:24:45 +12:00
|
|
|
while ((ak != NULL) && (done == false)) {
|
|
|
|
|
if (CFRA != (int)ak->cfra) {
|
|
|
|
|
/* this changes the frame, so set the frame and we're done */
|
|
|
|
|
CFRA = (int)ak->cfra;
|
|
|
|
|
done = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* take another step... */
|
|
|
|
|
if (next) {
|
|
|
|
|
ak = ak->next;
|
2010-06-08 00:08:45 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-07-17 02:24:45 +12:00
|
|
|
ak = ak->prev;
|
2010-06-08 00:08:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
2017-07-17 02:24:45 +12:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-24 13:34:45 +00:00
|
|
|
/* free temp stuff */
|
|
|
|
|
BLI_dlrbTree_free(&keys);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-27 11:22:06 +00:00
|
|
|
/* any success? */
|
2014-04-01 11:34:00 +11:00
|
|
|
if (done == false) {
|
2012-05-27 11:22:06 +00:00
|
|
|
BKE_report(op->reports, RPT_INFO, "No more keyframes to jump to in this direction");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-27 11:22:06 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
areas_do_frame_follow(C, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
|
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2009-07-24 13:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
ot->name = "Jump to Keyframe";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Jump to previous/next keyframe";
|
2009-07-24 13:34:45 +00:00
|
|
|
ot->idname = "SCREEN_OT_keyframe_jump";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = keyframe_jump_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
ot->flag = OPTYPE_UNDO_GROUPED;
|
2018-06-13 18:38:38 +02:00
|
|
|
ot->undo_group = "Frame Change";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-08-23 07:39:51 +00:00
|
|
|
/* properties */
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_def_boolean(ot->srna, "next", true, "Next Keyframe", "");
|
2009-07-24 13:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Jump to Marker Operator
|
|
|
|
|
* \{ */
|
2013-10-21 15:00:22 +00:00
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int marker_jump_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2014-01-10 01:01:23 +13:00
|
|
|
int closest = CFRA;
|
2014-02-03 18:55:59 +11:00
|
|
|
const bool next = RNA_boolean_get(op->ptr, "next");
|
2013-10-21 15:00:22 +00:00
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
|
|
/* find matching marker in the right direction */
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
|
2013-10-21 15:00:22 +00:00
|
|
|
if (next) {
|
2014-01-10 01:01:23 +13:00
|
|
|
if ((marker->frame > CFRA) && (!found || closest > marker->frame)) {
|
2013-10-21 15:00:22 +00:00
|
|
|
closest = marker->frame;
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
2013-10-21 23:35:08 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2014-01-10 01:01:23 +13:00
|
|
|
if ((marker->frame < CFRA) && (!found || closest < marker->frame)) {
|
2013-10-21 15:00:22 +00:00
|
|
|
closest = marker->frame;
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* any success? */
|
|
|
|
|
if (!found) {
|
|
|
|
|
BKE_report(op->reports, RPT_INFO, "No more markers to jump to in this direction");
|
|
|
|
|
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
CFRA = closest;
|
2015-02-12 13:08:22 +01:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
areas_do_frame_follow(C, true);
|
2013-10-21 15:00:22 +00:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
|
2013-10-21 15:00:22 +00:00
|
|
|
|
2020-07-03 16:01:15 +02:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
|
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
2013-10-21 15:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_marker_jump(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
ot->name = "Jump to Marker";
|
|
|
|
|
ot->description = "Jump to previous/next marker";
|
|
|
|
|
ot->idname = "SCREEN_OT_marker_jump";
|
|
|
|
|
|
|
|
|
|
ot->exec = marker_jump_exec;
|
|
|
|
|
|
|
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.
The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.
This complements rB13ee9b8e
Design with help by Sergey Sharybin.
Reviewers: sergey, mont29
Reviewed By: mont29, sergey
Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker
Differential Revision: https://developer.blender.org/D2330
2016-11-15 11:50:11 +01:00
|
|
|
ot->flag = OPTYPE_UNDO_GROUPED;
|
2018-06-13 18:38:38 +02:00
|
|
|
ot->undo_group = "Frame Change";
|
2013-10-21 15:00:22 +00:00
|
|
|
|
|
|
|
|
/* properties */
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_def_boolean(ot->srna, "next", true, "Next Marker", "");
|
2013-10-21 15:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Set Screen Operator
|
|
|
|
|
* \{ */
|
2008-12-17 17:33:45 +00:00
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
|
|
|
|
static int screen_set_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
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
|
|
|
WorkSpace *workspace = CTX_wm_workspace(C);
|
2012-05-08 11:48:19 +00:00
|
|
|
int delta = RNA_int_get(op->ptr, "delta");
|
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
|
|
|
|
|
|
|
|
if (ED_workspace_layout_cycle(workspace, delta, C)) {
|
2008-12-17 17:33:45 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
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
|
|
|
|
2008-12-17 17:33:45 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_screen_set(wmOperatorType *ot)
|
2008-12-17 17:33:45 +00:00
|
|
|
{
|
|
|
|
|
ot->name = "Set Screen";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Cycle through available screens";
|
2008-12-26 11:11:21 +00:00
|
|
|
ot->idname = "SCREEN_OT_screen_set";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_set_exec;
|
|
|
|
|
ot->poll = ED_operator_screenactive;
|
2014-02-26 13:48:41 +11:00
|
|
|
|
2008-12-17 17:33:45 +00:00
|
|
|
/* rna */
|
2020-03-26 12:49:10 +11:00
|
|
|
RNA_def_int(ot->srna, "delta", 1, -1, 1, "Delta", "", -1, 1);
|
2008-12-17 17:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2008-12-17 19:40:19 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Screen Full-Area Operator
|
|
|
|
|
* \{ */
|
2008-12-17 19:40:19 +00:00
|
|
|
|
|
|
|
|
/* function to be called outside UI context, or for redo */
|
2014-10-14 15:05:44 -03:00
|
|
|
static int screen_maximize_area_exec(bContext *C, wmOperator *op)
|
2008-12-17 19:40:19 +00:00
|
|
|
{
|
2011-04-02 14:11:13 +00:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = NULL;
|
2014-10-14 15:05:44 -03:00
|
|
|
const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-23 13:56:57 +01:00
|
|
|
BLI_assert(!screen->temp);
|
|
|
|
|
|
2011-04-02 14:11:13 +00:00
|
|
|
/* search current screen for 'fullscreen' areas */
|
|
|
|
|
/* prevents restoring info header, when mouse is over it */
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
|
|
|
|
|
if (area_iter->full) {
|
|
|
|
|
area = area_iter;
|
2011-04-02 14:11:13 +00:00
|
|
|
break;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2011-04-02 14:11:13 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area == NULL) {
|
|
|
|
|
area = CTX_wm_area(C);
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-14 15:05:44 -03:00
|
|
|
if (hide_panels) {
|
|
|
|
|
if (!ELEM(screen->state, SCREENNORMAL, SCREENFULL)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_screen_state_toggle(C, CTX_wm_window(C), area, SCREENFULL);
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (!ELEM(screen->state, SCREENNORMAL, SCREENMAXIMIZED)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_screen_state_toggle(C, CTX_wm_window(C), area, SCREENMAXIMIZED);
|
2014-10-14 15:05:44 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-17 19:40:19 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 12:03:56 +02:00
|
|
|
static bool screen_maximize_area_poll(bContext *C)
|
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
|
|
|
{
|
2020-12-23 13:56:57 +01:00
|
|
|
const wmWindow *win = CTX_wm_window(C);
|
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
|
|
|
const bScreen *screen = CTX_wm_screen(C);
|
|
|
|
|
const ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
return ED_operator_areaactive(C) &&
|
2018-05-23 22:38:25 +02:00
|
|
|
/* Don't allow maximizing global areas but allow minimizing from them. */
|
2020-12-23 13:56:57 +01:00
|
|
|
((screen->state != SCREENNORMAL) || !ED_area_is_global(area)) &&
|
|
|
|
|
/* Don't change temporary screens. */
|
|
|
|
|
!WM_window_is_temp_screen(win);
|
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
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
|
2008-12-17 19:40:19 +00:00
|
|
|
{
|
2014-10-14 15:05:44 -03:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2016-06-22 07:41:25 +10:00
|
|
|
ot->name = "Toggle Maximize Area";
|
2014-10-14 15:05:44 -03:00
|
|
|
ot->description = "Toggle display selected area as fullscreen/maximized";
|
2008-12-26 11:11:21 +00:00
|
|
|
ot->idname = "SCREEN_OT_screen_full_area";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-10-14 15:05:44 -03:00
|
|
|
ot->exec = screen_maximize_area_exec;
|
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
|
|
|
ot->poll = screen_maximize_area_poll;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = 0;
|
2008-12-17 17:33:45 +00:00
|
|
|
|
2014-10-14 15:05:44 -03:00
|
|
|
prop = RNA_def_boolean(ot->srna, "use_hide_panels", false, "Hide Panels", "Hide all the panels");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
|
|
|
|
}
|
2008-12-17 17:33:45 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Screen Join-Area Operator
|
|
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* operator state vars used:
|
2012-03-03 16:31:46 +00:00
|
|
|
* x1, y1 mouse coord in first area, which will disappear
|
|
|
|
|
* x2, y2 mouse coord in 2nd area, which will become joined
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* functions:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
|
|
|
|
* init() find edge based on state vars
|
|
|
|
|
* test if the edge divides two areas,
|
2012-03-03 16:31:46 +00:00
|
|
|
* store active and nonactive area,
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* apply() do the actual join
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exit() cleanup, send notifier
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
|
|
|
|
* exec() calls init, apply, exit
|
|
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* invoke() sets mouse coords in x,y
|
|
|
|
|
* call init()
|
|
|
|
|
* add modal handler
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* modal() accept modal events while doing it
|
|
|
|
|
* call apply() with active window and nonactive window
|
|
|
|
|
* call exit() and remove handler when LMB confirm
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
typedef struct sAreaJoinData {
|
2018-01-19 17:14:27 +11:00
|
|
|
ScrArea *sa1; /* first area to be considered */
|
|
|
|
|
ScrArea *sa2; /* second area to be considered */
|
|
|
|
|
void *draw_callback; /* call `ED_screen_draw_join_shape` */
|
2011-08-25 15:49:52 +00:00
|
|
|
|
|
|
|
|
} sAreaJoinData;
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-01-19 17:14:27 +11:00
|
|
|
static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
|
|
|
|
|
{
|
|
|
|
|
const wmOperator *op = userdata;
|
|
|
|
|
|
|
|
|
|
sAreaJoinData *sd = op->customdata;
|
|
|
|
|
if (sd->sa1 && sd->sa2) {
|
|
|
|
|
ED_screen_draw_join_shape(sd->sa1, sd->sa2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* validate selection inside screen, set variables OK */
|
2020-09-08 13:54:39 -05:00
|
|
|
/* return false: init failed */
|
|
|
|
|
static bool area_join_init(bContext *C, wmOperator *op, ScrArea *sa1, ScrArea *sa2)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2019-08-22 13:19:11 -07:00
|
|
|
if (sa1 == NULL || sa2 == NULL) {
|
|
|
|
|
/* Get areas from cursor location if not specified. */
|
|
|
|
|
int cursor[2];
|
|
|
|
|
RNA_int_get_array(op->ptr, "cursor", cursor);
|
|
|
|
|
screen_area_edge_from_cursor(C, cursor, &sa1, &sa2);
|
2018-07-02 16:48:18 +02:00
|
|
|
}
|
2019-08-22 13:19:11 -07:00
|
|
|
if (sa1 == NULL || sa2 == NULL) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2018-07-02 16:48:18 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-08-22 13:19:11 -07:00
|
|
|
sAreaJoinData *jd = MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
|
2018-01-19 17:14:27 +11:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
jd->sa1 = sa1;
|
|
|
|
|
jd->sa2 = sa2;
|
2018-01-19 17:14:27 +11:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
op->customdata = jd;
|
2018-01-19 17:14:27 +11:00
|
|
|
|
|
|
|
|
jd->draw_callback = WM_draw_cb_activate(CTX_wm_window(C), area_join_draw_cb, op);
|
|
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* apply the join of the areas (space types) */
|
2020-09-08 13:54:39 -05:00
|
|
|
static bool area_join_apply(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!jd) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2008-12-18 02:56:48 +00:00
|
|
|
if (CTX_wm_area(C) == jd->sa2) {
|
|
|
|
|
CTX_wm_area_set(C, NULL);
|
2008-12-18 19:41:36 +00:00
|
|
|
CTX_wm_region_set(C, NULL);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* finish operation */
|
|
|
|
|
static void area_join_exit(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2018-01-19 17:14:27 +11:00
|
|
|
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
|
|
|
|
|
|
|
|
|
|
if (jd) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (jd->draw_callback) {
|
2018-01-19 17:14:27 +11:00
|
|
|
WM_draw_cb_exit(CTX_wm_window(C), jd->draw_callback);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-01-19 17:14:27 +11:00
|
|
|
|
|
|
|
|
MEM_freeN(jd);
|
2008-11-19 16:28:11 +00:00
|
|
|
op->customdata = NULL;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* this makes sure aligned edges will result in aligned grabbing */
|
2018-04-13 21:43:57 +02:00
|
|
|
BKE_screen_remove_double_scredges(CTX_wm_screen(C));
|
|
|
|
|
BKE_screen_remove_unused_scredges(CTX_wm_screen(C));
|
|
|
|
|
BKE_screen_remove_unused_scrverts(CTX_wm_screen(C));
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int area_join_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2019-08-22 13:19:11 -07:00
|
|
|
if (!area_join_init(C, op, NULL, NULL)) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_join_apply(C, op);
|
|
|
|
|
area_join_exit(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* interaction callback */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->type == EVT_ACTIONZONE_AREA) {
|
|
|
|
|
sActionzoneData *sad = event->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-09-14 06:17:14 +00:00
|
|
|
if (sad == NULL || sad->modifier > 0) {
|
2009-03-05 23:19:44 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* verify *sad itself */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad->sa1 == NULL || sad->sa2 == NULL) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* is this our *sad? if areas equal it should be passed on */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sad->sa1 == sad->sa2) {
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (!area_join_init(C, op, sad->sa1, sad->sa2)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2019-08-22 13:19:11 -07:00
|
|
|
}
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
/* add temp handler */
|
2018-07-02 16:48:18 +02:00
|
|
|
WM_event_add_modal_handler(C, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-30 23:08:53 +00:00
|
|
|
static void area_join_cancel(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_join_exit(C, op);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* modal callback while selecting area (space) that will be removed */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2019-02-21 17:22:51 +01:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2019-08-22 13:19:11 -07:00
|
|
|
|
|
|
|
|
if (op->customdata == NULL) {
|
2019-08-26 13:39:25 -07:00
|
|
|
if (!area_join_init(C, op, NULL, NULL)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2019-08-22 13:19:11 -07:00
|
|
|
}
|
2020-10-16 21:56:58 -05:00
|
|
|
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* execute the events */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event->type) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
case MOUSEMOVE: {
|
2020-04-03 14:23:21 +02:00
|
|
|
ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y);
|
2019-02-21 17:22:51 +01:00
|
|
|
int dir = -1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area) {
|
|
|
|
|
if (jd->sa1 != area) {
|
|
|
|
|
dir = area_getorientation(jd->sa1, area);
|
2014-02-03 18:59:36 +11:00
|
|
|
if (dir != -1) {
|
2020-04-03 13:25:03 +02:00
|
|
|
jd->sa2 = area;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
else {
|
2018-06-04 09:31:30 +02:00
|
|
|
/* we are not bordering on the previously selected area
|
2012-03-03 16:31:46 +00:00
|
|
|
* we check if area has common border with the one marked for removal
|
|
|
|
|
* in this case we can swap areas.
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2020-04-03 13:25:03 +02:00
|
|
|
dir = area_getorientation(area, jd->sa2);
|
2014-02-03 18:59:36 +11:00
|
|
|
if (dir != -1) {
|
2008-11-19 16:28:11 +00:00
|
|
|
jd->sa1 = jd->sa2;
|
2020-04-03 13:25:03 +02:00
|
|
|
jd->sa2 = area;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
else {
|
2009-12-10 09:25:30 +00:00
|
|
|
jd->sa2 = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
else {
|
2018-06-04 09:31:30 +02:00
|
|
|
/* we are back in the area previously selected for keeping
|
2012-05-16 23:37:23 +00:00
|
|
|
* we swap the areas if possible to allow user to choose */
|
2009-12-10 09:25:30 +00:00
|
|
|
if (jd->sa2 != NULL) {
|
|
|
|
|
jd->sa1 = jd->sa2;
|
2020-04-03 13:25:03 +02:00
|
|
|
jd->sa2 = area;
|
2010-10-14 12:24:08 +00:00
|
|
|
dir = area_getorientation(jd->sa1, jd->sa2);
|
2014-02-03 18:59:36 +11:00
|
|
|
if (dir == -1) {
|
2009-12-10 09:25:30 +00:00
|
|
|
printf("oops, didn't expect that!\n");
|
|
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
dir = area_getorientation(jd->sa1, area);
|
2014-02-03 18:59:36 +11:00
|
|
|
if (dir != -1) {
|
2020-04-03 13:25:03 +02:00
|
|
|
jd->sa2 = area;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-12-10 09:25:30 +00:00
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (dir == 1) {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_N_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (dir == 3) {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_S_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (dir == 2) {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_E_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else if (dir == 0) {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_W_ARROW);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2019-09-26 14:31:48 +02:00
|
|
|
WM_cursor_set(win, WM_CURSOR_STOP);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2009-12-10 09:25:30 +00:00
|
|
|
}
|
2008-11-19 16:28:11 +00:00
|
|
|
case LEFTMOUSE:
|
2012-05-08 11:48:19 +00:00
|
|
|
if (event->val == KM_RELEASE) {
|
2010-01-16 22:56:52 +00:00
|
|
|
ED_area_tag_redraw(jd->sa1);
|
|
|
|
|
ED_area_tag_redraw(jd->sa2);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
area_join_apply(C, op);
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2008-11-19 16:28:11 +00:00
|
|
|
area_join_exit(C, op);
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-12-04 01:21:55 +00:00
|
|
|
case RIGHTMOUSE:
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2013-10-30 23:08:53 +00:00
|
|
|
area_join_cancel(C, op);
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Operator for joining two areas (space types) */
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_area_join(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-05-19 09:46:41 +00:00
|
|
|
ot->name = "Join Area";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Join selected areas into new window";
|
|
|
|
|
ot->idname = "SCREEN_OT_area_join";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = area_join_exec;
|
|
|
|
|
ot->invoke = area_join_invoke;
|
|
|
|
|
ot->modal = area_join_modal;
|
|
|
|
|
ot->poll = screen_active_editable;
|
|
|
|
|
ot->cancel = area_join_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-02-26 13:48:41 +11:00
|
|
|
/* flags */
|
2012-05-08 11:48:19 +00:00
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
/* rna */
|
2019-08-22 13:19:11 -07:00
|
|
|
RNA_def_int_vector(
|
|
|
|
|
ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Screen Area Options Operator
|
|
|
|
|
* \{ */
|
2011-03-02 14:09:54 +00:00
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2011-03-02 14:09:54 +00:00
|
|
|
{
|
2019-08-22 13:19:11 -07:00
|
|
|
ScrArea *sa1, *sa2;
|
|
|
|
|
if (screen_area_edge_from_cursor(C, &event->x, &sa1, &sa2) == NULL) {
|
2012-05-08 11:48:19 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-08-22 13:19:11 -07:00
|
|
|
/* Vertical Split */
|
2020-10-16 21:56:58 -05:00
|
|
|
PointerRNA ptr;
|
2019-08-22 13:19:11 -07:00
|
|
|
uiItemFullO(layout,
|
|
|
|
|
"SCREEN_OT_area_split",
|
|
|
|
|
IFACE_("Vertical Split"),
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
WM_OP_INVOKE_DEFAULT,
|
|
|
|
|
0,
|
|
|
|
|
&ptr);
|
|
|
|
|
/* store initial mouse cursor position. */
|
2018-07-02 12:24:21 +02:00
|
|
|
RNA_int_set_array(&ptr, "cursor", &event->x);
|
2019-08-22 13:19:11 -07:00
|
|
|
RNA_enum_set(&ptr, "direction", 'v');
|
|
|
|
|
|
|
|
|
|
/* Horizontal Split */
|
|
|
|
|
uiItemFullO(layout,
|
|
|
|
|
"SCREEN_OT_area_split",
|
|
|
|
|
IFACE_("Horizontal Split"),
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
WM_OP_INVOKE_DEFAULT,
|
|
|
|
|
0,
|
|
|
|
|
&ptr);
|
|
|
|
|
/* store initial mouse cursor position. */
|
|
|
|
|
RNA_int_set_array(&ptr, "cursor", &event->x);
|
|
|
|
|
RNA_enum_set(&ptr, "direction", 'h');
|
|
|
|
|
|
|
|
|
|
if (sa1 && sa2) {
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Join needs two very similar areas. */
|
|
|
|
|
if (sa1 && sa2 && (area_getorientation(sa1, sa2) != -1)) {
|
|
|
|
|
uiItemFullO(layout,
|
|
|
|
|
"SCREEN_OT_area_join",
|
|
|
|
|
IFACE_("Join Areas"),
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
WM_OP_INVOKE_DEFAULT,
|
|
|
|
|
0,
|
|
|
|
|
&ptr);
|
|
|
|
|
RNA_int_set_array(&ptr, "cursor", &event->x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Swap just needs two areas. */
|
|
|
|
|
if (sa1 && sa2) {
|
|
|
|
|
uiItemFullO(layout,
|
|
|
|
|
"SCREEN_OT_area_swap",
|
|
|
|
|
IFACE_("Swap Areas"),
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
WM_OP_EXEC_DEFAULT,
|
|
|
|
|
0,
|
|
|
|
|
&ptr);
|
|
|
|
|
RNA_int_set_array(&ptr, "cursor", &event->x);
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_popup_menu_end(C, pup);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-10-28 17:51:06 +01:00
|
|
|
return OPERATOR_INTERFACE;
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_area_options(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Area Options";
|
|
|
|
|
ot->description = "Operations for splitting and merging";
|
|
|
|
|
ot->idname = "SCREEN_OT_area_options";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-03-02 14:09:54 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = screen_area_options_invoke;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screen_mainwinactive;
|
2014-02-26 13:48:41 +11:00
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_INTERNAL;
|
2011-03-02 14:09:54 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2011-03-02 14:09:54 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Space Data Cleanup Operator
|
|
|
|
|
* \{ */
|
2011-01-06 17:54:17 +00:00
|
|
|
|
2013-07-28 17:06:31 +00:00
|
|
|
static int spacedata_cleanup_exec(bContext *C, wmOperator *op)
|
2011-01-06 17:54:17 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
|
int tot = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
|
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacedata.first != area->spacedata.last) {
|
|
|
|
|
SpaceLink *sl = area->spacedata.first;
|
|
|
|
|
|
|
|
|
|
BLI_remlink(&area->spacedata, sl);
|
|
|
|
|
tot += BLI_listbase_count(&area->spacedata);
|
|
|
|
|
BKE_spacedata_freelist(&area->spacedata);
|
|
|
|
|
BLI_addtail(&area->spacedata, sl);
|
2011-01-06 17:54:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BKE_reportf(op->reports, RPT_INFO, "Removed amount of editors: %d", tot);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-01-06 17:54:17 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2020-12-26 16:50:44 -06:00
|
|
|
ot->name = "Clean Up Space Data";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Remove unused settings for invisible editors";
|
|
|
|
|
ot->idname = "SCREEN_OT_spacedata_cleanup";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-03 19:33:42 +00:00
|
|
|
/* api callbacks */
|
2013-07-28 17:06:31 +00:00
|
|
|
ot->exec = spacedata_cleanup_exec;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = WM_operator_winactive;
|
2011-01-06 17:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Repeat Last Operator
|
|
|
|
|
* \{ */
|
2008-12-03 19:33:42 +00:00
|
|
|
|
2020-01-28 09:33:41 -08:00
|
|
|
static bool repeat_history_poll(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
if (!ED_operator_screenactive(C)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
return !BLI_listbase_is_empty(&wm->operators);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
|
2008-12-03 19:33:42 +00:00
|
|
|
{
|
2017-03-15 05:16:07 +11:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
wmOperator *lastop = wm->operators.last;
|
2017-03-15 02:37:33 +11:00
|
|
|
|
|
|
|
|
/* Seek last registered operator */
|
|
|
|
|
while (lastop) {
|
|
|
|
|
if (lastop->type->flag & OPTYPE_REGISTER) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
lastop = lastop->prev;
|
2017-03-15 02:37:33 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lastop) {
|
2017-03-15 05:16:07 +11:00
|
|
|
WM_operator_free_all_after(wm, lastop);
|
2019-06-24 21:41:17 +10:00
|
|
|
WM_operator_repeat_last(C, lastop);
|
2017-03-15 02:37:33 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-31 19:40:40 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2008-12-03 19:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_repeat_last(wmOperatorType *ot)
|
2008-12-03 19:33:42 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Repeat Last";
|
|
|
|
|
ot->description = "Repeat last action";
|
|
|
|
|
ot->idname = "SCREEN_OT_repeat_last";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
/* api callbacks */
|
|
|
|
|
ot->exec = repeat_last_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-01-28 09:33:41 -08:00
|
|
|
ot->poll = repeat_history_poll;
|
2008-12-03 19:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Repeat History Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
2009-01-15 18:28:40 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
int items = BLI_listbase_count(&wm->operators);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (items == 0) {
|
2009-01-15 18:28:40 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
wmOperator *lastop;
|
|
|
|
|
int i;
|
2019-04-22 09:19:45 +10:00
|
|
|
for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) {
|
2017-03-15 02:37:33 +11:00
|
|
|
if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
|
2019-06-05 14:30:44 +02:00
|
|
|
uiItemIntO(layout,
|
|
|
|
|
WM_operatortype_name(lastop->type, lastop->ptr),
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
op->type->idname,
|
|
|
|
|
"index",
|
|
|
|
|
i);
|
2017-03-15 02:37:33 +11:00
|
|
|
}
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_popup_menu_end(C, pup);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-10-28 17:51:06 +01:00
|
|
|
return OPERATOR_INTERFACE;
|
2009-01-15 18:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int repeat_history_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
op = BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
|
2012-03-24 06:38:07 +00:00
|
|
|
if (op) {
|
2009-01-15 18:28:40 +00:00
|
|
|
/* let's put it as last operator in list */
|
|
|
|
|
BLI_remlink(&wm->operators, op);
|
|
|
|
|
BLI_addtail(&wm->operators, op);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-01 12:00:00 +00:00
|
|
|
WM_operator_repeat(C, op);
|
2009-01-15 18:28:40 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-15 18:28:40 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_repeat_history(wmOperatorType *ot)
|
2009-01-15 18:28:40 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Repeat History";
|
|
|
|
|
ot->description = "Display menu for previous actions performed";
|
|
|
|
|
ot->idname = "SCREEN_OT_repeat_history";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-15 18:28:40 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = repeat_history_invoke;
|
|
|
|
|
ot->exec = repeat_history_exec;
|
2020-01-28 09:33:41 -08:00
|
|
|
ot->poll = repeat_history_poll;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
|
2009-01-15 18:28:40 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Redo Operator
|
|
|
|
|
* \{ */
|
2009-02-04 11:52:16 +00:00
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
|
2009-02-04 11:52:16 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
wmOperator *lastop = WM_operator_last_redo(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (lastop) {
|
2009-05-23 03:24:15 +00:00
|
|
|
WM_operator_redo_popup(C, lastop);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-04 11:52:16 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_redo_last(wmOperatorType *ot)
|
2009-02-04 11:52:16 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Redo Last";
|
2019-08-24 00:45:21 +02:00
|
|
|
ot->description = "Display parameters for last action performed";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->idname = "SCREEN_OT_redo_last";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-04 11:52:16 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->invoke = redo_last_invoke;
|
2020-01-28 09:33:41 -08:00
|
|
|
ot->poll = repeat_history_poll;
|
2009-02-04 11:52:16 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Region Quad-View Operator
|
|
|
|
|
* \{ */
|
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
|
|
|
|
2012-05-27 11:10:27 +00:00
|
|
|
static void view3d_localview_update_rv3d(struct RegionView3D *rv3d)
|
|
|
|
|
{
|
|
|
|
|
if (rv3d->localvd) {
|
|
|
|
|
rv3d->localvd->view = rv3d->view;
|
|
|
|
|
rv3d->localvd->persp = rv3d->persp;
|
|
|
|
|
copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 13:01:05 +00:00
|
|
|
static void region_quadview_init_rv3d(
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area, ARegion *region, const char viewlock, const char view, const char persp)
|
2013-05-08 13:01:05 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
RegionView3D *rv3d = region->regiondata;
|
2013-05-08 13:01:05 +00:00
|
|
|
|
2014-03-25 14:21:50 +11:00
|
|
|
if (persp == RV3D_CAMOB) {
|
|
|
|
|
ED_view3d_lastview_store(rv3d);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 13:01:05 +00:00
|
|
|
rv3d->viewlock = viewlock;
|
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.
Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.
To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.
- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.
Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.
---------------
This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)
Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.
For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.
---------------
A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
first bigger application to adopt OpenXR. Congratulations to them and
ourselves :)
This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report
Differential Revisions: D6193, D7098
Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
|
|
|
rv3d->runtime_viewlock = 0;
|
2013-05-08 13:01:05 +00:00
|
|
|
rv3d->view = view;
|
2020-02-09 11:50:25 +11:00
|
|
|
rv3d->view_axis_roll = RV3D_VIEW_AXIS_ROLL_0;
|
2013-05-08 13:01:05 +00:00
|
|
|
rv3d->persp = persp;
|
|
|
|
|
|
|
|
|
|
ED_view3d_lock(rv3d);
|
|
|
|
|
view3d_localview_update_rv3d(rv3d);
|
|
|
|
|
if ((viewlock & RV3D_BOXCLIP) && (persp == RV3D_ORTHO)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_view3d_quadview_update(area, region, true);
|
2013-05-08 13:01:05 +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
|
|
|
/* insert a region in the area region list */
|
2009-12-04 00:49:02 +00:00
|
|
|
static int region_quadview_exec(bContext *C, wmOperator *op)
|
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
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2019-04-17 06:17:24 +02: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
|
|
|
/* some rules... */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontype != RGN_TYPE_WINDOW) {
|
2019-08-24 08:54:48 +10:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-split");
|
2014-04-26 03:18:18 +10:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->alignment == RGN_ALIGN_QSPLIT) {
|
2014-04-26 03:18:18 +10:00
|
|
|
/* Exit quad-view */
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-20 18:31:11 +00:00
|
|
|
/* keep current region */
|
2020-03-06 16:56:42 +01:00
|
|
|
region->alignment = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacetype == SPACE_VIEW3D) {
|
2020-03-06 16:56:42 +01:00
|
|
|
RegionView3D *rv3d = region->regiondata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-30 03:49:01 +10:00
|
|
|
/* if this is a locked view, use settings from 'User' view */
|
|
|
|
|
if (rv3d->viewlock) {
|
|
|
|
|
View3D *v3d_user;
|
2020-04-03 12:51:03 +02:00
|
|
|
ARegion *region_user;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 12:51:03 +02:00
|
|
|
if (ED_view3d_context_user_region(C, &v3d_user, ®ion_user)) {
|
|
|
|
|
if (region != region_user) {
|
|
|
|
|
SWAP(void *, region->regiondata, region_user->regiondata);
|
2020-03-06 16:56:42 +01:00
|
|
|
rv3d = region->regiondata;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
2014-04-30 03:49:01 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-26 03:18:18 +10:00
|
|
|
rv3d->viewlock_quad = RV3D_VIEWLOCK_INIT;
|
2012-05-08 11:48:19 +00:00
|
|
|
rv3d->viewlock = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-11 17:13:36 +02:00
|
|
|
/* FIXME: This fixes missing update to workbench TAA. (see T76216)
|
|
|
|
|
* However, it would be nice if the tagging should be done in a more conventional way. */
|
|
|
|
|
rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
|
|
|
|
|
|
2019-08-17 00:54:22 +10:00
|
|
|
/* Accumulate locks, in case they're mixed. */
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (ARegion *, region_iter, &area->regionbase) {
|
2020-04-03 12:51:03 +02:00
|
|
|
if (region_iter->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
|
RegionView3D *rv3d_iter = region_iter->regiondata;
|
2014-04-26 03:18:18 +10:00
|
|
|
rv3d->viewlock_quad |= rv3d_iter->viewlock;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
2014-04-26 03:18:18 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
LISTBASE_FOREACH_MUTABLE (ARegion *, region_iter, &area->regionbase) {
|
|
|
|
|
if (region_iter->alignment == RGN_ALIGN_QSPLIT) {
|
|
|
|
|
ED_region_remove(C, area, region_iter);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-01-20 18:31:11 +00:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2009-01-20 18:31:11 +00:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->next) {
|
2019-08-24 08:54:48 +10:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-split");
|
2014-04-26 03:18:18 +10: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
|
|
|
else {
|
2014-04-26 03:18:18 +10:00
|
|
|
/* Enter quad-view */
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
region->alignment = RGN_ALIGN_QSPLIT;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
for (int count = 0; count < 3; count++) {
|
|
|
|
|
ARegion *new_region = BKE_area_region_copy(area->type, region);
|
|
|
|
|
BLI_addtail(&area->regionbase, new_region);
|
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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-20 14:23:32 +00:00
|
|
|
/* lock views and set them */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
View3D *v3d = area->spacedata.first;
|
2014-02-12 11:26:02 +11:00
|
|
|
int index_qsplit = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-08 07:44:30 +00:00
|
|
|
/* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
|
|
|
|
|
* otherwise when restoring rv3d->localvd the 'viewquat' won't
|
2020-09-30 20:09:02 +10:00
|
|
|
* match the 'view', set on entering localview See: T26315,
|
2011-03-08 07:44:30 +00:00
|
|
|
*
|
|
|
|
|
* We could avoid manipulating rv3d->localvd here if exiting
|
|
|
|
|
* localview with a 4-split would assign these view locks */
|
2020-03-06 16:56:42 +01:00
|
|
|
RegionView3D *rv3d = region->regiondata;
|
2013-05-08 13:01:05 +00:00
|
|
|
const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ?
|
|
|
|
|
(rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) :
|
VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.
Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.
To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.
- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.
Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.
---------------
This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)
Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.
For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.
---------------
A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
first bigger application to adopt OpenXR. Congratulations to them and
ourselves :)
This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report
Differential Revisions: D6193, D7098
Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 20:20:55 +01:00
|
|
|
RV3D_LOCK_ROTATION;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-12 11:26:02 +11:00
|
|
|
region_quadview_init_rv3d(
|
2020-04-03 13:25:03 +02:00
|
|
|
area, region, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
|
|
|
|
|
region_quadview_init_rv3d(area,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region = region->next),
|
2014-02-12 11:26:02 +11:00
|
|
|
viewlock,
|
|
|
|
|
ED_view3d_lock_view_from_index(index_qsplit++),
|
|
|
|
|
RV3D_ORTHO);
|
2020-04-03 13:25:03 +02:00
|
|
|
region_quadview_init_rv3d(area,
|
2020-03-06 16:56:42 +01:00
|
|
|
(region = region->next),
|
2014-02-12 11:26:02 +11:00
|
|
|
viewlock,
|
|
|
|
|
ED_view3d_lock_view_from_index(index_qsplit++),
|
|
|
|
|
RV3D_ORTHO);
|
2014-04-30 06:23:49 +10:00
|
|
|
/* forcing camera is distracting */
|
|
|
|
|
#if 0
|
2019-05-31 23:21:16 +10:00
|
|
|
if (v3d->camera) {
|
2020-04-03 13:25:03 +02:00
|
|
|
region_quadview_init_rv3d(area, (region = region->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB);
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
region_quadview_init_rv3d(area, (region = region->next), 0, RV3D_VIEW_USER, RV3D_PERSP);
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
2014-04-30 06:23:49 +10:00
|
|
|
#else
|
|
|
|
|
(void)v3d;
|
|
|
|
|
#endif
|
2009-01-20 14:23:32 +00:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02: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
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-04 00:49:02 +00:00
|
|
|
static void SCREEN_OT_region_quadview(wmOperatorType *ot)
|
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
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Toggle Quad View";
|
2020-12-10 18:22:16 -08:00
|
|
|
ot->description = "Split selected area into camera, front, right, and top views";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->idname = "SCREEN_OT_region_quadview";
|
2018-06-04 09:31:30 +02: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
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = region_quadview_exec;
|
|
|
|
|
ot->poll = ED_operator_region_view3d_active;
|
|
|
|
|
ot->flag = 0;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11: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
|
|
|
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Region Toggle Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static int region_toggle_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "region_type");
|
|
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
ARegion *region;
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
if (RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
|
region = BKE_area_find_region_type(CTX_wm_area(C), RNA_property_enum_get(op->ptr, prop));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
region = CTX_wm_region(C);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-08 10:50:43 +02:00
|
|
|
if (region && (region->alignment != RGN_ALIGN_NONE)) {
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
ED_region_toggle_hidden(C, region);
|
|
|
|
|
}
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool region_toggle_poll(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
|
2020-03-24 10:27:12 +11:00
|
|
|
/* Don't flip anything around in top-bar. */
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
if (area && area->spacetype == SPACE_TOPBAR) {
|
|
|
|
|
CTX_wm_operator_poll_msg_set(C, "Toggling regions in the Top-bar is not allowed");
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ED_operator_areaactive(C);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_region_toggle(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Toggle Region";
|
|
|
|
|
ot->idname = "SCREEN_OT_region_toggle";
|
|
|
|
|
ot->description = "Hide or unhide the region";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
|
ot->exec = region_toggle_exec;
|
|
|
|
|
ot->poll = region_toggle_poll;
|
|
|
|
|
ot->flag = 0;
|
|
|
|
|
|
|
|
|
|
RNA_def_enum(ot->srna,
|
|
|
|
|
"region_type",
|
|
|
|
|
rna_enum_region_type_items,
|
|
|
|
|
0,
|
|
|
|
|
"Region Type",
|
|
|
|
|
"Type of the region to toggle");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Region Flip Operator
|
|
|
|
|
* \{ */
|
2008-12-15 11:59:42 +00:00
|
|
|
|
|
|
|
|
/* flip a region alignment */
|
2010-10-14 12:24:08 +00:00
|
|
|
static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
|
2008-12-15 11:59:42 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (!region) {
|
2009-12-10 05:05:04 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->alignment == RGN_ALIGN_TOP) {
|
|
|
|
|
region->alignment = RGN_ALIGN_BOTTOM;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->alignment == RGN_ALIGN_BOTTOM) {
|
|
|
|
|
region->alignment = RGN_ALIGN_TOP;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->alignment == RGN_ALIGN_LEFT) {
|
|
|
|
|
region->alignment = RGN_ALIGN_RIGHT;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->alignment == RGN_ALIGN_RIGHT) {
|
|
|
|
|
region->alignment = RGN_ALIGN_LEFT;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-07-25 01:39:47 +00:00
|
|
|
|
|
|
|
|
ED_area_tag_redraw(CTX_wm_area(C));
|
2020-03-06 16:22:28 +01:00
|
|
|
WM_event_add_mousemove(CTX_wm_window(C));
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-15 11:59:42 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 12:03:56 +02:00
|
|
|
static bool region_flip_poll(bContext *C)
|
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
|
|
|
{
|
|
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
|
2020-03-24 10:27:12 +11:00
|
|
|
/* Don't flip anything around in top-bar. */
|
2018-10-28 22:55:21 +01:00
|
|
|
if (area && area->spacetype == SPACE_TOPBAR) {
|
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
|
|
|
CTX_wm_operator_poll_msg_set(C, "Flipping regions in the Top-bar is not allowed");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ED_operator_areaactive(C);
|
|
|
|
|
}
|
2009-01-25 20:22:05 +00:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_region_flip(wmOperatorType *ot)
|
2008-12-15 11:59:42 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Flip Region";
|
|
|
|
|
ot->idname = "SCREEN_OT_region_flip";
|
2012-05-06 15:03:31 +00:00
|
|
|
ot->description = "Toggle the region's alignment (left/right or top/bottom)";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-15 11:59:42 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = region_flip_exec;
|
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
|
|
|
ot->poll = region_flip_poll;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = 0;
|
2009-11-27 06:24:09 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Header Toggle Menu Operator
|
|
|
|
|
* \{ */
|
2012-10-25 13:08:47 +00:00
|
|
|
|
|
|
|
|
/* show/hide header text menus */
|
|
|
|
|
static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op))
|
|
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2012-10-25 13:08:47 +00:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
area->flag = area->flag ^ HEADER_NO_PULLDOWN;
|
2012-10-25 13:08:47 +00:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
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
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
2012-10-25 13:08:47 +00:00
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2014-01-27 18:38:53 +11:00
|
|
|
ot->name = "Expand/Collapse Header Menus";
|
2012-10-25 13:08:47 +00:00
|
|
|
ot->idname = "SCREEN_OT_header_toggle_menus";
|
2014-01-27 18:38:53 +11:00
|
|
|
ot->description = "Expand or collapse the header pulldown menus";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-10-25 13:08:47 +00:00
|
|
|
/* api callbacks */
|
2012-10-26 17:32:50 +00:00
|
|
|
ot->exec = header_toggle_menus_exec;
|
2012-10-25 13:08:47 +00:00
|
|
|
ot->poll = ED_operator_areaactive;
|
|
|
|
|
ot->flag = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
2012-10-25 13:08:47 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
2019-05-09 18:40:42 +10:00
|
|
|
/** \name Region Context Menu Operator (Header/Footer/Navbar)
|
2018-01-21 01:41:58 +11:00
|
|
|
* \{ */
|
2017-10-26 22:40:24 +02:00
|
|
|
|
2012-09-19 18:47:41 +00:00
|
|
|
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
|
2009-11-27 06:24:09 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
|
|
|
|
const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
|
2020-01-16 15:55:49 +01:00
|
|
|
IFACE_("Flip to Bottom") :
|
|
|
|
|
IFACE_("Flip to Top");
|
2019-04-18 21:13:22 +02:00
|
|
|
{
|
2019-04-18 16:35:11 +02:00
|
|
|
PointerRNA ptr;
|
2020-04-03 13:25:03 +02:00
|
|
|
RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr);
|
|
|
|
|
if (!ELEM(area->spacetype, SPACE_TOPBAR)) {
|
2019-06-17 15:18:29 +02:00
|
|
|
uiItemR(layout, &ptr, "show_region_header", 0, IFACE_("Show Header"), ICON_NONE);
|
|
|
|
|
}
|
2019-04-19 11:53:06 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
ARegion *region_header = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
|
2019-04-19 11:53:06 +02:00
|
|
|
uiLayout *col = uiLayoutColumn(layout, 0);
|
2020-04-03 12:51:03 +02:00
|
|
|
uiLayoutSetActive(col, (region_header->flag & RGN_FLAG_HIDDEN) == 0);
|
2019-04-19 11:53:06 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (BKE_area_find_region_type(area, RGN_TYPE_TOOL_HEADER)) {
|
2019-04-19 11:53:06 +02:00
|
|
|
uiItemR(col, &ptr, "show_region_tool_header", 0, IFACE_("Show Tool Settings"), ICON_NONE);
|
2019-04-18 21:13:22 +02:00
|
|
|
}
|
2019-04-19 11:53:06 +02:00
|
|
|
|
|
|
|
|
uiItemO(col,
|
|
|
|
|
IFACE_("Show Menus"),
|
2020-04-03 13:25:03 +02:00
|
|
|
(area->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT,
|
2019-04-19 11:53:06 +02:00
|
|
|
"SCREEN_OT_header_toggle_menus");
|
2018-07-06 13:37:39 +02:00
|
|
|
}
|
2018-06-01 02:55:16 +02:00
|
|
|
|
2017-10-26 22:40:24 +02:00
|
|
|
/* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
|
|
|
|
|
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
2012-09-19 18:47:41 +00:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (!ELEM(area->spacetype, SPACE_TOPBAR)) {
|
2019-06-17 15:18:29 +02:00
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2018-07-06 13:37:39 +02:00
|
|
|
uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-10 08:40:49 +02:00
|
|
|
/* File browser should be fullscreen all the time, top-bar should
|
|
|
|
|
* never be. But other regions can be maximized/restored. */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (!ELEM(area->spacetype, SPACE_FILE, SPACE_TOPBAR)) {
|
2018-07-06 13:37:39 +02:00
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
const char *but_str = area->full ? IFACE_("Tile Area") : IFACE_("Maximize Area");
|
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
|
|
|
uiItemO(layout, but_str, ICON_NONE, "SCREEN_OT_screen_full_area");
|
2009-11-27 06:24:09 +00:00
|
|
|
}
|
2012-09-19 18:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-05 13:48:26 +02:00
|
|
|
void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
|
|
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
|
|
|
|
const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
|
2020-01-16 15:55:49 +01:00
|
|
|
IFACE_("Flip to Bottom") :
|
|
|
|
|
IFACE_("Flip to Top");
|
2019-05-14 20:17:43 +10:00
|
|
|
{
|
|
|
|
|
PointerRNA ptr;
|
2020-04-03 13:25:03 +02:00
|
|
|
RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr);
|
2019-05-14 20:17:43 +10:00
|
|
|
uiItemR(layout, &ptr, "show_region_footer", 0, IFACE_("Show Footer"), ICON_NONE);
|
|
|
|
|
}
|
2019-04-05 13:48:26 +02:00
|
|
|
|
|
|
|
|
/* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
|
|
|
|
|
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
|
|
|
|
|
2018-10-31 00:41:03 +01:00
|
|
|
uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
|
2019-04-05 13:48:26 +02:00
|
|
|
|
2020-03-24 10:27:12 +11:00
|
|
|
/* File browser should be fullscreen all the time, top-bar should
|
2019-04-05 13:48:26 +02:00
|
|
|
* never be. But other regions can be maximized/restored... */
|
2020-04-03 13:25:03 +02:00
|
|
|
if (!ELEM(area->spacetype, SPACE_FILE, SPACE_TOPBAR)) {
|
2019-04-05 13:48:26 +02:00
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
const char *but_str = area->full ? IFACE_("Tile Area") : IFACE_("Maximize Area");
|
2019-04-05 13:48:26 +02:00
|
|
|
uiItemO(layout, but_str, ICON_NONE, "SCREEN_OT_screen_full_area");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-09 18:40:42 +10:00
|
|
|
void ED_screens_navigation_bar_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
|
|
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
const ARegion *region = CTX_wm_region(C);
|
|
|
|
|
const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_LEFT) ?
|
2020-01-16 15:55:49 +01:00
|
|
|
IFACE_("Flip to Right") :
|
|
|
|
|
IFACE_("Flip to Left");
|
2019-05-09 18:40:42 +10:00
|
|
|
|
|
|
|
|
/* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
|
|
|
|
|
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
|
|
|
|
|
|
|
|
|
uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-19 17:43:59 +10:00
|
|
|
static void ed_screens_statusbar_menu_create(uiLayout *layout, void *UNUSED(arg))
|
2020-07-18 07:49:25 -07:00
|
|
|
{
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(NULL, &RNA_PreferencesView, &U, &ptr);
|
|
|
|
|
uiItemR(layout, &ptr, "show_statusbar_stats", 0, IFACE_("Scene Statistics"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, &ptr, "show_statusbar_memory", 0, IFACE_("System Memory"), ICON_NONE);
|
|
|
|
|
if (GPU_mem_stats_supported()) {
|
|
|
|
|
uiItemR(layout, &ptr, "show_statusbar_vram", 0, IFACE_("Video Memory"), ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
uiItemR(layout, &ptr, "show_statusbar_version", 0, IFACE_("Blender Version"), ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-09 18:40:42 +10:00
|
|
|
static int screen_context_menu_invoke(bContext *C,
|
2019-04-05 13:48:26 +02:00
|
|
|
wmOperator *UNUSED(op),
|
|
|
|
|
const wmEvent *UNUSED(event))
|
|
|
|
|
{
|
2020-07-18 07:49:25 -07:00
|
|
|
const ScrArea *area = CTX_wm_area(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
const ARegion *region = CTX_wm_region(C);
|
2019-04-05 13:48:26 +02:00
|
|
|
|
2020-07-18 07:49:25 -07:00
|
|
|
if (area && area->spacetype == SPACE_STATUSBAR) {
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Status Bar"), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2020-07-19 17:43:59 +10:00
|
|
|
ed_screens_statusbar_menu_create(layout, NULL);
|
2020-07-18 07:49:25 -07:00
|
|
|
UI_popup_menu_end(C, pup);
|
|
|
|
|
}
|
|
|
|
|
else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Header"), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2019-05-09 18:40:42 +10:00
|
|
|
ED_screens_header_tools_menu_create(C, layout, NULL);
|
|
|
|
|
UI_popup_menu_end(C, pup);
|
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->regiontype == RGN_TYPE_FOOTER) {
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Footer"), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2019-05-09 18:40:42 +10:00
|
|
|
ED_screens_footer_tools_menu_create(C, layout, NULL);
|
|
|
|
|
UI_popup_menu_end(C, pup);
|
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (region->regiontype == RGN_TYPE_NAV_BAR) {
|
2020-10-16 21:56:58 -05:00
|
|
|
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Navigation Bar"), ICON_NONE);
|
|
|
|
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
2019-05-09 18:40:42 +10:00
|
|
|
ED_screens_navigation_bar_tools_menu_create(C, layout, NULL);
|
|
|
|
|
UI_popup_menu_end(C, pup);
|
|
|
|
|
}
|
2019-04-05 13:48:26 +02:00
|
|
|
|
|
|
|
|
return OPERATOR_INTERFACE;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-09 18:40:42 +10:00
|
|
|
static void SCREEN_OT_region_context_menu(wmOperatorType *ot)
|
2019-04-05 13:48:26 +02:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2019-05-09 18:40:42 +10:00
|
|
|
ot->name = "Region Context Menu";
|
|
|
|
|
ot->description = "Display region context menu";
|
|
|
|
|
ot->idname = "SCREEN_OT_region_context_menu";
|
2019-04-05 13:48:26 +02:00
|
|
|
|
|
|
|
|
/* api callbacks */
|
2019-05-09 18:40:42 +10:00
|
|
|
ot->invoke = screen_context_menu_invoke;
|
2019-04-05 13:48:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Animation Step Operator
|
|
|
|
|
*
|
|
|
|
|
* Animation Step.
|
|
|
|
|
* \{ */
|
2020-06-23 07:59:34 +02:00
|
|
|
static bool screen_animation_region_supports_time_follow(eSpace_Type spacetype,
|
|
|
|
|
eRegionType regiontype)
|
|
|
|
|
{
|
|
|
|
|
return (regiontype == RGN_TYPE_WINDOW &&
|
|
|
|
|
ELEM(spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
|
|
|
|
|
(spacetype == SPACE_CLIP && regiontype == RGN_TYPE_PREVIEW);
|
|
|
|
|
}
|
2008-12-21 19:58:25 +00:00
|
|
|
|
2020-06-23 13:17:31 +02:00
|
|
|
static bool match_region_with_redraws(const ScrArea *area,
|
2020-06-19 08:11:25 +02:00
|
|
|
eRegionType regiontype,
|
|
|
|
|
eScreen_Redraws_Flag redraws,
|
|
|
|
|
bool from_anim_edit)
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
{
|
2020-06-23 13:17:31 +02:00
|
|
|
const eSpace_Type spacetype = area->spacetype;
|
2012-05-08 11:48:19 +00:00
|
|
|
if (regiontype == RGN_TYPE_WINDOW) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
switch (spacetype) {
|
|
|
|
|
case SPACE_VIEW3D:
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
2019-02-16 16:42:11 +11:00
|
|
|
case SPACE_GRAPH:
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
case SPACE_NLA:
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
2018-04-20 17:17:10 +02:00
|
|
|
case SPACE_ACTION:
|
|
|
|
|
/* if only 1 window or 3d windows, we do timeline too
|
2019-11-25 00:55:11 +11:00
|
|
|
* NOTE: Now we do action editor in all these cases, since timeline is here. */
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
2019-02-16 10:44:15 +11:00
|
|
|
case SPACE_PROPERTIES:
|
2019-04-22 09:19:45 +10:00
|
|
|
if (redraws & TIME_ALL_BUTS_WIN) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
|
|
|
|
case SPACE_SEQ:
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
2009-10-22 23:22:05 +00:00
|
|
|
case SPACE_NODE:
|
2020-06-18 12:21:38 +10:00
|
|
|
if (redraws & TIME_NODES) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
break;
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
case SPACE_IMAGE:
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & TIME_ALL_IMAGE_WIN) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
break;
|
2011-11-07 12:55:18 +00:00
|
|
|
case SPACE_CLIP:
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((redraws & TIME_CLIPS) || from_anim_edit) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
break;
|
2020-06-19 08:11:25 +02:00
|
|
|
default:
|
|
|
|
|
break;
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-05-08 11:48:19 +00:00
|
|
|
else if (regiontype == RGN_TYPE_UI) {
|
|
|
|
|
if (spacetype == SPACE_CLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
/* Track Preview button is on Properties Editor in SpaceClip,
|
2012-03-03 16:31:46 +00:00
|
|
|
* and it's very common case when users want it be refreshing
|
|
|
|
|
* during playback, so asking people to enable special option
|
2012-03-04 04:35:12 +00:00
|
|
|
* for this is a bit tricky, so add exception here for refreshing
|
2012-03-03 16:31:46 +00:00
|
|
|
* Properties Editor for SpaceClip always */
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (redraws & TIME_ALL_BUTS_WIN) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
2020-06-19 08:13:06 +02:00
|
|
|
else if (regiontype == RGN_TYPE_HEADER) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (spacetype == SPACE_ACTION) {
|
2020-06-23 13:17:31 +02:00
|
|
|
/* The timeline shows the current frame in the header. Other headers
|
|
|
|
|
* don't need to be updated. */
|
|
|
|
|
SpaceAction *saction = (SpaceAction *)area->spacedata.first;
|
|
|
|
|
return saction->mode == SACTCONT_TIMELINE;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
2012-05-08 11:48:19 +00:00
|
|
|
else if (regiontype == RGN_TYPE_PREVIEW) {
|
2009-12-18 13:28:03 +00:00
|
|
|
switch (spacetype) {
|
|
|
|
|
case SPACE_SEQ:
|
2019-04-22 09:19:45 +10:00
|
|
|
if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) {
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-12-18 13:28:03 +00:00
|
|
|
break;
|
2011-11-07 12:55:18 +00:00
|
|
|
case SPACE_CLIP:
|
2020-06-19 08:11:25 +02:00
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2009-12-18 13:28:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-06-19 08:11:25 +02:00
|
|
|
return false;
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
2020-06-23 07:59:34 +02:00
|
|
|
static void screen_animation_region_tag_redraw(ScrArea *area,
|
|
|
|
|
ARegion *region,
|
|
|
|
|
const Scene *scene,
|
|
|
|
|
eScreen_Redraws_Flag redraws)
|
|
|
|
|
{
|
|
|
|
|
/* Do follow time here if editor type supports it */
|
|
|
|
|
if ((redraws & TIME_FOLLOW) &&
|
|
|
|
|
(screen_animation_region_supports_time_follow(area->spacetype, region->regiontype))) {
|
|
|
|
|
float w = BLI_rctf_size_x(®ion->v2d.cur);
|
|
|
|
|
if (scene->r.cfra < region->v2d.cur.xmin) {
|
|
|
|
|
region->v2d.cur.xmax = scene->r.cfra;
|
|
|
|
|
region->v2d.cur.xmin = region->v2d.cur.xmax - w;
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
if (scene->r.cfra > region->v2d.cur.xmax) {
|
2020-06-23 07:59:34 +02:00
|
|
|
region->v2d.cur.xmin = scene->r.cfra;
|
|
|
|
|
region->v2d.cur.xmax = region->v2d.cur.xmin + w;
|
2020-06-24 14:23:54 +10:00
|
|
|
ED_region_tag_redraw(region);
|
2020-06-23 07:59:34 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-01 19:54:12 +10:00
|
|
|
/* No need to do a full redraw as the current frame indicator is only updated.
|
|
|
|
|
* We do need to redraw when this area is in full screen as no other areas
|
|
|
|
|
* will be tagged for redrawing. */
|
2020-06-23 07:59:34 +02:00
|
|
|
if ((region->regiontype == RGN_TYPE_WINDOW) &&
|
2020-08-10 09:28:18 +02:00
|
|
|
(ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) && !area->full) {
|
2020-06-23 07:59:34 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-27 15:00:01 +01:00
|
|
|
//#define PROFILE_AUDIO_SYNCH
|
|
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
static int screen_animation_step_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
2008-12-21 19:58:25 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2020-10-21 18:03:42 +11:00
|
|
|
wmTimer *wt = screen->animtimer;
|
|
|
|
|
|
|
|
|
|
if (!(wt && wt == event->customdata)) {
|
|
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-01 11:31:53 +02:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2010-06-01 15:35:38 +00:00
|
|
|
|
2015-03-27 15:00:01 +01:00
|
|
|
#ifdef PROFILE_AUDIO_SYNCH
|
|
|
|
|
static int old_frame = 0;
|
|
|
|
|
int newfra_int;
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
|
|
|
|
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer);
|
|
|
|
|
Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL;
|
|
|
|
|
ScreenAnimData *sad = wt->customdata;
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
int sync;
|
|
|
|
|
double time;
|
|
|
|
|
|
|
|
|
|
/* sync, don't sync, or follow scene setting */
|
|
|
|
|
if (sad->flag & ANIMPLAY_FLAG_SYNC) {
|
|
|
|
|
sync = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) {
|
|
|
|
|
sync = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sync = (scene->flag & SCE_FRAME_DROP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene_eval == NULL) {
|
|
|
|
|
/* Happens when undo/redo system is used during playback, nothing meaningful we can do here. */
|
|
|
|
|
}
|
|
|
|
|
else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) {
|
|
|
|
|
/* Ignore seek here, the audio will be updated to the scene frame after jump during next
|
|
|
|
|
* dependency graph update. */
|
|
|
|
|
}
|
|
|
|
|
else if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false &&
|
|
|
|
|
isfinite(time = BKE_sound_sync_scene(scene_eval))) {
|
|
|
|
|
double newfra = time * FPS;
|
|
|
|
|
|
|
|
|
|
/* give some space here to avoid jumps */
|
|
|
|
|
if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra) {
|
|
|
|
|
scene->r.cfra++;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-21 18:03:42 +11:00
|
|
|
scene->r.cfra = max_ii(scene->r.cfra, round(newfra));
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
#ifdef PROFILE_AUDIO_SYNCH
|
|
|
|
|
newfra_int = scene->r.cfra;
|
|
|
|
|
if (newfra_int < old_frame) {
|
|
|
|
|
printf("back jump detected, frame %d!\n", newfra_int);
|
2019-07-01 11:31:53 +02:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
else if (newfra_int > old_frame + 1) {
|
|
|
|
|
printf("forward jump detected, frame %d!\n", newfra_int);
|
2019-06-17 16:32:29 +02:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
fflush(stdout);
|
|
|
|
|
old_frame = newfra_int;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (sync) {
|
|
|
|
|
/* Try to keep the playback in realtime by dropping frames. */
|
|
|
|
|
|
|
|
|
|
/* How much time (in frames) has passed since the last frame was drawn? */
|
|
|
|
|
double delta_frames = wt->delta * FPS;
|
|
|
|
|
|
|
|
|
|
/* Add the remaining fraction from the last time step. */
|
|
|
|
|
delta_frames += sad->lagging_frame_count;
|
|
|
|
|
|
|
|
|
|
if (delta_frames < 1.0) {
|
|
|
|
|
/* We can render faster than the scene frame rate. However skipping or delaying frames
|
|
|
|
|
* here seems to in practice lead to jittery playback so just step forward a minimum of
|
|
|
|
|
* one frame. (Even though this can lead to too fast playback, the jitteryness is more
|
|
|
|
|
* annoying)
|
|
|
|
|
*/
|
|
|
|
|
delta_frames = 1.0f;
|
|
|
|
|
sad->lagging_frame_count = 0;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-21 18:03:42 +11:00
|
|
|
/* Extract the delta frame fractions that will be skipped when converting to int. */
|
|
|
|
|
sad->lagging_frame_count = delta_frames - (int)delta_frames;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2015-03-27 15:00:01 +01:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
const int step = delta_frames;
|
|
|
|
|
|
|
|
|
|
/* skip frames */
|
|
|
|
|
if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
|
|
|
|
|
scene->r.cfra -= step;
|
2015-03-27 15:00:01 +01:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
else {
|
|
|
|
|
scene->r.cfra += step;
|
2015-03-27 15:00:01 +01:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-21 18:03:42 +11:00
|
|
|
/* one frame +/- */
|
|
|
|
|
if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
|
|
|
|
|
scene->r.cfra--;
|
2010-02-19 12:20:29 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-21 18:03:42 +11:00
|
|
|
scene->r.cfra++;
|
2010-02-19 12:20:29 +00:00
|
|
|
}
|
2009-07-07 07:29:21 +00:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
/* reset 'jumped' flag before checking if we need to jump... */
|
|
|
|
|
sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
|
|
|
|
|
/* jump back to end? */
|
|
|
|
|
if (PRVRANGEON) {
|
|
|
|
|
if (scene->r.cfra < scene->r.psfra) {
|
|
|
|
|
scene->r.cfra = scene->r.pefra;
|
|
|
|
|
sad->flag |= ANIMPLAY_FLAG_JUMPED;
|
2009-07-07 07:29:21 +00:00
|
|
|
}
|
2008-12-22 12:57:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-10-21 18:03:42 +11:00
|
|
|
if (scene->r.cfra < scene->r.sfra) {
|
|
|
|
|
scene->r.cfra = scene->r.efra;
|
|
|
|
|
sad->flag |= ANIMPLAY_FLAG_JUMPED;
|
2009-07-07 07:29:21 +00:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* jump back to start? */
|
|
|
|
|
if (PRVRANGEON) {
|
|
|
|
|
if (scene->r.cfra > scene->r.pefra) {
|
|
|
|
|
scene->r.cfra = scene->r.psfra;
|
|
|
|
|
sad->flag |= ANIMPLAY_FLAG_JUMPED;
|
2009-07-07 07:29:21 +00:00
|
|
|
}
|
2008-12-22 12:57:53 +00:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
else {
|
|
|
|
|
if (scene->r.cfra > scene->r.efra) {
|
|
|
|
|
scene->r.cfra = scene->r.sfra;
|
|
|
|
|
sad->flag |= ANIMPLAY_FLAG_JUMPED;
|
|
|
|
|
}
|
2010-10-11 10:40:34 +00:00
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* next frame overridden by user action (pressed jump to first/last frame) */
|
|
|
|
|
if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
|
|
|
|
|
scene->r.cfra = sad->nextfra;
|
|
|
|
|
sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
|
|
|
|
|
sad->flag |= ANIMPLAY_FLAG_JUMPED;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
if (sad->flag & ANIMPLAY_FLAG_JUMPED) {
|
|
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK);
|
2015-04-02 15:55:43 +11:00
|
|
|
#ifdef PROFILE_AUDIO_SYNCH
|
2020-10-21 18:03:42 +11:00
|
|
|
old_frame = CFRA;
|
2015-04-02 15:55:43 +11:00
|
|
|
#endif
|
2020-10-21 18:03:42 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
/* since we follow drawflags, we can't send notifier but tag regions ourselves */
|
|
|
|
|
if (depsgraph != NULL) {
|
|
|
|
|
ED_update_for_newframe(bmain, depsgraph);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
LISTBASE_FOREACH (wmWindow *, window, &wm->windows) {
|
|
|
|
|
const bScreen *win_screen = WM_window_get_active_screen(window);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area, &win_screen->areabase) {
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
|
|
|
|
bool redraw = false;
|
|
|
|
|
if (region == sad->region) {
|
|
|
|
|
redraw = true;
|
|
|
|
|
}
|
|
|
|
|
else if (match_region_with_redraws(
|
|
|
|
|
area, region->regiontype, sad->redraws, sad->from_anim_edit)) {
|
|
|
|
|
redraw = true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
if (redraw) {
|
|
|
|
|
screen_animation_region_tag_redraw(area, region, scene, sad->redraws);
|
2012-05-25 12:37:11 +00:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-10-21 18:03:42 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
/* update frame rate info too
|
|
|
|
|
* NOTE: this may not be accurate enough, since we might need this after modifiers/etc.
|
|
|
|
|
* have been calculated instead of just before updates have been done?
|
|
|
|
|
*/
|
|
|
|
|
ED_refresh_viewport_fps(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
/* Recalculate the time-step for the timer now that we've finished calculating this,
|
|
|
|
|
* since the frames-per-second value may have been changed.
|
|
|
|
|
*/
|
|
|
|
|
/* TODO: this may make evaluation a bit slower if the value doesn't change...
|
|
|
|
|
* any way to avoid this? */
|
|
|
|
|
wt->timestep = (1.0 / FPS);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-21 18:03:42 +11:00
|
|
|
return OPERATOR_FINISHED;
|
2008-12-21 19:58:25 +00:00
|
|
|
}
|
|
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
static void SCREEN_OT_animation_step(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Animation Step";
|
|
|
|
|
ot->description = "Step through animation by position";
|
|
|
|
|
ot->idname = "SCREEN_OT_animation_step";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
/* api callbacks */
|
2020-10-21 18:03:42 +11:00
|
|
|
ot->invoke = screen_animation_step_invoke;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Animation Playback Operator
|
|
|
|
|
*
|
|
|
|
|
* Animation Playback with Timer.
|
|
|
|
|
* \{ */
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
|
2012-05-25 12:37:11 +00:00
|
|
|
/* find window that owns the animation timer */
|
2012-05-25 12:56:29 +00:00
|
|
|
bScreen *ED_screen_animation_playing(const wmWindowManager *wm)
|
2012-05-25 12:37:11 +00:00
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
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
|
|
|
bScreen *screen = WM_window_get_active_screen(win);
|
2014-11-17 20:07:25 +01:00
|
|
|
|
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
|
|
|
if (screen->animtimer || screen->scrubbing) {
|
|
|
|
|
return screen;
|
2014-11-17 20:07:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-25 12:37:11 +00:00
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-05 16:47:01 +02:00
|
|
|
bScreen *ED_screen_animation_no_scrub(const wmWindowManager *wm)
|
|
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
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
|
|
|
bScreen *screen = WM_window_get_active_screen(win);
|
2015-06-05 16:47:01 +02:00
|
|
|
|
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
|
|
|
if (screen->animtimer) {
|
|
|
|
|
return screen;
|
2015-06-05 16:47:01 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
/* toggle operator */
|
2010-02-21 18:01:41 +00:00
|
|
|
int ED_screen_animation_play(bContext *C, int sync, int mode)
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2010-07-19 11:25:23 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2019-07-25 16:36:22 +02:00
|
|
|
Scene *scene_eval = DEG_get_evaluated_scene(CTX_data_ensure_evaluated_depsgraph(C));
|
2010-02-21 18:01:41 +00:00
|
|
|
|
2012-05-25 12:56:29 +00:00
|
|
|
if (ED_screen_animation_playing(CTX_wm_manager(C))) {
|
2009-11-27 04:14:56 +00:00
|
|
|
/* stop playback now */
|
2020-02-22 03:00:23 +11:00
|
|
|
ED_screen_animation_timer(C, 0, 0, 0);
|
2019-06-04 16:52:48 +02:00
|
|
|
BKE_sound_stop_scene(scene_eval);
|
2015-01-25 02:43:57 +01:00
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* these settings are currently only available from a menu in the TimeLine */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (mode == 1) { /* XXX only play audio forwards!? */
|
2019-06-04 16:52:48 +02:00
|
|
|
BKE_sound_play_scene(scene_eval);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-02-22 03:00:23 +11:00
|
|
|
ED_screen_animation_timer(C, screen->redraws_flag, sync, mode);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-02-01 23:41:01 +00:00
|
|
|
if (screen->animtimer) {
|
2012-05-08 11:48:19 +00:00
|
|
|
wmTimer *wt = screen->animtimer;
|
|
|
|
|
ScreenAnimData *sad = wt->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
sad->region = CTX_wm_region(C);
|
2011-12-04 23:13:28 +00:00
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
}
|
2010-02-21 18:01:41 +00:00
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-20 02:39:07 +00:00
|
|
|
static int screen_animation_play_exec(bContext *C, wmOperator *op)
|
2010-02-21 18:01:41 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
|
|
|
|
|
int sync = -1;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (RNA_struct_property_is_set(op->ptr, "sync")) {
|
2012-05-08 11:48:19 +00:00
|
|
|
sync = (RNA_boolean_get(op->ptr, "sync"));
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-02-21 18:01:41 +00:00
|
|
|
return ED_screen_animation_play(C, sync, mode);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
static void SCREEN_OT_animation_play(wmOperatorType *ot)
|
2008-12-21 19:58:25 +00:00
|
|
|
{
|
2012-03-28 22:43:26 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2008-12-21 19:58:25 +00:00
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Play Animation";
|
|
|
|
|
ot->description = "Play animation";
|
|
|
|
|
ot->idname = "SCREEN_OT_animation_play";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-21 19:58:25 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_animation_play_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive_norender;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 22:43:26 +00:00
|
|
|
prop = RNA_def_boolean(
|
|
|
|
|
ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
|
|
|
|
prop = RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
2008-12-21 19:58:25 +00:00
|
|
|
}
|
2008-12-09 15:59:43 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Animation Cancel Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2011-03-27 08:31:10 +00:00
|
|
|
static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2012-05-25 12:56:29 +00:00
|
|
|
bScreen *screen = ED_screen_animation_playing(CTX_wm_manager(C));
|
2011-03-27 08:31:10 +00:00
|
|
|
|
2012-05-25 12:37:11 +00:00
|
|
|
if (screen) {
|
2017-06-24 18:02:30 +02:00
|
|
|
if (RNA_boolean_get(op->ptr, "restore_frame") && screen->animtimer) {
|
2012-05-08 11:48:19 +00:00
|
|
|
ScreenAnimData *sad = screen->animtimer->customdata;
|
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2011-03-27 08:31:10 +00:00
|
|
|
|
|
|
|
|
/* reset current frame before stopping, and just send a notifier to deal with the rest
|
|
|
|
|
* (since playback still needs to be stopped)
|
|
|
|
|
*/
|
2012-05-08 11:48:19 +00:00
|
|
|
scene->r.cfra = sad->sfra;
|
2011-03-27 08:31:10 +00:00
|
|
|
|
2012-05-08 11:48:19 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2011-03-27 08:31:10 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-27 04:14:56 +00:00
|
|
|
/* call the other "toggling" operator to clean up now */
|
2010-04-02 08:51:48 +00:00
|
|
|
ED_screen_animation_play(C, 0, 0);
|
2009-11-27 04:14:56 +00:00
|
|
|
}
|
2010-04-02 08:51:48 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Cancel Animation";
|
|
|
|
|
ot->description = "Cancel animation, returning to the original frame";
|
|
|
|
|
ot->idname = "SCREEN_OT_animation_cancel";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_animation_cancel_exec;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive;
|
2011-03-27 08:31:10 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_def_boolean(ot->srna,
|
|
|
|
|
"restore_frame",
|
|
|
|
|
true,
|
|
|
|
|
"Restore Frame",
|
|
|
|
|
"Restore the frame when animation was initialized");
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2018-10-05 10:27:04 +10:00
|
|
|
/** \name Box Select Operator (Template)
|
2018-01-21 01:41:58 +11:00
|
|
|
* \{ */
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* operator state vars used: (added by default WM callbacks)
|
2018-06-01 18:19:39 +02:00
|
|
|
* xmin, ymin
|
|
|
|
|
* xmax, ymax
|
|
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* customdata: the wmGesture pointer
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* callbacks:
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* exec() has to be filled in by user
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* invoke() default WM function
|
|
|
|
|
* adds modal handler
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
|
|
|
|
* modal() default WM function
|
2012-03-03 16:31:46 +00:00
|
|
|
* accept modal events while doing it, calls exec(), handles ESC and border drawing
|
2018-06-01 18:19:39 +02:00
|
|
|
*
|
2012-03-03 16:31:46 +00:00
|
|
|
* poll() has to be filled in by user for context
|
2009-12-10 09:25:30 +00:00
|
|
|
*/
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#if 0
|
2018-10-05 10:27:04 +10:00
|
|
|
static int box_select_exec(bContext *C, wmOperator *op)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
int event_type = RNA_int_get(op->ptr, "event_type");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-05-31 23:21:16 +10:00
|
|
|
if (event_type == LEFTMOUSE) {
|
2018-10-05 10:27:04 +10:00
|
|
|
printf("box select do select\n");
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
|
|
|
|
else if (event_type == RIGHTMOUSE) {
|
2018-10-05 10:27:04 +10:00
|
|
|
printf("box select deselect\n");
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2018-10-05 10:27:04 +10:00
|
|
|
printf("box select do something\n");
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-05 10:27:04 +10:00
|
|
|
static void SCREEN_OT_box_select(wmOperatorType *ot)
|
2008-11-19 16:28:11 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2018-10-05 10:27:04 +10:00
|
|
|
ot->name = "Box Select";
|
|
|
|
|
ot->idname = "SCREEN_OT_box_select";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* api callbacks */
|
2018-10-05 10:27:04 +10:00
|
|
|
ot->exec = box_select_exec;
|
|
|
|
|
ot->invoke = WM_gesture_box_invoke;
|
|
|
|
|
ot->modal = WM_gesture_box_modal;
|
|
|
|
|
ot->cancel = WM_gesture_box_cancel;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_areaactive;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-11-24 10:45:36 +00:00
|
|
|
/* rna */
|
2009-01-16 23:53:11 +00:00
|
|
|
RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
|
2012-08-08 20:38:55 +00:00
|
|
|
WM_operator_properties_border(ot);
|
2008-11-19 16:28:11 +00:00
|
|
|
}
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#endif
|
2008-11-19 16:28:11 +00:00
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Full Screen Back Operator
|
2020-03-25 16:36:01 +11:00
|
|
|
*
|
|
|
|
|
* Use for generic full-screen 'back' button.
|
2018-01-21 01:41:58 +11:00
|
|
|
* \{ */
|
|
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
static int fullscreen_back_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
/* search current screen for 'fullscreen' areas */
|
2020-08-20 20:47:44 -04:00
|
|
|
LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
|
2020-08-22 11:30:51 -04:00
|
|
|
if (area_iter->full) {
|
2020-08-20 20:47:44 -04:00
|
|
|
area = area_iter;
|
2009-12-08 07:12:06 +00:00
|
|
|
break;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-12-08 07:12:06 +00:00
|
|
|
}
|
2020-04-03 13:25:03 +02:00
|
|
|
if (!area) {
|
2011-09-19 12:26:20 +00:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found");
|
2009-12-08 07:12:06 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2015-01-28 02:32:52 +01:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_screen_full_prevspace(C, area);
|
2015-01-28 02:32:52 +01:00
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Back to Previous Screen";
|
|
|
|
|
ot->description = "Revert back to the original screen layout, before fullscreen area overlay";
|
|
|
|
|
ot->idname = "SCREEN_OT_back_to_previous";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-12-08 07:12:06 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = fullscreen_back_exec;
|
|
|
|
|
ot->poll = ED_operator_screenactive;
|
2009-12-08 07:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Show User Preferences Operator
|
|
|
|
|
* \{ */
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2020-05-23 22:48:05 +02:00
|
|
|
static int userpref_show_exec(bContext *C, wmOperator *op)
|
2009-07-24 12:43:59 +00:00
|
|
|
{
|
2020-05-23 22:48:05 +02:00
|
|
|
wmWindow *win_cur = CTX_wm_window(C);
|
|
|
|
|
/* Use eventstate, not event from _invoke, so this can be called through exec(). */
|
|
|
|
|
const wmEvent *event = win_cur->eventstate;
|
2019-01-04 21:40:16 +01:00
|
|
|
int sizex = (500 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC;
|
|
|
|
|
int sizey = 520 * UI_DPI_FAC;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* changes context! */
|
2021-02-22 11:37:25 -08:00
|
|
|
if (WM_window_open(C,
|
|
|
|
|
IFACE_("Blender Preferences"),
|
|
|
|
|
event->x,
|
|
|
|
|
event->y,
|
|
|
|
|
sizex,
|
|
|
|
|
sizey,
|
|
|
|
|
SPACE_USERPREF,
|
|
|
|
|
false,
|
|
|
|
|
true,
|
|
|
|
|
WIN_ALIGN_LOCATION_CENTER) != NULL) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* The header only contains the editor switcher and looks empty.
|
|
|
|
|
* So hiding in the temp window makes sense. */
|
2019-01-04 21:40:16 +01:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
|
2020-01-22 17:54:18 +01:00
|
|
|
|
2019-01-04 21:40:16 +01:00
|
|
|
region->flag |= RGN_FLAG_HIDDEN;
|
2020-01-22 17:54:18 +01:00
|
|
|
ED_region_visibility_change_update(C, area, region);
|
|
|
|
|
|
2021-04-01 17:36:09 +11:00
|
|
|
/* And also show the region with "Load & Save" buttons. */
|
|
|
|
|
region = BKE_area_find_region_type(area, RGN_TYPE_EXECUTE);
|
|
|
|
|
region->flag &= ~RGN_FLAG_HIDDEN;
|
|
|
|
|
ED_region_visibility_change_update(C, area, region);
|
|
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-28 12:21:49 +01:00
|
|
|
static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
|
2009-07-24 12:43:59 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2018-11-28 12:21:49 +01:00
|
|
|
ot->name = "Show Preferences";
|
|
|
|
|
ot->description = "Edit user preferences and system settings";
|
|
|
|
|
ot->idname = "SCREEN_OT_userpref_show";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* api callbacks */
|
2020-05-23 22:48:05 +02:00
|
|
|
ot->exec = userpref_show_exec;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_screenactive;
|
2009-07-10 16:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Show Drivers Editor Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-05-23 22:48:05 +02:00
|
|
|
static int drivers_editor_show_exec(bContext *C, wmOperator *op)
|
2018-05-22 16:18:09 +02:00
|
|
|
{
|
2020-05-23 22:48:05 +02:00
|
|
|
wmWindow *win_cur = CTX_wm_window(C);
|
|
|
|
|
/* Use eventstate, not event from _invoke, so this can be called through exec(). */
|
|
|
|
|
const wmEvent *event = win_cur->eventstate;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
int sizex = 900 * UI_DPI_FAC;
|
|
|
|
|
int sizey = 580 * UI_DPI_FAC;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
/* Get active property to show driver for
|
|
|
|
|
* - Need to grab it first, or else this info disappears
|
|
|
|
|
* after we've created the window
|
|
|
|
|
*/
|
2020-10-16 21:56:58 -05:00
|
|
|
int index;
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
uiBut *but = UI_context_active_but_prop_get(C, &ptr, &prop, &index);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
/* changes context! */
|
2021-02-22 11:37:25 -08:00
|
|
|
if (WM_window_open(C,
|
|
|
|
|
IFACE_("Blender Drivers Editor"),
|
|
|
|
|
event->x,
|
|
|
|
|
event->y,
|
|
|
|
|
sizex,
|
|
|
|
|
sizey,
|
|
|
|
|
SPACE_GRAPH,
|
|
|
|
|
false,
|
|
|
|
|
true,
|
|
|
|
|
WIN_ALIGN_LOCATION_CENTER) != NULL) {
|
2019-09-18 14:21:32 +02:00
|
|
|
ED_drivers_editor_init(C, CTX_wm_area(C));
|
|
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
/* activate driver F-Curve for the property under the cursor */
|
|
|
|
|
if (but) {
|
|
|
|
|
bool driven, special;
|
2020-10-16 21:56:58 -05:00
|
|
|
FCurve *fcu = BKE_fcurve_find_by_rna_context_ui(
|
|
|
|
|
C, &ptr, prop, index, NULL, NULL, &driven, &special);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
if (fcu) {
|
|
|
|
|
/* Isolate this F-Curve... */
|
|
|
|
|
bAnimContext ac;
|
|
|
|
|
if (ANIM_animdata_get_context(C, &ac)) {
|
|
|
|
|
int filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS;
|
Cleanup: Animation, simplify channel selection code
Split up `ANIM_deselect_anim_channels()` into
`ANIM_anim_channels_select_set()` and
`ANIM_anim_channels_select_toggle()`.
`ANIM_anim_channels_select_set()` is equivalent to the old
`ANIM_deselect_anim_channels(..., false, ACHANNEL_SETFLAG_xxx)`.
`ANIM_anim_channels_select_toggle()` is equivalent to the old
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_ADD)`.
`ANIM_deselect_anim_channels(..., true, ACHANNEL_SETFLAG_CLEAR)` was
also called once. The `true` parameter suggested the "toggle" behaviour
was intended, but the `ACHANNEL_SETFLAG_CLEAR` argument prevented any
toggling. This is now replaced with `ANIM_anim_channels_select_set(ac,
ACHANNEL_SETFLAG_CLEAR)` to make this explicit.
No functional changes, just a cleanup in order to better understand how
the selection works.
2020-10-13 14:43:19 +02:00
|
|
|
ANIM_anim_channels_select_set(&ac, ACHANNEL_SETFLAG_CLEAR);
|
2018-05-22 16:18:09 +02:00
|
|
|
ANIM_set_active_channel(&ac, ac.data, ac.datatype, filter, fcu, ANIMTYPE_FCURVE);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-04-22 00:18:34 +10:00
|
|
|
/* Just blindly isolate...
|
|
|
|
|
* This isn't the best, and shouldn't happen, but may be enough. */
|
2018-05-22 16:18:09 +02:00
|
|
|
fcu->flag |= (FCURVE_ACTIVE | FCURVE_SELECTED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2018-05-22 16:18:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Show Drivers Editor";
|
|
|
|
|
ot->description = "Show drivers editor in a separate window";
|
|
|
|
|
ot->idname = "SCREEN_OT_drivers_editor_show";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-05-22 16:18:09 +02:00
|
|
|
/* api callbacks */
|
2020-05-23 22:48:05 +02:00
|
|
|
ot->exec = drivers_editor_show_exec;
|
2018-05-22 16:18:09 +02:00
|
|
|
ot->poll = ED_operator_screenactive;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2019-08-16 16:24:16 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Show Info Log Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-05-23 22:48:05 +02:00
|
|
|
static int info_log_show_exec(bContext *C, wmOperator *op)
|
2019-08-16 16:24:16 +02:00
|
|
|
{
|
2020-05-23 22:48:05 +02:00
|
|
|
wmWindow *win_cur = CTX_wm_window(C);
|
|
|
|
|
/* Use eventstate, not event from _invoke, so this can be called through exec(). */
|
|
|
|
|
const wmEvent *event = win_cur->eventstate;
|
2019-08-16 16:24:16 +02:00
|
|
|
int sizex = 900 * UI_DPI_FAC;
|
|
|
|
|
int sizey = 580 * UI_DPI_FAC;
|
|
|
|
|
int shift_y = 480;
|
|
|
|
|
|
|
|
|
|
/* changes context! */
|
2021-02-22 11:37:25 -08:00
|
|
|
if (WM_window_open(C,
|
|
|
|
|
IFACE_("Blender Info Log"),
|
|
|
|
|
event->x,
|
|
|
|
|
event->y + shift_y,
|
|
|
|
|
sizex,
|
|
|
|
|
sizey,
|
|
|
|
|
SPACE_INFO,
|
|
|
|
|
false,
|
|
|
|
|
true,
|
|
|
|
|
WIN_ALIGN_LOCATION_CENTER) != NULL) {
|
2019-08-16 16:24:16 +02:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2020-07-03 16:01:15 +02:00
|
|
|
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2019-08-16 16:24:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_info_log_show(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Show Info Log";
|
|
|
|
|
ot->description = "Show info log in a separate window";
|
|
|
|
|
ot->idname = "SCREEN_OT_info_log_show";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
2020-05-23 22:48:05 +02:00
|
|
|
ot->exec = info_log_show_exec;
|
2019-08-16 16:24:16 +02:00
|
|
|
ot->poll = ED_operator_screenactive;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name New Screen Operator
|
|
|
|
|
* \{ */
|
2009-07-10 16:55:49 +00:00
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-08-15 16:43:03 +00:00
|
|
|
{
|
2018-06-06 16:32:09 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2012-05-08 11:48:19 +00:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
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
|
|
|
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
|
|
|
|
|
WorkSpaceLayout *layout_old = BKE_workspace_active_layout_get(win->workspace_hook);
|
|
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(bmain, workspace, layout_old, win);
|
|
|
|
|
|
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
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
|
|
|
|
|
|
2009-08-15 16:43:03 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void SCREEN_OT_new(wmOperatorType *ot)
|
2009-08-15 16:43:03 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "New Screen";
|
|
|
|
|
ot->description = "Add a new screen";
|
|
|
|
|
ot->idname = "SCREEN_OT_new";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-15 16:43:03 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_new_exec;
|
|
|
|
|
ot->poll = WM_operator_winactive;
|
2009-08-15 16:43:03 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Delete Screen Operator
|
|
|
|
|
* \{ */
|
2009-08-15 16:43:03 +00:00
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-08-15 16:43:03 +00:00
|
|
|
{
|
2020-04-03 14:23:21 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
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
|
|
|
WorkSpace *workspace = CTX_wm_workspace(C);
|
2020-04-03 14:23:21 +02:00
|
|
|
WorkSpaceLayout *layout = BKE_workspace_layout_find(workspace, screen);
|
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
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTDELETE, layout);
|
|
|
|
|
|
2009-08-15 16:43:03 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void SCREEN_OT_delete(wmOperatorType *ot)
|
2009-08-15 16:43:03 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2013-12-07 13:23:21 +13:00
|
|
|
ot->name = "Delete Screen";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Delete active screen";
|
|
|
|
|
ot->idname = "SCREEN_OT_delete";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-15 16:43:03 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = screen_delete_exec;
|
2009-08-15 16:43:03 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Region Alpha Blending Operator
|
2019-04-18 12:52:50 +02:00
|
|
|
*
|
|
|
|
|
* Implementation note: a disappearing region needs at least 1 last draw with
|
2021-02-16 21:15:45 +11:00
|
|
|
* 100% back-buffer texture over it - then triple buffer will clear it entirely.
|
2019-04-18 12:52:50 +02:00
|
|
|
* This because flag #RGN_FLAG_HIDDEN is set in end - region doesn't draw at all then.
|
|
|
|
|
*
|
2018-01-21 01:41:58 +11:00
|
|
|
* \{ */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
|
typedef struct RegionAlphaInfo {
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area;
|
2020-04-03 12:51:03 +02:00
|
|
|
ARegion *region, *child_region; /* other region */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
int hidden;
|
|
|
|
|
} RegionAlphaInfo;
|
|
|
|
|
|
2018-11-09 03:26:42 +01:00
|
|
|
#define TIMEOUT 0.1f
|
2018-11-09 15:33:51 +01:00
|
|
|
#define TIMESTEP (1.0f / 60.0f)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
float ED_region_blend_alpha(ARegion *region)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
|
|
|
|
/* check parent too */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontimer == NULL && (region->alignment & RGN_SPLIT_PREV) && region->prev) {
|
|
|
|
|
region = region->prev;
|
2012-12-13 01:00:21 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontimer) {
|
|
|
|
|
RegionAlphaInfo *rgi = region->regiontimer->customdata;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
float alpha;
|
2012-12-13 01:00:21 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
alpha = (float)region->regiontimer->duration / TIMEOUT;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* makes sure the blend out works 100% - without area redraws */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (rgi->hidden) {
|
2012-12-13 00:47:47 +00:00
|
|
|
alpha = 0.9f - TIMESTEP - alpha;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
CLAMP(alpha, 0.0f, 1.0f);
|
|
|
|
|
return alpha;
|
|
|
|
|
}
|
|
|
|
|
return 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* assumes region has running region-blend timer */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void region_blend_end(bContext *C, ARegion *region, const bool is_running)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
RegionAlphaInfo *rgi = region->regiontimer->customdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* always send redraw */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2020-04-03 12:51:03 +02:00
|
|
|
if (rgi->child_region) {
|
|
|
|
|
ED_region_tag_redraw(rgi->child_region);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* if running timer was hiding, the flag toggle went wrong */
|
|
|
|
|
if (is_running) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (rgi->hidden) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rgi->region->flag &= ~RGN_FLAG_HIDDEN;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (rgi->hidden) {
|
2020-03-06 16:56:42 +01:00
|
|
|
rgi->region->flag |= rgi->hidden;
|
2020-08-01 13:02:21 +10:00
|
|
|
ED_area_init(CTX_wm_manager(C), CTX_wm_window(C), rgi->area);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
|
/* area decoration needs redraw in end */
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(rgi->area);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
WM_event_remove_timer(CTX_wm_manager(C), NULL, region->regiontimer); /* frees rgi */
|
|
|
|
|
region->regiontimer = NULL;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
2019-08-24 08:54:48 +10:00
|
|
|
/**
|
2020-03-06 16:56:42 +01:00
|
|
|
* \note Assumes that \a region itself is not a split version from previous region.
|
2019-08-24 08:54:48 +10:00
|
|
|
*/
|
2020-04-03 13:25:03 +02:00
|
|
|
void ED_region_visibility_change_update_animated(bContext *C, ScrArea *area, ARegion *region)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
|
2014-01-28 03:52:21 +11:00
|
|
|
/* end running timer */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->regiontimer) {
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
region_blend_end(C, region, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-10-16 21:56:58 -05:00
|
|
|
RegionAlphaInfo *rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo");
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
rgi->hidden = region->flag & RGN_FLAG_HIDDEN;
|
2020-04-03 13:25:03 +02:00
|
|
|
rgi->area = area;
|
2020-03-06 16:56:42 +01:00
|
|
|
rgi->region = region;
|
|
|
|
|
region->flag &= ~RGN_FLAG_HIDDEN;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2012-12-13 01:00:21 +00:00
|
|
|
/* blend in, reinitialize regions because it got unhidden */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (rgi->hidden == 0) {
|
2020-08-01 13:02:21 +10:00
|
|
|
ED_area_init(wm, win, area);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2020-03-06 16:56:42 +01:00
|
|
|
WM_event_remove_handlers(C, ®ion->handlers);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2012-12-13 01:00:21 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region->next) {
|
|
|
|
|
if (region->next->alignment & RGN_SPLIT_PREV) {
|
2020-04-03 12:51:03 +02:00
|
|
|
rgi->child_region = region->next;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
|
/* new timer */
|
2020-03-06 16:56:42 +01:00
|
|
|
region->regiontimer = WM_event_add_timer(wm, win, TIMERREGION, TIMESTEP);
|
|
|
|
|
region->regiontimer->customdata = rgi;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* timer runs in win->handlers, so it cannot use context to find area/region */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
|
|
|
|
wmTimer *timer = event->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* event type is TIMERREGION, but we better check */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (event->type != TIMERREGION || timer == NULL) {
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-10-16 21:56:58 -05:00
|
|
|
RegionAlphaInfo *rgi = timer->customdata;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* always send redraws */
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(rgi->region);
|
2020-04-03 12:51:03 +02:00
|
|
|
if (rgi->child_region) {
|
|
|
|
|
ED_region_tag_redraw(rgi->child_region);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* end timer? */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (rgi->region->regiontimer->duration > (double)TIMEOUT) {
|
|
|
|
|
region_blend_end(C, rgi->region, false);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_region_blend(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Region Alpha";
|
|
|
|
|
ot->idname = "SCREEN_OT_region_blend";
|
|
|
|
|
ot->description = "Blend in and out overlapping region";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* api callbacks */
|
|
|
|
|
ot->invoke = region_blend_invoke;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* flags */
|
2014-02-26 13:48:41 +11:00
|
|
|
ot->flag = OPTYPE_INTERNAL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* properties */
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
2018-11-29 18:13:01 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Space Type Set or Cycle Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2019-01-31 16:55:04 +01:00
|
|
|
static bool space_type_set_or_cycle_poll(bContext *C)
|
|
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
return (area && !ELEM(area->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR));
|
2019-01-31 16:55:04 +01:00
|
|
|
}
|
|
|
|
|
|
2018-11-29 18:13:01 +11:00
|
|
|
static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
const int space_type = RNA_enum_get(op->ptr, "space_type");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-29 18:13:01 +11:00
|
|
|
PointerRNA ptr;
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, area, &ptr);
|
2018-11-29 18:13:01 +11:00
|
|
|
PropertyRNA *prop_type = RNA_struct_find_property(&ptr, "type");
|
|
|
|
|
PropertyRNA *prop_ui_type = RNA_struct_find_property(&ptr, "ui_type");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area->spacetype != space_type) {
|
2018-11-29 18:13:01 +11:00
|
|
|
/* Set the type. */
|
|
|
|
|
RNA_property_enum_set(&ptr, prop_type, space_type);
|
|
|
|
|
RNA_property_update(C, &ptr, prop_type);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Types match, cycle the subtype. */
|
|
|
|
|
const int space_type_ui = RNA_property_enum_get(&ptr, prop_ui_type);
|
|
|
|
|
const EnumPropertyItem *item;
|
|
|
|
|
int item_len;
|
|
|
|
|
bool free;
|
|
|
|
|
RNA_property_enum_items(C, &ptr, prop_ui_type, &item, &item_len, &free);
|
|
|
|
|
int index = RNA_enum_from_value(item, space_type_ui);
|
|
|
|
|
for (int i = 1; i < item_len; i++) {
|
|
|
|
|
const EnumPropertyItem *item_test = &item[(index + i) % item_len];
|
|
|
|
|
if ((item_test->value >> 16) == space_type) {
|
|
|
|
|
RNA_property_enum_set(&ptr, prop_ui_type, item_test->value);
|
|
|
|
|
RNA_property_update(C, &ptr, prop_ui_type);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (free) {
|
|
|
|
|
MEM_freeN((void *)item);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-29 18:13:01 +11:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Cycle Space Type Set";
|
2020-12-24 13:11:22 -06:00
|
|
|
ot->description = "Set the space type or cycle subtype";
|
2018-11-29 18:13:01 +11:00
|
|
|
ot->idname = "SCREEN_OT_space_type_set_or_cycle";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
|
ot->exec = space_type_set_or_cycle_exec;
|
2019-01-31 16:55:04 +01:00
|
|
|
ot->poll = space_type_set_or_cycle_poll;
|
2018-11-29 18:13:01 +11:00
|
|
|
|
|
|
|
|
ot->flag = 0;
|
|
|
|
|
|
|
|
|
|
RNA_def_enum(ot->srna, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Type", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Space Context Cycle Operator
|
|
|
|
|
* \{ */
|
2016-09-21 14:43:11 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem space_context_cycle_direction[] = {
|
2016-09-21 14:43:11 +02:00
|
|
|
{SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""},
|
|
|
|
|
{SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2016-09-21 14:43:11 +02:00
|
|
|
};
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool space_context_cycle_poll(bContext *C)
|
2016-09-21 14:43:11 +02:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
|
/* area might be NULL if called out of window bounds */
|
|
|
|
|
return (area && ELEM(area->spacetype, SPACE_PROPERTIES, SPACE_USERPREF));
|
2016-09-21 14:43:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper to get the correct RNA pointer/property pair for changing
|
2020-04-03 13:25:03 +02:00
|
|
|
* the display context of active space type in \a area.
|
2016-09-21 14:43:11 +02:00
|
|
|
*/
|
|
|
|
|
static void context_cycle_prop_get(bScreen *screen,
|
2020-04-03 13:25:03 +02:00
|
|
|
const ScrArea *area,
|
2016-09-21 14:43:11 +02:00
|
|
|
PointerRNA *r_ptr,
|
|
|
|
|
PropertyRNA **r_prop)
|
|
|
|
|
{
|
|
|
|
|
const char *propname;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
switch (area->spacetype) {
|
2019-02-16 10:44:15 +11:00
|
|
|
case SPACE_PROPERTIES:
|
2020-04-03 13:25:03 +02:00
|
|
|
RNA_pointer_create(&screen->id, &RNA_SpaceProperties, area->spacedata.first, r_ptr);
|
2016-09-21 14:43:11 +02:00
|
|
|
propname = "context";
|
|
|
|
|
break;
|
|
|
|
|
case SPACE_USERPREF:
|
2018-12-21 12:47:44 +11:00
|
|
|
RNA_pointer_create(NULL, &RNA_Preferences, &U, r_ptr);
|
2016-09-21 14:43:11 +02:00
|
|
|
propname = "active_section";
|
|
|
|
|
break;
|
2016-10-24 10:25:04 +02:00
|
|
|
default:
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
propname = "";
|
2016-09-21 14:43:11 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-09-21 14:43:11 +02:00
|
|
|
*r_prop = RNA_struct_find_property(r_ptr, propname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
|
|
|
|
{
|
|
|
|
|
const int direction = RNA_enum_get(op->ptr, "direction");
|
|
|
|
|
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
context_cycle_prop_get(CTX_wm_screen(C), CTX_wm_area(C), &ptr, &prop);
|
|
|
|
|
const int old_context = RNA_property_enum_get(&ptr, prop);
|
|
|
|
|
const int new_context = RNA_property_enum_step(
|
2018-05-29 18:18:36 +02:00
|
|
|
C, &ptr, prop, old_context, direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1);
|
2016-09-21 14:43:11 +02:00
|
|
|
RNA_property_enum_set(&ptr, prop, new_context);
|
|
|
|
|
RNA_property_update(C, &ptr, prop);
|
|
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_space_context_cycle(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Cycle Space Context";
|
|
|
|
|
ot->description = "Cycle through the editor context by activating the next/previous one";
|
|
|
|
|
ot->idname = "SCREEN_OT_space_context_cycle";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
|
ot->invoke = space_context_cycle_invoke;
|
|
|
|
|
ot->poll = space_context_cycle_poll;
|
|
|
|
|
|
|
|
|
|
ot->flag = 0;
|
|
|
|
|
|
|
|
|
|
RNA_def_enum(ot->srna,
|
|
|
|
|
"direction",
|
|
|
|
|
space_context_cycle_direction,
|
|
|
|
|
SPACE_CONTEXT_CYCLE_NEXT,
|
|
|
|
|
"Direction",
|
|
|
|
|
"Direction to cycle through");
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2018-05-29 17:25:19 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Workspace Cycle Operator
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static int space_workspace_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
|
|
|
|
{
|
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
if (WM_window_is_temp_screen(win)) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2018-05-29 17:25:19 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
|
|
|
|
const int direction = RNA_enum_get(op->ptr, "direction");
|
|
|
|
|
WorkSpace *workspace_src = WM_window_get_active_workspace(win);
|
2018-09-11 16:20:29 +02:00
|
|
|
WorkSpace *workspace_dst = NULL;
|
|
|
|
|
|
|
|
|
|
ListBase ordered;
|
2019-03-08 09:29:17 +11:00
|
|
|
BKE_id_ordered_list(&ordered, &bmain->workspaces);
|
2018-09-11 16:20:29 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (LinkData *, link, &ordered) {
|
2018-09-11 16:20:29 +02:00
|
|
|
if (link->data == workspace_src) {
|
|
|
|
|
if (direction == SPACE_CONTEXT_CYCLE_PREV) {
|
|
|
|
|
workspace_dst = (link->prev) ? link->prev->data : NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
workspace_dst = (link->next) ? link->next->data : NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-29 17:25:19 +02:00
|
|
|
if (workspace_dst == NULL) {
|
2018-09-11 16:20:29 +02:00
|
|
|
LinkData *link = (direction == SPACE_CONTEXT_CYCLE_PREV) ? ordered.last : ordered.first;
|
|
|
|
|
workspace_dst = link->data;
|
2018-05-29 17:25:19 +02:00
|
|
|
}
|
2018-09-11 16:20:29 +02:00
|
|
|
|
|
|
|
|
BLI_freelistN(&ordered);
|
|
|
|
|
|
|
|
|
|
if (workspace_src == workspace_dst) {
|
|
|
|
|
return OPERATOR_CANCELLED;
|
2018-05-29 17:25:19 +02:00
|
|
|
}
|
2018-09-11 16:20:29 +02:00
|
|
|
|
|
|
|
|
win->workspace_hook->temp_workspace_store = workspace_dst;
|
|
|
|
|
WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, workspace_dst);
|
|
|
|
|
win->workspace_hook->temp_workspace_store = NULL;
|
|
|
|
|
|
2018-05-29 17:25:19 +02:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SCREEN_OT_workspace_cycle(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Cycle Workspace";
|
|
|
|
|
ot->description = "Cycle through workspaces";
|
|
|
|
|
ot->idname = "SCREEN_OT_workspace_cycle";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
|
ot->invoke = space_workspace_cycle_invoke;
|
2018-09-20 14:47:10 +00:00
|
|
|
ot->poll = ED_operator_screenactive;
|
2018-05-29 17:25:19 +02:00
|
|
|
|
|
|
|
|
ot->flag = 0;
|
|
|
|
|
|
|
|
|
|
RNA_def_enum(ot->srna,
|
|
|
|
|
"direction",
|
|
|
|
|
space_context_cycle_direction,
|
|
|
|
|
SPACE_CONTEXT_CYCLE_NEXT,
|
|
|
|
|
"Direction",
|
|
|
|
|
"Direction to cycle through");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Assigning Operator Types
|
|
|
|
|
* \{ */
|
2010-12-17 19:05:34 +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
|
|
|
/* called in spacetypes.c */
|
2008-01-07 18:03:41 +00:00
|
|
|
void ED_operatortypes_screen(void)
|
|
|
|
|
{
|
2.5 getting-back-into-coding commit :)
- cleaned up join and split operations. Most noticable is operator callback
design, which should make a design based on user-less exec() first, then
wrap invoke() and modal() around it. The exec() should be callable with
only Context and properties.
- split now works again; and inversed as previously, if you drag from a
triangle (action zone) inside area it subdivides area as expected.
- dragging from triangle outside area, over an edge, joins areas
- split has been simplified, it had too many options... it could just work
simpler (now)
- 'action zone' now is an operator itself, a widget sending an ACTIONZONE event,
which can be handled by others (so other gestures can be added in action zone
too)
Still evaluating:
- context gets set where?
- code structure confuses... what are proper functions for operators?
- what is WM... should low level screen stuff more there?
- when do you send event, notifier?
- files grow to large, will clean
Oh yeah and docs, docs, docs. Coming! :)
2008-11-17 18:54:03 +00:00
|
|
|
/* generic UI stuff */
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_actionzone);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_repeat_last);
|
2009-01-15 18:28:40 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_repeat_history);
|
2009-02-04 11:52:16 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_redo_last);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-11-24 18:59:59 +00:00
|
|
|
/* screen tools */
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_area_move);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_area_split);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_area_join);
|
2011-03-02 14:09:54 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_area_options);
|
2009-03-11 20:22:06 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_area_dupli);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_area_swap);
|
2009-12-04 00:49:02 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_quadview);
|
2.5
First version of region-scaling. WIP commit, so bear with me a while!
- All fixed sized regions have a small 'drag' widget, on the left or top.
(not yet for free-sized regions, like 4-split).
- Mouse-over on widget changes cursor and allows drag.
- Click on widget hides/reveals.
- Fun for test; 3d view header, if high enough, draws more rows of
buttons when width is too small.
The WIP stuff;
- It doesn't save yet in files, using the "minsize" variable of region
definitions, also means other similar areas show same sizes now.
- Definitions for pref size, min/max will be added.
- Properties panel in Fcurve window draws widget on wrong place when
hidden (subdiv system needs tweak)
- Widgets don't draw perfect yet, also needs further tweaks.
But, in general it's quite fun and usable. :) Many variatians are possible,
like for real tabs, or little icons, or just click-drag on edge.
The reason to first try the widget/tab variation:
- it re-uses the "Area Action Zone" code, widgets for layouting Screens
- it's visible, hotkey-only options for screen layouts are not preferred.
- distinguish clearly area-edges from region-edges this way. Having the
cursor change shape on every edge (and block input) is probably annoying
too... but that can be tested.
Later more!
2009-05-24 13:29:29 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_scale);
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_toggle);
|
2009-11-27 11:51:34 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_flip);
|
2012-10-25 13:08:47 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_header_toggle_menus);
|
2019-05-09 18:40:42 +10:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_context_menu);
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_screen_set);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_screen_full_area);
|
2009-12-08 07:12:06 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_back_to_previous);
|
2011-01-06 17:54:17 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_spacedata_cleanup);
|
2009-02-14 16:43:02 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_screenshot);
|
2018-11-28 12:21:49 +01:00
|
|
|
WM_operatortype_append(SCREEN_OT_userpref_show);
|
2018-05-22 16:18:09 +02:00
|
|
|
WM_operatortype_append(SCREEN_OT_drivers_editor_show);
|
2019-08-16 16:24:16 +02:00
|
|
|
WM_operatortype_append(SCREEN_OT_info_log_show);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_region_blend);
|
2018-11-29 18:13:01 +11:00
|
|
|
WM_operatortype_append(SCREEN_OT_space_type_set_or_cycle);
|
2016-09-21 14:43:11 +02:00
|
|
|
WM_operatortype_append(SCREEN_OT_space_context_cycle);
|
2018-05-29 17:25:19 +02:00
|
|
|
WM_operatortype_append(SCREEN_OT_workspace_cycle);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-17 16:21:14 +00:00
|
|
|
/*frame changes*/
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_frame_offset);
|
2009-08-02 07:08:51 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_frame_jump);
|
2009-07-24 13:34:45 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_keyframe_jump);
|
2013-10-21 15:00:22 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_marker_jump);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_animation_step);
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_animation_play);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_operatortype_append(SCREEN_OT_animation_cancel);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-08-15 16:43:03 +00:00
|
|
|
/* new/delete */
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_new);
|
|
|
|
|
WM_operatortype_append(SCREEN_OT_delete);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Operator Key Map
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
static void keymap_modal_set(wmKeyConfig *keyconf)
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
{
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem modal_items[] = {
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
{KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
|
|
|
|
|
{KM_MODAL_APPLY, "APPLY", 0, "Apply", ""},
|
2020-10-24 11:42:17 -07:00
|
|
|
{KM_MODAL_SNAP_ON, "SNAP", 0, "Snap On", ""},
|
|
|
|
|
{KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap Off", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
/* Standard Modal keymap ------------------------------------------------ */
|
2020-10-16 21:56:58 -05:00
|
|
|
wmKeyMap *keymap = WM_modalkeymap_ensure(keyconf, "Standard Modal Map", modal_items);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move");
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-22 17:18:42 +02:00
|
|
|
static bool blend_file_drop_poll(bContext *UNUSED(C),
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const wmEvent *UNUSED(event),
|
2020-03-25 17:58:58 +11:00
|
|
|
const char **UNUSED(r_tooltip))
|
2010-12-17 19:05:34 +00:00
|
|
|
{
|
2012-05-08 11:48:19 +00:00
|
|
|
if (drag->type == WM_DRAG_PATH) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (drag->icon == ICON_FILE_BLEND) {
|
2020-09-08 13:54:39 -05:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2010-12-17 19:05:34 +00:00
|
|
|
}
|
2020-09-08 13:54:39 -05:00
|
|
|
return false;
|
2010-12-17 19:05:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-22 17:18:42 +02:00
|
|
|
static void blend_file_drop_copy(wmDrag *drag, wmDropBox *drop)
|
2010-12-17 19:05:34 +00:00
|
|
|
{
|
|
|
|
|
/* copy drag path to properties */
|
|
|
|
|
RNA_string_set(drop->ptr, "filepath", drag->path);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/* called in spacetypes.c */
|
2009-10-22 23:22:05 +00:00
|
|
|
void ED_keymap_screen(wmKeyConfig *keyconf)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
/* Screen Editing ------------------------------------------------ */
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "Screen Editing", 0, 0);
|
2016-03-16 11:33:32 +11:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* Screen General ------------------------------------------------ */
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "Screen", 0, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-19 05:20:30 +00:00
|
|
|
/* Anim Playback ------------------------------------------------ */
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "Frames", 0, 0);
|
2010-07-18 14:46:52 +00:00
|
|
|
|
2010-12-17 19:05:34 +00:00
|
|
|
/* dropbox for entire window */
|
2020-10-16 21:56:58 -05:00
|
|
|
ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
|
2021-02-16 15:24:22 +01:00
|
|
|
WM_dropbox_add(lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL);
|
|
|
|
|
WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
keymap_modal_set(keyconf);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
2018-01-21 01:41:58 +11:00
|
|
|
/** \} */
|