Refactor VRCBoardImage component and remove unused shader/editor files

This commit is contained in:
2024-10-15 17:34:54 +03:00
parent e25230326b
commit f93aedbc88
6 changed files with 17 additions and 149 deletions

View File

@@ -168,6 +168,7 @@ namespace VRCBoard.Components
Array.Resize(ref script.imageIds, newSize);
Array.Resize(ref script.texturePropertyMappings, newSize);
Array.Resize(ref script.defaultTextures, newSize);
EditorUtility.SetDirty(script);
}
MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();
for (int i = 0; i < script.imageIds.Length; i++)
@@ -194,12 +195,25 @@ namespace VRCBoard.Components
defaultImage = EditorGUILayout.ObjectField(defaultImage, typeof(Texture2D), false) as Texture2D;
EditorGUILayout.EndHorizontal();
if (defaultImage != null) propertyBlock.SetTexture(propertyName, defaultImage);
}
if (script.defaultTextures[i] != defaultImage)
{
script.defaultTextures[i] = defaultImage;
EditorUtility.SetDirty(script);
}
script.imageIds[i] = imageId;
if (selectedIndex >= 0 && selectedIndex < materialPropertyNames.Length) script.texturePropertyMappings[i] = materialPropertyNames[selectedIndex];
if (script.imageIds[i] != imageId)
{
script.imageIds[i] = imageId;
EditorUtility.SetDirty(script);
}
if (selectedIndex >= 0 && selectedIndex < materialPropertyNames.Length && script.texturePropertyMappings[i] != materialPropertyNames[selectedIndex])
{
script.texturePropertyMappings[i] = materialPropertyNames[selectedIndex];
EditorUtility.SetDirty(script);
}
GUILayout.EndVertical();
}