From 2d2cc532a5446ddec3be23852fa0182be6f80f45 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Fri, 11 Nov 2022 22:59:45 +0800 Subject: [PATCH] Fixed editing intermdiate list values not working --- SHADE_Managed/src/Editor/Editor.cxx | 8 +++++--- SHADE_Managed/src/Editor/Editor.h++ | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/SHADE_Managed/src/Editor/Editor.cxx b/SHADE_Managed/src/Editor/Editor.cxx index d26bd252..7648e2aa 100644 --- a/SHADE_Managed/src/Editor/Editor.cxx +++ b/SHADE_Managed/src/Editor/Editor.cxx @@ -174,7 +174,7 @@ namespace SHADE // Any List if (field->FieldType->IsGenericType && field->FieldType->GetGenericTypeDefinition() == System::Collections::Generic::List::typeid->GetGenericTypeDefinition()) { - /* System::Type^ listType = field->FieldType->GenericTypeArguments[0]; + System::Type^ listType = field->FieldType->GenericTypeArguments[0]; RangeAttribute^ rangeAttrib = hasAttribute(field); System::Collections::IList^ iList = safe_cast(field->GetValue(object)); @@ -185,15 +185,17 @@ namespace SHADE SHEditorUI::Indent(); for (int i = 0; i < iList->Count; ++i) { + SHEditorUI::PushID(i); System::Object^ obj = iList[i]; - if (renderFieldInInspector(std::to_string(i), obj, rangeAttrib)) + if (renderFieldEditor(std::to_string(i), obj, rangeAttrib)) { iList[i] = obj; } SHEditorUI::SameLine(); SHEditorUI::Button("-"); + SHEditorUI::PopID(); } - SHEditorUI::Unindent();*/ + SHEditorUI::Unindent(); } else { diff --git a/SHADE_Managed/src/Editor/Editor.h++ b/SHADE_Managed/src/Editor/Editor.h++ index 8fbc6348..009160ce 100644 --- a/SHADE_Managed/src/Editor/Editor.h++ +++ b/SHADE_Managed/src/Editor/Editor.h++ @@ -86,11 +86,7 @@ namespace SHADE { if (object->GetType()->IsSubclassOf(Enum::typeid)) { - int managedVal = safe_cast(object); - if (renderFieldEditorInternal(fieldName, &managedVal, fieldEditor, isHovered, rangeAttrib)) - { - object = managedVal; - } + renderEnumEditor(fieldName, object, isHovered); return true; } }