2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-14 12:16:55 +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 12:16:55 +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 12:16:55 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup spfile
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2021-10-04 19:46:15 +02:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
2021-09-29 16:59:48 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-12-14 12:16:55 +00:00
|
|
|
/* internal exports only */
|
|
|
|
|
2009-06-29 20:23:40 +00:00
|
|
|
struct ARegion;
|
|
|
|
struct ARegionType;
|
2021-09-29 17:01:13 +02:00
|
|
|
struct AssetLibrary;
|
2019-03-05 16:17:09 +01:00
|
|
|
struct FileSelectParams;
|
2021-09-29 17:01:13 +02:00
|
|
|
struct FileAssetSelectParams;
|
2009-06-29 20:23:40 +00:00
|
|
|
struct SpaceFile;
|
2021-09-29 17:01:13 +02:00
|
|
|
struct uiLayout;
|
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
|
|
|
struct View2D;
|
2008-12-14 12:16:55 +00:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* file_draw.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
|
|
|
#define ATTRIBUTE_COLUMN_PADDING (0.5f * UI_UNIT_X)
|
|
|
|
|
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
|
|
|
#define SMALL_SIZE_CHECK(_size) ((_size) < 64) /* Related to FileSelectParams.thumbnail_size. */
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
void file_calc_previews(const bContext *C, ARegion *region);
|
|
|
|
void file_draw_list(const bContext *C, ARegion *region);
|
2021-10-26 21:55:46 +02:00
|
|
|
bool file_draw_hint_if_invalid(const bContext *C, const SpaceFile *sfile, ARegion *region);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2020-09-12 17:55:36 +10:00
|
|
|
void file_draw_check_ex(bContext *C, struct ScrArea *area);
|
2015-02-17 08:52:19 +11:00
|
|
|
void file_draw_check(bContext *C);
|
2010-09-17 09:27:31 +00:00
|
|
|
void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
|
2014-02-03 18:55:59 +11:00
|
|
|
bool file_draw_check_exists(SpaceFile *sfile);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* file_ops.h */
|
2009-01-28 11:27:25 +00:00
|
|
|
struct wmOperator;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmOperatorType;
|
File Browser Arrow Keys Navigation
Adds support for selecting/deselecting files in File Browser using the
arrow keys. All directions (up, down, left, right) are possible.
When to Select, When to Deselect?
Standard behaviour is selecting, however if we move into a block of
already selected files (meaning 2+ files are selected) we start
deselecting
Possible Selection Methods
Simple selection (arrow-key): All other files are deselected
Expand selection (Shift+arrow key): Add to/remove from existing
selection
ill-Expand selection (Ctrl+Shift+arrow key): Add to/remove from existing
selection and fill everything in-between
From which file do we start navigating?
From each available selection method (Mouse-, Walk-, All-, Border
Select), we use the last selected file. If there's no selection at all
we use the first (down/right arrow) or last (up/left arrow) file.
(Ideally, the view would automatically be set to the new selection, but
this behaviour overlaps with an other patch I've been working on, so
prefer to do that separately)
(Also tweaks color for highlighted file for better feedback)
D1297, Review done by @campbellbarton, thx a lot :)
2015-06-11 17:20:29 +02:00
|
|
|
|
2009-02-14 14:25:48 +00:00
|
|
|
void FILE_OT_highlight(struct wmOperatorType *ot);
|
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
|
|
|
void FILE_OT_sort_column_ui_context(struct wmOperatorType *ot);
|
2009-02-14 14:25:48 +00:00
|
|
|
void FILE_OT_select(struct wmOperatorType *ot);
|
File Browser Arrow Keys Navigation
Adds support for selecting/deselecting files in File Browser using the
arrow keys. All directions (up, down, left, right) are possible.
When to Select, When to Deselect?
Standard behaviour is selecting, however if we move into a block of
already selected files (meaning 2+ files are selected) we start
deselecting
Possible Selection Methods
Simple selection (arrow-key): All other files are deselected
Expand selection (Shift+arrow key): Add to/remove from existing
selection
ill-Expand selection (Ctrl+Shift+arrow key): Add to/remove from existing
selection and fill everything in-between
From which file do we start navigating?
From each available selection method (Mouse-, Walk-, All-, Border
Select), we use the last selected file. If there's no selection at all
we use the first (down/right arrow) or last (up/left arrow) file.
(Ideally, the view would automatically be set to the new selection, but
this behaviour overlaps with an other patch I've been working on, so
prefer to do that separately)
(Also tweaks color for highlighted file for better feedback)
D1297, Review done by @campbellbarton, thx a lot :)
2015-06-11 17:20:29 +02:00
|
|
|
void FILE_OT_select_walk(struct wmOperatorType *ot);
|
2018-07-03 15:44:56 +02:00
|
|
|
void FILE_OT_select_all(struct wmOperatorType *ot);
|
2018-10-05 10:27:04 +10:00
|
|
|
void FILE_OT_select_box(struct wmOperatorType *ot);
|
2009-02-14 14:25:48 +00:00
|
|
|
void FILE_OT_select_bookmark(struct wmOperatorType *ot);
|
2009-11-28 14:37:21 +00:00
|
|
|
void FILE_OT_bookmark_add(struct wmOperatorType *ot);
|
2013-10-08 13:16:14 +00:00
|
|
|
void FILE_OT_bookmark_delete(struct wmOperatorType *ot);
|
2015-02-11 17:07:52 +01:00
|
|
|
void FILE_OT_bookmark_cleanup(struct wmOperatorType *ot);
|
2015-02-11 00:09:45 +01:00
|
|
|
void FILE_OT_bookmark_move(struct wmOperatorType *ot);
|
2012-09-17 21:38:04 +00:00
|
|
|
void FILE_OT_reset_recent(wmOperatorType *ot);
|
2009-06-30 18:29:30 +00:00
|
|
|
void FILE_OT_hidedot(struct wmOperatorType *ot);
|
2009-09-04 04:29:54 +00:00
|
|
|
void FILE_OT_execute(struct wmOperatorType *ot);
|
2021-05-05 20:36:12 +02:00
|
|
|
void FILE_OT_mouse_execute(struct wmOperatorType *ot);
|
2009-02-14 14:25:48 +00:00
|
|
|
void FILE_OT_cancel(struct wmOperatorType *ot);
|
|
|
|
void FILE_OT_parent(struct wmOperatorType *ot);
|
2009-07-10 17:05:04 +00:00
|
|
|
void FILE_OT_directory_new(struct wmOperatorType *ot);
|
2009-07-07 07:25:44 +00:00
|
|
|
void FILE_OT_previous(struct wmOperatorType *ot);
|
|
|
|
void FILE_OT_next(struct wmOperatorType *ot);
|
2009-03-12 06:40:03 +00:00
|
|
|
void FILE_OT_refresh(struct wmOperatorType *ot);
|
2009-07-05 22:26:43 +00:00
|
|
|
void FILE_OT_filenum(struct wmOperatorType *ot);
|
2009-07-10 17:05:04 +00:00
|
|
|
void FILE_OT_delete(struct wmOperatorType *ot);
|
2009-07-26 18:52:27 +00:00
|
|
|
void FILE_OT_rename(struct wmOperatorType *ot);
|
2010-05-08 21:02:22 +00:00
|
|
|
void FILE_OT_smoothscroll(struct wmOperatorType *ot);
|
2015-11-04 14:24:46 +01:00
|
|
|
void FILE_OT_filepath_drop(struct wmOperatorType *ot);
|
2020-02-28 14:33:31 +01:00
|
|
|
void FILE_OT_start_filter(struct wmOperatorType *ot);
|
2021-03-08 13:57:15 +01:00
|
|
|
void FILE_OT_view_selected(struct wmOperatorType *ot);
|
2009-01-28 11:27:25 +00:00
|
|
|
|
2013-11-22 01:35:38 +01:00
|
|
|
void file_directory_enter_handle(bContext *C, void *arg_unused, void *arg_but);
|
|
|
|
void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but);
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my);
|
2009-01-18 18:24:11 +00:00
|
|
|
|
2015-11-04 14:24:46 +01:00
|
|
|
void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath);
|
2020-09-12 17:55:36 +10:00
|
|
|
void file_sfile_to_operator_ex(struct Main *bmain,
|
2018-06-05 15:10:33 +02:00
|
|
|
struct wmOperator *op,
|
|
|
|
struct SpaceFile *sfile,
|
|
|
|
char *filepath);
|
2020-09-12 17:55:36 +10:00
|
|
|
void file_sfile_to_operator(struct Main *bmain, struct wmOperator *op, struct SpaceFile *sfile);
|
2019-09-20 15:09:47 +02:00
|
|
|
|
2020-09-12 17:55:36 +10:00
|
|
|
void file_operator_to_sfile(struct Main *bmain, struct SpaceFile *sfile, struct wmOperator *op);
|
2010-09-17 09:27:31 +00:00
|
|
|
|
2021-09-01 16:27:29 +02:00
|
|
|
/* space_file.c */
|
|
|
|
extern const char *file_context_dir[]; /* doc access */
|
|
|
|
|
2009-05-14 18:08:14 +00:00
|
|
|
/* filesel.c */
|
2020-12-14 13:50:36 +01:00
|
|
|
void fileselect_refresh_params(struct SpaceFile *sfile);
|
2015-07-09 18:40:34 +02:00
|
|
|
void fileselect_file_set(SpaceFile *sfile, const int index);
|
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
|
|
|
bool file_attribute_column_type_enabled(const FileSelectParams *params,
|
|
|
|
FileAttributeColumnType column);
|
|
|
|
bool file_attribute_column_header_is_inside(const struct View2D *v2d,
|
|
|
|
const FileLayout *layout,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
FileAttributeColumnType file_attribute_column_type_find_isect(const View2D *v2d,
|
|
|
|
const FileSelectParams *params,
|
|
|
|
FileLayout *layout,
|
|
|
|
int x);
|
2012-06-18 13:01:24 +00:00
|
|
|
float file_string_width(const char *str);
|
2010-11-06 17:03:11 +00:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
float file_font_pointsize(void);
|
2021-07-07 18:15:16 +02:00
|
|
|
void file_select_deselect_all(SpaceFile *sfile, uint flag);
|
2012-06-17 14:16:26 +00:00
|
|
|
int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file);
|
2013-11-22 01:35:38 +01:00
|
|
|
int autocomplete_directory(struct bContext *C, char *str, void *arg_v);
|
|
|
|
int autocomplete_file(struct bContext *C, char *str, void *arg_v);
|
2009-05-14 18:08:14 +00:00
|
|
|
|
2021-07-05 13:30:47 +02:00
|
|
|
void file_params_smoothscroll_timer_clear(struct wmWindowManager *wm,
|
|
|
|
struct wmWindow *win,
|
|
|
|
SpaceFile *sfile);
|
|
|
|
void file_params_renamefile_clear(struct FileSelectParams *params);
|
|
|
|
void file_params_invoke_rename_postscroll(struct wmWindowManager *wm,
|
|
|
|
struct wmWindow *win,
|
|
|
|
SpaceFile *sfile);
|
File Browser: Select files and directories after renaming
(Note: This is an alternative version for D9994 by @Schiette. The commit
message is based on his description.)
Currently, when a new directory is created it is not selected.
Similarly, when renaming an existing file or directory, it does not
remain active/highlighted blue after renaming.
This change makes sure the file or directory is always selected after
renaming, even if the renaming failed or was cancelled.
This has some usability advantages:
- Open the newly created directory without having to select it (ENTER).
- If you make a naming mistake, you can immediately fix that (F2)
without having to click it again.
- If you create a directory and forget to name it, you can fix that
(F2) without having to select it.
- This is consistent with many common File Browsers.
Further, selecting the item even after renaming failed or was cancelled
helps keeping the file in focus, so the user doesn't have to look for it
(especially if the renaming just failed which the user may not notice).
In other words, it avoids disorienting the user.
Also see D11119 which requires this behavior.
We could also always select the file/directory on mouse press. This
would make some hacks unnecessary, but may have further implications. I
think eventually that's what we should do though.
2021-07-07 18:20:21 +02:00
|
|
|
void file_params_rename_end(struct wmWindowManager *wm,
|
|
|
|
struct wmWindow *win,
|
|
|
|
SpaceFile *sfile,
|
|
|
|
struct FileDirEntry *rename_file);
|
2019-03-05 16:17:09 +01:00
|
|
|
void file_params_renamefile_activate(struct SpaceFile *sfile, struct FileSelectParams *params);
|
|
|
|
|
2021-03-05 15:00:56 +01:00
|
|
|
typedef void *onReloadFnData;
|
|
|
|
typedef void (*onReloadFn)(struct SpaceFile *space_data, onReloadFnData custom_data);
|
|
|
|
typedef struct SpaceFile_Runtime {
|
|
|
|
/* Called once after the file browser has reloaded. Reset to NULL after calling.
|
|
|
|
* Use file_on_reload_callback_register() to register a callback. */
|
|
|
|
onReloadFn on_reload;
|
|
|
|
onReloadFnData on_reload_custom_data;
|
|
|
|
} SpaceFile_Runtime;
|
|
|
|
|
|
|
|
/* Register an on-reload callback function. Note that there can only be one such function at a
|
|
|
|
* time; registering a new one will overwrite the previous one. */
|
|
|
|
void file_on_reload_callback_register(struct SpaceFile *sfile,
|
|
|
|
onReloadFn callback,
|
|
|
|
onReloadFnData custom_data);
|
|
|
|
|
2009-06-29 20:23:40 +00:00
|
|
|
/* file_panels.c */
|
2019-09-04 16:21:42 +02:00
|
|
|
void file_tool_props_region_panels_register(struct ARegionType *art);
|
|
|
|
void file_execute_region_panels_register(struct ARegionType *art);
|
2021-09-29 17:01:13 +02:00
|
|
|
void file_tools_region_panels_register(struct ARegionType *art);
|
2009-06-29 20:23:40 +00:00
|
|
|
|
File Browser Arrow Keys Navigation
Adds support for selecting/deselecting files in File Browser using the
arrow keys. All directions (up, down, left, right) are possible.
When to Select, When to Deselect?
Standard behaviour is selecting, however if we move into a block of
already selected files (meaning 2+ files are selected) we start
deselecting
Possible Selection Methods
Simple selection (arrow-key): All other files are deselected
Expand selection (Shift+arrow key): Add to/remove from existing
selection
ill-Expand selection (Ctrl+Shift+arrow key): Add to/remove from existing
selection and fill everything in-between
From which file do we start navigating?
From each available selection method (Mouse-, Walk-, All-, Border
Select), we use the last selected file. If there's no selection at all
we use the first (down/right arrow) or last (up/left arrow) file.
(Ideally, the view would automatically be set to the new selection, but
this behaviour overlaps with an other patch I've been working on, so
prefer to do that separately)
(Also tweaks color for highlighted file for better feedback)
D1297, Review done by @campbellbarton, thx a lot :)
2015-06-11 17:20:29 +02:00
|
|
|
/* file_utils.c */
|
2020-03-06 16:56:42 +01:00
|
|
|
void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds);
|
Asset System: New Asset Browser editor
This introduces the User Interface part of the Asset Browser, based on the
design in T54642.
Additions:
* New Asset Browser (internally a sub-editor of the File Browser).
* Navigation region showing asset categories.
* Main region showing the assets of the selected asset library with previews.
The assets may be stored over multiple .blends in the directory that's
"mounted" as asset library in the Preferences. They will all be shown in this
list.
* Header with an asset library dropdown, allowing to choose the active asset
library to show. Options are the "Current File" as asset library and all
custom libraries.
* Display popover, filter popover and search box (partially dummies, see
T82680).
* Sidebar showing the metadata of the currently active file (name, preview,
description and tags), which can be edited for assets in the "Current File"
asset library. (For others it will reset on reload.)
* The sidebar includes a button to load a custom preview image from a file.
* Make asset files draggable (with preview image).
* If a library with invalid path is selected, a message is drawn in the main
region to help the user understand what's wrong.
* Operators to add and remove asset tags. Exposed in the sidebar.
* "Only Assets" option for Link/Append.
* Internal utilities for asset UI scripts.
For screenshots or demo videos, please see D9725. Or the 2.92 release notes.
Note that there are many things to be tweaked and polished in the Asset Browser
UI still. For example, the filter and display popovers are mostly dummies. See
T82680.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9725
Reviewed by: Brecht Van Lommel, Hans Goudey
2020-12-14 14:07:42 +01:00
|
|
|
|
|
|
|
void file_path_to_ui_path(const char *path, char *r_pathi, int max_size);
|
2021-09-29 16:59:48 +02:00
|
|
|
|
2021-09-29 17:01:13 +02:00
|
|
|
/* asset_catalog_tree_view.cc */
|
|
|
|
|
2021-10-04 19:46:15 +02:00
|
|
|
/* C-handle for #ed::asset_browser::AssetCatalogFilterSettings. */
|
|
|
|
typedef struct FileAssetCatalogFilterSettingsHandle FileAssetCatalogFilterSettingsHandle;
|
|
|
|
|
|
|
|
FileAssetCatalogFilterSettingsHandle *file_create_asset_catalog_filter_settings(void);
|
|
|
|
void file_delete_asset_catalog_filter_settings(
|
|
|
|
FileAssetCatalogFilterSettingsHandle **filter_settings_handle);
|
|
|
|
/**
|
|
|
|
* \return True if the stored filter settings were modified.
|
|
|
|
*/
|
|
|
|
bool file_set_asset_catalog_filter_settings(
|
|
|
|
FileAssetCatalogFilterSettingsHandle *filter_settings_handle,
|
|
|
|
eFileSel_Params_AssetCatalogVisibility catalog_visibility,
|
|
|
|
bUUID catalog_id);
|
|
|
|
void file_ensure_updated_catalog_filter_data(
|
|
|
|
FileAssetCatalogFilterSettingsHandle *filter_settings_handle,
|
|
|
|
const struct AssetLibrary *asset_library);
|
|
|
|
bool file_is_asset_visible_in_catalog_filter_settings(
|
|
|
|
const FileAssetCatalogFilterSettingsHandle *filter_settings_handle,
|
|
|
|
const AssetMetaData *asset_data);
|
|
|
|
|
2021-09-29 17:01:13 +02:00
|
|
|
void file_create_asset_catalog_tree_view_in_layout(struct AssetLibrary *asset_library,
|
|
|
|
struct uiLayout *layout,
|
2021-10-03 23:58:20 +02:00
|
|
|
struct SpaceFile *space_file,
|
2021-09-29 17:01:13 +02:00
|
|
|
struct FileAssetSelectParams *params);
|
|
|
|
|
2021-09-29 16:59:48 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|