mirror of
https://github.com/maxartz15/MA_TextureAtlasser.git
synced 2024-11-22 05:25:34 +01:00
Update MA_TextureAtlasserProInspectorView.cs
Fix 2020.2+ mesh input fields.
This commit is contained in:
parent
0933abdace
commit
05b4ea9f80
@ -94,53 +94,54 @@ namespace MA_TextureAtlasserPro
|
|||||||
{
|
{
|
||||||
SerializedProperty modelGroupsSP = serializedObject.FindProperty("modelGroups");
|
SerializedProperty modelGroupsSP = serializedObject.FindProperty("modelGroups");
|
||||||
|
|
||||||
for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.modelGroups.Count; i++)
|
for (int i = 0; i < curWindow.textureAtlas.selectedTextureQuad.modelGroups.Count; i++)
|
||||||
{
|
{
|
||||||
using (new GUILayout.VerticalScope(EditorStyles.helpBox))
|
using (new GUILayout.VerticalScope(EditorStyles.helpBox))
|
||||||
{
|
{
|
||||||
using (new GUILayout.HorizontalScope())
|
using (new GUILayout.HorizontalScope())
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name);
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name = EditorGUILayout.TextField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].name);
|
||||||
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups.RemoveAt(i);
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups.RemoveAt(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializedProperty meshesSP = modelGroupsSP.GetArrayElementAtIndex(i).FindPropertyRelative("meshes");
|
SerializedProperty meshesSP = modelGroupsSP.GetArrayElementAtIndex(i).FindPropertyRelative("meshes");
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
meshesSP.isExpanded = EditorGUILayout.Foldout(meshesSP.isExpanded, "Meshes", true);
|
||||||
#else
|
#else
|
||||||
EditorGUILayout.PropertyField(meshesSP, false, GUILayout.ExpandWidth(false), GUILayout.MaxWidth(editorViewRect.width * 0.5f));
|
EditorGUILayout.PropertyField(meshesSP, false, GUILayout.ExpandWidth(false), GUILayout.MaxWidth(editorViewRect.width * 0.5f));
|
||||||
#endif
|
#endif
|
||||||
if (meshesSP.isExpanded)
|
if (meshesSP.isExpanded)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Count; j++)
|
for (int j = 0; j < curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Count; j++)
|
||||||
{
|
{
|
||||||
using (new GUILayout.HorizontalScope())
|
using (new GUILayout.HorizontalScope())
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j] = (Mesh)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j], typeof(Mesh), false);
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j] = (Mesh)EditorGUILayout.ObjectField(curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes[j], typeof(Mesh), false);
|
||||||
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.RemoveAt(j);
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.RemoveAt(j);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("+", EditorStyles.miniButton))
|
if (GUILayout.Button("+", EditorStyles.miniButton))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Add(null);
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups[i].meshes.Add(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.ExpandWidth(true)))
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups.Add(new MA_ModelGroup() { name = MA_StringUtils.RandomAlphabetString(6) });
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups.Add(new MA_ModelGroup() { name = MA_StringUtils.RandomAlphabetString(6) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curWindow.textureAtlas.selectedTextureQuad.modelGroups = new List<MA_ModelGroup>();
|
curWindow.textureAtlas.selectedTextureQuad.modelGroups = new List<MA_ModelGroup>();
|
||||||
|
Loading…
Reference in New Issue
Block a user