2026-06-20 뉴페어리
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
/// <summary>
|
||||
/// Aboutダイアログ
|
||||
/// </summary>
|
||||
public class AboutMenu : EditorWindow
|
||||
{
|
||||
[SerializeField]
|
||||
private Texture2D image = null;
|
||||
|
||||
public const string MagicaClothVersion = "2.18.1";
|
||||
|
||||
public static AboutMenu AboutWindow { get; set; }
|
||||
private const float windowWidth = 300;
|
||||
private const float windowHeight = 220;
|
||||
|
||||
private const string webUrl = "https://magicasoft.jp/en/magica-cloth-2-2/";
|
||||
|
||||
//=========================================================================================
|
||||
[MenuItem("Tools/Magica Cloth2/About", false)]
|
||||
static void InitWindow()
|
||||
{
|
||||
if (AboutWindow)
|
||||
return;
|
||||
AboutWindow = CreateInstance<AboutMenu>();
|
||||
AboutWindow.position = new Rect(Screen.width / 2, Screen.height / 2, windowWidth, windowHeight);
|
||||
AboutWindow.minSize = new Vector2(windowWidth, windowHeight);
|
||||
AboutWindow.maxSize = new Vector2(windowWidth, windowHeight);
|
||||
AboutWindow.titleContent.text = "About Magica Cloth 2";
|
||||
AboutWindow.ShowUtility();
|
||||
}
|
||||
|
||||
protected void OnGUI()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
GUIStyle myStyle = new GUIStyle();
|
||||
myStyle.alignment = TextAnchor.MiddleCenter;
|
||||
myStyle.fontSize = 20;
|
||||
myStyle.normal.textColor = Color.white;
|
||||
|
||||
GUILayout.Box(image, myStyle);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Magica Cloth 2", myStyle);
|
||||
|
||||
EditorGUILayout.Space(5);
|
||||
myStyle.fontSize = 16;
|
||||
EditorGUILayout.LabelField($"version {MagicaClothVersion}", myStyle);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
myStyle.fontSize = 12;
|
||||
EditorGUILayout.LabelField("Copyright © Magica Soft", myStyle);
|
||||
EditorGUILayout.LabelField("All Rights Reserved", myStyle);
|
||||
|
||||
//EditorGUILayout.LabelField(webUrl, myStyle);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
using (var h = new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
if (GUILayout.Button("Website"))
|
||||
{
|
||||
Application.OpenURL(webUrl);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (GUILayout.Button("Close"))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnInspectorUpdate()
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 059c4023f8428864e994f30573930854
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_ViewDataDictionary: {instanceID: 0}
|
||||
- image: {fileID: 2800000, guid: cf7e3400035e987478c3a19e57b4cf75, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/AboutMenu.cs
|
||||
uploadId: 893596
|
||||
@@ -0,0 +1,60 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
/// <summary>
|
||||
/// CheckSliderSerializeDataプロパティのカスタムGUI描画
|
||||
/// </summary>
|
||||
[CustomPropertyDrawer(typeof(CheckSliderSerializeData))]
|
||||
public class CheckSliderSerializeDataDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// サイズ
|
||||
float lineHight = EditorGUIUtility.singleLineHeight;
|
||||
float y = position.y;
|
||||
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// プロパティ
|
||||
var useProperty = property.FindPropertyRelative("use");
|
||||
var valueProperty = property.FindPropertyRelative("value");
|
||||
|
||||
// ラベルを描画
|
||||
Rect positionA;
|
||||
using (new EditorGUI.DisabledScope(!useProperty.boolValue))
|
||||
{
|
||||
positionA = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
}
|
||||
|
||||
// 子のフィールドをインデントしない
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
// 設定値の範囲。プロパティ名から判定する
|
||||
var minmax = MagicaClothEditor.GetPropertyMinMax(property.name);
|
||||
|
||||
// 矩形を計算
|
||||
float w = positionA.width;
|
||||
const float toggleSize = 20;
|
||||
var buttonRect = new Rect(positionA.x, y, toggleSize, lineHight);
|
||||
var sliderRect = new Rect(positionA.x + toggleSize, y, Mathf.Max(w - toggleSize, 0), lineHight);
|
||||
|
||||
// GUIContent.none をそれぞれに渡すと、ラベルなしに描画されます
|
||||
EditorGUI.PropertyField(buttonRect, useProperty, GUIContent.none);
|
||||
using (new EditorGUI.DisabledScope(!useProperty.boolValue))
|
||||
{
|
||||
EditorGUI.Slider(sliderRect, valueProperty, minmax.x, minmax.y, GUIContent.none);
|
||||
}
|
||||
|
||||
// インデントを元通りに戻します
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3fa2fcfdd75dbb48b7566213e81bb9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/CheckSliderSerializeDataDrawer.cs
|
||||
uploadId: 893596
|
||||
@@ -0,0 +1,80 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
/// <summary>
|
||||
/// CurveSerializeDataプロパティのカスタムGUI描画
|
||||
/// </summary>
|
||||
[CustomPropertyDrawer(typeof(CurveSerializeData))]
|
||||
public class CurveSerializeDataDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// サイズ
|
||||
float lineHight = EditorGUIUtility.singleLineHeight;
|
||||
float y = position.y;
|
||||
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// ラベルを描画
|
||||
var positionA = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
// 子のフィールドをインデントしない
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
// プロパティ
|
||||
var useProperty = property.FindPropertyRelative("useCurve");
|
||||
var valueProperty = property.FindPropertyRelative("value");
|
||||
bool useCurve = useProperty.boolValue;
|
||||
|
||||
// 設定値の範囲。プロパティ名から判定する
|
||||
//var minmax = ClothSerializeData.GetMinMax(property.name);
|
||||
var minmax = MagicaClothEditor.GetPropertyMinMax(property.name);
|
||||
|
||||
// 矩形を計算
|
||||
float w = positionA.width;
|
||||
var buttonRect = new Rect(positionA.x + w - 30, y, 30, lineHight);
|
||||
var sliderRect = new Rect(positionA.x, y, Mathf.Max(w - 35, 0), lineHight);
|
||||
|
||||
// GUIContent.none をそれぞれに渡すと、ラベルなしに描画されます
|
||||
EditorGUI.Slider(sliderRect, valueProperty, minmax.x, minmax.y, GUIContent.none);
|
||||
if (GUI.Button(buttonRect, useProperty.boolValue ? "X" : "C"))
|
||||
{
|
||||
// カーブ切り替え
|
||||
useProperty.boolValue = !useProperty.boolValue;
|
||||
}
|
||||
|
||||
// カーブ
|
||||
if (useCurve)
|
||||
{
|
||||
// カーブプロパティ
|
||||
var curveProperty = property.FindPropertyRelative("curve");
|
||||
y += lineHight + 3;
|
||||
//var curveRect = new Rect(positionA.x - 15, y, w + 15, lineHight);
|
||||
var curveRect = new Rect(positionA.x, y, w, lineHight);
|
||||
EditorGUI.CurveField(curveRect, curveProperty, Color.green, new Rect(0, 0, 1, 1), GUIContent.none);
|
||||
}
|
||||
|
||||
// インデントを元通りに戻します
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
float h = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
var useProperty = property.FindPropertyRelative("useCurve");
|
||||
if (useProperty.boolValue)
|
||||
h += (h + 3 + 2);
|
||||
|
||||
return h;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43f33abae2910246b917331abff6706
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/CurveSerializeDataDrawer.cs
|
||||
uploadId: 893596
|
||||
@@ -0,0 +1,75 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
/// <summary>
|
||||
/// ヒエラルキーへアイコンの表示
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public class DrawIconInHierarchy
|
||||
{
|
||||
const int iconSize = 16;
|
||||
|
||||
static DrawIconInHierarchy()
|
||||
{
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
EditorApplication.hierarchyWindowItemByEntityIdOnGUI += DrawIcon;
|
||||
#else
|
||||
EditorApplication.hierarchyWindowItemOnGUI += DrawIcon;
|
||||
#endif
|
||||
}
|
||||
|
||||
//static void DrawIcon(int instanceId, Rect rect)
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
static void DrawIcon(EntityId instanceId, Rect rect)
|
||||
#else
|
||||
static void DrawIcon(int instanceId, Rect rect)
|
||||
#endif
|
||||
{
|
||||
rect.width = iconSize;
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
GameObject obj = UnityEditor.EditorUtility.EntityIdToObject(instanceId) as GameObject;
|
||||
#else
|
||||
GameObject obj = UnityEditor.EditorUtility.InstanceIDToObject(instanceId) as GameObject;
|
||||
#endif
|
||||
if (obj == null)
|
||||
return;
|
||||
rect.x += EditorStyles.label.CalcSize(obj.name).x;
|
||||
rect.y += -1;
|
||||
rect.x += iconSize + 4;
|
||||
|
||||
foreach (var component in obj.GetComponents<ClothBehaviour>())
|
||||
{
|
||||
if (component is MagicaSphereCollider
|
||||
|| component is MagicaCapsuleCollider
|
||||
|| component is MagicaPlaneCollider
|
||||
|| component is MagicaCloth
|
||||
|| component is MagicaWindZone
|
||||
|| component is MagicaSettings
|
||||
)
|
||||
{
|
||||
var icon = AssetPreview.GetMiniThumbnail(component);
|
||||
GUI.Label(rect, icon);
|
||||
rect.x += iconSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// テキストのサイズを取得
|
||||
/// </summary>
|
||||
public static class GUIStyleExtensions
|
||||
{
|
||||
public static Vector2 CalcSize(this GUIStyle self, string text)
|
||||
{
|
||||
var content = new GUIContent(text);
|
||||
var size = self.CalcSize(content);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c7a0c2cbd41e2a4b93ab9b238dfcf08
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/DrawIconInHierarchy.cs
|
||||
uploadId: 893596
|
||||
@@ -0,0 +1,222 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
public class MenuItemScript
|
||||
{
|
||||
//=========================================================================================
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Cloth", priority = 200)]
|
||||
static void AddMagicaCloth()
|
||||
{
|
||||
var obj = AddObject("Magica Cloth", false, false);
|
||||
var comp = obj.AddComponent<MagicaCloth>();
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Sphere Collider", priority = 200)]
|
||||
static void AddSphereCollider()
|
||||
{
|
||||
var obj = AddObject("Magica Sphere Collider", true, true);
|
||||
var comp = obj.AddComponent<MagicaSphereCollider>();
|
||||
//comp.size = new Vector3(0.1f, 0.1f, 0.1f);
|
||||
comp.SetSize(new Vector3(0.1f, 0.1f, 0.1f));
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Capsule Collider", priority = 200)]
|
||||
static void AddCapsuleCollider()
|
||||
{
|
||||
var obj = AddObject("Magica Capsule Collider", true, true);
|
||||
var comp = obj.AddComponent<MagicaCapsuleCollider>();
|
||||
//comp.size = new Vector3(0.05f, 0.05f, 0.3f);
|
||||
comp.SetSize(new Vector3(0.05f, 0.05f, 0.3f));
|
||||
comp.direction = MagicaCapsuleCollider.Direction.Y;
|
||||
comp.radiusSeparation = false;
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Plane Collider", priority = 200)]
|
||||
static void AddPlaneCollider()
|
||||
{
|
||||
var obj = AddObject("Magica Plane Collider", true, true);
|
||||
var comp = obj.AddComponent<MagicaPlaneCollider>();
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Wind Zone", priority = 200)]
|
||||
static void AddWindZone()
|
||||
{
|
||||
var obj = AddObject("Magica Wind Zone", false, true);
|
||||
var comp = obj.AddComponent<MagicaWindZone>();
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Create Other/Magica Cloth2/Magica Settings", priority = 200)]
|
||||
static void AddSettings()
|
||||
{
|
||||
var obj = AddObject("Magica Settings", false, true);
|
||||
var comp = obj.AddComponent<MagicaSettings>();
|
||||
Selection.activeGameObject = obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ヒエラルキーにオブジェクトを1つ追加する
|
||||
/// </summary>
|
||||
/// <param name="objName"></param>
|
||||
/// <returns></returns>
|
||||
static GameObject AddObject(string objName, bool addParentName, bool autoScale = false)
|
||||
{
|
||||
var parent = Selection.activeGameObject;
|
||||
|
||||
GameObject obj = new GameObject(addParentName && parent ? objName + " (" + parent.name + ")" : objName);
|
||||
if (parent)
|
||||
{
|
||||
obj.transform.parent = parent.transform;
|
||||
}
|
||||
obj.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||
|
||||
if (autoScale && parent)
|
||||
{
|
||||
var scl = parent.transform.lossyScale;
|
||||
obj.transform.localScale = new Vector3(1.0f / scl.x, 1.0f / scl.y, 1.0f / scl.z);
|
||||
}
|
||||
else
|
||||
obj.transform.localScale = Vector3.one;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
//=========================================================================================
|
||||
[MenuItem("Tools/Magica Cloth2/Manager information", false)]
|
||||
static async void DispClothManagerInfo()
|
||||
{
|
||||
StringBuilder allsb = new StringBuilder();
|
||||
|
||||
await ClothEditorManager.InformationLog(allsb);
|
||||
|
||||
var timeManager = MagicaManager.Time;
|
||||
if (timeManager == null)
|
||||
{
|
||||
Debug.LogWarning("Time Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
timeManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var teamManager = MagicaManager.Team;
|
||||
if (teamManager == null)
|
||||
{
|
||||
Debug.LogWarning("Team Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
teamManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var vmeshManager = MagicaManager.VMesh;
|
||||
if (vmeshManager == null)
|
||||
{
|
||||
Debug.LogWarning("VMesh Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
vmeshManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var transformManager = MagicaManager.Bone;
|
||||
if (transformManager == null)
|
||||
{
|
||||
Debug.LogWarning("Transform Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
transformManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var simulationManager = MagicaManager.Simulation;
|
||||
if (simulationManager == null)
|
||||
{
|
||||
Debug.LogWarning("Simulation Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
simulationManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var colliderManager = MagicaManager.Collider;
|
||||
if (colliderManager == null)
|
||||
{
|
||||
Debug.LogWarning("Collider Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
colliderManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var windManager = MagicaManager.Wind;
|
||||
if (windManager == null)
|
||||
{
|
||||
Debug.LogWarning("Wind Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
windManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var renderManager = MagicaManager.Render;
|
||||
if (renderManager == null)
|
||||
{
|
||||
Debug.LogWarning("Renderer Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
renderManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
var preBuildManager = MagicaManager.PreBuild;
|
||||
if (preBuildManager == null)
|
||||
{
|
||||
Debug.LogWarning("PreBuild Manager is null!");
|
||||
}
|
||||
else
|
||||
{
|
||||
preBuildManager.InformationLog(allsb);
|
||||
}
|
||||
|
||||
// file
|
||||
DateTime dt = DateTime.Now;
|
||||
var filename = dt.ToString("yyyy-MM-dd-HHmm-ss");
|
||||
StreamWriter sw = new StreamWriter($"./MagicaCloth2_SysInfo_{filename}.txt", false);
|
||||
sw.WriteLine(allsb.ToString());
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
//=========================================================================================
|
||||
// インスペクターのコンテキストメニュー
|
||||
[MenuItem("CONTEXT/MagicaCloth/Rebuild InitData")]
|
||||
private static void SampleMenu(MenuCommand menuCommand)
|
||||
{
|
||||
// 初期化データをクリアして再構築する
|
||||
var cloth = menuCommand.context as MagicaCloth;
|
||||
if (cloth)
|
||||
{
|
||||
cloth.GetSerializeData2().initData.Clear();
|
||||
EditorUtility.SetDirty(cloth);
|
||||
|
||||
// 編集用メッシュの再構築
|
||||
ClothEditorManager.RegisterComponent(cloth, GizmoType.Active, true); // 強制更新
|
||||
|
||||
Develop.Log($"[{cloth.name}] Initialization data rebuilt.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 160a2e4af5a88d34695643fc38100749
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/MenuItemScript.cs
|
||||
uploadId: 893596
|
||||
@@ -0,0 +1,76 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2024 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SharePreBuildData))]
|
||||
public class SharePreBuildDataDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// サイズ
|
||||
float lineHight = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
// 子のフィールドをインデントしない
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
var buildIdProperty = property.FindPropertyRelative("buildId");
|
||||
var versionProperty = property.FindPropertyRelative("version");
|
||||
var resultProperty = property.FindPropertyRelative("buildResult.result");
|
||||
|
||||
// テキスト幅調整
|
||||
EditorGUIUtility.labelWidth = position.width;
|
||||
|
||||
// build Id
|
||||
string buildId = string.IsNullOrEmpty(buildIdProperty.stringValue) ? "(Empty)" : buildIdProperty.stringValue;
|
||||
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent(buildId));
|
||||
position.y += lineHight;
|
||||
|
||||
// インデント+1
|
||||
EditorGUI.indentLevel = indent + 1;
|
||||
|
||||
// result
|
||||
Define.Result ret = (Define.Result)resultProperty.enumValueIndex;
|
||||
var result = new ResultCode(ret);
|
||||
if (result.IsFaild() == false)
|
||||
{
|
||||
// バージョン確認
|
||||
if (versionProperty.intValue != Define.System.LatestPreBuildVersion)
|
||||
result.SetError(Define.Result.PreBuildData_VersionMismatch);
|
||||
}
|
||||
|
||||
// result text
|
||||
var backColor = GUI.color;
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
GUI.color = Color.green;
|
||||
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent($"{result.Result}"));
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = Color.red;
|
||||
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), new GUIContent($"Error: {result.Result}"));
|
||||
}
|
||||
GUI.color = backColor;
|
||||
|
||||
// インデントを元通りに戻します
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
float h = EditorGUIUtility.singleLineHeight;
|
||||
h *= 2;
|
||||
|
||||
return h;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6706416db7bdd14cb7ed3f5195d6498
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/MagicaCloth2/Scripts/Editor/EditorExtension/SharePreBuildDataDrawer.cs
|
||||
uploadId: 893596
|
||||
Reference in New Issue
Block a user