diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-29 12:05:20 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-29 12:05:20 +0300 |
commit | c112418e952b51bbf4d56ea08a8856d74795b604 (patch) | |
tree | 25311f330f09ebd1c9c9eb11ea537d837458c664 /source/blender | |
parent | 43bc494892c3551222601122c880a4da87354634 (diff) | |
parent | f13826a572f76fe7a359e84f003c667d3b801725 (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_context.cc | 25 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc | 11 |
2 files changed, 30 insertions, 6 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc index c38e765caee..e55a7cae6a6 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc @@ -373,6 +373,21 @@ void ED_spreadsheet_context_path_set_evaluated_object(SpaceSpreadsheet *sspreads BLI_addtail(&sspreadsheet->context_path, context); } +static bScreen *find_screen_to_search_for_context(wmWindow *window, + SpaceSpreadsheet *current_space) +{ + bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + if (ELEM(screen->state, SCREENMAXIMIZED, SCREENFULL)) { + /* If the spreadsheet is maximized, try to find the context in the unmaximized screen. */ + ScrArea *main_area = (ScrArea *)screen->areabase.first; + SpaceLink *sl = (SpaceLink *)main_area->spacedata.first; + if (sl == (SpaceLink *)current_space) { + return main_area->full; + } + } + return screen; +} + void ED_spreadsheet_context_path_guess(const bContext *C, SpaceSpreadsheet *sspreadsheet) { ED_spreadsheet_context_path_clear(sspreadsheet); @@ -385,9 +400,12 @@ void ED_spreadsheet_context_path_guess(const bContext *C, SpaceSpreadsheet *sspr if (sspreadsheet->object_eval_state == SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE) { LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { - bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + bScreen *screen = find_screen_to_search_for_context(window, sspreadsheet); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { SpaceLink *sl = (SpaceLink *)area->spacedata.first; + if (sl == nullptr) { + continue; + } if (sl->spacetype == SPACE_NODE) { SpaceNode *snode = (SpaceNode *)sl; if (snode->edittree != nullptr) { @@ -466,9 +484,12 @@ bool ED_spreadsheet_context_path_is_active(const bContext *C, SpaceSpreadsheet * } LISTBASE_FOREACH (wmWindow *, window, &wm->windows) { - bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + bScreen *screen = find_screen_to_search_for_context(window, sspreadsheet); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { SpaceLink *sl = (SpaceLink *)area->spacedata.first; + if (sl == nullptr) { + continue; + } if (sl->spacetype != SPACE_NODE) { continue; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index f4a127faf43..1e94a4a6a50 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -202,12 +202,15 @@ static void geo_node_instance_on_points_exec(GeoNodeExecParams params) instances, *geometry_set.get_component_for_read<CurveComponent>(), instance, params); geometry_set.remove(GEO_COMPONENT_TYPE_CURVE); } - /* Unused references may have been added above. Remove those now so that other nodes don't - * process them needlessly. */ - /** \note: This currently expects that all originally existing instances were used. */ - instances.remove_unused_references(); }); + /* Unused references may have been added above. Remove those now so that other nodes don't + * process them needlessly. + * This should eventually be moved into the loop above, but currently this is quite tricky + * because it might remove references that the loop still wants to iterate over. */ + InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>(); + instances.remove_unused_references(); + params.set_output("Instances", std::move(geometry_set)); } |