Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-07-30 20:03:02 +0300
committerJulian Eisel <julian@blender.org>2021-07-30 20:07:51 +0300
commit0b10a964741d19cf7ada6d72cfaa6ffea9eded4b (patch)
treeba5fb3f59c14e0058d8ab244c924eaaec61ed5e1 /source/blender/editors/screen/screen_ops.c
parentf7836019b37152558f6808f81eea6344aa8d9608 (diff)
Assets: Disable File Browser only operators for asset browsing
These operators shouldn't be available in the Asset Browser. https://developer.blender.org/T83556 Added a comment to each operator poll assignment to explicitly mention the intention. That should also remind devs to decide if the operator should apply for both file & asset browsing when copy & pasting operator definition code.
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 3d0d856b1c5..8d7d742e44b 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -70,6 +70,7 @@
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_clip.h"
+#include "ED_fileselect.h"
#include "ED_image.h"
#include "ED_keyframes_keylist.h"
#include "ED_mesh.h"
@@ -274,11 +275,37 @@ bool ED_operator_outliner_active_no_editobject(bContext *C)
return false;
}
+/**
+ * \note Will return true for file spaces in either file or asset browsing mode! See
+ * #ED_operator_file_browsing_active() (file browsing only) and
+ * #ED_operator_asset_browsing_active() (asset browsing only).
+ */
bool ED_operator_file_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_FILE);
}
+/**
+ * \note Will only return true if the file space is in file browsing mode, not asset browsing! See
+ * #ED_operator_file_active() (file or asset browsing) and
+ * #ED_operator_asset_browsing_active() (asset browsing only).
+ */
+bool ED_operator_file_browsing_active(bContext *C)
+{
+ if (ed_spacetype_test(C, SPACE_FILE)) {
+ return ED_fileselect_is_file_browser(CTX_wm_space_file(C));
+ }
+ return false;
+}
+
+bool ED_operator_asset_browsing_active(bContext *C)
+{
+ if (ed_spacetype_test(C, SPACE_FILE)) {
+ return ED_fileselect_is_asset_browser(CTX_wm_space_file(C));
+ }
+ return false;
+}
+
bool ED_operator_spreadsheet_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_SPREADSHEET);