Merge branch 'blender-v3.0-release'

This commit is contained in:
Jacques Lucke 2021-10-29 11:05:20 +02:00
commit c112418e95
3 changed files with 30 additions and 19 deletions

View File

@ -50,19 +50,6 @@ class SPREADSHEET_OT_toggle_pin(Operator):
space.is_pinned = False
space.context_path.guess()
def find_geometry_node_editors(self, context):
editors = []
for window in context.window_manager.windows:
for area in window.screen.areas:
space = area.spaces.active
if space.type != 'NODE_EDITOR':
continue
if space.edit_tree is None:
continue
if space.edit_tree.type == 'GEOMETRY':
editors.append(space)
return editors
classes = (
SPREADSHEET_OT_toggle_pin,

View File

@ -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;
}

View File

@ -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));
}