유니티 셋팅

This commit is contained in:
2026-03-27 16:34:08 +09:00
parent 474bda26cd
commit d76f078a89
1400 changed files with 116263 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using UnityEditor;
using UnityEngine;
using DigitalOpus.MB.Core;
namespace DigitalOpus.MB.MBEditor
{
[CustomPropertyDrawer(typeof(ShaderTextureProperty))]
public class MB3_ShaderTexturePropertyDrawer : PropertyDrawer
{
public static GUIContent gc_isNormalMap = new GUIContent("isNormalMap", "This atlas texture will be marked as a normal map"),
gc_isGammaCorrected = new GUIContent("isGammaCorrected", "This atlas should be gamma corrected (sRGB checked). If not checked then the atlas will be a linear texture");
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(position, label, property);
Rect contentPosition = EditorGUI.PrefixLabel(position, label);
float w = contentPosition.width;
contentPosition.width = w * 0.4f;
EditorGUI.indentLevel = 0;
EditorGUI.PropertyField(contentPosition, property.FindPropertyRelative("name"), GUIContent.none);
contentPosition.x += contentPosition.width;
contentPosition.width = w * 0.3f;
EditorGUIUtility.labelWidth = 50f;
EditorGUI.PropertyField(contentPosition, property.FindPropertyRelative("isNormalMap"), gc_isNormalMap);
contentPosition.x += contentPosition.width;
EditorGUI.PropertyField(contentPosition, property.FindPropertyRelative("isGammaCorrected"), gc_isGammaCorrected);
//EditorGUILayout.PropertyField(property.FindPropertyRelative("name"));
//EditorGUILayout.PropertyField(property.FindPropertyRelative("isNormalMap"), gc_isNormalMap);
//EditorGUILayout.PropertyField(property.FindPropertyRelative("isGammaCorrected"), gc_isGammaCorrected);
EditorGUI.EndProperty();
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 24ced5fa006456249ac31e87abe5aa5b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 31895
packageName: Mesh Baker Free
packageVersion: 3.40.1
assetPath: Assets/MeshBaker/Editor/propertyDrawers/MB3_ShaderTexturePropertyDrawer.cs
uploadId: 797180

View File

@@ -0,0 +1,65 @@
using UnityEditor;
using UnityEngine;
using DigitalOpus.MB.Core;
namespace DigitalOpus.MB.MBEditor
{
public class MB_ConvertTextureArrayFormatWizard : ScriptableWizard
{
public Texture2DArray textureArray;
public TextureFormat format = TextureFormat.ARGB32;
[MenuItem("Window/Mesh Baker/TextureArray Format Converter")]
static void CreateWizard()
{
ScriptableWizard.DisplayWizard<MB_ConvertTextureArrayFormatWizard>("Convert Texture Array Format", "Close", "Convert");
}
void OnWizardCreate()
{
}
void OnWizardUpdate()
{
helpString = "Please assign a texture array";
}
void OnWizardOtherButton()
{
helpString = "";
if (textureArray == null)
{
helpString = "Please assign a texture array";
return;
}
MB3_EditorMethods editorMethods = new MB3_EditorMethods();
if (!editorMethods.TextureImporterFormatExistsForTextureFormat(format))
{
helpString = "No ImporterFormat exists for the selected format. Please select a different format.";
return;
}
if (textureArray.format != TextureFormat.ARGB32 &&
textureArray.format != TextureFormat.RGB24)
{
helpString = "Source TextureArray must be in format ARGB32 or RGB24. This will probably be changed in" +
"a future version of Mesh Baker.";
return;
}
Texture2DArray outArray = new Texture2DArray(textureArray.width, textureArray.height, textureArray.depth, format, true);
if (editorMethods.ConvertTexture2DArray(textureArray, outArray, format))
{
string pth = UnityEditor.AssetDatabase.GetAssetPath(textureArray);
if (pth == null) pth = "Assets/TextureArray.asset";
pth = pth.Replace(".asset", "");
pth += format.ToString() + ".asset";
UnityEditor.AssetDatabase.CreateAsset(outArray, pth);
Debug.Log("Convert success saved asset: " + pth);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d355da520c795f543a934da176eb59ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 31895
packageName: Mesh Baker Free
packageVersion: 3.40.1
assetPath: Assets/MeshBaker/Editor/propertyDrawers/MB_ConvertTextureArrayFormatWizard.cs
uploadId: 797180

View File

@@ -0,0 +1,87 @@
using UnityEditor;
using UnityEngine;
namespace DigitalOpus.MB.MBEditor
{
public class MB_PaginatedList
{
public static void GenerateObjectsToBeCombinedList(SerializedProperty objsToMesh, ref int currentPage, ref int objectsPerPage)
{
SerializedProperty arraySizeProp = objsToMesh.FindPropertyRelative("Array.size");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Size", GUILayout.Width(EditorGUIUtility.labelWidth));
int newSize = EditorGUILayout.DelayedIntField(arraySizeProp.intValue);
arraySizeProp.intValue = Mathf.Max(1, newSize);
if (newSize <= 0 &&
arraySizeProp.intValue == 1)
{
// This is necessary because the first element in the list gets preserved.
// If the user sets the number of elements to 0 or less then we should
// make the displayed first element == null
SerializedProperty element = objsToMesh.GetArrayElementAtIndex(0);
element.objectReferenceValue = null;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Objects per Page", GUILayout.Width(EditorGUIUtility.labelWidth));
EditorGUI.BeginChangeCheck();
int newObjectsPerPage = EditorGUILayout.DelayedIntField(objectsPerPage);
if (EditorGUI.EndChangeCheck())
{
objectsPerPage = Mathf.Clamp(newObjectsPerPage, 10, 500);
currentPage = 1;
}
EditorGUILayout.EndHorizontal();
int totalObjects = objsToMesh.arraySize;
int totalPages = totalObjects / objectsPerPage;
if (totalObjects % objectsPerPage != 0)
{
totalPages++;
}
if (totalPages == 0)
{
currentPage = 1;
}
else if (currentPage > totalPages)
{
currentPage = totalPages;
}
else if (currentPage < 1)
{
currentPage = 1;
}
int startIndex = (currentPage - 1) * objectsPerPage;
int endIndex = Mathf.Min(startIndex + objectsPerPage, totalObjects);
for (int i = startIndex; i < endIndex; i++)
{
SerializedProperty objProp = objsToMesh.GetArrayElementAtIndex(i);
EditorGUILayout.PropertyField(objProp, new GUIContent("Object " + (i + 1)));
}
EditorGUILayout.BeginHorizontal();
GUI.enabled = currentPage > 1;
if (GUILayout.Button("Previous"))
{
currentPage--;
}
bool prevGUIEnabled = GUI.enabled;
GUI.enabled = true;
GUIStyle centeredLabelStyle = new GUIStyle(EditorStyles.label);
centeredLabelStyle.alignment = TextAnchor.MiddleCenter;
EditorGUILayout.LabelField("Page " + currentPage + " of " + totalPages, centeredLabelStyle);
GUI.enabled = prevGUIEnabled;
GUI.enabled = currentPage < totalPages;
if (GUILayout.Button("Next"))
{
currentPage++;
}
GUI.enabled = true;
EditorGUILayout.EndHorizontal();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0eac7adb5e69eaa45b05407b27e84965
AssetOrigin:
serializedVersion: 1
productId: 31895
packageName: Mesh Baker Free
packageVersion: 3.40.1
assetPath: Assets/MeshBaker/Editor/propertyDrawers/MB_PaginatedList.cs
uploadId: 797180

View File

@@ -0,0 +1,82 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using DigitalOpus.MB.MBEditor;
namespace DigitalOpus.MB.MBEditor
{
/// <summary>
/// Draws rows for the PrafabPairs in the Switch Prefabs In Scene Window.
/// </summary>
[CustomPropertyDrawer(typeof(MB_ReplacePrefabsSettings.PrefabPair))]
public class MB_PrefabPairPropertyDrawer : PropertyDrawer
{
private GUIStyle redFont = new GUIStyle();
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
float xx = position.x;
float yy = position.y;
float ww = 15f;
float hh = position.height;
Rect enabledRect = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
xx += ww;
ww = 50;
Rect srcLabel = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
xx += ww;
ww = 200;
Rect sourceRect = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
xx += ww;
ww = 50;
Rect targetLabel = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
xx += ww;
ww = 200;
Rect targetRect = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
EditorGUI.PropertyField(enabledRect, property.FindPropertyRelative("enabled"), GUIContent.none);
EditorGUI.LabelField(srcLabel, "Source:");
EditorGUI.PropertyField(sourceRect, property.FindPropertyRelative("srcPrefab"), GUIContent.none);
EditorGUI.LabelField(targetLabel, "Target:");
EditorGUI.PropertyField(targetRect, property.FindPropertyRelative("targPrefab"), GUIContent.none);
SerializedProperty errorsProp = property.serializedObject.FindProperty(property.propertyPath + ".objsWithErrors");
if (errorsProp.arraySize > 0)
{
redFont.normal.textColor = Color.red;
for (int i = 0; i < errorsProp.arraySize; i++)
{
xx = position.x;
yy = position.y + (1 + i) * EditorGUIUtility.singleLineHeight;
ww = 100;
SerializedProperty errProp = errorsProp.GetArrayElementAtIndex(i);
GameObject obj = (GameObject)errProp.FindPropertyRelative("errorObj").objectReferenceValue;
string errStr = errProp.FindPropertyRelative("error").stringValue;
Rect buttonRect = new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight);
if (GUI.Button(buttonRect, "Select"))
{
if (obj != null) Selection.activeGameObject = obj;
}
xx += ww;
ww = 500;
EditorGUI.LabelField(new Rect(xx, yy, ww, EditorGUIUtility.singleLineHeight), errStr, redFont);
}
}
EditorGUI.indentLevel = indent;
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
SerializedProperty errorsProp = property.serializedObject.FindProperty(property.propertyPath + ".objsWithErrors");
return base.GetPropertyHeight(property, label) + errorsProp.arraySize * EditorGUIUtility.singleLineHeight;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f8fdae7bfb5aa3a41ab365cd5a8238c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 31895
packageName: Mesh Baker Free
packageVersion: 3.40.1
assetPath: Assets/MeshBaker/Editor/propertyDrawers/MB_PrefabPairPropertyDrawer.cs
uploadId: 797180