2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-14 11:25:00 +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-12-14 11:25:00 +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-12-14 11:25:00 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spfile
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2014-11-23 14:37:13 +01:00
|
|
|
#include "BKE_appdir.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
#include "BKE_screen.h"
|
2012-08-08 08:25:20 +00:00
|
|
|
#include "BKE_global.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
2017-11-13 19:43:34 +11:00
|
|
|
#include "WM_message.h"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
#include "ED_space_api.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
#include "ED_screen.h"
|
2009-01-06 14:42:54 +00:00
|
|
|
#include "ED_fileselect.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2009-03-03 10:24:06 +00:00
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
#include "IMB_thumbs.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#include "file_intern.h" // own include
|
2009-01-06 14:42:54 +00:00
|
|
|
#include "fsmenu.h"
|
|
|
|
|
#include "filelist.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_framebuffer.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2019-09-20 15:09:47 +02:00
|
|
|
static ARegion *file_execute_region_ensure(ScrArea *sa, ARegion *ar_prev)
|
|
|
|
|
{
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE)) != NULL) {
|
|
|
|
|
return ar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "execute region for file");
|
|
|
|
|
BLI_insertlinkafter(&sa->regionbase, ar_prev, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_EXECUTE;
|
|
|
|
|
ar->alignment = RGN_ALIGN_BOTTOM;
|
|
|
|
|
ar->flag = RGN_FLAG_DYNAMIC_SIZE;
|
|
|
|
|
|
|
|
|
|
return ar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ARegion *file_tool_props_region_ensure(ScrArea *sa, ARegion *ar_prev)
|
|
|
|
|
{
|
|
|
|
|
ARegion *ar;
|
|
|
|
|
|
|
|
|
|
if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS)) != NULL) {
|
|
|
|
|
return ar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add subdiv level; after execute region */
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "tool props for file");
|
|
|
|
|
BLI_insertlinkafter(&sa->regionbase, ar_prev, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_TOOL_PROPS;
|
|
|
|
|
ar->alignment = RGN_ALIGN_RIGHT;
|
|
|
|
|
|
|
|
|
|
return ar;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-14 12:16:55 +00:00
|
|
|
/* ******************** default callbacks for file space ***************** */
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2018-04-21 19:30:56 +02:00
|
|
|
static SpaceLink *file_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
ARegion *ar;
|
|
|
|
|
SpaceFile *sfile;
|
|
|
|
|
|
|
|
|
|
sfile = MEM_callocN(sizeof(SpaceFile), "initfile");
|
|
|
|
|
sfile->spacetype = SPACE_FILE;
|
|
|
|
|
|
|
|
|
|
/* header */
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "header for file");
|
|
|
|
|
BLI_addtail(&sfile->regionbase, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_HEADER;
|
|
|
|
|
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */
|
|
|
|
|
ar->alignment = RGN_ALIGN_TOP;
|
|
|
|
|
|
2019-09-29 20:16:19 +02:00
|
|
|
/* Tools region */
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "tools region for file");
|
|
|
|
|
BLI_addtail(&sfile->regionbase, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_TOOLS;
|
|
|
|
|
ar->alignment = RGN_ALIGN_LEFT;
|
|
|
|
|
|
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
|
|
|
/* ui list region */
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "ui region for file");
|
|
|
|
|
BLI_addtail(&sfile->regionbase, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_UI;
|
|
|
|
|
ar->alignment = RGN_ALIGN_TOP;
|
|
|
|
|
ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
|
|
|
|
|
|
2019-09-20 17:36:38 +02:00
|
|
|
/* Tool props and execute region are added as needed, see file_refresh(). */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
/* main region */
|
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "main region for file");
|
|
|
|
|
BLI_addtail(&sfile->regionbase, ar);
|
|
|
|
|
ar->regiontype = RGN_TYPE_WINDOW;
|
|
|
|
|
ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
|
|
|
|
ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
|
|
|
|
ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
|
|
|
|
ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
|
|
|
|
ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
|
|
|
|
|
|
|
|
|
|
return (SpaceLink *)sfile;
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* not spacelink itself */
|
|
|
|
|
static void file_free(SpaceLink *sl)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
|
|
|
|
|
|
|
|
|
BLI_assert(sfile->previews_timer == NULL);
|
|
|
|
|
|
|
|
|
|
if (sfile->files) {
|
|
|
|
|
// XXXXX would need to do thumbnails_stop here, but no context available
|
|
|
|
|
filelist_freelib(sfile->files);
|
|
|
|
|
filelist_free(sfile->files);
|
|
|
|
|
MEM_freeN(sfile->files);
|
|
|
|
|
sfile->files = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sfile->folders_prev) {
|
|
|
|
|
folderlist_free(sfile->folders_prev);
|
|
|
|
|
MEM_freeN(sfile->folders_prev);
|
|
|
|
|
sfile->folders_prev = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sfile->folders_next) {
|
|
|
|
|
folderlist_free(sfile->folders_next);
|
|
|
|
|
MEM_freeN(sfile->folders_next);
|
|
|
|
|
sfile->folders_next = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sfile->params) {
|
|
|
|
|
MEM_freeN(sfile->params);
|
|
|
|
|
sfile->params = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sfile->layout) {
|
|
|
|
|
MEM_freeN(sfile->layout);
|
|
|
|
|
sfile->layout = NULL;
|
|
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-17 13:11:09 +00:00
|
|
|
/* spacetype; init callback, area size changes, screen set, etc */
|
2019-11-27 14:50:37 +11:00
|
|
|
static void file_init(wmWindowManager *UNUSED(wm), ScrArea *sa)
|
2009-01-06 19:22:29 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
|
2015-02-16 15:48:37 +01:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sfile->layout) {
|
2019-04-17 06:17:24 +02:00
|
|
|
sfile->layout->dirty = true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-15 19:56:29 +00:00
|
|
|
static void file_exit(wmWindowManager *wm, ScrArea *sa)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
|
2013-03-15 19:56:29 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (sfile->previews_timer) {
|
|
|
|
|
WM_event_remove_timer_notifier(wm, NULL, sfile->previews_timer);
|
|
|
|
|
sfile->previews_timer = NULL;
|
|
|
|
|
}
|
Final 'FileBrowser First Stage' merge.
It basically rewrites most of filelist.c, with some more limited changes in other areas of filebrowser.
From user perspective, it:
* Removes some info in 'long' drawing mode (owner, permissions) - OS-specific data that do not really matter in Blender!
* Makes short/long display 'fixed' size (among four choices, like thumbnails mode).
* Allows to list several layers of dirtree at once, in a flat way (inside .blend files and/or real directories).
* Consequently, adds datablocks types filtering.
* Uses way less RAM when listing big directories, especially in thumbnail mode (we are talking of several hundred of MiB spared).
* Generates thumbnails way faster.
From code perspective, it:
* Is ready for asset engine needs (on data structure level in filebrowser's listing).
* Simplifies and makes 'generic' file listing much lighter.
* Separates file listing in three different aspects:
** 'generic' filelisting (in BLI), which becomes a shallow wrapper around stat struct.
** 'filebrowser drawing' filelisting, which only contains current visible subset of the whole list (sliding window), with extra drawing data (strings for size, date/time, preview, etc.).
** 'asset-ready' filelisting, which is used for operations common to 'basic' filehandling and future asset-related one.
* Uses uuid's to handle file selection/state in the browser, instead of using flags in filelisting items.
* Uses much lighter BLI_task handling for previews, instead of heavy 'job' system (using the new 'notifier' timer to handle UI refresh, in similar way to jobs).
* Moves .blend datablocks preview handling to IMB_thumbnail (necessary to avoid storing all datablock previews at once, and gives better consistency and performances too).
Revision: https://developer.blender.org/D1316
Thanks to Campbell & Sergey for the reviews. :)
2015-08-19 22:41:39 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_fileselect_exit(wm, sa, sfile);
|
2013-03-15 19:56:29 +00:00
|
|
|
}
|
2009-02-17 13:11:09 +00:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
static SpaceLink *file_duplicate(SpaceLink *sl)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfileo = (SpaceFile *)sl;
|
|
|
|
|
SpaceFile *sfilen = MEM_dupallocN(sl);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* clear or remove stuff from old */
|
|
|
|
|
sfilen->op = NULL; /* file window doesn't own operators */
|
2009-01-06 19:22:29 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
sfilen->previews_timer = NULL;
|
|
|
|
|
sfilen->smoothscroll_timer = NULL;
|
2018-02-09 16:13:13 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (sfileo->params) {
|
|
|
|
|
sfilen->files = filelist_new(sfileo->params->type);
|
|
|
|
|
sfilen->params = MEM_dupallocN(sfileo->params);
|
|
|
|
|
filelist_setdir(sfilen->files, sfilen->params->dir);
|
|
|
|
|
}
|
2010-03-10 19:30:20 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sfileo->folders_prev) {
|
2019-04-17 06:17:24 +02:00
|
|
|
sfilen->folders_prev = folderlist_duplicate(sfileo->folders_prev);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-07-07 07:25:44 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sfileo->folders_next) {
|
2019-04-17 06:17:24 +02:00
|
|
|
sfilen->folders_next = folderlist_duplicate(sfileo->folders_next);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (sfileo->layout) {
|
|
|
|
|
sfilen->layout = MEM_dupallocN(sfileo->layout);
|
|
|
|
|
}
|
|
|
|
|
return (SpaceLink *)sfilen;
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-20 15:09:47 +02:00
|
|
|
static void file_ensure_valid_region_state(bContext *C,
|
|
|
|
|
wmWindowManager *wm,
|
|
|
|
|
wmWindow *win,
|
|
|
|
|
ScrArea *sa,
|
|
|
|
|
SpaceFile *sfile,
|
|
|
|
|
FileSelectParams *params)
|
|
|
|
|
{
|
2019-09-29 20:16:19 +02:00
|
|
|
ARegion *ar_ui = BKE_area_find_region_type(sa, RGN_TYPE_UI);
|
2019-09-20 15:09:47 +02:00
|
|
|
ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
|
|
|
|
|
ARegion *ar_execute = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE);
|
|
|
|
|
bool needs_init = false; /* To avoid multiple ED_area_initialize() calls. */
|
|
|
|
|
|
|
|
|
|
/* If there's an file-operation, ensure we have the option and execute region */
|
|
|
|
|
if (sfile->op && (ar_props == NULL)) {
|
2019-09-29 20:16:19 +02:00
|
|
|
ar_execute = file_execute_region_ensure(sa, ar_ui);
|
2019-09-20 15:09:47 +02:00
|
|
|
ar_props = file_tool_props_region_ensure(sa, ar_execute);
|
|
|
|
|
|
|
|
|
|
if (params->flag & FILE_HIDE_TOOL_PROPS) {
|
|
|
|
|
ar_props->flag |= RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ar_props->flag &= ~RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
needs_init = true;
|
|
|
|
|
}
|
|
|
|
|
/* If there's _no_ file-operation, ensure we _don't_ have the option and execute region */
|
|
|
|
|
else if ((sfile->op == NULL) && (ar_props != NULL)) {
|
|
|
|
|
BLI_assert(ar_execute != NULL);
|
|
|
|
|
|
|
|
|
|
ED_region_remove(C, sa, ar_props);
|
|
|
|
|
ED_region_remove(C, sa, ar_execute);
|
|
|
|
|
needs_init = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (needs_init) {
|
|
|
|
|
ED_area_initialize(wm, win, sa);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 00:09:45 +01:00
|
|
|
static void file_refresh(const bContext *C, ScrArea *sa)
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
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
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
|
|
|
|
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
|
|
|
|
struct FSMenu *fsmenu = ED_fsmenu_get();
|
|
|
|
|
|
|
|
|
|
if (!sfile->folders_prev) {
|
|
|
|
|
sfile->folders_prev = folderlist_new();
|
|
|
|
|
}
|
|
|
|
|
if (!sfile->files) {
|
|
|
|
|
sfile->files = filelist_new(params->type);
|
|
|
|
|
params->highlight_file = -1; /* added this so it opens nicer (ton) */
|
|
|
|
|
}
|
|
|
|
|
filelist_setdir(sfile->files, params->dir);
|
|
|
|
|
filelist_setrecursion(sfile->files, params->recursion_level);
|
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
|
|
|
filelist_setsorting(sfile->files, params->sort, params->flag & FILE_SORT_INVERT);
|
|
|
|
|
filelist_setfilter_options(
|
|
|
|
|
sfile->files,
|
|
|
|
|
(params->flag & FILE_FILTER) != 0,
|
|
|
|
|
(params->flag & FILE_HIDE_DOT) != 0,
|
|
|
|
|
true, /* Just always hide parent, prefer to not add an extra user option for this. */
|
|
|
|
|
params->filter,
|
|
|
|
|
params->filter_id,
|
|
|
|
|
params->filter_glob,
|
|
|
|
|
params->filter_search);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
/* Update the active indices of bookmarks & co. */
|
|
|
|
|
sfile->systemnr = fsmenu_get_active_indices(fsmenu, FS_CATEGORY_SYSTEM, params->dir);
|
|
|
|
|
sfile->system_bookmarknr = fsmenu_get_active_indices(
|
|
|
|
|
fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, params->dir);
|
|
|
|
|
sfile->bookmarknr = fsmenu_get_active_indices(fsmenu, FS_CATEGORY_BOOKMARKS, params->dir);
|
|
|
|
|
sfile->recentnr = fsmenu_get_active_indices(fsmenu, FS_CATEGORY_RECENT, params->dir);
|
|
|
|
|
|
|
|
|
|
if (filelist_force_reset(sfile->files)) {
|
|
|
|
|
filelist_readjob_stop(wm, sa);
|
|
|
|
|
filelist_clear(sfile->files);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (filelist_empty(sfile->files)) {
|
|
|
|
|
if (!filelist_pending(sfile->files)) {
|
|
|
|
|
filelist_readjob_start(sfile->files, C);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filelist_sort(sfile->files);
|
|
|
|
|
filelist_filter(sfile->files);
|
|
|
|
|
|
|
|
|
|
if (params->display == FILE_IMGDISPLAY) {
|
|
|
|
|
filelist_cache_previews_set(sfile->files, true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
filelist_cache_previews_set(sfile->files, false);
|
|
|
|
|
if (sfile->previews_timer) {
|
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_event_remove_timer_notifier(wm, win, sfile->previews_timer);
|
2019-04-17 06:17:24 +02:00
|
|
|
sfile->previews_timer = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (params->rename_flag != 0) {
|
|
|
|
|
file_params_renamefile_activate(sfile, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sfile->layout) {
|
|
|
|
|
sfile->layout->dirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Might be called with NULL sa, see file_main_region_draw() below. */
|
2019-09-20 15:09:47 +02:00
|
|
|
if (sa) {
|
|
|
|
|
file_ensure_valid_region_state((bContext *)C, wm, win, sa, sfile, params);
|
2019-09-20 12:03:32 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
ED_area_tag_redraw(sa);
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void file_listener(wmWindow *UNUSED(win),
|
|
|
|
|
ScrArea *sa,
|
|
|
|
|
wmNotifier *wmn,
|
|
|
|
|
Scene *UNUSED(scene))
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
/* context changes */
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_SPACE:
|
|
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_SPACE_FILE_LIST:
|
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
|
break;
|
|
|
|
|
case ND_SPACE_FILE_PARAMS:
|
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
|
break;
|
|
|
|
|
case ND_SPACE_FILE_PREVIEW:
|
|
|
|
|
if (sfile->files && filelist_cache_previews_update(sfile->files)) {
|
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_main_region_init(wmWindowManager *wm, ARegion *ar)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* own keymaps */
|
|
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void file_main_region_listener(wmWindow *UNUSED(win),
|
|
|
|
|
ScrArea *UNUSED(sa),
|
|
|
|
|
ARegion *ar,
|
|
|
|
|
wmNotifier *wmn,
|
|
|
|
|
const Scene *UNUSED(scene))
|
2009-07-26 12:40:44 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* context changes */
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_SPACE:
|
|
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_SPACE_FILE_LIST:
|
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
|
break;
|
|
|
|
|
case ND_SPACE_FILE_PARAMS:
|
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-26 12:40:44 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
|
|
|
|
|
struct WorkSpace *UNUSED(workspace),
|
|
|
|
|
struct Scene *UNUSED(scene),
|
|
|
|
|
struct bScreen *screen,
|
|
|
|
|
struct ScrArea *sa,
|
|
|
|
|
struct ARegion *ar,
|
|
|
|
|
struct wmMsgBus *mbus)
|
2017-11-13 19:43:34 +11:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceFile *sfile = sa->spacedata.first;
|
|
|
|
|
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
|
|
|
|
/* This is a bit odd that a region owns the subscriber for an area,
|
|
|
|
|
* keep for now since all subscribers for WM are regions.
|
|
|
|
|
* May be worth re-visiting later. */
|
|
|
|
|
wmMsgSubscribeValue msg_sub_value_area_tag_refresh = {
|
|
|
|
|
.owner = ar,
|
|
|
|
|
.user_data = sa,
|
|
|
|
|
.notify = ED_area_do_msg_notify_tag_refresh,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* SpaceFile itself. */
|
|
|
|
|
{
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
RNA_pointer_create(&screen->id, &RNA_SpaceFileBrowser, sfile, &ptr);
|
|
|
|
|
|
|
|
|
|
/* All properties for this space type. */
|
|
|
|
|
WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_area_tag_refresh, __func__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FileSelectParams */
|
|
|
|
|
{
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
RNA_pointer_create(&screen->id, &RNA_FileSelectParams, params, &ptr);
|
|
|
|
|
|
|
|
|
|
/* All properties for this space type. */
|
|
|
|
|
WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_area_tag_refresh, __func__);
|
|
|
|
|
}
|
2017-11-13 19:43:34 +11:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_main_region_draw(const bContext *C, ARegion *ar)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* draw entirely, view changes should be handled here */
|
|
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
|
|
|
|
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
|
|
|
|
|
|
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
View2DScrollers *scrollers;
|
|
|
|
|
float col[3];
|
|
|
|
|
|
|
|
|
|
/* Needed, because filelist is not initialized on loading */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!sfile->files || filelist_empty(sfile->files)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
file_refresh(C, NULL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
/* clear and setup matrix */
|
|
|
|
|
UI_GetThemeColor3fv(TH_BACK, col);
|
|
|
|
|
GPU_clear_color(col[0], col[1], col[2], 0.0);
|
|
|
|
|
GPU_clear(GPU_COLOR_BIT);
|
|
|
|
|
|
|
|
|
|
/* Allow dynamically sliders to be set, saves notifiers etc. */
|
|
|
|
|
|
|
|
|
|
if (params->display == FILE_IMGDISPLAY) {
|
|
|
|
|
v2d->scroll = V2D_SCROLL_RIGHT;
|
|
|
|
|
v2d->keepofs &= ~V2D_LOCKOFS_Y;
|
|
|
|
|
v2d->keepofs |= V2D_LOCKOFS_X;
|
|
|
|
|
}
|
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
|
|
|
else if (params->display == FILE_VERTICALDISPLAY) {
|
|
|
|
|
v2d->scroll = V2D_SCROLL_RIGHT;
|
|
|
|
|
v2d->keepofs &= ~V2D_LOCKOFS_Y;
|
|
|
|
|
v2d->keepofs |= V2D_LOCKOFS_X;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
else {
|
|
|
|
|
v2d->scroll = V2D_SCROLL_BOTTOM;
|
|
|
|
|
v2d->keepofs &= ~V2D_LOCKOFS_X;
|
|
|
|
|
v2d->keepofs |= V2D_LOCKOFS_Y;
|
|
|
|
|
|
|
|
|
|
/* XXX this happens on scaling down Screen (like from startup.blend) */
|
|
|
|
|
/* view2d has no type specific for filewindow case, which doesn't scroll vertically */
|
|
|
|
|
if (v2d->cur.ymax < 0) {
|
|
|
|
|
v2d->cur.ymin -= v2d->cur.ymax;
|
|
|
|
|
v2d->cur.ymax = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* v2d has initialized flag, so this call will only set the mask correct */
|
|
|
|
|
UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
|
|
|
|
|
|
|
|
|
|
/* sets tile/border settings in sfile */
|
|
|
|
|
file_calc_previews(C, ar);
|
|
|
|
|
|
|
|
|
|
/* set view */
|
|
|
|
|
UI_view2d_view_ortho(v2d);
|
|
|
|
|
|
|
|
|
|
/* on first read, find active file */
|
|
|
|
|
if (params->highlight_file == -1) {
|
|
|
|
|
wmEvent *event = CTX_wm_window(C)->eventstate;
|
|
|
|
|
file_highlight_set(sfile, ar, event->x, event->y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file_draw_list(C, ar);
|
|
|
|
|
|
|
|
|
|
/* reset view matrix */
|
|
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
|
|
|
|
|
|
/* scrollers */
|
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
|
|
|
rcti view_rect;
|
|
|
|
|
ED_fileselect_layout_maskrect(sfile->layout, v2d, &view_rect);
|
|
|
|
|
scrollers = UI_view2d_scrollers_calc(v2d, &view_rect);
|
2019-04-30 14:10:53 +02:00
|
|
|
UI_view2d_scrollers_draw(v2d, scrollers);
|
2019-04-17 06:17:24 +02:00
|
|
|
UI_view2d_scrollers_free(scrollers);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void file_operatortypes(void)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operatortype_append(FILE_OT_select);
|
|
|
|
|
WM_operatortype_append(FILE_OT_select_walk);
|
|
|
|
|
WM_operatortype_append(FILE_OT_select_all);
|
|
|
|
|
WM_operatortype_append(FILE_OT_select_box);
|
|
|
|
|
WM_operatortype_append(FILE_OT_select_bookmark);
|
|
|
|
|
WM_operatortype_append(FILE_OT_highlight);
|
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(FILE_OT_sort_column_ui_context);
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_operatortype_append(FILE_OT_execute);
|
|
|
|
|
WM_operatortype_append(FILE_OT_cancel);
|
|
|
|
|
WM_operatortype_append(FILE_OT_parent);
|
|
|
|
|
WM_operatortype_append(FILE_OT_previous);
|
|
|
|
|
WM_operatortype_append(FILE_OT_next);
|
|
|
|
|
WM_operatortype_append(FILE_OT_refresh);
|
|
|
|
|
WM_operatortype_append(FILE_OT_bookmark_add);
|
|
|
|
|
WM_operatortype_append(FILE_OT_bookmark_delete);
|
|
|
|
|
WM_operatortype_append(FILE_OT_bookmark_cleanup);
|
|
|
|
|
WM_operatortype_append(FILE_OT_bookmark_move);
|
|
|
|
|
WM_operatortype_append(FILE_OT_reset_recent);
|
|
|
|
|
WM_operatortype_append(FILE_OT_hidedot);
|
|
|
|
|
WM_operatortype_append(FILE_OT_filenum);
|
|
|
|
|
WM_operatortype_append(FILE_OT_directory_new);
|
|
|
|
|
WM_operatortype_append(FILE_OT_delete);
|
|
|
|
|
WM_operatortype_append(FILE_OT_rename);
|
|
|
|
|
WM_operatortype_append(FILE_OT_smoothscroll);
|
|
|
|
|
WM_operatortype_append(FILE_OT_filepath_drop);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-28 12:28:50 +00:00
|
|
|
/* NOTE: do not add .blend file reading on this level */
|
2011-02-14 17:55:27 +00:00
|
|
|
static void file_keymap(struct wmKeyConfig *keyconf)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* keys for all regions */
|
|
|
|
|
WM_keymap_ensure(keyconf, "File Browser", SPACE_FILE, 0);
|
2015-12-03 12:21:57 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* keys for main region */
|
|
|
|
|
WM_keymap_ensure(keyconf, "File Browser Main", SPACE_FILE, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* keys for button region (top) */
|
|
|
|
|
WM_keymap_ensure(keyconf, "File Browser Buttons", SPACE_FILE, 0);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_tools_region_init(wmWindowManager *wm, ARegion *ar)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMap *keymap;
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
|
|
|
|
|
ED_region_panels_init(wm, ar);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* own keymaps */
|
|
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_tools_region_draw(const bContext *C, ARegion *ar)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_region_panels(C, ar);
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void file_tools_region_listener(wmWindow *UNUSED(win),
|
|
|
|
|
ScrArea *UNUSED(sa),
|
|
|
|
|
ARegion *UNUSED(ar),
|
|
|
|
|
wmNotifier *UNUSED(wmn),
|
|
|
|
|
const Scene *UNUSED(scene))
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2013-08-07 03:44:05 +00:00
|
|
|
#if 0
|
2019-04-17 06:17:24 +02:00
|
|
|
/* context changes */
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
2013-08-07 03:44:05 +00:00
|
|
|
#endif
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_header_region_init(wmWindowManager *wm, ARegion *ar)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_region_header_init(ar);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_header_region_draw(const bContext *C, ARegion *ar)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_region_header(C, ar);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_ui_region_init(wmWindowManager *wm, ARegion *ar)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
wmKeyMap *keymap;
|
2009-07-05 22:26:43 +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
|
|
|
ED_region_panels_init(wm, ar);
|
|
|
|
|
ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* own keymap */
|
|
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
|
2019-04-24 17:34:48 +02:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void file_ui_region_draw(const bContext *C, ARegion *ar)
|
2009-01-06 14:42:54 +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
|
|
|
ED_region_panels(C, ar);
|
|
|
|
|
}
|
2009-01-06 14:42:54 +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
|
|
|
static void file_execution_region_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
|
{
|
2019-09-08 20:31:12 +02:00
|
|
|
wmKeyMap *keymap;
|
|
|
|
|
|
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_panels_init(wm, ar);
|
|
|
|
|
ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
|
2019-09-08 20:31:12 +02:00
|
|
|
|
|
|
|
|
/* own keymap */
|
|
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
|
|
|
|
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
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
|
|
|
}
|
2011-10-03 04:48:14 +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
|
|
|
static void file_execution_region_draw(const bContext *C, ARegion *ar)
|
|
|
|
|
{
|
|
|
|
|
ED_region_panels(C, ar);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static void file_ui_region_listener(wmWindow *UNUSED(win),
|
|
|
|
|
ScrArea *UNUSED(sa),
|
|
|
|
|
ARegion *ar,
|
|
|
|
|
wmNotifier *wmn,
|
|
|
|
|
const Scene *UNUSED(scene))
|
2009-07-26 19:23:07 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
/* context changes */
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_SPACE:
|
|
|
|
|
switch (wmn->data) {
|
|
|
|
|
case ND_SPACE_FILE_LIST:
|
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-26 19:23:07 +00:00
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
static bool filepath_drop_poll(bContext *C,
|
|
|
|
|
wmDrag *drag,
|
|
|
|
|
const wmEvent *UNUSED(event),
|
|
|
|
|
const char **UNUSED(tooltip))
|
2015-11-04 14:24:46 +01:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
if (drag->type == WM_DRAG_PATH) {
|
|
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
|
|
|
|
if (sfile) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void filepath_drop_copy(wmDrag *drag, wmDropBox *drop)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
RNA_string_set(drop->ptr, "filepath", drag->path);
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* region dropbox definition */
|
|
|
|
|
static void file_dropboxes(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
ListBase *lb = WM_dropboxmap_find("Window", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
2015-11-04 14:24:46 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
WM_dropbox_add(lb, "FILE_OT_filepath_drop", filepath_drop_poll, filepath_drop_copy);
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* only called once, from space/spacetypes.c */
|
|
|
|
|
void ED_spacetype_file(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype file");
|
|
|
|
|
ARegionType *art;
|
|
|
|
|
|
|
|
|
|
st->spaceid = SPACE_FILE;
|
|
|
|
|
strncpy(st->name, "File", BKE_ST_MAXNAME);
|
|
|
|
|
|
|
|
|
|
st->new = file_new;
|
|
|
|
|
st->free = file_free;
|
|
|
|
|
st->init = file_init;
|
|
|
|
|
st->exit = file_exit;
|
|
|
|
|
st->duplicate = file_duplicate;
|
|
|
|
|
st->refresh = file_refresh;
|
|
|
|
|
st->listener = file_listener;
|
|
|
|
|
st->operatortypes = file_operatortypes;
|
|
|
|
|
st->keymap = file_keymap;
|
|
|
|
|
st->dropboxes = file_dropboxes;
|
|
|
|
|
|
|
|
|
|
/* regions: main window */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
|
|
|
|
|
art->regionid = RGN_TYPE_WINDOW;
|
|
|
|
|
art->init = file_main_region_init;
|
|
|
|
|
art->draw = file_main_region_draw;
|
|
|
|
|
art->listener = file_main_region_listener;
|
|
|
|
|
art->message_subscribe = file_main_region_message_subscribe;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
/* regions: header */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
|
|
|
|
|
art->regionid = RGN_TYPE_HEADER;
|
|
|
|
|
art->prefsizey = HEADERY;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
|
|
|
|
|
art->init = file_header_region_init;
|
|
|
|
|
art->draw = file_header_region_draw;
|
|
|
|
|
// art->listener = file_header_region_listener;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
/* regions: ui */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
|
|
|
|
|
art->regionid = RGN_TYPE_UI;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
|
|
|
|
art->listener = file_ui_region_listener;
|
|
|
|
|
art->init = file_ui_region_init;
|
|
|
|
|
art->draw = file_ui_region_draw;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
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
|
|
|
/* regions: execution */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
|
|
|
|
|
art->regionid = RGN_TYPE_EXECUTE;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
|
|
|
|
art->listener = file_ui_region_listener;
|
|
|
|
|
art->init = file_execution_region_init;
|
|
|
|
|
art->draw = file_execution_region_draw;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-09-04 16:21:42 +02:00
|
|
|
file_execute_region_panels_register(art);
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
/* regions: channels (directories) */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file region");
|
|
|
|
|
art->regionid = RGN_TYPE_TOOLS;
|
|
|
|
|
art->prefsizex = 240;
|
|
|
|
|
art->prefsizey = 60;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
|
|
|
|
art->listener = file_tools_region_listener;
|
|
|
|
|
art->init = file_tools_region_init;
|
|
|
|
|
art->draw = file_tools_region_draw;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
|
|
/* regions: tool properties */
|
|
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype file operator region");
|
|
|
|
|
art->regionid = RGN_TYPE_TOOL_PROPS;
|
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
|
|
|
art->prefsizex = 240;
|
|
|
|
|
art->prefsizey = 60;
|
2019-04-17 06:17:24 +02:00
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
|
|
|
|
art->listener = file_tools_region_listener;
|
|
|
|
|
art->init = file_tools_region_init;
|
|
|
|
|
art->draw = file_tools_region_draw;
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-09-04 16:21:42 +02:00
|
|
|
file_tool_props_region_panels_register(art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
|
|
|
|
BKE_spacetype_register(st);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
void ED_file_init(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
ED_file_read_bookmarks();
|
2010-07-04 15:35:23 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (G.background == false) {
|
|
|
|
|
filelist_init_icons();
|
|
|
|
|
}
|
2012-08-08 08:25:20 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
IMB_thumb_makedirs();
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ED_file_exit(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
fsmenu_free();
|
2012-08-08 08:25:20 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (G.background == false) {
|
|
|
|
|
filelist_free_icons();
|
|
|
|
|
}
|
2009-01-18 18:24:11 +00:00
|
|
|
}
|
2013-12-20 17:39:22 +01:00
|
|
|
|
|
|
|
|
void ED_file_read_bookmarks(void)
|
|
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
fsmenu_free();
|
2013-12-20 17:39:22 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
fsmenu_read_system(ED_fsmenu_get(), true);
|
2013-12-20 17:39:22 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
if (cfgdir) {
|
|
|
|
|
char name[FILE_MAX];
|
|
|
|
|
BLI_make_file_string("/", name, cfgdir, BLENDER_BOOKMARK_FILE);
|
|
|
|
|
fsmenu_read_bookmarks(ED_fsmenu_get(), name);
|
|
|
|
|
}
|
2013-12-20 17:39:22 +01:00
|
|
|
}
|