From 7cc16f3ae1a2372d8258442fa1cafe9ebaad4b3f Mon Sep 17 00:00:00 2001 From: Hiroki Omae Date: Fri, 17 Jul 2020 00:04:47 +0900 Subject: [PATCH 01/16] Add localization and make default language to English --- Editor/AssmblyInfo.cs | 3 + Editor/AssmblyInfo.cs.meta | 11 + Editor/AutoSpringBoneSetup.cs | 1 + .../GUI/Windows/LoadSpringBoneSetupWindow.cs | 77 ++-- Editor/GUI/Windows/MirrorSpringBoneWindow.cs | 37 +- .../GUI/Windows/SaveSpringBoneSetupWindow.cs | 46 ++- .../GUI/Windows/SpringBoneSetupErrorWindow.cs | 30 +- Editor/GUI/Windows/SpringBoneWindow.cs | 128 +++--- Editor/SpringBoneEditorActions.cs | 64 ++- Editor/SpringColliderEditorActions.cs | 48 ++- Editor/Utility/FindGameObjectsWindow.cs | 26 +- Editor/Utility/SetObjectParentWindow.cs | 18 +- Editor/ja.po | 383 ++++++++++++++++++ Editor/ja.po.meta | 7 + 14 files changed, 721 insertions(+), 158 deletions(-) create mode 100644 Editor/AssmblyInfo.cs create mode 100644 Editor/AssmblyInfo.cs.meta create mode 100644 Editor/ja.po create mode 100644 Editor/ja.po.meta diff --git a/Editor/AssmblyInfo.cs b/Editor/AssmblyInfo.cs new file mode 100644 index 0000000..6915ff6 --- /dev/null +++ b/Editor/AssmblyInfo.cs @@ -0,0 +1,3 @@ +using UnityEditor.Localization.Editor; + +[assembly: Localization] \ No newline at end of file diff --git a/Editor/AssmblyInfo.cs.meta b/Editor/AssmblyInfo.cs.meta new file mode 100644 index 0000000..1c02fdf --- /dev/null +++ b/Editor/AssmblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2ad4ab0d6f72042059f8f8c7daeb9f75 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AutoSpringBoneSetup.cs b/Editor/AutoSpringBoneSetup.cs index 7a75aa5..07d1a13 100755 --- a/Editor/AutoSpringBoneSetup.cs +++ b/Editor/AutoSpringBoneSetup.cs @@ -3,6 +3,7 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs index 6346254..8497952 100755 --- a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs @@ -1,15 +1,46 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class LoadSpringBoneSetupWindow : EditorWindow { + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("Load spring bone setup"); + public static readonly string stopPlayModeMessage = Localization.Tr("Do not setup in Play Mode"); + public static readonly string selectObjectRootsMessage = Localization.Tr("Select parent object of the spring bone"); + public static readonly string resultFormat = Localization.Tr("Set up complete:{0}\nNumber of bones: {1} Number of colliders: {2}"); + public static readonly string csvFile = Localization.Tr("CSV File"); + public static readonly string textFile = Localization.Tr("Text File"); + public static readonly string loadSpringBoneSetup = Localization.Tr("Load spring bone setup"); + public static readonly string errorFormat = Localization.Tr( + "SpringBone setup failed.\n" + + "Souce data may contain errors,\n" + + "or the data don't match the character.\n" + + "Please refer console logs for further info.\n" + + "\n" + + "Character: {0}\n" + + "\n" + + "Path: {1}"); + + public static readonly string springBoneSetup = Localization.Tr("SpringBone Setup"); + public static readonly string springBoneSetupFailedFormat = Localization.Tr("SpringBone Setup failed:{0}\nPath:{1}"); + public static readonly string labelSpringBoneRoot = Localization.Tr("SpringBone Root"); + + public static readonly GUIContent labelLoadingConfig = new GUIContent(Localization.Tr("Loading Configuration")); + public static readonly GUIContent labelSpringBone = new GUIContent(Localization.Tr("SpringBone")); + public static readonly GUIContent labelCollider = new GUIContent(Localization.Tr("Collider")); + + public static readonly GUIContent labelSelectFromRoot = new GUIContent(Localization.Tr("Get root from selection")); + public static readonly GUIContent labelSetupLoadCSV = new GUIContent(Localization.Tr("Set up from CSV file")); + } + public static void ShowWindow() { - var editorWindow = GetWindow( - "スプリングボーンセットアップを読み込む"); + var editorWindow = GetWindow(Styles.editorWindowTitle); if (editorWindow != null) { editorWindow.SelectObjectsFromSelection(); @@ -35,8 +66,6 @@ ref int yPos // private - private const string StopPlayModeMessage = "再生モードでセットアップしないでください。"; - private const string SelectObjectRootsMessage = "スプリングボーンの親オブジェクトを指定してください。"; private const int UIRowHeight = 24; private const int UISpacing = 8; private const int LabelWidth = 200; @@ -74,11 +103,11 @@ private void ShowImportSettingsUI(ref Rect uiRect) importSettings = new DynamicsSetup.ImportSettings(); } - GUI.Label(uiRect, "読み込み設定", SpringBoneGUIStyles.HeaderLabelStyle); + GUI.Label(uiRect, Styles.labelLoadingConfig, SpringBoneGUIStyles.HeaderLabelStyle); uiRect.y += uiRect.height; - importSettings.ImportSpringBones = GUI.Toggle(uiRect, importSettings.ImportSpringBones, "スプリングボーン", SpringBoneGUIStyles.ToggleStyle); + importSettings.ImportSpringBones = GUI.Toggle(uiRect, importSettings.ImportSpringBones, Styles.labelSpringBone, SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; - importSettings.ImportCollision = GUI.Toggle(uiRect, importSettings.ImportCollision, "コライダー", SpringBoneGUIStyles.ToggleStyle); + importSettings.ImportCollision = GUI.Toggle(uiRect, importSettings.ImportCollision, Styles.labelCollider, SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; } @@ -90,9 +119,9 @@ private void OnGUI() var uiWidth = (int)position.width - UISpacing * 2; var yPos = UISpacing; - springBoneRoot = DoObjectPicker("スプリングボーンのルート", springBoneRoot, uiWidth, UIRowHeight, ref yPos); + springBoneRoot = DoObjectPicker(Styles.labelSpringBoneRoot, springBoneRoot, uiWidth, UIRowHeight, ref yPos); var buttonRect = new Rect(UISpacing, yPos, uiWidth, ButtonHeight); - if (GUI.Button(buttonRect, "選択からルートを取得", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, Styles.labelSelectFromRoot, SpringBoneGUIStyles.ButtonStyle)) { SelectObjectsFromSelection(); } @@ -104,7 +133,7 @@ private void OnGUI() string errorMessage; if (IsOkayToSetup(out errorMessage)) { - if (GUI.Button(buttonRect, "CSVを読み込んでセットアップ", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, Styles.labelSetupLoadCSV, SpringBoneGUIStyles.ButtonStyle)) { BrowseAndLoadSpringSetup(); } @@ -122,13 +151,13 @@ private bool IsOkayToSetup(out string errorMessage) errorMessage = ""; if (EditorApplication.isPlaying) { - errorMessage = StopPlayModeMessage; + errorMessage = Styles.stopPlayModeMessage; return false; } if (springBoneRoot == null) { - errorMessage = SelectObjectRootsMessage; + errorMessage = Styles.selectObjectRootsMessage; return false; } return true; @@ -169,11 +198,10 @@ public void Perform() setup.Build(); AssetDatabase.Refresh(); - const string ResultFormat = "セットアップ完了: {0}\nボーン数: {1} コライダー数: {2}"; var boneCount = springBoneRoot.GetComponentsInChildren(true).Length; var colliderCount = SpringColliderSetup.GetColliderTypes() .Sum(type => springBoneRoot.GetComponentsInChildren(type, true).Length); - var resultMessage = string.Format(ResultFormat, path, boneCount, colliderCount); + var resultMessage = string.Format(Styles.resultFormat, path, boneCount, colliderCount); Debug.Log(resultMessage); } @@ -184,8 +212,7 @@ public void Perform() private void BrowseAndLoadSpringSetup() { - string checkErrorMessage; - if (!IsOkayToSetup(out checkErrorMessage)) + if (!IsOkayToSetup(out var checkErrorMessage)) { Debug.LogError(checkErrorMessage); return; @@ -193,9 +220,9 @@ private void BrowseAndLoadSpringSetup() // var initialPath = ""; var initialDirectory = ""; // System.IO.Path.GetDirectoryName(initialPath); - var fileFilters = new string[] { "CSVファイル", "csv", "テキストファイル", "txt" }; + var fileFilters = new string[] { Styles.csvFile, "csv", Styles.textFile, "txt" }; var path = EditorUtility.OpenFilePanelWithFilters( - "スプリングボーンセットアップを読み込む", initialDirectory, fileFilters); + Styles.loadSpringBoneSetup, initialDirectory, fileFilters); if (path.Length == 0) { return; } var sourceText = FileUtil.ReadAllText(path); @@ -216,16 +243,10 @@ private void BrowseAndLoadSpringSetup() } else { - const string ErrorFormat = - "スプリングボーンセットアップが失敗しました。\n" - + "元データにエラーがあるか、もしくは\n" - + "キャラクターにデータが一致しません。\n" - + "詳しくはConsoleのログをご覧下さい。\n\n" - + "キャラクター: {0}\n\n" - + "パス: {1}"; - var resultErrorMessage = string.Format(ErrorFormat, springBoneRoot.name, path); - EditorUtility.DisplayDialog("スプリングボーンセットアップ", resultErrorMessage, "OK"); - Debug.LogError("スプリングボーンセットアップ失敗: " + springBoneRoot.name + "\n" + path); + var resultErrorMessage = string.Format(Styles.errorFormat, springBoneRoot.name, path); + EditorUtility.DisplayDialog(Styles.springBoneSetup, resultErrorMessage, "OK"); + Debug.LogFormat(LogType.Error, LogOption.None, springBoneRoot, + Styles.springBoneSetupFailedFormat, springBoneRoot.name, path); } Close(); } diff --git a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs index 0eb7e7f..589f592 100755 --- a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs +++ b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs @@ -3,14 +3,31 @@ using UnityEditor; using UnityEngine; using Unity.Animations.SpringBones.GameObjectExtensions; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class MirrorSpringBoneWindow : EditorWindow { + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("SpringBone Mirror"); + + public static readonly GUIContent labelDoMirror = new GUIContent(Localization.Tr("Do Mirror")); + public static readonly GUIContent labelGetFromSelection = new GUIContent(Localization.Tr("Get from selection")); + + public static readonly GUIContent labelSelectAllCopyDst = new GUIContent(Localization.Tr("Select all copy destination")); + public static readonly GUIContent labelSelectAllCopySrc = new GUIContent(Localization.Tr("Select all copy source")); + public static readonly GUIContent labelSelectAll = new GUIContent(Localization.Tr("Select All")); + public static readonly GUIContent labelConfigXbZero = new GUIContent(Localization.Tr("Set bone where X > 0")); + public static readonly GUIContent labelConfigXlZero = new GUIContent(Localization.Tr("Set bone where X < 0")); + public static readonly GUIContent labelSrc = new GUIContent(Localization.Tr("Source")); + public static readonly GUIContent labelDst = new GUIContent(Localization.Tr("→ Destination")); + } + public static void ShowWindow() { - var window = GetWindow("SpringBoneミラー"); + var window = GetWindow(Styles.editorWindowTitle); window.Show(); window.OnShow(); } @@ -57,7 +74,7 @@ private void OnGUI() uiRect = ShowUtilityButtons(uiRect); uiRect = ShowBoneList(uiRect); - if (GUI.Button(uiRect, "ミラーを行う", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, Styles.labelDoMirror, SpringBoneGUIStyles.ButtonStyle)) { PerformMirror(); } @@ -66,7 +83,7 @@ private void OnGUI() private Rect ShowUtilityButtons(Rect uiRect) { var buttonOffset = uiRect.height + Spacing; - if (GUI.Button(uiRect, "選択から取得", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, Styles.labelGetFromSelection, SpringBoneGUIStyles.ButtonStyle)) { AcquireBonesFromSelection(); } @@ -74,12 +91,12 @@ private Rect ShowUtilityButtons(Rect uiRect) var halfRectWidth = 0.5f * (uiRect.width - Spacing); var halfButtonRect = new Rect(uiRect.x, uiRect.y, halfRectWidth, uiRect.height); - if (GUI.Button(halfButtonRect, "X < 0のボーンを元に設定", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, Styles.labelConfigXlZero, SpringBoneGUIStyles.ButtonStyle)) { AcquireSourceBonesOnSideOfAxis(true); } halfButtonRect.x += halfRectWidth + Spacing; - if (GUI.Button(halfButtonRect, "X > 0のボーンを元に設定", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, Styles.labelConfigXbZero, SpringBoneGUIStyles.ButtonStyle)) { AcquireSourceBonesOnSideOfAxis(false); } @@ -87,20 +104,20 @@ private Rect ShowUtilityButtons(Rect uiRect) halfButtonRect.x = uiRect.x; halfButtonRect.y = uiRect.y; - if (GUI.Button(halfButtonRect, "コピー元を全選択", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, Styles.labelSelectAllCopySrc, SpringBoneGUIStyles.ButtonStyle)) { var sourceBones = boneEntries.Select(entry => entry.sourceBone).Where(bone => bone != null); if (sourceBones.Any()) { Selection.objects = sourceBones.Select(bone => bone.gameObject).ToArray(); } } halfButtonRect.x += halfRectWidth + Spacing; - if (GUI.Button(halfButtonRect, "コピー先を全選択", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, Styles.labelSelectAllCopyDst, SpringBoneGUIStyles.ButtonStyle)) { var targetBones = boneEntries.Select(entry => entry.targetBone).Where(bone => bone != null); if (targetBones.Any()) { Selection.objects = targetBones.Select(bone => bone.gameObject).ToArray(); } } uiRect.y += buttonOffset; - if (GUI.Button(uiRect, "全選択", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, Styles.labelSelectAll, SpringBoneGUIStyles.ButtonStyle)) { var bonesToSelect = new List(); bonesToSelect.AddRange(boneEntries.Select(entry => entry.sourceBone).Where(bone => bone != null)); @@ -117,9 +134,9 @@ private Rect ShowBoneList(Rect uiRect) var listBoxBottom = position.height - (Spacing * 2f + RowHeight); var headerRowRect = new Rect(uiRect.x, uiRect.y, uiRect.width * 0.5f, uiRect.height); - GUI.Label(headerRowRect, "元", SpringBoneGUIStyles.LabelStyle); + GUI.Label(headerRowRect, Styles.labelSrc, SpringBoneGUIStyles.LabelStyle); headerRowRect.x += headerRowRect.width; - GUI.Label(headerRowRect, "→ 先", SpringBoneGUIStyles.LabelStyle); + GUI.Label(headerRowRect, Styles.labelDst, SpringBoneGUIStyles.LabelStyle); uiRect.y += uiRect.height; const float ScrollbarWidth = 20f; diff --git a/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs b/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs index 5df218c..4e74b76 100755 --- a/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs @@ -1,15 +1,34 @@ -using System.Linq; +using System; +using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class SaveSpringBoneSetupWindow : EditorWindow { + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("Save SpringBone Setup"); + public static readonly string textSpringBoneRoot = Localization.Tr("SpringBone Root"); + public static readonly string textSaveSpringBoneSetup = Localization.Tr("Save SpringBone Setup"); + public static readonly string textSaveSpringBone = Localization.Tr("Save SpringBone"); + public static readonly string textFileOverwriteFormat = Localization.Tr("File already exists. Overwrite?:{0}\n\n"); + public static readonly string textOverwrite = Localization.Tr("Overwrite"); + public static readonly string textSavedFormat = Localization.Tr("Saved.: {0}"); + public static readonly string textCancel = Localization.Tr("Cancel"); + + public static readonly GUIContent labelExportSetting = new GUIContent(Localization.Tr("Export Setting")); + public static readonly GUIContent labelSpringBone = new GUIContent(Localization.Tr("SpringBone")); + public static readonly GUIContent labelCollider = new GUIContent(Localization.Tr("Collider")); + public static readonly GUIContent labelGetRootFromSelection = new GUIContent(Localization.Tr("Get root from selection")); + public static readonly GUIContent labelSaveToCSV = new GUIContent(Localization.Tr("Save to CSV")); + } + public static void ShowWindow() { - var editorWindow = GetWindow( - "スプリングボーンセットアップを保存"); + var editorWindow = GetWindow(Styles.editorWindowTitle); if (editorWindow != null) { editorWindow.SelectObjectsFromSelection(); @@ -52,11 +71,11 @@ private void ShowExportSettingsUI(ref Rect uiRect) exportSettings = new SpringBoneSerialization.ExportSettings(); } - GUI.Label(uiRect, "書き出し設定", SpringBoneGUIStyles.HeaderLabelStyle); + GUI.Label(uiRect, Styles.labelExportSetting, SpringBoneGUIStyles.HeaderLabelStyle); uiRect.y += uiRect.height; - exportSettings.ExportSpringBones = GUI.Toggle(uiRect, exportSettings.ExportSpringBones, "スプリングボーン", SpringBoneGUIStyles.ToggleStyle); + exportSettings.ExportSpringBones = GUI.Toggle(uiRect, exportSettings.ExportSpringBones, Styles.labelSpringBone, SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; - exportSettings.ExportCollision = GUI.Toggle(uiRect, exportSettings.ExportCollision, "コライダー", SpringBoneGUIStyles.ToggleStyle); + exportSettings.ExportCollision = GUI.Toggle(uiRect, exportSettings.ExportCollision,Styles.labelCollider, SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; } @@ -72,9 +91,9 @@ private void OnGUI() var yPos = UISpacing; springBoneRoot = LoadSpringBoneSetupWindow.DoObjectPicker( - "スプリングボーンのルート", springBoneRoot, uiWidth, UIRowHeight, ref yPos); + Styles.textSpringBoneRoot, springBoneRoot, uiWidth, UIRowHeight, ref yPos); var buttonRect = new Rect(UISpacing, yPos, uiWidth, ButtonHeight); - if (GUI.Button(buttonRect, "選択からルートを取得", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, Styles.labelGetRootFromSelection, SpringBoneGUIStyles.ButtonStyle)) { SelectObjectsFromSelection(); } @@ -84,7 +103,7 @@ private void OnGUI() ShowExportSettingsUI(ref buttonRect); if (springBoneRoot != null) { - if (GUI.Button(buttonRect, "CSVを保存", SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, Styles.labelSaveToCSV, SpringBoneGUIStyles.ButtonStyle)) { BrowseAndSaveSpringSetup(); } @@ -98,13 +117,14 @@ private void BrowseAndSaveSpringSetup() var initialFileName = springBoneRoot.name + "_Dynamics.csv"; var path = EditorUtility.SaveFilePanel( - "スプリングボーンセットアップを保存", "", initialFileName, "csv"); + Styles.textSaveSpringBoneSetup, "", initialFileName, "csv"); if (path.Length == 0) { return; } if (System.IO.File.Exists(path)) { - var overwriteMessage = "ファイルは既に存在します。上書きしますか?\n\n" + path; - if (!EditorUtility.DisplayDialog("スプリングボーン保存", overwriteMessage, "上書き", "キャンセル")) + var overwriteMessage = string.Format(Styles.textFileOverwriteFormat, path); + if (!EditorUtility.DisplayDialog(Styles.textSaveSpringBone, overwriteMessage, Styles.textOverwrite, + Styles.textCancel)) { return; } @@ -114,7 +134,7 @@ private void BrowseAndSaveSpringSetup() if (FileUtil.WriteAllText(path, sourceText)) { AssetDatabase.Refresh(); - Debug.Log("保存しました: " + path); + Debug.LogFormat(Styles.textSavedFormat, path); } } } diff --git a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs index c4762fc..ca4a053 100755 --- a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs +++ b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs @@ -2,11 +2,25 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class SpringBoneSetupErrorWindow : EditorWindow { + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("Setup Dynamics"); + + public static readonly GUIContent labelAskDynamicError = new GUIContent(Localization.Tr("There are errors in dynamics setup. Do you want to create only ones without error(s)?")); + public static readonly GUIContent labelSpringBoneRoot = new GUIContent(Localization.Tr("SpringBone Root")); + public static readonly GUIContent labelColliderRoot = new GUIContent(Localization.Tr("Collider Root")); + public static readonly GUIContent labelPath = new GUIContent(Localization.Tr("Path")); + public static readonly GUIContent labelCreate = new GUIContent(Localization.Tr("Create")); + public static readonly GUIContent labelCancel = new GUIContent(Localization.Tr("Cancel")); + public static readonly GUIContent labelError = new GUIContent(Localization.Tr("Error")); + } + public interface IConfirmAction { void Perform(); @@ -21,7 +35,7 @@ public static void ShowWindow IConfirmAction onConfirm ) { - var window = GetWindow("ダイナミクスセットアップ"); + var window = GetWindow(Styles.editorWindowTitle); window.springBoneRoot = springBoneRoot; window.colliderRoot = colliderRoot; window.filePath = path; @@ -41,23 +55,23 @@ IConfirmAction onConfirm private void OnGUI() { EditorGUILayout.Space(); - GUILayout.Label("ダイナミクスセットアップに一部エラーが出ているものがあります。正常なものだけ作成しますか?"); + GUILayout.Label(Styles.labelAskDynamicError); EditorGUILayout.Space(); - EditorGUILayout.ObjectField("スプリングボーンのルート", springBoneRoot, typeof(GameObject), true); - EditorGUILayout.ObjectField("コライダーのルート", colliderRoot, typeof(GameObject), true); - EditorGUILayout.TextField("パス", filePath); + EditorGUILayout.ObjectField(Styles.labelSpringBoneRoot, springBoneRoot, typeof(GameObject), true); + EditorGUILayout.ObjectField(Styles.labelColliderRoot, colliderRoot, typeof(GameObject), true); + EditorGUILayout.TextField(Styles.labelPath, filePath); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); - if (GUILayout.Button("作成")) + if (GUILayout.Button(Styles.labelCreate)) { onConfirmAction.Perform(); Close(); } - if (GUILayout.Button("キャンセル")) { Close(); } + if (GUILayout.Button(Styles.labelCancel)) { Close(); } GUILayout.EndHorizontal(); EditorGUILayout.Space(); - GUILayout.Label("エラー"); + GUILayout.Label(Styles.labelError); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true); foreach (var error in errors) { diff --git a/Editor/GUI/Windows/SpringBoneWindow.cs b/Editor/GUI/Windows/SpringBoneWindow.cs index 90ba895..ed29281 100755 --- a/Editor/GUI/Windows/SpringBoneWindow.cs +++ b/Editor/GUI/Windows/SpringBoneWindow.cs @@ -1,15 +1,54 @@ using System.Linq; +using Unity.Collections; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class SpringBoneWindow : EditorWindow { - [MenuItem("UTJ/スプリングボーン窓")] + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("SpringBone"); + + public static readonly string logIconLoadFailedFormat = Localization.Tr("Icon load failed:\nPath:{0}"); + public static readonly string logIconDirNotFound = Localization.Tr("SpringBoneWindow icon directory not found"); + + public static readonly string labelDynamicCSV = Localization.Tr("Dynamics CSV"); + public static readonly string labelLoad = Localization.Tr("Load"); + public static readonly string labelSave = Localization.Tr("Save"); + public static readonly string labelSpringBone = (Localization.Tr("SpringBone")); + public static readonly string labelSpringBoneAdd = (Localization.Tr("Add\nSpringBone")); + public static readonly string labelCreateOrigin = (Localization.Tr("Create Origin")); + public static readonly string labelCreateManager = (Localization.Tr("Create or Update Manager")); + public static readonly string labelMirrorBone = (Localization.Tr("Mirror SpringBones")); + public static readonly string labelSelectOneAndChild = (Localization.Tr("Select this and child bones")); + public static readonly string labelDeleteBone = (Localization.Tr("Delete SpringBone")); + public static readonly string labelDeleteBoneAndManager = (Localization.Tr("Delete Managers and Bones of Selection and Children")); + public static readonly string labelCollision = (Localization.Tr("Collision")); + public static readonly string labelSphere = (Localization.Tr("Sphere")); + public static readonly string labelCapsule = (Localization.Tr("Capsule")); + public static readonly string labelQuad = (Localization.Tr("Quad")); + public static readonly string labelFitCapsulePos = (Localization.Tr("Fit capsule place to parent")); + public static readonly string labelExcludeCollisionFromBone = (Localization.Tr("Exclude collision from SpringBone")); + public static readonly string labelDeleteCollier = (Localization.Tr("Delete collider of selection and children")); + public static readonly string labelCleanup = (Localization.Tr("Cleanup")); + public static readonly string labelShow = (Localization.Tr("Show")); + + public static readonly string labelShowOnlySelectedBones = (Localization.Tr("Show only selected bones")); + public static readonly string labelShowBoneCollision = (Localization.Tr("Show bone collisions")); + public static readonly string labelShowOnlySelectedCollider = (Localization.Tr("Show only selected colliders")); + public static readonly string labelShowBoneName = (Localization.Tr("Show bone names")); + } + + private const string kIconDirectoryPath = "Packages/com.unity.springbone/Editor/GUI/Icons"; + + + [MenuItem("Window/Animation/SpringBone/SpringBone")] public static void ShowWindow() { - var window = GetWindow("スプリングボーン"); + var window = GetWindow(Styles.editorWindowTitle); window.OnShow(); } @@ -36,41 +75,24 @@ private static Texture LoadIcon(string iconDirectory, string filename) var iconTexture = AssetDatabase.LoadAssetAtPath(iconPath); if (iconTexture == null) { - Debug.LogWarning("アイコン読み込み失敗:\n" + iconPath); + Debug.LogFormat(LogType.Warning, LogOption.None, null, Styles.logIconDirNotFound, iconPath); } return iconTexture; } - private static string FindIconAssetDirectory() - { - // Try to find the icons in a way such that the user can put the Dynamics folder anywhere - return DirectoryUtil.GetFilesRecursively(Application.dataPath, "SpringCapsuleIcon.tga") - .Select(path => PathUtil.NormalizePath(path)) - .Where(path => path.ToLowerInvariant().Contains("editor/springbone/gui/icons/")) - .Select(path => PathUtil.SystemPathToAssetPath(System.IO.Path.GetDirectoryName(path))) - .FirstOrDefault(); - } - private void InitializeIcons() { if (headerIcon != null) { return; } - var iconDirectory = FindIconAssetDirectory(); - if (iconDirectory == null) - { - Debug.LogWarning("SpringBoneWindowのアイコンディレクトリーが見つかりません"); - return; - } - - headerIcon = LoadIcon(iconDirectory, "SpringIcon.tga"); - newDocumentIcon = LoadIcon(iconDirectory, "NewDocumentHS.png"); - openDocumentIcon = LoadIcon(iconDirectory, "OpenHH.bmp"); - saveDocumentIcon = LoadIcon(iconDirectory, "SaveHH.bmp"); - deleteIcon = LoadIcon(iconDirectory, "Delete.png"); - pivotIcon = LoadIcon(iconDirectory, "Pivot.png"); - sphereIcon = LoadIcon(iconDirectory, "SpringSphereIcon.tga"); - capsuleIcon = LoadIcon(iconDirectory, "SpringCapsuleIcon.tga"); - panelIcon = LoadIcon(iconDirectory, "SpringPanelIcon.tga"); + headerIcon = LoadIcon(kIconDirectoryPath, "SpringIcon.tga"); + newDocumentIcon = LoadIcon(kIconDirectoryPath, "NewDocumentHS.png"); + openDocumentIcon = LoadIcon(kIconDirectoryPath, "OpenHH.bmp"); + saveDocumentIcon = LoadIcon(kIconDirectoryPath, "SaveHH.bmp"); + deleteIcon = LoadIcon(kIconDirectoryPath, "Delete.png"); + pivotIcon = LoadIcon(kIconDirectoryPath, "Pivot.png"); + sphereIcon = LoadIcon(kIconDirectoryPath, "SpringSphereIcon.tga"); + capsuleIcon = LoadIcon(kIconDirectoryPath, "SpringCapsuleIcon.tga"); + panelIcon = LoadIcon(kIconDirectoryPath, "SpringPanelIcon.tga"); } private void InitializeButtonGroups() @@ -86,48 +108,48 @@ private void InitializeButtonGroups() { new GUIElements.Column(new GUIElements.IElement[] { - new GUIElements.Label("ダイナミクスCSV", headerLabelStyleProvider), + new GUIElements.Label(Styles.labelDynamicCSV, headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Button("読み込む", LoadSpringBoneSetupWindow.ShowWindow, openDocumentIcon, buttonLabelStyleProvider), - new GUIElements.Button("保存", SaveSpringBoneSetupWindow.ShowWindow, saveDocumentIcon, buttonLabelStyleProvider) + new GUIElements.Button(Styles.labelLoad, LoadSpringBoneSetupWindow.ShowWindow, openDocumentIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelSave, SaveSpringBoneSetupWindow.ShowWindow, saveDocumentIcon, buttonLabelStyleProvider) }, BigButtonHeight) }), new GUIElements.Column(new GUIElements.IElement[] { - new GUIElements.Label("スプリングボーン", headerLabelStyleProvider), + new GUIElements.Label(Styles.labelSpringBone, headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Button("スプリング\nボーン追加", SpringBoneEditorActions.AssignSpringBonesRecursively, headerIcon, buttonLabelStyleProvider), - new GUIElements.Button("基点作成", SpringBoneEditorActions.CreatePivotForSpringBones, pivotIcon, buttonLabelStyleProvider) + new GUIElements.Button(Styles.labelSpringBoneAdd, SpringBoneEditorActions.AssignSpringBonesRecursively, headerIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelCreateOrigin, SpringBoneEditorActions.CreatePivotForSpringBones, pivotIcon, buttonLabelStyleProvider) }, BigButtonHeight), - new GUIElements.Button("マネージャーを作成/更新", SpringBoneEditorActions.AddToOrUpdateSpringManagerInSelection, newDocumentIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelCreateManager, SpringBoneEditorActions.AddToOrUpdateSpringManagerInSelection, newDocumentIcon, buttonLabelStyleProvider), //new GUIElements.Button("初期セットアップを行う", SpringBoneAutoSetupWindow.ShowWindow, newDocumentIcon, buttonLabelStyleProvider), //new GUIElements.Button("初期ボーンリストに合わせる", SpringBoneEditorActions.PromptToUpdateSpringBonesFromList, null, buttonLabelStyleProvider), new GUIElements.Separator(), - new GUIElements.Button("スプリングボーンをミラー", MirrorSpringBoneWindow.ShowWindow, null, buttonLabelStyleProvider), - new GUIElements.Button("選択と子供のスプリングボーンを選択", SpringBoneEditorActions.SelectChildSpringBones, null, buttonLabelStyleProvider), - new GUIElements.Button("選択スプリングボーンを削除", SpringBoneEditorActions.DeleteSelectedBones, deleteIcon, buttonLabelStyleProvider), - new GUIElements.Button("選択と子供のマネージャーとボーンを削除", SpringBoneEditorActions.DeleteSpringBonesAndManagers, deleteIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelMirrorBone, MirrorSpringBoneWindow.ShowWindow, null, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelSelectOneAndChild, SpringBoneEditorActions.SelectChildSpringBones, null, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelDeleteBone, SpringBoneEditorActions.DeleteSelectedBones, deleteIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelDeleteBoneAndManager, SpringBoneEditorActions.DeleteSpringBonesAndManagers, deleteIcon, buttonLabelStyleProvider), }), new GUIElements.Column(new GUIElements.IElement[] { - new GUIElements.Label("コリジョン", headerLabelStyleProvider), + new GUIElements.Label(Styles.labelCollision, headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Button("球体", SpringColliderEditorActions.CreateSphereColliderBeneathSelectedObjects, sphereIcon, buttonLabelStyleProvider), - new GUIElements.Button("カプセル", SpringColliderEditorActions.CreateCapsuleColliderBeneathSelectedObjects, capsuleIcon, buttonLabelStyleProvider), - new GUIElements.Button("板", SpringColliderEditorActions.CreatePanelColliderBeneathSelectedObjects, panelIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelSphere, SpringColliderEditorActions.CreateSphereColliderBeneathSelectedObjects, sphereIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelCapsule, SpringColliderEditorActions.CreateCapsuleColliderBeneathSelectedObjects, capsuleIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelQuad, SpringColliderEditorActions.CreatePanelColliderBeneathSelectedObjects, panelIcon, buttonLabelStyleProvider), }, BigButtonHeight), - new GUIElements.Button("カプセルの位置を親に合わせる", SpringColliderEditorActions.AlignSelectedCapsulesToParents, capsuleIcon, buttonLabelStyleProvider), - new GUIElements.Button("スプリングボーンからコリジョンを外す", SpringColliderEditorActions.DeleteCollidersFromSelectedSpringBones, deleteIcon, buttonLabelStyleProvider), - new GUIElements.Button("選択と子供のコライダーを削除", SpringColliderEditorActions.DeleteAllChildCollidersFromSelection, deleteIcon, buttonLabelStyleProvider), - new GUIElements.Button("クリーンナップ", SpringColliderEditorActions.CleanUpDynamics, deleteIcon, buttonLabelStyleProvider) + new GUIElements.Button(Styles.labelFitCapsulePos, SpringColliderEditorActions.AlignSelectedCapsulesToParents, capsuleIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelExcludeCollisionFromBone, SpringColliderEditorActions.DeleteCollidersFromSelectedSpringBones, deleteIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelDeleteCollier, SpringColliderEditorActions.DeleteAllChildCollidersFromSelection, deleteIcon, buttonLabelStyleProvider), + new GUIElements.Button(Styles.labelCleanup, SpringColliderEditorActions.CleanUpDynamics, deleteIcon, buttonLabelStyleProvider) }) }, false, @@ -190,17 +212,17 @@ private float ShowHeaderUI(float xPos, float yPos, float uiWidth) System.Func toggleStyleProvider = () => SpringBoneGUIStyles.ToggleStyle; var headerColumn = new GUIElements.Column( new GUIElements.IElement[] { - new GUIElements.Label("表示", headerLabelStyleProvider), + new GUIElements.Label(Styles.labelShow, headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Toggle("選択ボーンのみ表示", () => settings.onlyShowSelectedBones, newValue => { settings.onlyShowSelectedBones = newValue; needToRepaint = true; }, toggleStyleProvider), - new GUIElements.Toggle("ボーンのコリジョンを表示", () => settings.showBoneSpheres, newValue => { settings.showBoneSpheres = newValue; needToRepaint = true; }, toggleStyleProvider), + new GUIElements.Toggle(Styles.labelShowOnlySelectedBones, () => settings.onlyShowSelectedBones, newValue => { settings.onlyShowSelectedBones = newValue; needToRepaint = true; }, toggleStyleProvider), + new GUIElements.Toggle(Styles.labelShowBoneCollision, () => settings.showBoneSpheres, newValue => { settings.showBoneSpheres = newValue; needToRepaint = true; }, toggleStyleProvider), }, GUIElements.RowHeight), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Toggle("選択コライダーのみ表示", () => settings.onlyShowSelectedColliders, newValue => { settings.onlyShowSelectedColliders = newValue; needToRepaint = true; }, toggleStyleProvider), - new GUIElements.Toggle("ボーン名を表示", () => settings.showBoneNames, newValue => { settings.showBoneNames = newValue; needToRepaint = true; }, toggleStyleProvider) + new GUIElements.Toggle(Styles.labelShowOnlySelectedCollider, () => settings.onlyShowSelectedColliders, newValue => { settings.onlyShowSelectedColliders = newValue; needToRepaint = true; }, toggleStyleProvider), + new GUIElements.Toggle(Styles.labelShowBoneName, () => settings.showBoneNames, newValue => { settings.showBoneNames = newValue; needToRepaint = true; }, toggleStyleProvider) }, GUIElements.RowHeight), }, diff --git a/Editor/SpringBoneEditorActions.cs b/Editor/SpringBoneEditorActions.cs index bcf3f31..6ba8ad7 100755 --- a/Editor/SpringBoneEditorActions.cs +++ b/Editor/SpringBoneEditorActions.cs @@ -3,11 +3,39 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public static class SpringBoneEditorActions { + private static class Styles + { + public static readonly string logStopPlayMode = Localization.Tr("You must stop Playmode first."); + public static readonly string logSelectOneOrMoreObjects = Localization.Tr("Select one or more objects."); + public static readonly string logSelectOnlyOneSpringManager = Localization.Tr("Select only one SpringManager"); + + public static readonly string textDelete = Localization.Tr("Delete"); + public static readonly string textCancel = Localization.Tr("Cancel"); + public static readonly string textUpdate = Localization.Tr("Update"); + + public static readonly string textDeleteSpringBoneAndManager = Localization.Tr("Delete SpringBone and Manager"); + public static readonly string textDeleteSelectedBones = Localization.Tr("Delete selected bones"); + + public static readonly string textUpdateFromBoneList = Localization.Tr("Update from bone list"); + + public static readonly string textConfirmRemoveAllBoneAndManagerFormat = Localization.Tr( + "Do you really want to remove all\n" + + "SpringBones and managers under this object?\n" + + "\n{0}"); + + public static readonly string textConfirmUpdateBonesFromListFormat = Localization.Tr( + "Do you want to update secondary bones from bone list?\n" + + "\nThis will remove all SpringBones that are not listed,\n" + + "and will add SpringBones missing in model.\n" + + "\nSpringManager: {0}\n"); + } + public static void ShowSpringBoneWindow() { SpringBoneWindow.ShowWindow(); @@ -17,13 +45,13 @@ public static void AssignSpringBonesRecursively() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } if (Selection.gameObjects.Length < 1) { - Debug.LogError("一つ以上のオブジェクトを選択してください。"); + Debug.LogError(Styles.logSelectOneOrMoreObjects); return; } @@ -50,13 +78,13 @@ public static void CreatePivotForSpringBones() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } if (Selection.gameObjects.Length < 1) { - Debug.LogError("一つ以上のオブジェクトを選択してください。"); + Debug.LogError(Styles.logSelectOneOrMoreObjects); return; } @@ -73,13 +101,13 @@ public static void AddToOrUpdateSpringManagerInSelection() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } if (Selection.gameObjects.Length <= 0) { - Debug.LogError("一つ以上のオブジェクトを選択してください。"); + Debug.LogError(Styles.logSelectOneOrMoreObjects); return; } @@ -105,22 +133,20 @@ public static void DeleteSpringBonesAndManagers() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } if (Selection.gameObjects.Length != 1) { - Debug.LogError("一つだけのルートオブジェクトを選択してください"); + Debug.LogError(Styles.logSelectOneOrMoreObjects); return; } var rootObject = Selection.gameObjects.First(); - var queryMessage = "本当にこのオブジェクトとその子供に入っている全ての\n" - + "スプリングボーンとスプリングマネージャーを削除しますか?\n\n" - + rootObject.name; + var queryMessage = string.Format(Styles.textConfirmRemoveAllBoneAndManagerFormat, rootObject.name); if (EditorUtility.DisplayDialog( - "スプリングボーンとマネージャーを削除", queryMessage, "削除", "キャンセル")) + Styles.textDeleteSpringBoneAndManager, queryMessage, Styles.textDelete, Styles.textCancel)) { SpringBoneSetup.DestroySpringManagersAndBones(rootObject); AssetDatabase.Refresh(); @@ -135,7 +161,7 @@ public static void DeleteSelectedBones() var springManagersToUpdate = GameObjectUtil.FindComponentsOfType() .Where(manager => manager.springBones.Any(bone => springBonesToDelete.Contains(bone))) .ToArray(); - Undo.RecordObjects(springManagersToUpdate, "Delete selected bones"); + Undo.RecordObjects(springManagersToUpdate, Styles.textDeleteSelectedBones); foreach (var boneToDelete in springBonesToDelete) { Undo.DestroyObjectImmediate(boneToDelete); @@ -150,7 +176,7 @@ public static void PromptToUpdateSpringBonesFromList() { if (Application.isPlaying) { - Debug.LogError("再生中に更新できません"); + Debug.LogError(Styles.logStopPlayMode); return; } @@ -165,16 +191,14 @@ public static void PromptToUpdateSpringBonesFromList() if (selectedSpringManagers.Count() != 1) { - Debug.LogError("一つだけのSpringManagerを選択してください"); + Debug.LogError(Styles.logSelectOnlyOneSpringManager); return; } var springManager = selectedSpringManagers.First(); - var queryMessage = "ボーンリストから揺れものボーンを更新しますか?\n\n" - + "リストにないSpringBone情報は削除され、\n" - + "モデルにないSpringBone情報は追加されます。\n\n" - + "SpringManager: " + springManager.name; - if (EditorUtility.DisplayDialog("ボーンリストから更新", queryMessage, "更新", "キャンセル")) + var queryMessage = string.Format(Styles.textConfirmUpdateBonesFromListFormat, springManager.name); + + if (EditorUtility.DisplayDialog(Styles.textUpdateFromBoneList, queryMessage, Styles.textUpdate, Styles.textCancel)) { AutoSpringBoneSetup.UpdateSpringManagerFromBoneList(springManager); } diff --git a/Editor/SpringColliderEditorActions.cs b/Editor/SpringColliderEditorActions.cs index f459801..b52dcf9 100755 --- a/Editor/SpringColliderEditorActions.cs +++ b/Editor/SpringColliderEditorActions.cs @@ -3,16 +3,34 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public static class SpringColliderEditorActions { + private static class Styles + { + public static readonly string logStopPlayMode = Localization.Tr("You must stop Playmode first."); + public static readonly string textAlignCapsulesToParent = Localization.Tr("Align capsules to parents"); + public static readonly string textConfirmDeleteCollisions = Localization.Tr("Do you really want to remove collisions from selected SpringBones?"); + public static readonly string textRemoveCollisions = Localization.Tr("Remove Collisions"); + public static readonly string textRemove = Localization.Tr("Remove"); + public static readonly string textCancel = Localization.Tr("Cancel"); + public static readonly string textRemoveDuplicateComponents = Localization.Tr("Remove duplicate components"); + public static readonly string textCleanupSpringBone = Localization.Tr("Cleanup SpringBones"); + public static readonly string textConfirmDynamicCleanup = Localization.Tr("Do you really want to cleanup dynamics?"); + public static readonly string textCleanupDynamics = Localization.Tr("Cleanup Dynamics"); + public static readonly string textRemoveAllChildColliders = Localization.Tr("Remove all selected child colliders"); + public static readonly string textConfirmRemoveAllChildColliders = Localization.Tr("Do you really want to remove all colliders from children?"); + public static readonly string textRemoveSelectedColliders = Localization.Tr("Remove Colliders"); + } + public static IList CreateObjectsWithComponentBeneathSelectedObjects(string suffix) where T : Component { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return new List(); } @@ -43,7 +61,7 @@ public static void AlignCapsulesToParents(IEnumerable cap var undoObjects = new List(); undoObjects.AddRange(capsules.Select(item => (Object)item)); undoObjects.AddRange(capsules.Select(item => (Object)item.transform)); - Undo.RecordObjects(undoObjects.ToArray(), "Align capsules to parents"); + Undo.RecordObjects(undoObjects.ToArray(), Styles.textAlignCapsulesToParent); foreach (var capsule in capsules) { capsule.transform.localPosition = Vector3.zero; @@ -96,7 +114,7 @@ public static void DeleteCollidersFromSelectedSpringBones() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } @@ -105,10 +123,10 @@ public static void DeleteCollidersFromSelectedSpringBones() .Where(bone => bone != null); if (!selectedBones.Any()) { return; } - var queryMessage = "本当に選択SpringBoneのコリジョンを削除しますか?"; - if (EditorUtility.DisplayDialog("コリジョンを削除", queryMessage, "削除", "キャンセル")) + var queryMessage = Styles.textConfirmDeleteCollisions; + if (EditorUtility.DisplayDialog(Styles.textConfirmDeleteCollisions, queryMessage, Styles.textRemove, Styles.textCancel)) { - Undo.RecordObjects(selectedBones.ToArray(), "コリジョンを削除"); + Undo.RecordObjects(selectedBones.ToArray(), Styles.textRemoveCollisions); foreach (var springBone in selectedBones) { springBone.RemoveAllColliders(); @@ -120,14 +138,14 @@ public static void DeleteAllChildCollidersFromSelection() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } if (Selection.gameObjects.Length == 0) { return; } - var queryMessage = "本当に選択中のオブジェクトの全子供のコライダーを削除しますか?"; - if (!EditorUtility.DisplayDialog("選択コライダーを削除", queryMessage, "削除", "キャンセル")) + var queryMessage = Styles.textConfirmRemoveAllChildColliders; + if (!EditorUtility.DisplayDialog(Styles.textRemoveSelectedColliders, queryMessage, Styles.textRemove, Styles.textCancel)) { return; } @@ -158,7 +176,7 @@ public static void DeleteAllChildCollidersFromSelection() var undoObjects = new List(springBones.Select(item => (Object)item)); undoObjects.AddRange(deadColliders.Select(item => (Object)item)); undoObjects.AddRange(probablyDeadGameObjects.Select(item => (Object)item)); - Undo.RecordObjects(undoObjects.ToArray(), "Remove all selected child colliders"); + Undo.RecordObjects(undoObjects.ToArray(), Styles.textRemoveAllChildColliders); foreach (var springBone in springBones) { @@ -182,15 +200,15 @@ public static void CleanUpDynamics() { if (Application.isPlaying) { - Debug.LogError("再生モードを止めてください。"); + Debug.LogError(Styles.logStopPlayMode); return; } var springManagers = GameObjectUtil.FindComponentsOfType(); if (!springManagers.Any()) { return; } - var queryMessage = "本当にダイナミクスのクリーンナップを行いますか?"; - if (EditorUtility.DisplayDialog("ダイナミクスクリーンナップ", queryMessage, "削除", "キャンセル")) + var queryMessage = Styles.textConfirmDynamicCleanup; + if (EditorUtility.DisplayDialog(Styles.textCleanupDynamics, queryMessage, Styles.textRemove, Styles.textCancel)) { RemoveDuplicateComponents(); RemoveDuplicateComponents(); @@ -239,7 +257,7 @@ public static void CleanUpDynamics() } // Next remove all empty entries from SpringBones - Undo.RecordObjects(springBones.ToArray(), "SpringBone cleanup"); + Undo.RecordObjects(springBones.ToArray(), Styles.textCleanupSpringBone); foreach (var springBone in springBones) { springBone.capsuleColliders = springBone.capsuleColliders.Where(item => item != null).ToArray(); @@ -265,7 +283,7 @@ private static void RemoveDuplicateComponents() where T : Component .Where(item => item.GetComponents().Length > 1); if (duplicateObjects.Any()) { - Undo.RecordObjects(duplicateObjects.ToArray(), "Remove duplicate components"); + Undo.RecordObjects(duplicateObjects.ToArray(), Styles.textRemoveDuplicateComponents); foreach (var transform in duplicateObjects) { var components = transform.GetComponents(); diff --git a/Editor/Utility/FindGameObjectsWindow.cs b/Editor/Utility/FindGameObjectsWindow.cs index 01b84eb..b68bd45 100755 --- a/Editor/Utility/FindGameObjectsWindow.cs +++ b/Editor/Utility/FindGameObjectsWindow.cs @@ -3,15 +3,27 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class FindGameObjectsWindow : EditorWindow { - [MenuItem("UTJ/名前で選択窓")] + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("Name Selector Tool"); + + public static readonly string textName = Localization.Tr("Name"); + public static readonly string textIgnore = Localization.Tr("Ignore"); + public static readonly string textComponent = Localization.Tr("Component"); + public static readonly string textSelect = Localization.Tr("Select"); + public static readonly string textSelectingMultipleObjectFormat = Localization.Tr("Selecting {0} objects"); + } + + [MenuItem("Window/Animation/SpringBone/Name Selector Tool")] public static void ShowWindow() { - var window = GetWindow("名前で選択"); + var window = GetWindow(Styles.editorWindowTitle); window.OnShow(); } @@ -278,18 +290,18 @@ private void OnGUI() var rowWidth = position.width - Spacing * 2f; var fieldPositions = GetTextFieldPositions(Spacing, Spacing, rowWidth, RowHeight, Spacing); - DoTextFieldWithClearButton(ref fieldPositions, "名前", ref objectPattern, RestartSearchCountdown, SearchNameField); + DoTextFieldWithClearButton(ref fieldPositions, Styles.textName, ref objectPattern, RestartSearchCountdown, SearchNameField); fieldPositions.y += RowOffset; - DoTextFieldWithClearButton(ref fieldPositions, "無視", ref ignorePattern, RestartSearchCountdown); + DoTextFieldWithClearButton(ref fieldPositions, Styles.textIgnore, ref ignorePattern, RestartSearchCountdown); fieldPositions.y += RowOffset; - DoTextFieldWithClearButton(ref fieldPositions, "コンポーネント", ref componentPattern, RestartSearchCountdown); + DoTextFieldWithClearButton(ref fieldPositions, Styles.textComponent, ref componentPattern, RestartSearchCountdown); fieldPositions.y += RowOffset; var rowRect = new Rect(fieldPositions.x, fieldPositions.y, rowWidth, RowHeight); - if (GUI.Button(rowRect, "選択")) { FindAndSelectObjects(); } + if (GUI.Button(rowRect, Styles.textSelect)) { FindAndSelectObjects(); } rowRect.y += RowOffset; - var message = Selection.objects.Length.ToString() + " 個のオブジェクトを選択中"; + var message = string.Format(Styles.textSelectingMultipleObjectFormat, Selection.objects.Length); GUI.Label(rowRect, message); if (isInitialShow) diff --git a/Editor/Utility/SetObjectParentWindow.cs b/Editor/Utility/SetObjectParentWindow.cs index 9db5374..e137e49 100755 --- a/Editor/Utility/SetObjectParentWindow.cs +++ b/Editor/Utility/SetObjectParentWindow.cs @@ -1,15 +1,25 @@ using System.Linq; using UnityEditor; using UnityEngine; +using UnityEditor.Localization.Editor; namespace Unity.Animations.SpringBones { public class SetObjectParentWindow : EditorWindow { - [MenuItem("UTJ/親子付け")] + private static class Styles + { + public static readonly string editorWindowTitle = Localization.Tr("Parenting Tool"); + + public static readonly GUIContent labelNewParent = new GUIContent(Localization.Tr("New Parent")); + public static readonly GUIContent labelSetParent = new GUIContent(Localization.Tr("Set Parent")); + } + + + [MenuItem("Window/Animation/SpringBone/Parenting Tool")] public static void ShowWindow() { - GetWindow("親子付け"); + GetWindow(Styles.editorWindowTitle); } // private @@ -31,9 +41,9 @@ private void ReparentSelectedObjects() private void OnGUI() { EditorGUILayout.Space(); - newParent = EditorGUILayout.ObjectField("新しい親", newParent, typeof(Transform), true) as Transform; + newParent = EditorGUILayout.ObjectField(Styles.labelNewParent, newParent, typeof(Transform), true) as Transform; EditorGUILayout.Space(); - if (GUILayout.Button("親子付け")) + if (GUILayout.Button(Styles.labelSetParent)) { ReparentSelectedObjects(); } diff --git a/Editor/ja.po b/Editor/ja.po new file mode 100644 index 0000000..23cdb57 --- /dev/null +++ b/Editor/ja.po @@ -0,0 +1,383 @@ +msgid "" +msgstr "" +"POT-Creation-Date: Tue Jul 15 2020 05:00:00 GMT+0000 (Coordinated Universal " +"Time)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.3\n" +"Language: ja\n" +"Project-Id-Version: 54\n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" + +# MenuItem +msgid "Parenting Tool" +msgstr "親子付けツール" + +# MenuItem +msgid "Name Selector Tool" +msgstr "名前選択ツール" + +# MenuItem +msgid "SpringBone" +msgstr "スプリングボーン" + +msgid "Loading Configuration" +msgstr "読み込み設定" + +msgid "Cancel" +msgstr "キャンセル" + +msgid "Set up from CSV file" +msgstr "CSVを読み込んでセットアップ" + +msgid "Select root from selection" +msgstr "選択からルートを取得" + +msgid "SpringBone root" +msgstr "スプリングボーンのルート" + +msgid "Collider" +msgstr "コライダー" + +msgid "Do not setup in Play Mode" +msgstr "再生モードでセットアップしないでください" + +msgid "Select parent object of the spring bone" +msgstr "スプリングボーンの親オブジェクトを指定してください" + +msgid "Load spring bone setup" +msgstr "スプリングボーンセットアップを読み込む" + +msgid "" +"Set up complete:{0}\n" +"Number of bones: {1} Number of colliders: {2}" +msgstr "" +"セットアップ完了: {0}\n" +"ボーン数: {1} コライダー数: {2}" + +msgid "CSV File" +msgstr "CSVファイル" + +msgid "Text File" +msgstr "テキストファイル" + +msgid "" +"SpringBone setup failed.\n" +"Souce data may contain errors,\n" +"or the data don't match the character.\n" +"Please refer console logs for further info.\n" +"\n" +"Character: {0}\n" +"\n" +"Path: {1}" +msgstr "" +"スプリングボーンセットアップが失敗しました。\n" +"元データにエラーがあるか、もしくは\n" +"キャラクターにデータが一致しません。\n" +"詳しくはConsoleのログをご覧下さい。\n" +"\n" +"キャラクター: {0}\n" +"\n" +"パス: {1}" + +msgid "SpringBone Setup" +msgstr "スプリングボーンセットアップ" + +msgid "SpringBone Setup failed:{0}\nPath:{1}" +msgstr "スプリングボーンセットアップ失敗:{0}\nPath:{1}" + +msgid "SpringBone Mirror" +msgstr "SpringBoneミラー" + +msgid "Do Mirror" +msgstr "ミラーを行う" + +msgid "Get from selection" +msgstr "選択から取得" + +msgid "Select All" +msgstr "全選択" + +msgid "Select all copy destination" +msgstr "コピー先を全選択" + +msgid "Select all copy source" +msgstr "コピー元を全選択" + +msgid "Set bone where X > 0" +msgstr "X > 0のボーンを元に設定" + +msgid "Set bone where X < 0" +msgstr "X < 0のボーンを元に設定" + +msgid "Source" +msgstr "元" + +msgid "→ Destination" +msgstr "→ 先" + +msgid "Save SpringBone Setup" +msgstr "スプリングボーンセットアップを保存" + +msgid "Export Setting" +msgstr "書き出し設定" + +msgid "Get root from selection" +msgstr "選択からルートを取得" + +msgid "Save to CSV" +msgstr "CSVを保存" + +msgid "" +"File already exists. Overwrite?\n" +"\n" +msgstr "" +"ファイルは既に存在します。上書きしますか?\n" +"\n" + +msgid "Save SpringBone" +msgstr "スプリングボーン保存" + +msgid "Overwrite" +msgstr "上書き" + +msgid "Saved.: {0}" +msgstr "保存しました: {0}" + +msgid "Setup Dynamics" +msgstr "ダイナミクスセットアップ" + +msgid "" +"There are errors in dynamics setup. Do you want to create only ones without " +"error(s)?" +msgstr "" +"ダイナミクスセットアップに一部エラーが出ているものがあります。正常なものだけ" +"作成しますか?" + +msgid "SpringBone Root" +msgstr "スプリングボーンのルート" + +msgid "Collider Root" +msgstr "コライダーのルート" + +msgid "Path" +msgstr "パス" + +msgid "Create" +msgstr "作成" + +msgid "Error" +msgstr "エラー" + +msgid "Select by name" +msgstr "名前で選択" + +msgid "" +"Icon load failed:\n" +" Path:{0}" +msgstr "" +"アイコン読み込み失敗:\n" +" パス:{0}" + +msgid "SpringBoneWindow icon directory not found" +msgstr "SpringBoneWindowのアイコンディレクトリーが見つかりません" + +msgid "Load" +msgstr "読み込む" + +msgid "Save" +msgstr "保存" + +msgid "Dynamics CSV" +msgstr "ダイナミクスCSV" + +msgid "" +"Add\n" +"SpringBone" +msgstr "" +"スプリング\n" +"ボーン追加" + +msgid "Create Origin" +msgstr "基点作成" + +msgid "Create or Update Manager" +msgstr "マネージャーを作成/更新" + +msgid "Do Initial Setup" +msgstr "初期セットアップを行う" + +msgid "Fit to initial bone list" +msgstr "初期ボーンリストに合わせる" + +msgid "Mirror SpringBones" +msgstr "スプリングボーンをミラー" + +msgid "Select this and child bones" +msgstr "選択と子供のスプリングボーンを選択" + +msgid "Delete SpringBone" +msgstr "選択スプリングボーンを削除" + +msgid "Delete Managers and Bones of Selection and Children" +msgstr "選択と子供のマネージャーとボーンを削除" + +msgid "Collision" +msgstr "コリジョン" + +msgid "Sphere" +msgstr "球体" + +msgid "Capsule" +msgstr "カプセル" + +msgid "Quad" +msgstr "板" + +msgid "Fit capsule place to parent" +msgstr "カプセルの位置を親に合わせる" + +msgid "Exclude collision from SpringBone" +msgstr "スプリングボーンからコリジョンを外す" + +msgid "Delete collider of selection and children" +msgstr "選択と子供のコライダーを削除" + +msgid "Cleanup" +msgstr "クリーンナップ" + +msgid "Show" +msgstr "表示" + +msgid "Show only selected bones" +msgstr "選択ボーンのみ表示" + +msgid "Show bone collisions" +msgstr "ボーンのコリジョンを表示" + +msgid "Show only selected colliders" +msgstr "選択コライダーのみ表示" + +msgid "Show bone names" +msgstr "ボーン名を表示" + +msgid "Selecting {0} objects" +msgstr "{0} 個のオブジェクトを選択中" + +msgid "Set Parent" +msgstr "親子付け" + +msgid "New Parent" +msgstr "新しい親" + +msgid "Dynamics bone not found:{0}" +msgstr "ダイナミクス骨が見つかりません:{0}" + +msgid "Stop Play Mode" +msgstr "再生モードを止めてください" + +msgid "Select one or more objects." +msgstr "一つ以上のオブジェクトを選択してください。" + +msgid "Select only one root object" +msgstr "一つだけのルートオブジェクトを選択してください" + +msgid "" +"Do you really want to remove all\n" +"SpringBones and managers under this object?\n" +"\n{0}" +msgstr "" +"本当にこのオブジェクトとその子供に入っている全ての\n" +"スプリングボーンとスプリングマネージャーを削除しますか?\n" +"\n{0}" + +msgid "Delete SpringBone and Manager" +msgstr "スプリングボーンとマネージャーを削除" + +msgid "Delete" +msgstr "削除" + +msgid "Can't update while in Play Mode" +msgstr "再生中に更新できません" + +msgid "Select only one SpringManager" +msgstr "一つだけのSpringManagerを選択してください" + +msgid "" +"Do you want to update secondary bones from bone list?\n" +"\n" +"This will remove all SpringBones that are not listed,\n" +"and will add SpringBones missing in model.\n" +"\n" +"SpringManager: {0}\n" +msgstr "" +"ボーンリストから揺れものボーンを更新しますか?\n" +"\n" +"リストにないSpringBone情報は削除され、\n" +"モデルにないSpringBone情報は追加されます。\n" +"\n" +"SpringManager: {0}\n" + +msgid "Update from bone list" +msgstr "ボーンリストから更新" + +msgid "Update" +msgstr "更新" + +msgid "Ignore" +msgstr "無視" + +msgid "Component" +msgstr "コンポーネント" + +msgid "Name" +msgstr "名前" + +msgid "Select" +msgstr "選択" + +msgid "New Parent" +msgstr "新しい親" + +msgid "You must stop Playmode first." +msgstr "この操作を行うには、プレイモードを停止してください。" + +msgid "Align capsules to parents" +msgstr "カプセルを親に合わせる" + +msgid "Do you really want to remove collisions from selected SpringBones?" +msgstr "本当に選択SpringBoneのコリジョンを削除しますか?" + +msgid "Remove Collisions" +msgstr "コリジョンを削除" + +msgid "Remove duplicate components" +msgstr "重複したコンポーネントを削除" + +msgid "Cleanup SpringBones" +msgstr "スプリングボーンをクリーンアップ" + +msgid "Do you really want to cleanup dynamics?" +msgstr "本当にダイナミクスのクリーンアップを行いますか?" + +msgid "Cleanup Dynamics" +msgstr "ダイナミクスをクリーンアップ" + +msgid "Remove all selected child colliders" +msgstr "選択中の子のコライダーを全て削除" + +msgid "Do you really want to remove all colliders from children?" +msgstr "本当に選択中のオブジェクトの全子供のコライダーを削除しますか?" + +msgid "Remove Colliders" +msgstr "コライダーを削除" + +msgid "Remove" +msgstr "削除" + +msgid "Delete selected bones" +msgstr "選択したボーンを削除" diff --git a/Editor/ja.po.meta b/Editor/ja.po.meta new file mode 100644 index 0000000..b175db6 --- /dev/null +++ b/Editor/ja.po.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 32c431e98808145fdb3cfb443a74f97f +LocalizationImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 5c87fd2d15a582f7967e2ef372e00607c2a06bb4 Mon Sep 17 00:00:00 2001 From: Hiroki Omae Date: Wed, 2 Dec 2020 12:51:42 +0900 Subject: [PATCH 02/16] update package version and supported Unity version due to localization support --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6e2ad13..196b97a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "com.unity.springbone", "displayName": "Unity Chan Spring Bone", - "version": "1.1.0-preview", - "unity": "2018.3", + "version": "1.2.0-preview", + "unity": "2019.4", "description": "Sping Bone System for lightweight secondary animations.", "keywords": ["animation"], "category": "Animation", From 8e3a10554637d02422250892513596c23bfb68f3 Mon Sep 17 00:00:00 2001 From: Hiroki Omae Date: Thu, 10 Dec 2020 10:51:40 +0900 Subject: [PATCH 03/16] fixed assembly issue during build --- Editor/com.unity.animations.springbone.editor.asmdef | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Editor/com.unity.animations.springbone.editor.asmdef b/Editor/com.unity.animations.springbone.editor.asmdef index f406c98..2964823 100644 --- a/Editor/com.unity.animations.springbone.editor.asmdef +++ b/Editor/com.unity.animations.springbone.editor.asmdef @@ -3,12 +3,15 @@ "references": [ "com.unity.animations.springbone" ], - "optionalUnityReferences": [], - "includePlatforms": [], + "includePlatforms": [ + "Editor" + ], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file From 24f4b29ab7646c69de8120409d87f056162a3836 Mon Sep 17 00:00:00 2001 From: riina <54872398+riina@users.noreply.github.com> Date: Thu, 8 Apr 2021 23:47:04 -0700 Subject: [PATCH 04/16] Add conditional localization import Localization API moved in 2020.1 and 2020.2 --- Editor/AssmblyInfo.cs | 6 +++++- Editor/AutoSpringBoneSetup.cs | 6 +++++- Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs | 6 +++++- Editor/GUI/Windows/MirrorSpringBoneWindow.cs | 6 +++++- Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs | 6 +++++- Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs | 6 +++++- Editor/GUI/Windows/SpringBoneWindow.cs | 6 +++++- Editor/SpringBoneEditorActions.cs | 6 +++++- Editor/SpringColliderEditorActions.cs | 6 +++++- Editor/Utility/FindGameObjectsWindow.cs | 6 +++++- Editor/Utility/SetObjectParentWindow.cs | 6 +++++- 11 files changed, 55 insertions(+), 11 deletions(-) diff --git a/Editor/AssmblyInfo.cs b/Editor/AssmblyInfo.cs index 6915ff6..955ca8c 100644 --- a/Editor/AssmblyInfo.cs +++ b/Editor/AssmblyInfo.cs @@ -1,3 +1,7 @@ -using UnityEditor.Localization.Editor; +#if UNITY_2020_1_OR_NEWER +using Localization = UnityEditor.LocalizationAttribute; +#else +using Localization = UnityEditor.Localization.Editor.LocalizationAttribute; +#endif [assembly: Localization] \ No newline at end of file diff --git a/Editor/AutoSpringBoneSetup.cs b/Editor/AutoSpringBoneSetup.cs index 07d1a13..2f0ca90 100755 --- a/Editor/AutoSpringBoneSetup.cs +++ b/Editor/AutoSpringBoneSetup.cs @@ -3,7 +3,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs index 8497952..d2a754e 100755 --- a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs @@ -1,7 +1,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs index 589f592..6781f9e 100755 --- a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs +++ b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs @@ -3,7 +3,11 @@ using UnityEditor; using UnityEngine; using Unity.Animations.SpringBones.GameObjectExtensions; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs b/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs index 4e74b76..5ab245e 100755 --- a/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs @@ -2,7 +2,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs index ca4a053..38775a9 100755 --- a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs +++ b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs @@ -2,7 +2,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/GUI/Windows/SpringBoneWindow.cs b/Editor/GUI/Windows/SpringBoneWindow.cs index ed29281..14ac210 100755 --- a/Editor/GUI/Windows/SpringBoneWindow.cs +++ b/Editor/GUI/Windows/SpringBoneWindow.cs @@ -2,7 +2,11 @@ using Unity.Collections; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/SpringBoneEditorActions.cs b/Editor/SpringBoneEditorActions.cs index 6ba8ad7..02ac2dd 100755 --- a/Editor/SpringBoneEditorActions.cs +++ b/Editor/SpringBoneEditorActions.cs @@ -3,7 +3,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/SpringColliderEditorActions.cs b/Editor/SpringColliderEditorActions.cs index b52dcf9..b3a8f2a 100755 --- a/Editor/SpringColliderEditorActions.cs +++ b/Editor/SpringColliderEditorActions.cs @@ -3,7 +3,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/Utility/FindGameObjectsWindow.cs b/Editor/Utility/FindGameObjectsWindow.cs index b68bd45..0e48b10 100755 --- a/Editor/Utility/FindGameObjectsWindow.cs +++ b/Editor/Utility/FindGameObjectsWindow.cs @@ -3,7 +3,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { diff --git a/Editor/Utility/SetObjectParentWindow.cs b/Editor/Utility/SetObjectParentWindow.cs index e137e49..4fc72b0 100755 --- a/Editor/Utility/SetObjectParentWindow.cs +++ b/Editor/Utility/SetObjectParentWindow.cs @@ -1,7 +1,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -using UnityEditor.Localization.Editor; +#if UNITY_2020_2_OR_NEWER +using Localization = UnityEditor.L10n; +#else +using Localization = UnityEditor.Localization.Editor.Localization; +#endif namespace Unity.Animations.SpringBones { From 123bdf0ef0918f137ff65eab4513ce3f45de52b7 Mon Sep 17 00:00:00 2001 From: riina <54872398+riina@users.noreply.github.com> Date: Tue, 14 Sep 2021 15:14:19 -0700 Subject: [PATCH 05/16] Mark v1.2.0-preview.0 (unlikely name) --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcb106e..612e24d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.2.0-preview.0] - 2021-9-14 +### Changed +- Added *conditional* localization attribute definiion. Fixes editor script import on 2020.3 while preserving functions on 2019.4. + ## [1.1.0] - 2019-10-31 *This is the first version of UnityChan Spring Bone in the package form.* diff --git a/package.json b/package.json index 196b97a..a93ce39 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.springbone", "displayName": "Unity Chan Spring Bone", - "version": "1.2.0-preview", + "version": "1.2.0-preview.0", "unity": "2019.4", "description": "Sping Bone System for lightweight secondary animations.", "keywords": ["animation"], From 443811a90e0ee826e13c20072f7b7675f811598d Mon Sep 17 00:00:00 2001 From: riina <54872398+riina@users.noreply.github.com> Date: Sat, 25 Sep 2021 00:12:45 -0700 Subject: [PATCH 06/16] Adjust version to 1.2.1-preview.0 Technically based off 1.2.1-preview, but package manifest originally listed 1.2.0-preview --- CHANGELOG.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 612e24d..c01c422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [1.2.0-preview.0] - 2021-9-14 +## [1.2.1-preview.0] - 2021-9-14 ### Changed -- Added *conditional* localization attribute definiion. Fixes editor script import on 2020.3 while preserving functions on 2019.4. +- Added *conditional* localization attribute definition. Fixes editor script import on 2020.3 while preserving functions on 2019.4. ## [1.1.0] - 2019-10-31 *This is the first version of UnityChan Spring Bone in the package form.* diff --git a/package.json b/package.json index a93ce39..d0d51cc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.springbone", "displayName": "Unity Chan Spring Bone", - "version": "1.2.0-preview.0", + "version": "1.2.1-preview.0", "unity": "2019.4", "description": "Sping Bone System for lightweight secondary animations.", "keywords": ["animation"], From 715ee38f22ea024eaad912e87674d86603ae3659 Mon Sep 17 00:00:00 2001 From: tyfkda Date: Fri, 15 Oct 2021 21:02:53 +0900 Subject: [PATCH 07/16] Consider model scale (#11) Even if the model is scaled, the size of the gizmo will not be scaled. So you can't set the collision. This change will take scale into account and fix it to work correctly. --- Runtime/Colliders/SpringCapsuleCollider.cs | 6 +++--- Runtime/Colliders/SpringPanelCollider.cs | 4 ++-- Runtime/Colliders/SpringSphereCollider.cs | 4 ++-- Runtime/SpringBone.cs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Runtime/Colliders/SpringCapsuleCollider.cs b/Runtime/Colliders/SpringCapsuleCollider.cs index b012277..0e43911 100755 --- a/Runtime/Colliders/SpringCapsuleCollider.cs +++ b/Runtime/Colliders/SpringCapsuleCollider.cs @@ -147,7 +147,7 @@ public void DrawGizmos(Color drawColor) endRingPoints = new Vector3[PointCount]; } - var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformVector(radius, 0f, 0f).magnitude; var startCapOrigin = transform.position; var endCapOrigin = transform.TransformPoint(0f, height, 0f); @@ -221,7 +221,7 @@ private void DrawPickBox() var start = transform.position; var end = transform.TransformPoint(0f, height, 0f); var center = 0.5f * (start + end); - var worldRadius = 1.5f * transform.TransformDirection(radius, 0f, 0f).magnitude; + var worldRadius = 1.5f * transform.TransformVector(radius, 0f, 0f).magnitude; var size = new Vector3( Mathf.Abs(end.x - start.x) + worldRadius, Mathf.Abs(end.y - start.y) + worldRadius, @@ -259,7 +259,7 @@ SpringBone.CollisionStatus collisionStatus var localContactPoint = new Vector3(originToContactPoint.x, localMoverPosition.y, originToContactPoint.z); var worldContactPoint = transform.TransformPoint(localContactPoint); var worldNormal = transform.TransformDirection(localNormal).normalized; - var worldRadius = transform.TransformDirection(localMoverRadius, 0f, 0f).magnitude; + var worldRadius = transform.TransformVector(localMoverRadius, 0f, 0f).magnitude; m_colliderDebugger.RecordCollision( worldContactPoint, worldNormal, diff --git a/Runtime/Colliders/SpringPanelCollider.cs b/Runtime/Colliders/SpringPanelCollider.cs index 2af6ba1..6e22219 100755 --- a/Runtime/Colliders/SpringPanelCollider.cs +++ b/Runtime/Colliders/SpringPanelCollider.cs @@ -32,14 +32,14 @@ ref Vector3 hitNormal } var localTailPosition = transform.InverseTransformPoint(tailPosition); - var localTailRadius = transform.InverseTransformDirection(tailRadius, 0f, 0f).magnitude; + var localTailRadius = transform.InverseTransformVector(tailRadius, 0f, 0f).magnitude; if (localTailPosition.z >= localTailRadius) { return SpringBone.CollisionStatus.NoCollision; } var localHeadPosition = transform.InverseTransformPoint(headPosition); - var localLength = transform.InverseTransformDirection(length, 0f, 0f).magnitude; + var localLength = transform.InverseTransformVector(length, 0f, 0f).magnitude; var halfWidth = 0.5f * width; var halfHeight = 0.5f * height; diff --git a/Runtime/Colliders/SpringSphereCollider.cs b/Runtime/Colliders/SpringSphereCollider.cs index a0d53af..7dabef3 100755 --- a/Runtime/Colliders/SpringSphereCollider.cs +++ b/Runtime/Colliders/SpringSphereCollider.cs @@ -20,7 +20,7 @@ ref Vector3 hitNormal { var localHeadPosition = transform.InverseTransformPoint(headPosition); var localTailPosition = transform.InverseTransformPoint(tailPosition); - var localTailRadius = transform.InverseTransformDirection(tailRadius, 0f, 0f).magnitude; + var localTailRadius = transform.InverseTransformVector(tailRadius, 0f, 0f).magnitude; #if UNITY_EDITOR var originalLocalTailPosition = localTailPosition; @@ -141,7 +141,7 @@ public static Vector3 ComputeNewTailPosition(Circle3 intersection, Vector3 tailP public void DrawGizmos(Color drawColor) { - var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformVector(radius, 0f, 0f).magnitude; // For picking Gizmos.color = new Color(0f, 0f, 0f, 0f); Gizmos.DrawWireSphere(transform.position, worldRadius); diff --git a/Runtime/SpringBone.cs b/Runtime/SpringBone.cs index 96ee1dd..784988c 100755 --- a/Runtime/SpringBone.cs +++ b/Runtime/SpringBone.cs @@ -264,7 +264,7 @@ private bool CheckForCollision() { var desiredPosition = currTipPos; var headPosition = transform.position; - var scaledRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; + var scaledRadius = transform.TransformVector(radius, 0f, 0f).magnitude; var hitNormal = new Vector3(0f, 0f, 1f); var hadCollision = false; @@ -333,7 +333,7 @@ private bool CheckForGroundCollision() // Todo: this assumes a flat ground parallel to the xz plane var worldHeadPosition = transform.position; var worldTailPosition = currTipPos; - var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformVector(radius, 0f, 0f).magnitude; var worldLength = (currTipPos - worldHeadPosition).magnitude; var groundHeight = manager.groundHeight; worldHeadPosition.y -= groundHeight; @@ -432,7 +432,7 @@ private Vector3 ApplyLengthLimits(float deltaTime) public void DrawSpringBoneCollision() { var childPosition = ComputeChildPosition(); - var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformVector(radius, 0f, 0f).magnitude; // For picking Gizmos.DrawSphere(childPosition, worldRadius); From e6a5df35884e8927f0a57a454653eaecb3d42206 Mon Sep 17 00:00:00 2001 From: YuukiARIA Date: Fri, 15 Oct 2021 21:15:42 +0900 Subject: [PATCH 08/16] Call SpringBoneGUIStyles.ReacquireStyles() on SpringBonePivotInspector (#12) --- Editor/GUI/Inspectors/SpringBonePivotInspector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Editor/GUI/Inspectors/SpringBonePivotInspector.cs b/Editor/GUI/Inspectors/SpringBonePivotInspector.cs index 8f8cc7d..42b91e1 100755 --- a/Editor/GUI/Inspectors/SpringBonePivotInspector.cs +++ b/Editor/GUI/Inspectors/SpringBonePivotInspector.cs @@ -13,6 +13,7 @@ public override void OnInspectorGUI() { InitializeData(); + SpringBoneGUIStyles.ReacquireStyles(); if (GUILayout.Button("ボーンを選択", SpringBoneGUIStyles.ButtonStyle)) { Selection.objects = bones.Select(bone => bone.gameObject).ToArray(); From f33712f1f40774f77cbeb5b6fc0a7f8032552c5c Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Fri, 15 Oct 2021 22:24:43 +0900 Subject: [PATCH 09/16] Updated CHANGELOG.md package.json Added upm-ci --- .yamato/upm-ci-SpringBone.yml | 76 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 19 +++++++-- package.json | 2 +- 3 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 .yamato/upm-ci-SpringBone.yml diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml new file mode 100644 index 0000000..42333ed --- /dev/null +++ b/.yamato/upm-ci-SpringBone.yml @@ -0,0 +1,76 @@ +yamato_name: SpringBone +test_editors: + - version: 2019.4 + - version: 2020.3 +test_platforms: + - name: win + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large +# - name: mac +# type: Unity::VM::osx +# image: buildfarm/mac:stable +# flavor: m1.mac +--- +pack: + name: Pack {{ yamato_name }} + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm + - upm-ci package pack + artifacts: + {{ yamato_name }}_pack_artifacts: + paths: + - "upm-ci~/**/*" + +{% for editor in test_editors %} +{% for platform in test_platforms %} +test_{{ platform.name }}_{{ editor.version }}: + name : Test {{ yamato_name }} using {{ editor.version }} on {{ platform.name }} + agent: + type: {{ platform.type }} + image: {{ platform.image }} + flavor: {{ platform.flavor}} + commands: + - npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm + - upm-ci package test --unity-version {{ editor.version }} + triggers: + branches: + only: + - "/.*/" + artifacts: + {{ yamato_name }}_test_results: + paths: + - "upm-ci~/test-results/**/*" + dependencies: + - .yamato/upm-ci-{{ yamato_name }}.yml#pack +{% endfor %} +{% endfor %} + +publish: + name: Publish {{ yamato_name }} to Internal Registry + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm + - upm-ci package publish + triggers: + tags: + only: + - /^(r|R)(c|C)-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/ + artifacts: + {{ yamato_name }}_publish_artifacts: + paths: + - "upm-ci~/packages/*.tgz" + dependencies: + - .yamato/upm-ci-{{ yamato_name }}.yml#pack + {% for editor in test_editors %} + {% for platform in test_platforms %} + - .yamato/upm-ci-{{ yamato_name }}.yml#test_{{ platform.name }}_{{ editor.version }} + {% endfor %} + {% endfor %} diff --git a/CHANGELOG.md b/CHANGELOG.md index c01c422..32ca477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,23 @@ # Changelog All notable changes to this package will be documented in this file. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.2.2] - 2021-10-15 +### Added +- *conditional* localization attribute definition. Fixes editor script import on 2020.3 while preserving functions on 2019.4. -## [1.2.1-preview.0] - 2021-9-14 +### Fixed +- Gizmos are not shown when scaled. +- Null pointer exception when SpringBonePivot is selected on the hierarchy. + + +## [1.2.1-preview] - 2020-12-10 +### Fixed +- Assembly issue during buid. + +## [1.2.0-preview] - 2020-12-02 ### Changed -- Added *conditional* localization attribute definition. Fixes editor script import on 2020.3 while preserving functions on 2019.4. +- Set default language to English. Except Inspector GUI yet. +- Minimum supported Unity version is 2019.4 ## [1.1.0] - 2019-10-31 *This is the first version of UnityChan Spring Bone in the package form.* diff --git a/package.json b/package.json index d0d51cc..90d1efc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.springbone", "displayName": "Unity Chan Spring Bone", - "version": "1.2.1-preview.0", + "version": "1.2.2", "unity": "2019.4", "description": "Sping Bone System for lightweight secondary animations.", "keywords": ["animation"], From 9ec7b9437dda67012c8718e1fa310d2167799179 Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Fri, 15 Oct 2021 22:41:55 +0900 Subject: [PATCH 10/16] Re-added some to CHANGELOG.md. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32ca477..e1f5565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog All notable changes to this package will be documented in this file. +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [1.2.2] - 2021-10-15 ### Added From e0e98476d5ba7c9491519e9555fdc2ee6284ba35 Mon Sep 17 00:00:00 2001 From: Toshiyuki Mori Date: Fri, 15 Oct 2021 23:10:13 +0900 Subject: [PATCH 11/16] Updated upm-ci file to check web-hook on GitHub. --- .yamato/upm-ci-SpringBone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml index 42333ed..40cdd18 100644 --- a/.yamato/upm-ci-SpringBone.yml +++ b/.yamato/upm-ci-SpringBone.yml @@ -2,6 +2,7 @@ yamato_name: SpringBone test_editors: - version: 2019.4 - version: 2020.3 + - version: 2021.1 test_platforms: - name: win type: Unity::VM From 6eda966beb7f887353e58b5ed294129205dd2297 Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Sat, 16 Oct 2021 06:10:59 +0900 Subject: [PATCH 12/16] updated upm-ci-SpringBone.yml --- .yamato/upm-ci-SpringBone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml index 40cdd18..1156255 100644 --- a/.yamato/upm-ci-SpringBone.yml +++ b/.yamato/upm-ci-SpringBone.yml @@ -1,6 +1,8 @@ yamato_name: SpringBone test_editors: - version: 2019.4 + - version: 2020.1 + - version: 2020.2 - version: 2020.3 - version: 2021.1 test_platforms: From 9741dd71cbb2b6d8981482394bb404ac6a9ba322 Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Sat, 16 Oct 2021 11:04:50 +0900 Subject: [PATCH 13/16] Set up tentative enviroment just to make the project can pass yamato-ci.test. --- .gitattributes | 5 ++++ .yamato/upm-ci-SpringBone.yml | 10 +++---- Documentation~/index.md | 12 ++++++++ Tests/Editor.meta | 8 ++++++ Tests/Editor/NewTestScript.cs | 28 +++++++++++++++++++ Tests/Editor/NewTestScript.cs.meta | 11 ++++++++ .../Unity.Springbone.Tests.Editor.asmdef | 22 +++++++++++++++ .../Unity.Springbone.Tests.Editor.asmdef.meta | 7 +++++ 8 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 .gitattributes create mode 100644 Documentation~/index.md create mode 100644 Tests/Editor.meta create mode 100644 Tests/Editor/NewTestScript.cs create mode 100644 Tests/Editor/NewTestScript.cs.meta create mode 100644 Tests/Editor/Unity.Springbone.Tests.Editor.asmdef create mode 100644 Tests/Editor/Unity.Springbone.Tests.Editor.asmdef.meta diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2bbf64f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +/.* export-ignore +/Documentation~ export-ignore +/Tests export-ignore + + diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml index 1156255..f4e5dd8 100644 --- a/.yamato/upm-ci-SpringBone.yml +++ b/.yamato/upm-ci-SpringBone.yml @@ -1,8 +1,6 @@ yamato_name: SpringBone test_editors: - version: 2019.4 - - version: 2020.1 - - version: 2020.2 - version: 2020.3 - version: 2021.1 test_platforms: @@ -10,10 +8,10 @@ test_platforms: type: Unity::VM image: package-ci/win10:stable flavor: b1.large -# - name: mac -# type: Unity::VM::osx -# image: buildfarm/mac:stable -# flavor: m1.mac + - name: mac + type: Unity::VM::osx + image: buildfarm/mac:stable + flavor: m1.mac --- pack: name: Pack {{ yamato_name }} diff --git a/Documentation~/index.md b/Documentation~/index.md new file mode 100644 index 0000000..1056e51 --- /dev/null +++ b/Documentation~/index.md @@ -0,0 +1,12 @@ +>>> +**_Springbone Documentation_** + +Work in progress + +## Document revision history +>>> + +|Date|Reason| +|---|---| +|Oct 16, 2021|Document created. Matches package version 1.2.2-preview| +>>> diff --git a/Tests/Editor.meta b/Tests/Editor.meta new file mode 100644 index 0000000..0e142e2 --- /dev/null +++ b/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 699cda04c9d44324db6d60e77838f827 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Editor/NewTestScript.cs b/Tests/Editor/NewTestScript.cs new file mode 100644 index 0000000..f16e70c --- /dev/null +++ b/Tests/Editor/NewTestScript.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.TestTools; + +namespace Tests +{ + public class NewTestScript + { + // A Test behaves as an ordinary method + [Test] + public void NewTestScriptSimplePasses() + { + // Use the Assert class to test conditions + } + + // A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use + // `yield return null;` to skip a frame. + [UnityTest] + public IEnumerator NewTestScriptWithEnumeratorPasses() + { + // Use the Assert class to test conditions. + // Use yield to skip a frame. + yield return null; + } + } +} diff --git a/Tests/Editor/NewTestScript.cs.meta b/Tests/Editor/NewTestScript.cs.meta new file mode 100644 index 0000000..d13b8a1 --- /dev/null +++ b/Tests/Editor/NewTestScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29b05809868220346acdc899c15495d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef b/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef new file mode 100644 index 0000000..f53742c --- /dev/null +++ b/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef @@ -0,0 +1,22 @@ +{ + "name": "Unity.Springbone.Tests.Editor", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef.meta b/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef.meta new file mode 100644 index 0000000..f01755c --- /dev/null +++ b/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6bded67ef16ee2a41b4a0e8a467ed6fb +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From e5d5a1429b7c1c8bf166dabab7f63302c05ceac9 Mon Sep 17 00:00:00 2001 From: Toshiyuki Mori Date: Sat, 16 Oct 2021 11:26:52 +0900 Subject: [PATCH 14/16] Fixed: old mac build farm in upm-ci --- .yamato/upm-ci-SpringBone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml index f4e5dd8..46549dd 100644 --- a/.yamato/upm-ci-SpringBone.yml +++ b/.yamato/upm-ci-SpringBone.yml @@ -10,7 +10,7 @@ test_platforms: flavor: b1.large - name: mac type: Unity::VM::osx - image: buildfarm/mac:stable + image: package-ci/mac:stable flavor: m1.mac --- pack: From 08e337f8127fd4b714f3748acd5aa50e8cdba7db Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Sat, 16 Oct 2021 11:49:35 +0900 Subject: [PATCH 15/16] Added Tests.meta to avoid yamato-ci errors. --- Tests.meta | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Tests.meta diff --git a/Tests.meta b/Tests.meta new file mode 100644 index 0000000..721eeb5 --- /dev/null +++ b/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ef86cb67fc1f03d46b608902bad1bf53 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From ce52e968dbc25797c19a117fb50c88e53e8366b6 Mon Sep 17 00:00:00 2001 From: tohsiyuki Date: Sat, 16 Oct 2021 12:40:46 +0900 Subject: [PATCH 16/16] added Tests.meta to .gitattribute --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 2bbf64f..4376f4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ /.* export-ignore /Documentation~ export-ignore /Tests export-ignore +/Tests.meta export-ignore