Skip to content

Commit 03adb8f

Browse files
committed
Editor: Delete item from internal list only when action accepts (#178)
1 parent 459d2d7 commit 03adb8f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,6 @@ v0.9.1 (WIP):
204204

205205
BUGFIX: Application: Recreate DX11 resources lazily (related to #162)
206206

207-
BUGFIX: Editor: Don't steal input from active user widget (#172)
207+
BUGFIX: Editor: Don't steal input from active user widget (#172)
208+
209+
BUGFIX: Editor: Delete item from internal list only when action accepts (#178)

imgui_node_editor.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5081,13 +5081,12 @@ void ed::DeleteItemsAction::RejectItem()
50815081

50825082
m_UserAction = Rejected;
50835083

5084-
RemoveItem(false);
5084+
DropCurrentItem();
50855085
}
50865086

50875087
void ed::DeleteItemsAction::RemoveItem(bool deleteDependencies)
50885088
{
5089-
auto item = m_CandidateObjects[m_CandidateItemIndex];
5090-
m_CandidateObjects.erase(m_CandidateObjects.begin() + m_CandidateItemIndex);
5089+
auto item = DropCurrentItem();
50915090

50925091
Editor->DeselectObject(item);
50935092

@@ -5106,6 +5105,14 @@ void ed::DeleteItemsAction::RemoveItem(bool deleteDependencies)
51065105
Editor->NotifyLinkDeleted(item->AsLink());
51075106
}
51085107

5108+
ed::Object* ed::DeleteItemsAction::DropCurrentItem()
5109+
{
5110+
auto item = m_CandidateObjects[m_CandidateItemIndex];
5111+
m_CandidateObjects.erase(m_CandidateObjects.begin() + m_CandidateItemIndex);
5112+
5113+
return item;
5114+
}
5115+
51095116

51105117

51115118

imgui_node_editor_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ struct DeleteItemsAction final: EditorAction
11561156

11571157
bool QueryItem(ObjectId* itemId, IteratorType itemType);
11581158
void RemoveItem(bool deleteDependencies);
1159+
Object* DropCurrentItem();
11591160

11601161
vector<Object*> m_ManuallyDeletedObjects;
11611162

0 commit comments

Comments
 (0)