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:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_types.h12
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c17
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c14
3 files changed, 34 insertions, 9 deletions
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index b0dd7be4572..a1edc4196dc 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -120,6 +120,10 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* Also show this group when another group is being interacted with.
*/
WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL = (1 << 5),
+
+ /** Don't draw this gizmo group when it is modal. */
+ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE = (1 << 6),
+
/**
* When used with tool, only run when activating the tool,
* instead of linking the gizmo while the tool is active.
@@ -130,7 +134,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* when a tool can activate multiple operators based on the key-map.
* We could even move the options into the key-map item.
* ~ campbell. */
- WM_GIZMOGROUPTYPE_TOOL_INIT = (1 << 6),
+ WM_GIZMOGROUPTYPE_TOOL_INIT = (1 << 7),
/**
* This gizmo type supports using the fallback tools keymap.
@@ -138,7 +142,7 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
*
* Often useful in combination with #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK
*/
- WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP = (1 << 7),
+ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP = (1 << 8),
/**
* Use this from a gizmos refresh callback so we can postpone the refresh operation
@@ -149,14 +153,14 @@ typedef enum eWM_GizmoFlagGroupTypeFlag {
* for selection operations. This means gizmos that use this check don't interfere
* with click drag events by popping up under the cursor and catching the tweak event.
*/
- WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK = (1 << 8),
+ WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK = (1 << 9),
/**
* Cause continuous redraws, i.e. set the region redraw flag on every main loop iteration. This
* should really be avoided by using proper region redraw tagging, notifiers and the message-bus,
* however for VR it's sometimes needed.
*/
- WM_GIZMOGROUPTYPE_VR_REDRAWS = (1 << 9),
+ WM_GIZMOGROUPTYPE_VR_REDRAWS = (1 << 10),
} eWM_GizmoFlagGroupTypeFlag;
/**
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 1144cd072e0..295196c701b 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -387,14 +387,21 @@ static void gizmomap_prepare_drawing(wmGizmoMap *gzmap,
LISTBASE_FOREACH (wmGizmoGroup *, gzgroup, &gzmap->groups) {
/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */
- if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep) ||
- !WM_gizmo_group_type_poll(C, gzgroup->type)) {
+ if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep)) {
continue;
}
- /* When modal only show other gizmo groups tagged with #WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL. */
- if (gz_modal && (gzgroup != gz_modal->parent_gzgroup)) {
- if ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
+ if (gz_modal && (gzgroup == gz_modal->parent_gzgroup)) {
+ if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE) {
+ continue;
+ }
+ }
+ else { /* Don't poll modal gizmo since some poll functions unlink. */
+ if (!WM_gizmo_group_type_poll(C, gzgroup->type)) {
+ continue;
+ }
+ /* When modal only show other gizmo groups tagged with #WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL. */
+ if (gz_modal && ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0)) {
continue;
}
}
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 2416f5b50b3..7568c9989a8 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -383,6 +383,12 @@ static void wm_append_loose_data_instantiate(WMLinkAppendData *lapp_data,
ViewLayer *view_layer,
const View3D *v3d)
{
+ if (scene == NULL) {
+ /* In some cases, like the asset drag&drop e.g., the caller code manages instantiation itself.
+ */
+ return;
+ }
+
LinkNode *itemlink;
Collection *active_collection = NULL;
const bool do_obdata = (lapp_data->flag & FILE_OBDATA_INSTANCE) != 0;
@@ -1281,6 +1287,10 @@ static ID *wm_file_link_append_datablock_ex(Main *bmain,
return id;
}
+/*
+ * NOTE: `scene` (and related `view_layer` and `v3d`) pointers may be NULL, in which case no
+ * instantiation of linked objects, collections etc. will be performed.
+ */
ID *WM_file_link_datablock(Main *bmain,
Scene *scene,
ViewLayer *view_layer,
@@ -1293,6 +1303,10 @@ ID *WM_file_link_datablock(Main *bmain,
bmain, scene, view_layer, v3d, filepath, id_code, id_name, false);
}
+/*
+ * NOTE: `scene` (and related `view_layer` and `v3d`) pointers may be NULL, in which case no
+ * instantiation of appended objects, collections etc. will be performed.
+ */
ID *WM_file_append_datablock(Main *bmain,
Scene *scene,
ViewLayer *view_layer,