2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spfile
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-07-22 11:27:25 +10:00
|
|
|
#include <cstring>
|
2008-12-14 11:25:00 +00:00
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2025-02-11 16:59:42 +01:00
|
|
|
#include "BLI_listbase.h"
|
2025-01-26 20:08:00 +01:00
|
|
|
#include "BLI_path_utils.hh"
|
|
|
|
|
#include "BLI_string.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2024-01-21 19:42:13 +01:00
|
|
|
#include "BKE_appdir.hh"
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_context.hh"
|
2024-02-10 18:25:14 +01:00
|
|
|
#include "BKE_global.hh"
|
2024-01-18 12:20:42 +01:00
|
|
|
#include "BKE_lib_query.hh"
|
2023-12-01 19:43:16 +01:00
|
|
|
#include "BKE_main.hh"
|
2024-02-10 18:34:29 +01:00
|
|
|
#include "BKE_report.hh"
|
2023-09-25 17:48:21 -04:00
|
|
|
#include "BKE_screen.hh"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_access.hh"
|
|
|
|
|
#include "RNA_define.hh"
|
|
|
|
|
#include "RNA_enum_types.hh"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_api.hh"
|
|
|
|
|
#include "WM_message.hh"
|
|
|
|
|
#include "WM_types.hh"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_asset.hh"
|
2024-01-26 15:23:10 -05:00
|
|
|
#include "ED_asset_indexer.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_fileselect.hh"
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "ED_screen.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_space_api.hh"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_thumbs.hh"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_resources.hh"
|
|
|
|
|
#include "UI_view2d.hh"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2023-08-28 15:01:05 +02:00
|
|
|
#include "BLO_read_write.hh"
|
2022-09-28 11:52:22 +02:00
|
|
|
|
2023-08-01 12:19:47 +02:00
|
|
|
#include "file_indexer.hh"
|
|
|
|
|
#include "file_intern.hh" /* own include */
|
|
|
|
|
#include "filelist.hh"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "fsmenu.h"
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2008-12-14 12:16:55 +00:00
|
|
|
/* ******************** default callbacks for file space ***************** */
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
static SpaceLink *file_create(const ScrArea * /*area*/, const Scene * /*scene*/)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region;
|
2008-12-14 11:25:00 +00:00
|
|
|
SpaceFile *sfile;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile = static_cast<SpaceFile *>(MEM_callocN(sizeof(SpaceFile), "initfile"));
|
2012-06-18 13:01:24 +00:00
|
|
|
sfile->spacetype = SPACE_FILE;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* header */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_HEADER;
|
2018-12-14 09:47:10 +11:00
|
|
|
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */
|
2020-03-06 16:56:42 +01:00
|
|
|
region->alignment = RGN_ALIGN_TOP;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-29 20:16:19 +02:00
|
|
|
/* Tools region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_TOOLS;
|
|
|
|
|
region->alignment = RGN_ALIGN_LEFT;
|
2019-09-29 20:16:19 +02: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
|
|
|
/* ui list region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_UI;
|
|
|
|
|
region->alignment = RGN_ALIGN_TOP;
|
2023-07-28 14:30:59 +02:00
|
|
|
region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE;
|
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: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
/* execute region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_EXECUTE;
|
|
|
|
|
region->alignment = RGN_ALIGN_BOTTOM;
|
2023-07-28 14:30:59 +02:00
|
|
|
region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
|
|
|
|
|
/* tools props region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_TOOL_PROPS;
|
|
|
|
|
region->alignment = RGN_ALIGN_RIGHT;
|
|
|
|
|
region->flag = RGN_FLAG_HIDDEN;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* main region */
|
2024-11-15 02:00:11 +01:00
|
|
|
region = BKE_area_region_new();
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_addtail(&sfile->regionbase, region);
|
|
|
|
|
region->regiontype = RGN_TYPE_WINDOW;
|
|
|
|
|
region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
|
|
|
|
region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
|
|
|
|
|
region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
|
|
|
|
|
region->v2d.keeptot = V2D_KEEPTOT_STRICT;
|
|
|
|
|
region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
return (SpaceLink *)sfile;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 11:39:27 +10:00
|
|
|
/* Doesn't free the space-link itself. */
|
2008-12-14 11:25:00 +00:00
|
|
|
static void file_free(SpaceLink *sl)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2012-06-18 13:01:24 +00:00
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
BLI_assert(sfile->previews_timer == nullptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sfile->files) {
|
2010-03-10 19:30:20 +00:00
|
|
|
/* XXX would need to do thumbnails_stop here, but no context available */
|
2009-09-12 19:54:39 +00:00
|
|
|
filelist_freelib(sfile->files);
|
2009-01-06 19:22:29 +00:00
|
|
|
filelist_free(sfile->files);
|
2025-02-20 10:37:10 +01:00
|
|
|
MEM_freeN(static_cast<void *>(sfile->files));
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->files = nullptr;
|
2009-01-06 19:22:29 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
folder_history_list_free(sfile);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
MEM_SAFE_FREE(sfile->params);
|
|
|
|
|
MEM_SAFE_FREE(sfile->asset_params);
|
2023-07-24 14:53:33 +02:00
|
|
|
if (sfile->runtime != nullptr) {
|
2023-10-13 11:29:59 +02:00
|
|
|
BKE_reports_free(&sfile->runtime->is_blendfile_readable_reports);
|
2023-07-24 14:53:33 +02:00
|
|
|
}
|
2021-03-05 15:00:56 +01:00
|
|
|
MEM_SAFE_FREE(sfile->runtime);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-08-06 13:59:38 +10:00
|
|
|
MEM_SAFE_FREE(sfile->layout);
|
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 */
|
2023-07-12 13:43:00 +02:00
|
|
|
static void file_init(wmWindowManager * /*wm*/, ScrArea *area)
|
2009-01-06 19:22:29 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)area->spacedata.first;
|
2015-02-16 15:48:37 +01:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (sfile->layout) {
|
2014-04-01 11:34:00 +11:00
|
|
|
sfile->layout->dirty = true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2021-03-05 15:00:56 +01:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
if (sfile->runtime == nullptr) {
|
|
|
|
|
sfile->runtime = static_cast<SpaceFile_Runtime *>(
|
|
|
|
|
MEM_callocN(sizeof(*sfile->runtime), __func__));
|
2023-07-24 14:53:33 +02:00
|
|
|
BKE_reports_init(&sfile->runtime->is_blendfile_readable_reports, RPT_STORE);
|
2021-03-05 15:00:56 +01:00
|
|
|
}
|
2021-03-11 13:02:47 +01:00
|
|
|
/* Validate the params right after file read. */
|
|
|
|
|
fileselect_refresh_params(sfile);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
static void file_exit(wmWindowManager *wm, ScrArea *area)
|
2013-03-15 19:56:29 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)area->spacedata.first;
|
2013-03-15 19:56:29 +00:00
|
|
|
|
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
|
|
|
if (sfile->previews_timer) {
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_event_timer_remove_notifier(wm, nullptr, sfile->previews_timer);
|
|
|
|
|
sfile->previews_timer = nullptr;
|
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
|
|
|
}
|
|
|
|
|
|
2021-07-01 15:09:08 +02:00
|
|
|
ED_fileselect_exit(wm, 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)
|
|
|
|
|
{
|
2012-06-18 13:01:24 +00:00
|
|
|
SpaceFile *sfileo = (SpaceFile *)sl;
|
2023-07-12 13:43:00 +02:00
|
|
|
SpaceFile *sfilen = static_cast<SpaceFile *>(MEM_dupallocN(sl));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* clear or remove stuff from old */
|
2023-07-12 13:43:00 +02:00
|
|
|
sfilen->op = nullptr; /* file window doesn't own operators */
|
|
|
|
|
sfilen->runtime = nullptr;
|
2009-01-06 19:22:29 +00:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
sfilen->previews_timer = nullptr;
|
|
|
|
|
sfilen->smoothscroll_timer = nullptr;
|
2018-02-09 16:13:13 +01:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
FileSelectParams *active_params_old = ED_fileselect_get_active_params(sfileo);
|
|
|
|
|
if (active_params_old) {
|
|
|
|
|
sfilen->files = filelist_new(active_params_old->type);
|
|
|
|
|
filelist_setdir(sfilen->files, active_params_old->dir);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-10 19:30:20 +00:00
|
|
|
if (sfileo->params) {
|
2023-07-12 13:43:00 +02:00
|
|
|
sfilen->params = static_cast<FileSelectParams *>(MEM_dupallocN(sfileo->params));
|
2010-03-10 19:30:20 +00:00
|
|
|
}
|
2020-12-14 13:50:36 +01:00
|
|
|
if (sfileo->asset_params) {
|
2023-07-12 13:43:00 +02:00
|
|
|
sfilen->asset_params = static_cast<FileAssetSelectParams *>(
|
|
|
|
|
MEM_dupallocN(sfileo->asset_params));
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-07-07 07:25:44 +00:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
sfilen->folder_histories = folder_history_list_duplicate(&sfileo->folder_histories);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-03-08 13:14:12 +00:00
|
|
|
if (sfileo->layout) {
|
2023-07-12 13:43:00 +02:00
|
|
|
sfilen->layout = static_cast<FileLayout *>(MEM_dupallocN(sfileo->layout));
|
2009-03-08 13:14:12 +00:00
|
|
|
}
|
2008-12-14 12:16:55 +00:00
|
|
|
return (SpaceLink *)sfilen;
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
static void file_refresh(const bContext *C, ScrArea *area)
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2024-01-26 18:30:55 -05:00
|
|
|
using namespace blender::ed;
|
2013-03-15 19:56:29 +00: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);
|
2012-06-18 13:01:24 +00:00
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
2020-12-08 13:47:37 +01:00
|
|
|
FileSelectParams *params = ED_fileselect_ensure_active_params(sfile);
|
2020-12-14 13:50:36 +01:00
|
|
|
FileAssetSelectParams *asset_params = ED_fileselect_get_asset_params(sfile);
|
2023-07-20 11:30:25 +10:00
|
|
|
FSMenu *fsmenu = ED_fsmenu_get();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
fileselect_refresh_params(sfile);
|
|
|
|
|
folder_history_list_ensure_for_active_browse_mode(sfile);
|
|
|
|
|
|
2023-07-24 14:53:33 +02:00
|
|
|
if (sfile->runtime != nullptr) {
|
|
|
|
|
sfile->runtime->is_blendfile_status_set = false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
if (sfile->files && (sfile->tags & FILE_TAG_REBUILD_MAIN_FILES) &&
|
|
|
|
|
filelist_needs_reset_on_main_changes(sfile->files))
|
|
|
|
|
{
|
2021-10-20 13:09:40 +02:00
|
|
|
filelist_tag_force_reset_mainfiles(sfile->files);
|
2014-12-31 20:13:21 +01:00
|
|
|
}
|
2020-12-14 13:50:36 +01:00
|
|
|
sfile->tags &= ~FILE_TAG_REBUILD_MAIN_FILES;
|
|
|
|
|
|
2009-06-29 20:23:40 +00:00
|
|
|
if (!sfile->files) {
|
2009-09-12 19:54:39 +00:00
|
|
|
sfile->files = filelist_new(params->type);
|
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
|
|
|
params->highlight_file = -1; /* added this so it opens nicer (ton) */
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
2021-08-11 14:20:49 +02:00
|
|
|
|
2021-09-29 17:01:13 +02:00
|
|
|
if (ED_fileselect_is_asset_browser(sfile)) {
|
2021-10-22 23:56:05 +02:00
|
|
|
/* Ask the asset code for appropriate ID filter flags for the supported assets, and mask others
|
|
|
|
|
* out. */
|
2024-01-26 18:30:55 -05:00
|
|
|
params->filter_id &= asset::types_supported_as_filter_flags();
|
2021-08-11 14:20:49 +02:00
|
|
|
}
|
|
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
filelist_settype(sfile->files, params->type);
|
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
|
|
|
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);
|
2023-07-12 13:43:00 +02:00
|
|
|
filelist_setlibrary(sfile->files, asset_params ? &asset_params->asset_library_ref : nullptr);
|
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_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,
|
2020-12-14 13:50:36 +01:00
|
|
|
(params->flag & FILE_ASSETS_ONLY) != 0,
|
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
|
|
|
params->filter_glob,
|
|
|
|
|
params->filter_search);
|
2021-09-29 17:01:13 +02:00
|
|
|
if (asset_params) {
|
|
|
|
|
filelist_set_asset_catalog_filter_options(
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->files,
|
|
|
|
|
eFileSel_Params_AssetCatalogVisibility(asset_params->asset_catalog_visibility),
|
|
|
|
|
&asset_params->catalog_id);
|
2021-09-29 17:01:13 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-11-24 08:20:18 +01:00
|
|
|
if (ED_fileselect_is_asset_browser(sfile)) {
|
2022-01-19 20:02:23 +01:00
|
|
|
const bool use_asset_indexer = !USER_EXPERIMENTAL_TEST(&U, no_asset_indexing);
|
2024-01-26 18:30:55 -05:00
|
|
|
filelist_setindexer(
|
|
|
|
|
sfile->files, use_asset_indexer ? &asset::index::file_indexer_asset : &file_indexer_noop);
|
2021-11-24 08:20:18 +01:00
|
|
|
}
|
|
|
|
|
|
2015-02-11 00:09:45 +01: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);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
if (filelist_needs_force_reset(sfile->files)) {
|
2021-07-01 15:09:08 +02:00
|
|
|
filelist_readjob_stop(sfile->files, wm);
|
2021-10-20 13:09:40 +02:00
|
|
|
filelist_clear_from_reset_tag(sfile->files);
|
2014-12-31 20:13:21 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
if (filelist_needs_reading(sfile->files)) {
|
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
|
|
|
if (!filelist_pending(sfile->files)) {
|
2021-07-09 12:56:26 +02:00
|
|
|
filelist_readjob_start(sfile->files, NC_SPACE | ND_SPACE_FILE_LIST, C);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
filelist_sort(sfile->files);
|
2014-12-31 20:13:21 +01:00
|
|
|
filelist_filter(sfile->files);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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
|
|
|
if (params->display == FILE_IMGDISPLAY) {
|
|
|
|
|
filelist_cache_previews_set(sfile->files, true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
filelist_cache_previews_set(sfile->files, false);
|
|
|
|
|
if (sfile->previews_timer) {
|
2023-07-11 13:16:04 +10:00
|
|
|
WM_event_timer_remove_notifier(wm, win, sfile->previews_timer);
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->previews_timer = nullptr;
|
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
|
|
|
}
|
|
|
|
|
|
2019-03-05 21:01:45 +01:00
|
|
|
if (params->rename_flag != 0) {
|
2019-03-05 16:17:09 +01:00
|
|
|
file_params_renamefile_activate(sfile, params);
|
2009-09-13 09:41:00 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-12-31 20:13:21 +01:00
|
|
|
if (sfile->layout) {
|
|
|
|
|
sfile->layout->dirty = true;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
if (area) {
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
ARegion *region_props = BKE_area_find_region_type(area, RGN_TYPE_TOOL_PROPS);
|
2023-07-12 13:43:00 +02:00
|
|
|
const short region_flag_old = region_props->flag;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
if (!(region_props->v2d.flag & V2D_IS_INIT)) {
|
|
|
|
|
if (ED_fileselect_is_asset_browser(sfile)) {
|
|
|
|
|
/* Hide by default in asset browser. */
|
|
|
|
|
region_props->flag |= RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (params->flag & FILE_HIDE_TOOL_PROPS) {
|
|
|
|
|
region_props->flag |= RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
region_props->flag &= ~RGN_FLAG_HIDDEN;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (region_flag_old != region_props->flag) {
|
|
|
|
|
ED_region_visibility_change_update((bContext *)C, area, region_props);
|
|
|
|
|
}
|
2019-09-20 12:03:32 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(area);
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
2021-03-05 15:00:56 +01:00
|
|
|
void file_on_reload_callback_register(SpaceFile *sfile,
|
|
|
|
|
onReloadFn callback,
|
|
|
|
|
onReloadFnData custom_data)
|
|
|
|
|
{
|
|
|
|
|
sfile->runtime->on_reload = callback;
|
|
|
|
|
sfile->runtime->on_reload_custom_data = custom_data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void file_on_reload_callback_call(SpaceFile *sfile)
|
|
|
|
|
{
|
2023-07-12 13:43:00 +02:00
|
|
|
if (sfile->runtime->on_reload == nullptr) {
|
2021-03-05 15:00:56 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sfile->runtime->on_reload(sfile, sfile->runtime->on_reload_custom_data);
|
|
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->runtime->on_reload = nullptr;
|
|
|
|
|
sfile->runtime->on_reload_custom_data = nullptr;
|
2021-03-05 15:00:56 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-11 15:42:22 +01:00
|
|
|
static void file_reset_filelist_showing_main_data(ScrArea *area, SpaceFile *sfile)
|
|
|
|
|
{
|
|
|
|
|
if (sfile->files && filelist_needs_reset_on_main_changes(sfile->files)) {
|
2021-10-20 13:09:40 +02:00
|
|
|
filelist_tag_force_reset_mainfiles(sfile->files);
|
|
|
|
|
ED_area_tag_refresh(area);
|
2021-03-11 15:42:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-05 16:45:15 +02:00
|
|
|
static void file_listener(const wmSpaceTypeListenerParams *listener_params)
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2021-07-05 16:45:15 +02:00
|
|
|
ScrArea *area = listener_params->area;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = listener_params->notifier;
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceFile *sfile = (SpaceFile *)area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-29 20:23:40 +00:00
|
|
|
/* context changes */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (wmn->category) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2009-06-29 20:23:40 +00:00
|
|
|
switch (wmn->data) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SPACE_FILE_LIST:
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_refresh(area);
|
2009-06-29 20:23:40 +00:00
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SPACE_FILE_PARAMS:
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_refresh(area);
|
2009-06-29 20:23:40 +00:00
|
|
|
break;
|
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
|
|
|
case ND_SPACE_FILE_PREVIEW:
|
2015-08-23 20:27:59 +02:00
|
|
|
if (sfile->files && filelist_cache_previews_update(sfile->files)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_refresh(area);
|
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
|
|
|
}
|
|
|
|
|
break;
|
2020-12-15 16:58:30 +01:00
|
|
|
case ND_SPACE_ASSET_PARAMS:
|
|
|
|
|
if (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS) {
|
|
|
|
|
ED_area_tag_refresh(area);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-03-11 15:42:22 +01:00
|
|
|
case ND_SPACE_CHANGED:
|
|
|
|
|
/* If the space was just turned into a file/asset browser, the file-list may need to be
|
|
|
|
|
* updated to reflect latest changes in main data. */
|
|
|
|
|
file_reset_filelist_showing_main_data(area, sfile);
|
|
|
|
|
break;
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
2021-03-05 15:00:56 +01:00
|
|
|
switch (wmn->action) {
|
|
|
|
|
case NA_JOB_FINISHED:
|
|
|
|
|
file_on_reload_callback_call(sfile);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-06-29 20:23:40 +00:00
|
|
|
break;
|
2021-04-29 13:15:42 +02:00
|
|
|
case NC_ID: {
|
|
|
|
|
switch (wmn->action) {
|
Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.
Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).
Reviewed by: Sybren Stüvel
Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
|
|
|
case NA_RENAME: {
|
|
|
|
|
const ID *active_file_id = ED_fileselect_active_asset_get(sfile);
|
|
|
|
|
/* If a renamed ID is active in the file browser, update scrolling to keep it in view. */
|
|
|
|
|
if (active_file_id && (wmn->reference == active_file_id)) {
|
|
|
|
|
FileSelectParams *params = ED_fileselect_get_active_params(sfile);
|
|
|
|
|
params->rename_id = active_file_id;
|
2023-07-12 13:43:00 +02:00
|
|
|
file_params_invoke_rename_postscroll(
|
|
|
|
|
static_cast<wmWindowManager *>(G_MAIN->wm.first), listener_params->window, sfile);
|
Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.
Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).
Reviewed by: Sybren Stüvel
Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
|
|
|
}
|
|
|
|
|
|
2021-04-29 13:15:42 +02:00
|
|
|
/* Force list to update sorting (with a full reset for now). */
|
|
|
|
|
file_reset_filelist_showing_main_data(area, sfile);
|
|
|
|
|
break;
|
Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.
Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).
Reviewed by: Sybren Stüvel
Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
|
|
|
}
|
2021-04-29 13:15:42 +02:00
|
|
|
}
|
2021-04-29 13:36:04 +02:00
|
|
|
break;
|
2021-04-29 13:15:42 +02:00
|
|
|
}
|
2020-12-14 13:50:36 +01:00
|
|
|
case NC_ASSET: {
|
2021-03-05 15:00:56 +01:00
|
|
|
switch (wmn->action) {
|
|
|
|
|
case NA_SELECTED:
|
|
|
|
|
case NA_ACTIVATED:
|
|
|
|
|
ED_area_tag_refresh(area);
|
|
|
|
|
break;
|
|
|
|
|
case NA_ADDED:
|
|
|
|
|
case NA_REMOVED:
|
2021-03-08 16:32:32 +01:00
|
|
|
case NA_EDITED:
|
2021-03-11 15:42:22 +01:00
|
|
|
file_reset_filelist_showing_main_data(area, sfile);
|
2021-03-05 15:00:56 +01:00
|
|
|
break;
|
2020-12-14 13:50:36 +01:00
|
|
|
}
|
|
|
|
|
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 */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_main_region_init(wmWindowManager *wm, ARegion *region)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2024-06-13 19:53:22 +02:00
|
|
|
/* Truncate, otherwise these can be on ".5" and give fuzzy text. #77696. */
|
|
|
|
|
region->v2d.cur.ymin = trunc(region->v2d.cur.ymin);
|
|
|
|
|
region->v2d.cur.ymax = trunc(region->v2d.cur.ymax);
|
|
|
|
|
|
2009-07-05 22:26:43 +00:00
|
|
|
/* own keymaps */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Main", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-05 16:45:15 +02:00
|
|
|
static void file_main_region_listener(const wmRegionListenerParams *listener_params)
|
2009-07-26 12:40:44 +00:00
|
|
|
{
|
2021-07-05 16:45:15 +02:00
|
|
|
ARegion *region = listener_params->region;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = listener_params->notifier;
|
2021-01-18 17:28:47 -06:00
|
|
|
|
2009-07-26 12:40:44 +00:00
|
|
|
/* context changes */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (wmn->category) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2009-07-26 12:40:44 +00:00
|
|
|
switch (wmn->data) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SPACE_FILE_LIST:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-07-26 12:40:44 +00:00
|
|
|
break;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SPACE_FILE_PARAMS:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-07-26 12:40:44 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-01-21 21:40:25 +01:00
|
|
|
case NC_ID:
|
2021-03-05 15:00:56 +01:00
|
|
|
if (ELEM(wmn->action, NA_SELECTED, NA_ACTIVATED, NA_RENAME)) {
|
2021-01-21 21:40:25 +01:00
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-07-26 12:40:44 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-19 12:59:00 +11:00
|
|
|
static void file_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
2017-11-13 19:43:34 +11:00
|
|
|
{
|
2023-07-20 11:30:25 +10:00
|
|
|
wmMsgBus *mbus = params->message_bus;
|
2021-01-18 17:28:47 -06:00
|
|
|
bScreen *screen = params->screen;
|
|
|
|
|
ScrArea *area = params->area;
|
|
|
|
|
ARegion *region = params->region;
|
2023-07-12 13:43:00 +02:00
|
|
|
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
2021-01-18 17:28:47 -06:00
|
|
|
|
|
|
|
|
FileSelectParams *file_params = ED_fileselect_ensure_active_params(sfile);
|
2017-11-13 19:43:34 +11:00
|
|
|
/* 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. */
|
2023-07-12 13:43:00 +02:00
|
|
|
wmMsgSubscribeValue msg_sub_value_area_tag_refresh{};
|
|
|
|
|
msg_sub_value_area_tag_refresh.owner = region;
|
|
|
|
|
msg_sub_value_area_tag_refresh.user_data = area;
|
|
|
|
|
msg_sub_value_area_tag_refresh.notify = ED_area_do_msg_notify_tag_refresh;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-29 12:50:15 +01:00
|
|
|
/* SpaceFile itself. */
|
|
|
|
|
{
|
2025-01-24 16:45:32 +01:00
|
|
|
PointerRNA ptr = RNA_pointer_create_discrete(&screen->id, &RNA_SpaceFileBrowser, sfile);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-29 12:50:15 +01:00
|
|
|
/* All properties for this space type. */
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_msg_subscribe_rna(mbus, &ptr, nullptr, &msg_sub_value_area_tag_refresh, __func__);
|
2018-01-29 12:50:15 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* FileSelectParams */
|
|
|
|
|
{
|
2025-01-24 16:45:32 +01:00
|
|
|
PointerRNA ptr = RNA_pointer_create_discrete(&screen->id, &RNA_FileSelectParams, file_params);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
/* All properties for this space type. */
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_msg_subscribe_rna(mbus, &ptr, nullptr, &msg_sub_value_area_tag_refresh, __func__);
|
2017-11-13 19:43:34 +11:00
|
|
|
}
|
2021-08-11 14:20:49 +02:00
|
|
|
|
|
|
|
|
/* Experimental Asset Browser features option. */
|
|
|
|
|
{
|
2025-01-24 16:45:32 +01:00
|
|
|
PointerRNA ptr = RNA_pointer_create_discrete(
|
|
|
|
|
nullptr, &RNA_PreferencesExperimental, &U.experimental);
|
2021-08-11 14:20:49 +02:00
|
|
|
PropertyRNA *prop = RNA_struct_find_property(&ptr, "use_extended_asset_browser");
|
|
|
|
|
|
|
|
|
|
/* All properties for this space type. */
|
|
|
|
|
WM_msg_subscribe_rna(mbus, &ptr, prop, &msg_sub_value_area_tag_refresh, __func__);
|
|
|
|
|
}
|
2017-11-13 19:43:34 +11:00
|
|
|
}
|
|
|
|
|
|
2023-08-01 11:33:15 +02:00
|
|
|
bool file_main_region_needs_refresh_before_draw(SpaceFile *sfile)
|
2020-12-14 13:50:36 +01:00
|
|
|
{
|
|
|
|
|
/* Needed, because filelist is not initialized on loading */
|
|
|
|
|
if (!sfile->files || filelist_needs_reading(sfile->files)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* File reading tagged the space because main data changed that may require a filelist reset. */
|
|
|
|
|
if (filelist_needs_reset_on_main_changes(sfile->files) &&
|
|
|
|
|
(sfile->tags & FILE_TAG_REBUILD_MAIN_FILES))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_main_region_draw(const bContext *C, ARegion *region)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
|
|
|
|
/* draw entirely, view changes should be handled here */
|
2012-06-18 13:01:24 +00:00
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
2020-12-08 13:47:37 +01:00
|
|
|
FileSelectParams *params = ED_fileselect_ensure_active_params(sfile);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
View2D *v2d = ®ion->v2d;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-14 13:50:36 +01:00
|
|
|
if (file_main_region_needs_refresh_before_draw(sfile)) {
|
2023-07-12 13:43:00 +02:00
|
|
|
file_refresh(C, nullptr);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* clear and setup matrix */
|
2020-08-23 11:11:27 +02:00
|
|
|
UI_ThemeClearColor(TH_BACK);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-02-17 13:11:09 +00:00
|
|
|
/* Allow dynamically sliders to be set, saves notifiers etc. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-08-26 06:54:05 +00:00
|
|
|
if (params->display == FILE_IMGDISPLAY) {
|
2009-02-17 13:11:09 +00:00
|
|
|
v2d->scroll = V2D_SCROLL_RIGHT;
|
2009-03-09 09:15:23 +00:00
|
|
|
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;
|
|
|
|
|
}
|
2009-03-09 09:15:23 +00:00
|
|
|
else {
|
2009-02-17 13:11:09 +00:00
|
|
|
v2d->scroll = V2D_SCROLL_BOTTOM;
|
2009-03-09 09:15:23 +00:00
|
|
|
v2d->keepofs &= ~V2D_LOCKOFS_X;
|
|
|
|
|
v2d->keepofs |= V2D_LOCKOFS_Y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-12-20 18:29:32 +00:00
|
|
|
/* XXX this happens on scaling down Screen (like from startup.blend) */
|
2021-02-25 16:34:27 +11:00
|
|
|
/* view2d has no type specific for file-window case, which doesn't scroll vertically. */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (v2d->cur.ymax < 0) {
|
2010-12-20 18:29:32 +00:00
|
|
|
v2d->cur.ymin -= v2d->cur.ymax;
|
2012-03-24 02:51:46 +00:00
|
|
|
v2d->cur.ymax = 0;
|
2010-12-20 18:29:32 +00:00
|
|
|
}
|
2009-03-09 09:15:23 +00:00
|
|
|
}
|
|
|
|
|
/* v2d has initialized flag, so this call will only set the mask correct */
|
2020-03-06 16:56:42 +01:00
|
|
|
UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-28 11:27:25 +00:00
|
|
|
/* sets tile/border settings in sfile */
|
2020-03-06 16:56:42 +01:00
|
|
|
file_calc_previews(C, region);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-02-17 13:11:09 +00:00
|
|
|
/* set view */
|
2010-10-14 01:22:14 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-28 11:27:25 +00:00
|
|
|
/* on first read, find active file */
|
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
|
|
|
if (params->highlight_file == -1) {
|
2024-04-29 08:58:01 +10:00
|
|
|
const wmEvent *event = CTX_wm_window(C)->eventstate;
|
2021-10-20 23:45:30 +11:00
|
|
|
file_highlight_set(sfile, region, event->xy[0], event->xy[1]);
|
2009-01-28 11:27:25 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-10-26 21:55:46 +02:00
|
|
|
if (!file_draw_hint_if_invalid(C, sfile, region)) {
|
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
|
|
|
file_draw_list(C, region);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* reset view matrix */
|
|
|
|
|
UI_view2d_view_restore(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* 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);
|
2020-06-22 21:44:18 +02:00
|
|
|
UI_view2d_scrollers_draw(v2d, &view_rect);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
static void file_operatortypes()
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2009-02-14 14:25:48 +00:00
|
|
|
WM_operatortype_append(FILE_OT_select);
|
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
|
|
|
WM_operatortype_append(FILE_OT_select_walk);
|
2018-07-03 15:44:56 +02:00
|
|
|
WM_operatortype_append(FILE_OT_select_all);
|
2018-10-05 10:27:04 +10:00
|
|
|
WM_operatortype_append(FILE_OT_select_box);
|
2009-02-14 14:25:48 +00:00
|
|
|
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);
|
2009-09-04 04:29:54 +00:00
|
|
|
WM_operatortype_append(FILE_OT_execute);
|
2021-05-05 20:36:12 +02:00
|
|
|
WM_operatortype_append(FILE_OT_mouse_execute);
|
2009-02-14 14:25:48 +00:00
|
|
|
WM_operatortype_append(FILE_OT_cancel);
|
|
|
|
|
WM_operatortype_append(FILE_OT_parent);
|
2009-07-07 07:25:44 +00:00
|
|
|
WM_operatortype_append(FILE_OT_previous);
|
|
|
|
|
WM_operatortype_append(FILE_OT_next);
|
2009-03-12 06:40:03 +00:00
|
|
|
WM_operatortype_append(FILE_OT_refresh);
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(FILE_OT_bookmark_add);
|
2013-10-08 13:16:14 +00:00
|
|
|
WM_operatortype_append(FILE_OT_bookmark_delete);
|
2015-02-11 17:07:52 +01:00
|
|
|
WM_operatortype_append(FILE_OT_bookmark_cleanup);
|
2015-02-11 00:09:45 +01:00
|
|
|
WM_operatortype_append(FILE_OT_bookmark_move);
|
2012-09-17 21:38:04 +00:00
|
|
|
WM_operatortype_append(FILE_OT_reset_recent);
|
2016-10-03 16:34:51 +02:00
|
|
|
WM_operatortype_append(FILE_OT_hidedot);
|
2009-07-05 22:26:43 +00:00
|
|
|
WM_operatortype_append(FILE_OT_filenum);
|
2009-07-10 17:05:04 +00:00
|
|
|
WM_operatortype_append(FILE_OT_directory_new);
|
|
|
|
|
WM_operatortype_append(FILE_OT_delete);
|
2009-07-26 18:52:27 +00:00
|
|
|
WM_operatortype_append(FILE_OT_rename);
|
2010-05-08 21:02:22 +00:00
|
|
|
WM_operatortype_append(FILE_OT_smoothscroll);
|
2015-11-04 14:24:46 +01:00
|
|
|
WM_operatortype_append(FILE_OT_filepath_drop);
|
2020-02-28 14:33:31 +01:00
|
|
|
WM_operatortype_append(FILE_OT_start_filter);
|
2022-06-16 19:44:39 +02:00
|
|
|
WM_operatortype_append(FILE_OT_edit_directory_path);
|
2021-03-08 13:57:15 +01:00
|
|
|
WM_operatortype_append(FILE_OT_view_selected);
|
2023-04-18 20:39:30 +02:00
|
|
|
WM_operatortype_append(FILE_OT_external_operation);
|
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 */
|
2023-06-03 08:36:28 +10:00
|
|
|
static void file_keymap(wmKeyConfig *keyconf)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2015-11-28 17:14:45 +01:00
|
|
|
/* keys for all regions */
|
2023-09-14 13:32:42 +10:00
|
|
|
WM_keymap_ensure(keyconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2015-12-03 12:21:57 +01:00
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* keys for main region */
|
2023-09-14 13:32:42 +10:00
|
|
|
WM_keymap_ensure(keyconf, "File Browser Main", SPACE_FILE, RGN_TYPE_WINDOW);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* keys for button region (top) */
|
2023-09-14 13:32:42 +10:00
|
|
|
WM_keymap_ensure(keyconf, "File Browser Buttons", SPACE_FILE, RGN_TYPE_WINDOW);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
static bool file_ui_region_poll(const RegionPollParams *params)
|
|
|
|
|
{
|
|
|
|
|
const SpaceFile *sfile = (SpaceFile *)params->area->spacedata.first;
|
|
|
|
|
/* Always visible except when browsing assets. */
|
|
|
|
|
return sfile->browse_mode != FILE_BROWSE_MODE_ASSETS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool file_tool_props_region_poll(const RegionPollParams *params)
|
|
|
|
|
{
|
|
|
|
|
const SpaceFile *sfile = (SpaceFile *)params->area->spacedata.first;
|
2023-07-12 13:43:00 +02:00
|
|
|
return (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS) || (sfile->op != nullptr);
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool file_execution_region_poll(const RegionPollParams *params)
|
|
|
|
|
{
|
|
|
|
|
const SpaceFile *sfile = (SpaceFile *)params->area->spacedata.first;
|
2023-07-12 13:43:00 +02:00
|
|
|
return sfile->op != nullptr;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_tools_region_init(wmWindowManager *wm, ARegion *region)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
|
|
|
|
|
ED_region_panels_init(wm, region);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
|
|
|
|
/* own keymaps */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_tools_region_draw(const bContext *C, ARegion *region)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels(C, region);
|
2009-06-29 20:23:40 +00:00
|
|
|
}
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2021-09-20 22:01:28 +02:00
|
|
|
static void file_tools_region_listener(const wmRegionListenerParams *listener_params)
|
2009-06-29 20:23:40 +00:00
|
|
|
{
|
2021-09-20 22:01:28 +02:00
|
|
|
const wmNotifier *wmn = listener_params->notifier;
|
|
|
|
|
ARegion *region = listener_params->region;
|
|
|
|
|
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_SCENE:
|
|
|
|
|
if (ELEM(wmn->data, ND_MODE)) {
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-05 16:45:15 +02:00
|
|
|
static void file_tool_props_region_listener(const wmRegionListenerParams *listener_params)
|
2021-01-21 21:40:25 +01:00
|
|
|
{
|
2021-07-05 16:45:15 +02:00
|
|
|
const wmNotifier *wmn = listener_params->notifier;
|
|
|
|
|
ARegion *region = listener_params->region;
|
2021-01-21 21:40:25 +01:00
|
|
|
|
|
|
|
|
switch (wmn->category) {
|
|
|
|
|
case NC_ID:
|
|
|
|
|
if (ELEM(wmn->action, NA_RENAME)) {
|
|
|
|
|
/* In case the filelist shows ID names. */
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-09-20 22:01:28 +02:00
|
|
|
case NC_SCENE:
|
|
|
|
|
if (ELEM(wmn->data, ND_MODE)) {
|
|
|
|
|
ED_region_tag_redraw(region);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-01-21 21:40:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_header_region_init(wmWindowManager *wm, ARegion *region)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2010-05-10 08:57:58 +00:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_header_init(region);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_header_region_draw(const bContext *C, ARegion *region)
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_header(C, region);
|
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 */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_ui_region_init(wmWindowManager *wm, ARegion *region)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels_init(wm, region);
|
|
|
|
|
region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
|
2009-07-05 22:26:43 +00:00
|
|
|
|
|
|
|
|
/* own keymap */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2009-07-05 22:26:43 +00:00
|
|
|
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Buttons", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->handlers, keymap);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_ui_region_draw(const bContext *C, ARegion *region)
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels(C, region);
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
}
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_execution_region_init(wmWindowManager *wm, ARegion *region)
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
{
|
2019-09-08 20:31:12 +02:00
|
|
|
wmKeyMap *keymap;
|
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels_init(wm, region);
|
|
|
|
|
region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
|
2019-09-08 20:31:12 +02:00
|
|
|
|
|
|
|
|
/* own keymap */
|
2023-09-14 13:32:42 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, RGN_TYPE_WINDOW);
|
2024-11-21 19:34:53 +01:00
|
|
|
WM_event_add_keymap_handler_v2d_mask(®ion->runtime->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
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void file_execution_region_draw(const bContext *C, ARegion *region)
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_panels(C, region);
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-05 16:45:15 +02:00
|
|
|
static void file_ui_region_listener(const wmRegionListenerParams *listener_params)
|
2009-07-26 19:23:07 +00:00
|
|
|
{
|
2021-07-05 16:45:15 +02:00
|
|
|
ARegion *region = listener_params->region;
|
2022-08-27 12:50:43 +10:00
|
|
|
const wmNotifier *wmn = listener_params->notifier;
|
2021-01-18 17:28:47 -06:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* context changes */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (wmn->category) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case NC_SPACE:
|
2009-07-26 19:23:07 +00:00
|
|
|
switch (wmn->data) {
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
case ND_SPACE_FILE_LIST:
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_tag_redraw(region);
|
2009-07-26 19:23:07 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-12-14 11:25:00 +00:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
static bool filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent * /*event*/)
|
2015-11-04 14:24:46 +01:00
|
|
|
{
|
|
|
|
|
if (drag->type == WM_DRAG_PATH) {
|
|
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
|
|
|
|
if (sfile) {
|
2020-09-02 19:10:18 +02:00
|
|
|
return true;
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-09-02 19:10:18 +02:00
|
|
|
return false;
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
static void filepath_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
2015-11-04 14:24:46 +01:00
|
|
|
{
|
2023-12-12 18:46:12 +01:00
|
|
|
RNA_string_set(drop->ptr, "filepath", WM_drag_get_single_path(drag));
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* region dropbox definition */
|
2023-07-13 09:54:02 +10:00
|
|
|
static void file_dropboxes()
|
2015-11-04 14:24:46 +01:00
|
|
|
{
|
|
|
|
|
ListBase *lb = WM_dropboxmap_find("Window", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
|
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_dropbox_add(
|
|
|
|
|
lb, "FILE_OT_filepath_drop", filepath_drop_poll, filepath_drop_copy, nullptr, nullptr);
|
2015-11-04 14:24:46 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static int file_space_subtype_get(ScrArea *area)
|
|
|
|
|
{
|
2023-07-12 13:43:00 +02:00
|
|
|
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
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
|
|
|
return sfile->browse_mode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void file_space_subtype_set(ScrArea *area, int value)
|
|
|
|
|
{
|
2023-07-12 13:43:00 +02:00
|
|
|
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
/* Force re-init. */
|
|
|
|
|
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
|
|
|
|
region->v2d.flag &= ~V2D_IS_INIT;
|
|
|
|
|
}
|
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
|
|
|
sfile->browse_mode = value;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
static void file_space_subtype_item_extend(bContext * /*C*/, EnumPropertyItem **item, int *totitem)
|
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
|
|
|
{
|
2021-08-11 14:20:49 +02:00
|
|
|
RNA_enum_items_add(item, totitem, rna_enum_space_file_browse_mode_items);
|
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
|
|
|
}
|
|
|
|
|
|
2024-07-12 01:13:44 +02:00
|
|
|
static blender::StringRefNull file_space_name_get(const ScrArea *area)
|
2024-07-11 20:40:06 +02:00
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
|
|
|
|
const int index = RNA_enum_from_value(rna_enum_space_file_browse_mode_items, sfile->browse_mode);
|
|
|
|
|
const EnumPropertyItem item = rna_enum_space_file_browse_mode_items[index];
|
|
|
|
|
return item.name;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-12 00:08:19 +02:00
|
|
|
static int file_space_icon_get(const ScrArea *area)
|
|
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
|
|
|
|
const int index = RNA_enum_from_value(rna_enum_space_file_browse_mode_items, sfile->browse_mode);
|
|
|
|
|
const EnumPropertyItem item = rna_enum_space_file_browse_mode_items[index];
|
|
|
|
|
return item.icon;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-13 15:36:38 +01:00
|
|
|
static void file_id_remap(ScrArea *area,
|
|
|
|
|
SpaceLink *sl,
|
|
|
|
|
const blender::bke::id::IDRemapper & /*mappings*/)
|
2020-12-14 13:50:36 +01:00
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
|
|
|
|
|
2021-03-11 15:42:22 +01:00
|
|
|
/* If the file shows main data (IDs), tag it for reset.
|
|
|
|
|
* Full reset of the file list if main data was changed, don't even attempt remap pointers.
|
|
|
|
|
* We could give file list types a id-remap callback, but it's probably not worth it.
|
|
|
|
|
* Refreshing local file lists is relatively cheap. */
|
|
|
|
|
file_reset_filelist_showing_main_data(area, sfile);
|
2020-12-14 13:50:36 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-17 14:42:04 +02:00
|
|
|
static void file_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
|
|
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = reinterpret_cast<SpaceFile *>(space_link);
|
|
|
|
|
const int data_flags = BKE_lib_query_foreachid_process_flags_get(data);
|
|
|
|
|
const bool is_readonly = (data_flags & IDWALK_READONLY) != 0;
|
|
|
|
|
|
|
|
|
|
/* TODO: investigate whether differences between this code and the one in #file_id_remap are
|
|
|
|
|
* meaningful and make sense or not. */
|
|
|
|
|
if (!is_readonly) {
|
|
|
|
|
sfile->op = nullptr;
|
|
|
|
|
sfile->tags = FILE_TAG_REBUILD_MAIN_FILES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-27 14:42:21 +10:00
|
|
|
static void file_space_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
|
2022-09-28 11:52:22 +02:00
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
|
|
|
|
|
|
|
|
|
/* this sort of info is probably irrelevant for reloading...
|
|
|
|
|
* plus, it isn't saved to files yet!
|
|
|
|
|
*/
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->folders_prev = sfile->folders_next = nullptr;
|
2022-09-28 11:52:22 +02:00
|
|
|
BLI_listbase_clear(&sfile->folder_histories);
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->files = nullptr;
|
|
|
|
|
sfile->layout = nullptr;
|
|
|
|
|
sfile->op = nullptr;
|
|
|
|
|
sfile->previews_timer = nullptr;
|
2022-09-28 11:52:22 +02:00
|
|
|
sfile->tags = 0;
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->runtime = nullptr;
|
2024-04-24 17:01:22 +02:00
|
|
|
BLO_read_struct(reader, FileSelectParams, &sfile->params);
|
|
|
|
|
BLO_read_struct(reader, FileAssetSelectParams, &sfile->asset_params);
|
2022-09-28 11:52:22 +02:00
|
|
|
if (sfile->params) {
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->params->rename_id = nullptr;
|
2022-09-28 11:52:22 +02:00
|
|
|
}
|
|
|
|
|
if (sfile->asset_params) {
|
2023-07-12 13:43:00 +02:00
|
|
|
sfile->asset_params->base_params.rename_id = nullptr;
|
2022-09-28 11:52:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-11 18:07:59 +01:00
|
|
|
static void file_space_blend_read_after_liblink(BlendLibReader * /*reader*/,
|
2023-08-25 09:39:26 +10:00
|
|
|
ID * /*parent_id*/,
|
|
|
|
|
SpaceLink *sl)
|
2022-09-28 11:52:22 +02:00
|
|
|
{
|
2023-03-11 18:07:59 +01:00
|
|
|
SpaceFile *sfile = reinterpret_cast<SpaceFile *>(sl);
|
|
|
|
|
|
2022-09-28 11:52:22 +02:00
|
|
|
sfile->tags |= FILE_TAG_REBUILD_MAIN_FILES;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-27 14:42:21 +10:00
|
|
|
static void file_space_blend_write(BlendWriter *writer, SpaceLink *sl)
|
2022-09-28 11:52:22 +02:00
|
|
|
{
|
|
|
|
|
SpaceFile *sfile = (SpaceFile *)sl;
|
|
|
|
|
|
|
|
|
|
BLO_write_struct(writer, SpaceFile, sl);
|
|
|
|
|
if (sfile->params) {
|
|
|
|
|
BLO_write_struct(writer, FileSelectParams, sfile->params);
|
|
|
|
|
}
|
|
|
|
|
if (sfile->asset_params) {
|
|
|
|
|
BLO_write_struct(writer, FileAssetSelectParams, sfile->asset_params);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void ED_spacetype_file()
|
2008-12-14 11:25:00 +00:00
|
|
|
{
|
2024-02-02 20:59:20 +01:00
|
|
|
std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
|
2008-12-14 11:25:00 +00:00
|
|
|
ARegionType *art;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-18 13:01:24 +00:00
|
|
|
st->spaceid = SPACE_FILE;
|
2022-09-10 16:51:15 +10:00
|
|
|
STRNCPY(st->name, "File");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-04 14:39:53 +02:00
|
|
|
st->create = file_create;
|
2012-06-18 13:01:24 +00:00
|
|
|
st->free = file_free;
|
|
|
|
|
st->init = file_init;
|
2013-03-15 19:56:29 +00:00
|
|
|
st->exit = file_exit;
|
2012-06-18 13:01:24 +00:00
|
|
|
st->duplicate = file_duplicate;
|
|
|
|
|
st->refresh = file_refresh;
|
|
|
|
|
st->listener = file_listener;
|
|
|
|
|
st->operatortypes = file_operatortypes;
|
|
|
|
|
st->keymap = file_keymap;
|
2015-11-04 14:24:46 +01:00
|
|
|
st->dropboxes = file_dropboxes;
|
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
|
|
|
st->space_subtype_item_extend = file_space_subtype_item_extend;
|
|
|
|
|
st->space_subtype_get = file_space_subtype_get;
|
|
|
|
|
st->space_subtype_set = file_space_subtype_set;
|
2024-07-11 20:40:06 +02:00
|
|
|
st->space_name_get = file_space_name_get;
|
2024-07-12 00:08:19 +02:00
|
|
|
st->space_icon_get = file_space_icon_get;
|
2020-12-14 13:50:36 +01:00
|
|
|
st->context = file_context;
|
|
|
|
|
st->id_remap = file_id_remap;
|
2023-08-17 14:42:04 +02:00
|
|
|
st->foreach_id = file_foreach_id;
|
2023-04-27 14:42:21 +10:00
|
|
|
st->blend_read_data = file_space_blend_read_data;
|
2023-03-11 18:07:59 +01:00
|
|
|
st->blend_read_after_liblink = file_space_blend_read_after_liblink;
|
2023-04-27 14:42:21 +10:00
|
|
|
st->blend_write = file_space_blend_write;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* regions: main window */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(MEM_callocN(sizeof(ARegionType), "spacetype file region"));
|
2008-12-14 11:25:00 +00:00
|
|
|
art->regionid = RGN_TYPE_WINDOW;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = file_main_region_init;
|
|
|
|
|
art->draw = file_main_region_draw;
|
|
|
|
|
art->listener = file_main_region_listener;
|
2017-11-13 19:43:34 +11:00
|
|
|
art->message_subscribe = file_main_region_message_subscribe;
|
2012-06-18 13:01:24 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
|
2008-12-14 11:25:00 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-14 11:25:00 +00:00
|
|
|
/* regions: header */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(MEM_callocN(sizeof(ARegionType), "spacetype file region"));
|
2008-12-14 11:25:00 +00:00
|
|
|
art->regionid = RGN_TYPE_HEADER;
|
2012-06-18 13:01:24 +00:00
|
|
|
art->prefsizey = HEADERY;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = file_header_region_init;
|
|
|
|
|
art->draw = file_header_region_draw;
|
|
|
|
|
// art->listener = file_header_region_listener;
|
2008-12-14 11:25:00 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* regions: ui */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(MEM_callocN(sizeof(ARegionType), "spacetype file region"));
|
2009-01-06 14:42:54 +00:00
|
|
|
art->regionid = RGN_TYPE_UI;
|
2012-06-18 13:01:24 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
art->poll = file_ui_region_poll;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = file_ui_region_listener;
|
|
|
|
|
art->init = file_ui_region_init;
|
|
|
|
|
art->draw = file_ui_region_draw;
|
2009-01-06 14:42:54 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-04-17 06:17:24 +02: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
|
|
|
/* regions: execution */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(MEM_callocN(sizeof(ARegionType), "spacetype file region"));
|
UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.
Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views
----
General:
* The file browser now opens as temporary floating window. It closes on
Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
visible.
* All file browser regions are now defined in Python (the button
layout).
* Adjusted related operator UI names.
Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection
Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
sub-panels. This will have to be committed separately (Add-on
repository).
* If operators want to show the options by default, they have the option
to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
they are hidden by default.
General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
naming.
* Search box is always live now, just like Outliner.
Views:
* Date Modified column combines both date and time, also uses user
friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
are now also calculated using base 10 of course.
* Option to sort in inverse order.
Vertical List View:
* This view now used a much simpler single vertical list with columns
for information.
* Users can click on the headers of these columns to order by that
category, and click again to reverse the ordering.
Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
previously.
* Workspaces now show their icon on Link/Append - also when listed in
the Outliner.
Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
`LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.
Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.
----
//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//
Differential Revision: https://developer.blender.org/D5601
Reviewers: Brecht, Bastien
2019-09-03 15:43:38 +02:00
|
|
|
art->regionid = RGN_TYPE_EXECUTE;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
art->poll = file_execution_region_poll;
|
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->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
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* regions: channels (directories) */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(MEM_callocN(sizeof(ARegionType), "spacetype file region"));
|
2015-02-11 00:09:45 +01:00
|
|
|
art->regionid = RGN_TYPE_TOOLS;
|
2012-06-18 13:01:24 +00:00
|
|
|
art->prefsizex = 240;
|
2015-02-11 00:09:45 +01:00
|
|
|
art->prefsizey = 60;
|
|
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = file_tools_region_listener;
|
|
|
|
|
art->init = file_tools_region_init;
|
|
|
|
|
art->draw = file_tools_region_draw;
|
2015-02-11 00:09:45 +01:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2021-09-29 17:01:13 +02:00
|
|
|
file_tools_region_panels_register(art);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-11 00:09:45 +01:00
|
|
|
/* regions: tool properties */
|
2023-07-12 13:43:00 +02:00
|
|
|
art = static_cast<ARegionType *>(
|
|
|
|
|
MEM_callocN(sizeof(ARegionType), "spacetype file operator region"));
|
2015-02-11 00:09:45 +01:00
|
|
|
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;
|
2012-06-18 13:01:24 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI;
|
UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.
Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.
We plan to use this in #102879.
This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences
Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.
Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
This patch makes it disappear entirely.
## Implementation
- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/105088
2023-04-05 15:30:32 +02:00
|
|
|
art->poll = file_tool_props_region_poll;
|
2021-01-21 21:40:25 +01:00
|
|
|
art->listener = file_tool_props_region_listener;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = file_tools_region_init;
|
|
|
|
|
art->draw = file_tools_region_draw;
|
2008-12-14 12:16:55 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2019-09-04 16:21:42 +02:00
|
|
|
file_tool_props_region_panels_register(art);
|
2023-04-18 20:39:30 +02:00
|
|
|
file_external_operations_menu_register();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-02-02 20:59:20 +01:00
|
|
|
BKE_spacetype_register(std::move(st));
|
2008-12-14 11:25:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void ED_file_init()
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2013-12-20 17:39:22 +01:00
|
|
|
ED_file_read_bookmarks();
|
2009-03-03 10:24:06 +00:00
|
|
|
IMB_thumb_makedirs();
|
2009-01-06 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void ED_file_exit()
|
2009-01-06 14:42:54 +00:00
|
|
|
{
|
2013-12-20 17:39:22 +01:00
|
|
|
fsmenu_free();
|
2012-08-08 08:25:20 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
if (G.background == false) {
|
2012-08-08 08:25:20 +00:00
|
|
|
filelist_free_icons();
|
|
|
|
|
}
|
2009-01-18 18:24:11 +00:00
|
|
|
}
|
2013-12-20 17:39:22 +01:00
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void ED_file_read_bookmarks()
|
2013-12-20 17:39:22 +01:00
|
|
|
{
|
2024-01-23 18:38:15 +01:00
|
|
|
const std::optional<std::string> cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, nullptr);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-12-20 17:39:22 +01:00
|
|
|
fsmenu_free();
|
|
|
|
|
|
2015-02-11 00:09:45 +01:00
|
|
|
fsmenu_read_system(ED_fsmenu_get(), true);
|
2013-12-20 17:39:22 +01:00
|
|
|
|
2024-01-23 18:38:15 +01:00
|
|
|
if (cfgdir.has_value()) {
|
2023-05-03 14:13:27 +10:00
|
|
|
char filepath[FILE_MAX];
|
2024-01-23 18:38:15 +01:00
|
|
|
BLI_path_join(filepath, sizeof(filepath), cfgdir->c_str(), BLENDER_BOOKMARK_FILE);
|
2023-05-03 14:13:27 +10:00
|
|
|
fsmenu_read_bookmarks(ED_fsmenu_get(), filepath);
|
2013-12-20 17:39:22 +01:00
|
|
|
}
|
|
|
|
|
}
|