浏览代码

combined multiple methods

/4.1
Shan Jiang 4 年前
当前提交
ff7b50b1
共有 2 个文件被更改,包括 24 次插入26 次删除
  1. 46
      Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/MultiTrackedImageInfoManager.cs
  2. 4
      ProjectSettings/ProjectSettings.asset

46
Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/MultiTrackedImageInfoManager.cs


internal void OnLibraryChanged(XRReferenceImageLibrary library)
{
UpdatePrefabList();
}
void UpdatePrefabList()
{
if (m_ImageLibrary != null)
if (library)
for (int i = 0; i < m_ImageLibrary.count; i++)
for (int i = 0; i < library.count; i++)
m_PrefabList.Add(new NamedPrefab(m_ImageLibrary[i].guid, null));
m_PrefabList.Add(new NamedPrefab(library[i].guid, null));
for (int i = 0; i < m_ImageLibrary.count; i++)
for (int i = 0; i < library.count; i++)
var idx = m_PrefabList.FindIndex(item => item.imageGuid == m_ImageLibrary[i].guid);
tempList.Add(new NamedPrefab(m_ImageLibrary[i].guid, (idx != -1) ? m_PrefabList[idx].prefab : null));
var idx = m_PrefabList.FindIndex(item => item.imageGuid == library[i].guid);
tempList.Add(new NamedPrefab(library[i].guid, (idx != -1) ? m_PrefabList[idx].prefab : null));
}
m_PrefabList = tempList;
}

public override void OnInspectorGUI ()
{
//customized inspector
var list = serializedObject.FindProperty("m_PrefabList");
serializedObject.Update();
GUI.enabled = false;

EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ImageLibrary"));
ShowPrefabList(serializedObject.FindProperty("m_PrefabList"), library);
serializedObject.ApplyModifiedProperties();
//show prefab list
EditorGUILayout.PropertyField(list, false);
EditorGUI.indentLevel += 1;
if (list.isExpanded)
{
for (int i = 0; i < list.arraySize; i++) {
EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i).FindPropertyRelative("m_Prefab"), new GUIContent(library[i].name));
}
}
EditorGUI.indentLevel -= 1;
//check library changes
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())

m_ReferenceImages.Add(referenceImage);
}
}
}
public static void ShowPrefabList (SerializedProperty list, XRReferenceImageLibrary library)
{
EditorGUILayout.PropertyField(list, false);
EditorGUI.indentLevel += 1;
if (list.isExpanded)
{
for (int i = 0; i < list.arraySize; i++) {
EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i).FindPropertyRelative("m_Prefab"), new GUIContent(library[i].name));
}
}
EditorGUI.indentLevel -= 1;
serializedObject.ApplyModifiedProperties();
}
}
#endif

4
ProjectSettings/ProjectSettings.asset


16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets: []
preloadedAssets:
- {fileID: 4800000, guid: e7c77f6eaab324a819efdc13b8125a39, type: 3}
- {fileID: -7479341934665344595, guid: e2f869774b12e400996eb546603602e3, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

正在加载...
取消
保存