Nodes: Panels integration with blend files and UI #111348

Merged
Lukas Tönne merged 96 commits from LukasTonne/blender:node-panels-final into main 2023-08-30 12:37:28 +02:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit d0844d3d2c - Show all commits

View File

@ -846,15 +846,16 @@ bool bNodeTreeInterfacePanel::move_item(bNodeTreeInterfaceItem &item, int new_po
}
new_position = find_valid_insert_position_for_item(item, new_position);
new_position = std::min(std::max(new_position, 0), items_num - 1);
new_position = std::min(std::max(new_position, 0), items_num);
if (old_position < new_position) {
/* Actual target position and all existing items shifted by 1. */
const blender::Span<bNodeTreeInterfaceItem *> moved_items = this->items().slice(
old_position + 1, new_position - old_position);
old_position + 1, new_position - old_position - 1);
bNodeTreeInterfaceItem *tmp = this->items()[old_position];
std::copy(
moved_items.begin(), moved_items.end(), this->items().drop_front(old_position).data());
this->items()[new_position] = tmp;
this->items()[new_position - 1] = tmp;
LukasTonne marked this conversation as resolved Outdated

Use this->flag. Reading the code like this I expected the flag to be an input parameter.

Use `this->flag`. Reading the code like this I expected the `flag` to be an input parameter.
}
else /* old_position > new_position */ {
const blender::Span<bNodeTreeInterfaceItem *> moved_items = this->items().slice(

View File

@ -458,7 +458,7 @@ bool NodePanelDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const
/* Insert into same panel as the target. */
parent = interface.find_item_parent(panel_.item);
BLI_assert(parent != nullptr);
index = parent->items().as_span().first_index_try(&panel_.item) - 1;
index = parent->items().as_span().first_index_try(&panel_.item);
break;
}
case DropLocation::After: {