List Serialization and Editor for Scripts #193

Merged
Pycorax merged 21 commits from SP3-6-ArraySerialization into main 2022-11-13 11:58:06 +08:00
2 changed files with 6 additions and 8 deletions
Showing only changes of commit 2d2cc532a5 - Show all commits

View File

@ -174,7 +174,7 @@ namespace SHADE
// Any List
if (field->FieldType->IsGenericType && field->FieldType->GetGenericTypeDefinition() == System::Collections::Generic::List<int>::typeid->GetGenericTypeDefinition())
{
/* System::Type^ listType = field->FieldType->GenericTypeArguments[0];
System::Type^ listType = field->FieldType->GenericTypeArguments[0];
RangeAttribute^ rangeAttrib = hasAttribute<RangeAttribute^>(field);
System::Collections::IList^ iList = safe_cast<System::Collections::IList^>(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
{

View File

@ -86,11 +86,7 @@ namespace SHADE
{
if (object->GetType()->IsSubclassOf(Enum::typeid))
{
int managedVal = safe_cast<int>(object);
if (renderFieldEditorInternal<int, int>(fieldName, &managedVal, fieldEditor, isHovered, rangeAttrib))
{
object = managedVal;
}
renderEnumEditor(fieldName, object, isHovered);
return true;
}
}