List Serialization and Editor for Scripts #193
|
@ -181,7 +181,12 @@ namespace SHADE
|
||||||
SHEditorUI::Text(Convert::ToNative(field->Name));
|
SHEditorUI::Text(Convert::ToNative(field->Name));
|
||||||
SHEditorUI::SameLine();
|
SHEditorUI::SameLine();
|
||||||
|
|
||||||
SHEditorUI::Button("+");
|
if (SHEditorUI::Button("+"))
|
||||||
|
{
|
||||||
|
System::Object^ obj = System::Activator::CreateInstance(listType);
|
||||||
|
iList->Add(obj);
|
||||||
|
registerUndoListAddAction(listType, iList, iList->Count - 1, obj);
|
||||||
|
}
|
||||||
|
|
||||||
SHEditorUI::Indent();
|
SHEditorUI::Indent();
|
||||||
for (int i = 0; i < iList->Count; ++i)
|
for (int i = 0; i < iList->Count; ++i)
|
||||||
|
@ -195,7 +200,14 @@ namespace SHADE
|
||||||
registerUndoListChangeAction(listType, iList, i, obj, oldObj);
|
registerUndoListChangeAction(listType, iList, i, obj, oldObj);
|
||||||
}
|
}
|
||||||
SHEditorUI::SameLine();
|
SHEditorUI::SameLine();
|
||||||
SHEditorUI::Button("-");
|
if (SHEditorUI::Button("-"))
|
||||||
|
{
|
||||||
|
System::Object^ obj = iList[i];
|
||||||
|
iList->RemoveAt(i);
|
||||||
|
registerUndoListRemoveAction(listType, iList, i, obj);
|
||||||
|
SHEditorUI::PopID();
|
||||||
|
break;
|
||||||
|
}
|
||||||
SHEditorUI::PopID();
|
SHEditorUI::PopID();
|
||||||
}
|
}
|
||||||
SHEditorUI::Unindent();
|
SHEditorUI::Unindent();
|
||||||
|
@ -367,6 +379,9 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actionStack.Add(gcnew ListElementAddCommand(list, index, data));
|
actionStack.Add(gcnew ListElementAddCommand(list, index, data));
|
||||||
|
|
||||||
|
// Inform the C++ Undo-Redo stack
|
||||||
|
SHCommandManager::RegisterCommand(std::reinterpret_pointer_cast<SHBaseCommand>(std::make_shared<SHCLICommand>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::registerUndoListRemoveAction(System::Type^ type, System::Collections::IList^ list, int index, System::Object^ data)
|
void Editor::registerUndoListRemoveAction(System::Type^ type, System::Collections::IList^ list, int index, System::Object^ data)
|
||||||
|
@ -375,6 +390,9 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actionStack.Add(gcnew ListElementRemoveCommand(list, index, data));
|
actionStack.Add(gcnew ListElementRemoveCommand(list, index, data));
|
||||||
|
|
||||||
|
// Inform the C++ Undo-Redo stack
|
||||||
|
SHCommandManager::RegisterCommand(std::reinterpret_pointer_cast<SHBaseCommand>(std::make_shared<SHCLICommand>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
generic<typename Attribute>
|
generic<typename Attribute>
|
||||||
|
|
Loading…
Reference in New Issue