diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 4376f4f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -/.* export-ignore -/Documentation~ export-ignore -/Tests export-ignore -/Tests.meta export-ignore - - diff --git a/.yamato/upm-ci-SpringBone.yml b/.yamato/upm-ci-SpringBone.yml deleted file mode 100644 index 46549dd..0000000 --- a/.yamato/upm-ci-SpringBone.yml +++ /dev/null @@ -1,77 +0,0 @@ -yamato_name: SpringBone -test_editors: - - version: 2019.4 - - version: 2020.3 - - version: 2021.1 -test_platforms: - - name: win - type: Unity::VM - image: package-ci/win10:stable - flavor: b1.large - - name: mac - type: Unity::VM::osx - image: package-ci/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 e1f5565..bcb106e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,26 +1,9 @@ # 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. - -### 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 -- 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/Documentation~/index.md b/Documentation~/index.md deleted file mode 100644 index 1056e51..0000000 --- a/Documentation~/index.md +++ /dev/null @@ -1,12 +0,0 @@ ->>> -**_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/Editor/AssmblyInfo.cs b/Editor/AssmblyInfo.cs deleted file mode 100644 index 955ca8c..0000000 --- a/Editor/AssmblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -#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/AssmblyInfo.cs.meta b/Editor/AssmblyInfo.cs.meta deleted file mode 100644 index 1c02fdf..0000000 --- a/Editor/AssmblyInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 2f0ca90..7a75aa5 100755 --- a/Editor/AutoSpringBoneSetup.cs +++ b/Editor/AutoSpringBoneSetup.cs @@ -3,11 +3,6 @@ using System.Linq; using UnityEditor; using UnityEngine; -#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/Inspectors/SpringBonePivotInspector.cs b/Editor/GUI/Inspectors/SpringBonePivotInspector.cs index 42b91e1..8f8cc7d 100755 --- a/Editor/GUI/Inspectors/SpringBonePivotInspector.cs +++ b/Editor/GUI/Inspectors/SpringBonePivotInspector.cs @@ -13,7 +13,6 @@ public override void OnInspectorGUI() { InitializeData(); - SpringBoneGUIStyles.ReacquireStyles(); if (GUILayout.Button("ボーンを選択", SpringBoneGUIStyles.ButtonStyle)) { Selection.objects = bones.Select(bone => bone.gameObject).ToArray(); diff --git a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs index d2a754e..6346254 100755 --- a/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/LoadSpringBoneSetupWindow.cs @@ -1,50 +1,15 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(Styles.editorWindowTitle); + var editorWindow = GetWindow( + "スプリングボーンセットアップを読み込む"); if (editorWindow != null) { editorWindow.SelectObjectsFromSelection(); @@ -70,6 +35,8 @@ 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; @@ -107,11 +74,11 @@ private void ShowImportSettingsUI(ref Rect uiRect) importSettings = new DynamicsSetup.ImportSettings(); } - GUI.Label(uiRect, Styles.labelLoadingConfig, SpringBoneGUIStyles.HeaderLabelStyle); + GUI.Label(uiRect, "読み込み設定", SpringBoneGUIStyles.HeaderLabelStyle); uiRect.y += uiRect.height; - importSettings.ImportSpringBones = GUI.Toggle(uiRect, importSettings.ImportSpringBones, Styles.labelSpringBone, SpringBoneGUIStyles.ToggleStyle); + importSettings.ImportSpringBones = GUI.Toggle(uiRect, importSettings.ImportSpringBones, "スプリングボーン", SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; - importSettings.ImportCollision = GUI.Toggle(uiRect, importSettings.ImportCollision, Styles.labelCollider, SpringBoneGUIStyles.ToggleStyle); + importSettings.ImportCollision = GUI.Toggle(uiRect, importSettings.ImportCollision, "コライダー", SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; } @@ -123,9 +90,9 @@ private void OnGUI() var uiWidth = (int)position.width - UISpacing * 2; var yPos = UISpacing; - springBoneRoot = DoObjectPicker(Styles.labelSpringBoneRoot, springBoneRoot, uiWidth, UIRowHeight, ref yPos); + springBoneRoot = DoObjectPicker("スプリングボーンのルート", springBoneRoot, uiWidth, UIRowHeight, ref yPos); var buttonRect = new Rect(UISpacing, yPos, uiWidth, ButtonHeight); - if (GUI.Button(buttonRect, Styles.labelSelectFromRoot, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, "選択からルートを取得", SpringBoneGUIStyles.ButtonStyle)) { SelectObjectsFromSelection(); } @@ -137,7 +104,7 @@ private void OnGUI() string errorMessage; if (IsOkayToSetup(out errorMessage)) { - if (GUI.Button(buttonRect, Styles.labelSetupLoadCSV, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, "CSVを読み込んでセットアップ", SpringBoneGUIStyles.ButtonStyle)) { BrowseAndLoadSpringSetup(); } @@ -155,13 +122,13 @@ private bool IsOkayToSetup(out string errorMessage) errorMessage = ""; if (EditorApplication.isPlaying) { - errorMessage = Styles.stopPlayModeMessage; + errorMessage = StopPlayModeMessage; return false; } if (springBoneRoot == null) { - errorMessage = Styles.selectObjectRootsMessage; + errorMessage = SelectObjectRootsMessage; return false; } return true; @@ -202,10 +169,11 @@ 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(Styles.resultFormat, path, boneCount, colliderCount); + var resultMessage = string.Format(ResultFormat, path, boneCount, colliderCount); Debug.Log(resultMessage); } @@ -216,7 +184,8 @@ public void Perform() private void BrowseAndLoadSpringSetup() { - if (!IsOkayToSetup(out var checkErrorMessage)) + string checkErrorMessage; + if (!IsOkayToSetup(out checkErrorMessage)) { Debug.LogError(checkErrorMessage); return; @@ -224,9 +193,9 @@ private void BrowseAndLoadSpringSetup() // var initialPath = ""; var initialDirectory = ""; // System.IO.Path.GetDirectoryName(initialPath); - var fileFilters = new string[] { Styles.csvFile, "csv", Styles.textFile, "txt" }; + var fileFilters = new string[] { "CSVファイル", "csv", "テキストファイル", "txt" }; var path = EditorUtility.OpenFilePanelWithFilters( - Styles.loadSpringBoneSetup, initialDirectory, fileFilters); + "スプリングボーンセットアップを読み込む", initialDirectory, fileFilters); if (path.Length == 0) { return; } var sourceText = FileUtil.ReadAllText(path); @@ -247,10 +216,16 @@ private void BrowseAndLoadSpringSetup() } else { - 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); + 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); } Close(); } diff --git a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs index 6781f9e..0eb7e7f 100755 --- a/Editor/GUI/Windows/MirrorSpringBoneWindow.cs +++ b/Editor/GUI/Windows/MirrorSpringBoneWindow.cs @@ -3,35 +3,14 @@ using UnityEditor; using UnityEngine; using Unity.Animations.SpringBones.GameObjectExtensions; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(Styles.editorWindowTitle); + var window = GetWindow("SpringBoneミラー"); window.Show(); window.OnShow(); } @@ -78,7 +57,7 @@ private void OnGUI() uiRect = ShowUtilityButtons(uiRect); uiRect = ShowBoneList(uiRect); - if (GUI.Button(uiRect, Styles.labelDoMirror, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, "ミラーを行う", SpringBoneGUIStyles.ButtonStyle)) { PerformMirror(); } @@ -87,7 +66,7 @@ private void OnGUI() private Rect ShowUtilityButtons(Rect uiRect) { var buttonOffset = uiRect.height + Spacing; - if (GUI.Button(uiRect, Styles.labelGetFromSelection, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, "選択から取得", SpringBoneGUIStyles.ButtonStyle)) { AcquireBonesFromSelection(); } @@ -95,12 +74,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, Styles.labelConfigXlZero, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, "X < 0のボーンを元に設定", SpringBoneGUIStyles.ButtonStyle)) { AcquireSourceBonesOnSideOfAxis(true); } halfButtonRect.x += halfRectWidth + Spacing; - if (GUI.Button(halfButtonRect, Styles.labelConfigXbZero, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, "X > 0のボーンを元に設定", SpringBoneGUIStyles.ButtonStyle)) { AcquireSourceBonesOnSideOfAxis(false); } @@ -108,20 +87,20 @@ private Rect ShowUtilityButtons(Rect uiRect) halfButtonRect.x = uiRect.x; halfButtonRect.y = uiRect.y; - if (GUI.Button(halfButtonRect, Styles.labelSelectAllCopySrc, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, "コピー元を全選択", 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, Styles.labelSelectAllCopyDst, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(halfButtonRect, "コピー先を全選択", 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, Styles.labelSelectAll, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(uiRect, "全選択", SpringBoneGUIStyles.ButtonStyle)) { var bonesToSelect = new List(); bonesToSelect.AddRange(boneEntries.Select(entry => entry.sourceBone).Where(bone => bone != null)); @@ -138,9 +117,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, Styles.labelSrc, SpringBoneGUIStyles.LabelStyle); + GUI.Label(headerRowRect, "元", SpringBoneGUIStyles.LabelStyle); headerRowRect.x += headerRowRect.width; - GUI.Label(headerRowRect, Styles.labelDst, SpringBoneGUIStyles.LabelStyle); + GUI.Label(headerRowRect, "→ 先", 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 5ab245e..5df218c 100755 --- a/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs +++ b/Editor/GUI/Windows/SaveSpringBoneSetupWindow.cs @@ -1,38 +1,15 @@ -using System; -using System.Linq; +using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(Styles.editorWindowTitle); + var editorWindow = GetWindow( + "スプリングボーンセットアップを保存"); if (editorWindow != null) { editorWindow.SelectObjectsFromSelection(); @@ -75,11 +52,11 @@ private void ShowExportSettingsUI(ref Rect uiRect) exportSettings = new SpringBoneSerialization.ExportSettings(); } - GUI.Label(uiRect, Styles.labelExportSetting, SpringBoneGUIStyles.HeaderLabelStyle); + GUI.Label(uiRect, "書き出し設定", SpringBoneGUIStyles.HeaderLabelStyle); uiRect.y += uiRect.height; - exportSettings.ExportSpringBones = GUI.Toggle(uiRect, exportSettings.ExportSpringBones, Styles.labelSpringBone, SpringBoneGUIStyles.ToggleStyle); + exportSettings.ExportSpringBones = GUI.Toggle(uiRect, exportSettings.ExportSpringBones, "スプリングボーン", SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; - exportSettings.ExportCollision = GUI.Toggle(uiRect, exportSettings.ExportCollision,Styles.labelCollider, SpringBoneGUIStyles.ToggleStyle); + exportSettings.ExportCollision = GUI.Toggle(uiRect, exportSettings.ExportCollision, "コライダー", SpringBoneGUIStyles.ToggleStyle); uiRect.y += uiRect.height; } @@ -95,9 +72,9 @@ private void OnGUI() var yPos = UISpacing; springBoneRoot = LoadSpringBoneSetupWindow.DoObjectPicker( - Styles.textSpringBoneRoot, springBoneRoot, uiWidth, UIRowHeight, ref yPos); + "スプリングボーンのルート", springBoneRoot, uiWidth, UIRowHeight, ref yPos); var buttonRect = new Rect(UISpacing, yPos, uiWidth, ButtonHeight); - if (GUI.Button(buttonRect, Styles.labelGetRootFromSelection, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, "選択からルートを取得", SpringBoneGUIStyles.ButtonStyle)) { SelectObjectsFromSelection(); } @@ -107,7 +84,7 @@ private void OnGUI() ShowExportSettingsUI(ref buttonRect); if (springBoneRoot != null) { - if (GUI.Button(buttonRect, Styles.labelSaveToCSV, SpringBoneGUIStyles.ButtonStyle)) + if (GUI.Button(buttonRect, "CSVを保存", SpringBoneGUIStyles.ButtonStyle)) { BrowseAndSaveSpringSetup(); } @@ -121,14 +98,13 @@ private void BrowseAndSaveSpringSetup() var initialFileName = springBoneRoot.name + "_Dynamics.csv"; var path = EditorUtility.SaveFilePanel( - Styles.textSaveSpringBoneSetup, "", initialFileName, "csv"); + "スプリングボーンセットアップを保存", "", initialFileName, "csv"); if (path.Length == 0) { return; } if (System.IO.File.Exists(path)) { - var overwriteMessage = string.Format(Styles.textFileOverwriteFormat, path); - if (!EditorUtility.DisplayDialog(Styles.textSaveSpringBone, overwriteMessage, Styles.textOverwrite, - Styles.textCancel)) + var overwriteMessage = "ファイルは既に存在します。上書きしますか?\n\n" + path; + if (!EditorUtility.DisplayDialog("スプリングボーン保存", overwriteMessage, "上書き", "キャンセル")) { return; } @@ -138,7 +114,7 @@ private void BrowseAndSaveSpringSetup() if (FileUtil.WriteAllText(path, sourceText)) { AssetDatabase.Refresh(); - Debug.LogFormat(Styles.textSavedFormat, path); + Debug.Log("保存しました: " + path); } } } diff --git a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs index 38775a9..c4762fc 100755 --- a/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs +++ b/Editor/GUI/Windows/SpringBoneSetupErrorWindow.cs @@ -2,29 +2,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(); @@ -39,7 +21,7 @@ public static void ShowWindow IConfirmAction onConfirm ) { - var window = GetWindow(Styles.editorWindowTitle); + var window = GetWindow("ダイナミクスセットアップ"); window.springBoneRoot = springBoneRoot; window.colliderRoot = colliderRoot; window.filePath = path; @@ -59,23 +41,23 @@ IConfirmAction onConfirm private void OnGUI() { EditorGUILayout.Space(); - GUILayout.Label(Styles.labelAskDynamicError); + GUILayout.Label("ダイナミクスセットアップに一部エラーが出ているものがあります。正常なものだけ作成しますか?"); EditorGUILayout.Space(); - EditorGUILayout.ObjectField(Styles.labelSpringBoneRoot, springBoneRoot, typeof(GameObject), true); - EditorGUILayout.ObjectField(Styles.labelColliderRoot, colliderRoot, typeof(GameObject), true); - EditorGUILayout.TextField(Styles.labelPath, filePath); + EditorGUILayout.ObjectField("スプリングボーンのルート", springBoneRoot, typeof(GameObject), true); + EditorGUILayout.ObjectField("コライダーのルート", colliderRoot, typeof(GameObject), true); + EditorGUILayout.TextField("パス", filePath); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); - if (GUILayout.Button(Styles.labelCreate)) + if (GUILayout.Button("作成")) { onConfirmAction.Perform(); Close(); } - if (GUILayout.Button(Styles.labelCancel)) { Close(); } + if (GUILayout.Button("キャンセル")) { Close(); } GUILayout.EndHorizontal(); EditorGUILayout.Space(); - GUILayout.Label(Styles.labelError); + GUILayout.Label("エラー"); 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 14ac210..90ba895 100755 --- a/Editor/GUI/Windows/SpringBoneWindow.cs +++ b/Editor/GUI/Windows/SpringBoneWindow.cs @@ -1,58 +1,15 @@ using System.Linq; -using Unity.Collections; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif namespace Unity.Animations.SpringBones { public class SpringBoneWindow : EditorWindow { - 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")] + [MenuItem("UTJ/スプリングボーン窓")] public static void ShowWindow() { - var window = GetWindow(Styles.editorWindowTitle); + var window = GetWindow("スプリングボーン"); window.OnShow(); } @@ -79,24 +36,41 @@ private static Texture LoadIcon(string iconDirectory, string filename) var iconTexture = AssetDatabase.LoadAssetAtPath(iconPath); if (iconTexture == null) { - Debug.LogFormat(LogType.Warning, LogOption.None, null, Styles.logIconDirNotFound, iconPath); + Debug.LogWarning("アイコン読み込み失敗:\n" + 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; } - 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"); + 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"); } private void InitializeButtonGroups() @@ -112,48 +86,48 @@ private void InitializeButtonGroups() { new GUIElements.Column(new GUIElements.IElement[] { - new GUIElements.Label(Styles.labelDynamicCSV, headerLabelStyleProvider), + new GUIElements.Label("ダイナミクスCSV", headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Button(Styles.labelLoad, LoadSpringBoneSetupWindow.ShowWindow, openDocumentIcon, buttonLabelStyleProvider), - new GUIElements.Button(Styles.labelSave, SaveSpringBoneSetupWindow.ShowWindow, saveDocumentIcon, buttonLabelStyleProvider) + new GUIElements.Button("読み込む", LoadSpringBoneSetupWindow.ShowWindow, openDocumentIcon, buttonLabelStyleProvider), + new GUIElements.Button("保存", SaveSpringBoneSetupWindow.ShowWindow, saveDocumentIcon, buttonLabelStyleProvider) }, BigButtonHeight) }), new GUIElements.Column(new GUIElements.IElement[] { - new GUIElements.Label(Styles.labelSpringBone, headerLabelStyleProvider), + new GUIElements.Label("スプリングボーン", headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - new GUIElements.Button(Styles.labelSpringBoneAdd, SpringBoneEditorActions.AssignSpringBonesRecursively, headerIcon, buttonLabelStyleProvider), - new GUIElements.Button(Styles.labelCreateOrigin, SpringBoneEditorActions.CreatePivotForSpringBones, pivotIcon, buttonLabelStyleProvider) + new GUIElements.Button("スプリング\nボーン追加", SpringBoneEditorActions.AssignSpringBonesRecursively, headerIcon, buttonLabelStyleProvider), + new GUIElements.Button("基点作成", SpringBoneEditorActions.CreatePivotForSpringBones, pivotIcon, buttonLabelStyleProvider) }, BigButtonHeight), - new GUIElements.Button(Styles.labelCreateManager, SpringBoneEditorActions.AddToOrUpdateSpringManagerInSelection, newDocumentIcon, buttonLabelStyleProvider), + new GUIElements.Button("マネージャーを作成/更新", SpringBoneEditorActions.AddToOrUpdateSpringManagerInSelection, newDocumentIcon, buttonLabelStyleProvider), //new GUIElements.Button("初期セットアップを行う", SpringBoneAutoSetupWindow.ShowWindow, newDocumentIcon, buttonLabelStyleProvider), //new GUIElements.Button("初期ボーンリストに合わせる", SpringBoneEditorActions.PromptToUpdateSpringBonesFromList, null, buttonLabelStyleProvider), new GUIElements.Separator(), - 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.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.Column(new GUIElements.IElement[] { - new GUIElements.Label(Styles.labelCollision, headerLabelStyleProvider), + new GUIElements.Label("コリジョン", headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - 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), + new GUIElements.Button("球体", SpringColliderEditorActions.CreateSphereColliderBeneathSelectedObjects, sphereIcon, buttonLabelStyleProvider), + new GUIElements.Button("カプセル", SpringColliderEditorActions.CreateCapsuleColliderBeneathSelectedObjects, capsuleIcon, buttonLabelStyleProvider), + new GUIElements.Button("板", SpringColliderEditorActions.CreatePanelColliderBeneathSelectedObjects, panelIcon, buttonLabelStyleProvider), }, BigButtonHeight), - 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) + 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) }) }, false, @@ -216,17 +190,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(Styles.labelShow, headerLabelStyleProvider), + new GUIElements.Label("表示", headerLabelStyleProvider), new GUIElements.Row(new GUIElements.IElement[] { - 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), + new GUIElements.Toggle("選択ボーンのみ表示", () => settings.onlyShowSelectedBones, newValue => { settings.onlyShowSelectedBones = newValue; needToRepaint = true; }, toggleStyleProvider), + new GUIElements.Toggle("ボーンのコリジョンを表示", () => settings.showBoneSpheres, newValue => { settings.showBoneSpheres = newValue; needToRepaint = true; }, toggleStyleProvider), }, GUIElements.RowHeight), new GUIElements.Row(new GUIElements.IElement[] { - 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) + new GUIElements.Toggle("選択コライダーのみ表示", () => settings.onlyShowSelectedColliders, newValue => { settings.onlyShowSelectedColliders = newValue; needToRepaint = true; }, toggleStyleProvider), + new GUIElements.Toggle("ボーン名を表示", () => settings.showBoneNames, newValue => { settings.showBoneNames = newValue; needToRepaint = true; }, toggleStyleProvider) }, GUIElements.RowHeight), }, diff --git a/Editor/SpringBoneEditorActions.cs b/Editor/SpringBoneEditorActions.cs index 02ac2dd..bcf3f31 100755 --- a/Editor/SpringBoneEditorActions.cs +++ b/Editor/SpringBoneEditorActions.cs @@ -3,43 +3,11 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(); @@ -49,13 +17,13 @@ public static void AssignSpringBonesRecursively() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } if (Selection.gameObjects.Length < 1) { - Debug.LogError(Styles.logSelectOneOrMoreObjects); + Debug.LogError("一つ以上のオブジェクトを選択してください。"); return; } @@ -82,13 +50,13 @@ public static void CreatePivotForSpringBones() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } if (Selection.gameObjects.Length < 1) { - Debug.LogError(Styles.logSelectOneOrMoreObjects); + Debug.LogError("一つ以上のオブジェクトを選択してください。"); return; } @@ -105,13 +73,13 @@ public static void AddToOrUpdateSpringManagerInSelection() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } if (Selection.gameObjects.Length <= 0) { - Debug.LogError(Styles.logSelectOneOrMoreObjects); + Debug.LogError("一つ以上のオブジェクトを選択してください。"); return; } @@ -137,20 +105,22 @@ public static void DeleteSpringBonesAndManagers() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } if (Selection.gameObjects.Length != 1) { - Debug.LogError(Styles.logSelectOneOrMoreObjects); + Debug.LogError("一つだけのルートオブジェクトを選択してください"); return; } var rootObject = Selection.gameObjects.First(); - var queryMessage = string.Format(Styles.textConfirmRemoveAllBoneAndManagerFormat, rootObject.name); + var queryMessage = "本当にこのオブジェクトとその子供に入っている全ての\n" + + "スプリングボーンとスプリングマネージャーを削除しますか?\n\n" + + rootObject.name; if (EditorUtility.DisplayDialog( - Styles.textDeleteSpringBoneAndManager, queryMessage, Styles.textDelete, Styles.textCancel)) + "スプリングボーンとマネージャーを削除", queryMessage, "削除", "キャンセル")) { SpringBoneSetup.DestroySpringManagersAndBones(rootObject); AssetDatabase.Refresh(); @@ -165,7 +135,7 @@ public static void DeleteSelectedBones() var springManagersToUpdate = GameObjectUtil.FindComponentsOfType() .Where(manager => manager.springBones.Any(bone => springBonesToDelete.Contains(bone))) .ToArray(); - Undo.RecordObjects(springManagersToUpdate, Styles.textDeleteSelectedBones); + Undo.RecordObjects(springManagersToUpdate, "Delete selected bones"); foreach (var boneToDelete in springBonesToDelete) { Undo.DestroyObjectImmediate(boneToDelete); @@ -180,7 +150,7 @@ public static void PromptToUpdateSpringBonesFromList() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生中に更新できません"); return; } @@ -195,14 +165,16 @@ public static void PromptToUpdateSpringBonesFromList() if (selectedSpringManagers.Count() != 1) { - Debug.LogError(Styles.logSelectOnlyOneSpringManager); + Debug.LogError("一つだけのSpringManagerを選択してください"); return; } var springManager = selectedSpringManagers.First(); - var queryMessage = string.Format(Styles.textConfirmUpdateBonesFromListFormat, springManager.name); - - if (EditorUtility.DisplayDialog(Styles.textUpdateFromBoneList, queryMessage, Styles.textUpdate, Styles.textCancel)) + var queryMessage = "ボーンリストから揺れものボーンを更新しますか?\n\n" + + "リストにないSpringBone情報は削除され、\n" + + "モデルにないSpringBone情報は追加されます。\n\n" + + "SpringManager: " + springManager.name; + if (EditorUtility.DisplayDialog("ボーンリストから更新", queryMessage, "更新", "キャンセル")) { AutoSpringBoneSetup.UpdateSpringManagerFromBoneList(springManager); } diff --git a/Editor/SpringColliderEditorActions.cs b/Editor/SpringColliderEditorActions.cs index b3a8f2a..f459801 100755 --- a/Editor/SpringColliderEditorActions.cs +++ b/Editor/SpringColliderEditorActions.cs @@ -3,38 +3,16 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif 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(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return new List(); } @@ -65,7 +43,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(), Styles.textAlignCapsulesToParent); + Undo.RecordObjects(undoObjects.ToArray(), "Align capsules to parents"); foreach (var capsule in capsules) { capsule.transform.localPosition = Vector3.zero; @@ -118,7 +96,7 @@ public static void DeleteCollidersFromSelectedSpringBones() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } @@ -127,10 +105,10 @@ public static void DeleteCollidersFromSelectedSpringBones() .Where(bone => bone != null); if (!selectedBones.Any()) { return; } - var queryMessage = Styles.textConfirmDeleteCollisions; - if (EditorUtility.DisplayDialog(Styles.textConfirmDeleteCollisions, queryMessage, Styles.textRemove, Styles.textCancel)) + var queryMessage = "本当に選択SpringBoneのコリジョンを削除しますか?"; + if (EditorUtility.DisplayDialog("コリジョンを削除", queryMessage, "削除", "キャンセル")) { - Undo.RecordObjects(selectedBones.ToArray(), Styles.textRemoveCollisions); + Undo.RecordObjects(selectedBones.ToArray(), "コリジョンを削除"); foreach (var springBone in selectedBones) { springBone.RemoveAllColliders(); @@ -142,14 +120,14 @@ public static void DeleteAllChildCollidersFromSelection() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } if (Selection.gameObjects.Length == 0) { return; } - var queryMessage = Styles.textConfirmRemoveAllChildColliders; - if (!EditorUtility.DisplayDialog(Styles.textRemoveSelectedColliders, queryMessage, Styles.textRemove, Styles.textCancel)) + var queryMessage = "本当に選択中のオブジェクトの全子供のコライダーを削除しますか?"; + if (!EditorUtility.DisplayDialog("選択コライダーを削除", queryMessage, "削除", "キャンセル")) { return; } @@ -180,7 +158,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(), Styles.textRemoveAllChildColliders); + Undo.RecordObjects(undoObjects.ToArray(), "Remove all selected child colliders"); foreach (var springBone in springBones) { @@ -204,15 +182,15 @@ public static void CleanUpDynamics() { if (Application.isPlaying) { - Debug.LogError(Styles.logStopPlayMode); + Debug.LogError("再生モードを止めてください。"); return; } var springManagers = GameObjectUtil.FindComponentsOfType(); if (!springManagers.Any()) { return; } - var queryMessage = Styles.textConfirmDynamicCleanup; - if (EditorUtility.DisplayDialog(Styles.textCleanupDynamics, queryMessage, Styles.textRemove, Styles.textCancel)) + var queryMessage = "本当にダイナミクスのクリーンナップを行いますか?"; + if (EditorUtility.DisplayDialog("ダイナミクスクリーンナップ", queryMessage, "削除", "キャンセル")) { RemoveDuplicateComponents(); RemoveDuplicateComponents(); @@ -261,7 +239,7 @@ public static void CleanUpDynamics() } // Next remove all empty entries from SpringBones - Undo.RecordObjects(springBones.ToArray(), Styles.textCleanupSpringBone); + Undo.RecordObjects(springBones.ToArray(), "SpringBone cleanup"); foreach (var springBone in springBones) { springBone.capsuleColliders = springBone.capsuleColliders.Where(item => item != null).ToArray(); @@ -287,7 +265,7 @@ private static void RemoveDuplicateComponents() where T : Component .Where(item => item.GetComponents().Length > 1); if (duplicateObjects.Any()) { - Undo.RecordObjects(duplicateObjects.ToArray(), Styles.textRemoveDuplicateComponents); + Undo.RecordObjects(duplicateObjects.ToArray(), "Remove duplicate components"); foreach (var transform in duplicateObjects) { var components = transform.GetComponents(); diff --git a/Editor/Utility/FindGameObjectsWindow.cs b/Editor/Utility/FindGameObjectsWindow.cs index 0e48b10..01b84eb 100755 --- a/Editor/Utility/FindGameObjectsWindow.cs +++ b/Editor/Utility/FindGameObjectsWindow.cs @@ -3,31 +3,15 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif namespace Unity.Animations.SpringBones { public class FindGameObjectsWindow : EditorWindow { - 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")] + [MenuItem("UTJ/名前で選択窓")] public static void ShowWindow() { - var window = GetWindow(Styles.editorWindowTitle); + var window = GetWindow("名前で選択"); window.OnShow(); } @@ -294,18 +278,18 @@ private void OnGUI() var rowWidth = position.width - Spacing * 2f; var fieldPositions = GetTextFieldPositions(Spacing, Spacing, rowWidth, RowHeight, Spacing); - DoTextFieldWithClearButton(ref fieldPositions, Styles.textName, ref objectPattern, RestartSearchCountdown, SearchNameField); + DoTextFieldWithClearButton(ref fieldPositions, "名前", ref objectPattern, RestartSearchCountdown, SearchNameField); fieldPositions.y += RowOffset; - DoTextFieldWithClearButton(ref fieldPositions, Styles.textIgnore, ref ignorePattern, RestartSearchCountdown); + DoTextFieldWithClearButton(ref fieldPositions, "無視", ref ignorePattern, RestartSearchCountdown); fieldPositions.y += RowOffset; - DoTextFieldWithClearButton(ref fieldPositions, Styles.textComponent, ref componentPattern, RestartSearchCountdown); + DoTextFieldWithClearButton(ref fieldPositions, "コンポーネント", ref componentPattern, RestartSearchCountdown); fieldPositions.y += RowOffset; var rowRect = new Rect(fieldPositions.x, fieldPositions.y, rowWidth, RowHeight); - if (GUI.Button(rowRect, Styles.textSelect)) { FindAndSelectObjects(); } + if (GUI.Button(rowRect, "選択")) { FindAndSelectObjects(); } rowRect.y += RowOffset; - var message = string.Format(Styles.textSelectingMultipleObjectFormat, Selection.objects.Length); + var message = Selection.objects.Length.ToString() + " 個のオブジェクトを選択中"; GUI.Label(rowRect, message); if (isInitialShow) diff --git a/Editor/Utility/SetObjectParentWindow.cs b/Editor/Utility/SetObjectParentWindow.cs index 4fc72b0..9db5374 100755 --- a/Editor/Utility/SetObjectParentWindow.cs +++ b/Editor/Utility/SetObjectParentWindow.cs @@ -1,29 +1,15 @@ using System.Linq; using UnityEditor; using UnityEngine; -#if UNITY_2020_2_OR_NEWER -using Localization = UnityEditor.L10n; -#else -using Localization = UnityEditor.Localization.Editor.Localization; -#endif namespace Unity.Animations.SpringBones { public class SetObjectParentWindow : EditorWindow { - 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")] + [MenuItem("UTJ/親子付け")] public static void ShowWindow() { - GetWindow(Styles.editorWindowTitle); + GetWindow("親子付け"); } // private @@ -45,9 +31,9 @@ private void ReparentSelectedObjects() private void OnGUI() { EditorGUILayout.Space(); - newParent = EditorGUILayout.ObjectField(Styles.labelNewParent, newParent, typeof(Transform), true) as Transform; + newParent = EditorGUILayout.ObjectField("新しい親", newParent, typeof(Transform), true) as Transform; EditorGUILayout.Space(); - if (GUILayout.Button(Styles.labelSetParent)) + if (GUILayout.Button("親子付け")) { ReparentSelectedObjects(); } diff --git a/Editor/com.unity.animations.springbone.editor.asmdef b/Editor/com.unity.animations.springbone.editor.asmdef index 2964823..f406c98 100644 --- a/Editor/com.unity.animations.springbone.editor.asmdef +++ b/Editor/com.unity.animations.springbone.editor.asmdef @@ -3,15 +3,12 @@ "references": [ "com.unity.animations.springbone" ], - "includePlatforms": [ - "Editor" - ], + "optionalUnityReferences": [], + "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false + "defineConstraints": [] } \ No newline at end of file diff --git a/Editor/ja.po b/Editor/ja.po deleted file mode 100644 index 23cdb57..0000000 --- a/Editor/ja.po +++ /dev/null @@ -1,383 +0,0 @@ -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 deleted file mode 100644 index b175db6..0000000 --- a/Editor/ja.po.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 32c431e98808145fdb3cfb443a74f97f -LocalizationImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Colliders/SpringCapsuleCollider.cs b/Runtime/Colliders/SpringCapsuleCollider.cs index 0e43911..b012277 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.TransformVector(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformDirection(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.TransformVector(radius, 0f, 0f).magnitude; + var worldRadius = 1.5f * transform.TransformDirection(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.TransformVector(localMoverRadius, 0f, 0f).magnitude; + var worldRadius = transform.TransformDirection(localMoverRadius, 0f, 0f).magnitude; m_colliderDebugger.RecordCollision( worldContactPoint, worldNormal, diff --git a/Runtime/Colliders/SpringPanelCollider.cs b/Runtime/Colliders/SpringPanelCollider.cs index 6e22219..2af6ba1 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.InverseTransformVector(tailRadius, 0f, 0f).magnitude; + var localTailRadius = transform.InverseTransformDirection(tailRadius, 0f, 0f).magnitude; if (localTailPosition.z >= localTailRadius) { return SpringBone.CollisionStatus.NoCollision; } var localHeadPosition = transform.InverseTransformPoint(headPosition); - var localLength = transform.InverseTransformVector(length, 0f, 0f).magnitude; + var localLength = transform.InverseTransformDirection(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 7dabef3..a0d53af 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.InverseTransformVector(tailRadius, 0f, 0f).magnitude; + var localTailRadius = transform.InverseTransformDirection(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.TransformVector(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformDirection(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 784988c..96ee1dd 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.TransformVector(radius, 0f, 0f).magnitude; + var scaledRadius = transform.TransformDirection(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.TransformVector(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformDirection(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.TransformVector(radius, 0f, 0f).magnitude; + var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude; // For picking Gizmos.DrawSphere(childPosition, worldRadius); diff --git a/Tests.meta b/Tests.meta deleted file mode 100644 index 721eeb5..0000000 --- a/Tests.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ef86cb67fc1f03d46b608902bad1bf53 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/Editor.meta b/Tests/Editor.meta deleted file mode 100644 index 0e142e2..0000000 --- a/Tests/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 699cda04c9d44324db6d60e77838f827 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Tests/Editor/NewTestScript.cs b/Tests/Editor/NewTestScript.cs deleted file mode 100644 index f16e70c..0000000 --- a/Tests/Editor/NewTestScript.cs +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index d13b8a1..0000000 --- a/Tests/Editor/NewTestScript.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index f53742c..0000000 --- a/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef +++ /dev/null @@ -1,22 +0,0 @@ -{ - "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 deleted file mode 100644 index f01755c..0000000 --- a/Tests/Editor/Unity.Springbone.Tests.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6bded67ef16ee2a41b4a0e8a467ed6fb -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/package.json b/package.json index 90d1efc..6e2ad13 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "com.unity.springbone", "displayName": "Unity Chan Spring Bone", - "version": "1.2.2", - "unity": "2019.4", + "version": "1.1.0-preview", + "unity": "2018.3", "description": "Sping Bone System for lightweight secondary animations.", "keywords": ["animation"], "category": "Animation",