소스 검색

Managed serializable list resize works
Fixed an issue where array and list inspectables were adding element buttons whenever any child of the array/list was modified

Marko Pintera 10 년 전
부모
커밋
1342e920d2
4개의 변경된 파일18개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      MBansheeEditor/Inspector/InspectableArray.cs
  2. 2 1
      MBansheeEditor/Inspector/InspectableList.cs
  3. 10 2
      SBansheeEngine/Source/BsManagedSerializableList.cpp
  4. 5 0
      TODO.txt

+ 1 - 1
MBansheeEditor/Inspector/InspectableArray.cs

@@ -24,7 +24,7 @@ namespace BansheeEditor
 
 
             public void Refresh(InspectableObjectBase child, int seqIndex, InspectableArray parent)
             public void Refresh(InspectableObjectBase child, int seqIndex, InspectableArray parent)
             {
             {
-                if (ownsTitleLayout)
+                if (ownsTitleLayout || (titleLayout != null && titleLayout == child.GetTitleLayout()))
                     return;
                     return;
 
 
                 titleLayout = child.GetTitleLayout();
                 titleLayout = child.GetTitleLayout();

+ 2 - 1
MBansheeEditor/Inspector/InspectableList.cs

@@ -24,7 +24,7 @@ namespace BansheeEditor
 
 
             public void Refresh(InspectableObjectBase child, int seqIndex, InspectableList parent)
             public void Refresh(InspectableObjectBase child, int seqIndex, InspectableList parent)
             {
             {
-                if (ownsTitleLayout)
+                if (ownsTitleLayout || (titleLayout != null && titleLayout == child.GetTitleLayout()))
                     return;
                     return;
 
 
                 titleLayout = child.GetTitleLayout();
                 titleLayout = child.GetTitleLayout();
@@ -224,6 +224,7 @@ namespace BansheeEditor
 
 
             int maxSize = MathEx.Min(size, list.Count);
             int maxSize = MathEx.Min(size, list.Count);
 
 
+            Debug.Log("List resize: " + list.Count + " - " + newList.Count + " - " + size);
             for (int i = 0; i < maxSize; i++)
             for (int i = 0; i < maxSize; i++)
                 newList[i] = list[i];
                 newList[i] = list[i];
 
 

+ 10 - 2
SBansheeEngine/Source/BsManagedSerializableList.cpp

@@ -63,7 +63,15 @@ namespace BansheeEngine
 			return nullptr;
 			return nullptr;
 
 
 		void* params[1] = { &size };
 		void* params[1] = { &size };
-		return listClass->createInstance("int", params);
+		MonoObject* instance = listClass->createInstance("int", params);
+		
+		ScriptArray tempArray(typeInfo->mElementType->getMonoClass(), size);
+		params[0] = tempArray.getInternal();
+
+		MonoMethod* addRangeMethod = listClass->getMethod("AddRange", 1);
+		addRangeMethod->invoke(instance, params);
+
+		return instance;
 	}
 	}
 
 
 	ManagedSerializableListPtr ManagedSerializableList::createEmpty()
 	ManagedSerializableListPtr ManagedSerializableList::createEmpty()
@@ -165,7 +173,7 @@ namespace BansheeEngine
 		UINT32 idx = 0;
 		UINT32 idx = 0;
 		for (auto& entry : mCachedEntries)
 		for (auto& entry : mCachedEntries)
 		{
 		{
-			addFieldDataInternal(entry);
+			setFieldData(idx, entry);
 			idx++;
 			idx++;
 		}
 		}
 
 

+ 5 - 0
TODO.txt

@@ -54,6 +54,10 @@ Code quality improvements:
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 Polish
 Polish
 
 
+TODO:
+ - Thoroughly test inspector
+ - Modifying structs doesn't persist changes
+
 Ribek use:
 Ribek use:
  - Camera, Renderable, Material, Texture inspector
  - Camera, Renderable, Material, Texture inspector
   - Material/Shader has no color type so I cannot know when to display normal vector and when color in inspector
   - Material/Shader has no color type so I cannot know when to display normal vector and when color in inspector
@@ -107,6 +111,7 @@ Other polish:
  - When I expand inspector elements and them come back to that object it should remember the previous state
  - When I expand inspector elements and them come back to that object it should remember the previous state
    - Add a chaching mechanism to inspector (likely based on instance ID & property names)
    - Add a chaching mechanism to inspector (likely based on instance ID & property names)
    - This has to work not only when I come back to the object, but whenever inspector rebuilds (e.g. after removing element from array)
    - This has to work not only when I come back to the object, but whenever inspector rebuilds (e.g. after removing element from array)
+   - Consider saving this information with the serialized object
  - Make sure to persist EditorSettings
  - Make sure to persist EditorSettings
  - Import option inspectors for Texture, Mesh, Font
  - Import option inspectors for Texture, Mesh, Font
  - DOck manager maximize doesn't work'
  - DOck manager maximize doesn't work'