Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix additional mesh paths not backed up #27

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Packages/jp.suzuryg.face-emo/Editor/Detail/FaceEmoBackupper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ private void BackupPath()
if (subAvatar != null) { _aV3Setting.SubTargetAvatarPaths.Add(subAvatar?.gameObject?.GetFullPath()); }
}

// Meshes
_aV3Setting.AdditionalSkinnedMeshPaths.Clear();
foreach (var mesh in _aV3Setting.AdditionalSkinnedMeshes)
{
if (mesh != null) { _aV3Setting.AdditionalSkinnedMeshPaths.Add(mesh.gameObject.GetFullPath()); }
}

// Toggles
_aV3Setting.AdditionalToggleObjectPaths.Clear();
foreach (var toggle in _aV3Setting.AdditionalToggleObjects)
Expand Down Expand Up @@ -182,6 +189,22 @@ private void RestorePath()
}
}

// Meshes
_aV3Setting.AdditionalSkinnedMeshes.Clear();
foreach (var path in _aV3Setting.AdditionalSkinnedMeshPaths)
{
if (path.StartsWith("/") &&
GameObject.Find(path) is GameObject gameObject && gameObject != null &&
gameObject.GetComponent<SkinnedMeshRenderer>() is SkinnedMeshRenderer skinnedMesh && skinnedMesh != null)
{
_aV3Setting.AdditionalSkinnedMeshes.Add(skinnedMesh);
}
else
{
Debug.LogError($"{_localizationTable.Backupper_Message_FailedToFindSkinnedMesh}\n{path}");
}
}

// Toggles
_aV3Setting.AdditionalToggleObjects.Clear();
foreach (var path in _aV3Setting.AdditionalToggleObjectPaths)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ public class LocalizationTable : ScriptableObject

public string Backupper_Message_FailedToFindTargetAvatar = "Failed to find tareget avatar. Make sure the avatar is active.";
public string Backupper_Message_FailedToFindSubTargetAvatar = "Failed to find sub tareget avatar. Make sure the avatar is active.";
public string Backupper_Message_FailedToFindSkinnedMesh = "Failed to find skinned mesh.";
public string Backupper_Message_FailedToFindToggleObject = "Failed to find toggle object.";
public string Backupper_Message_FailedToFindTransformObject = "Failed to find transform object.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ MonoBehaviour:
\u8FFD\u52A0\u3055\u308C\u308B\u30B7\u30A7\u30A4\u30D7\u30AD\u30FC\u306E\u5024\u306F\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5024\uFF08\u30B7\u30FC\u30F3\u4E0A\u3067\u8A2D\u5B9A\u3057\u305F\u5024\uFF09\u3068\u306A\u308A\u307E\u3059\u3002"
Backupper_Message_FailedToFindTargetAvatar: "\u5BFE\u8C61\u30A2\u30D0\u30BF\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30A2\u30D0\u30BF\u30FC\u304C\u30A2\u30AF\u30C6\u30A3\u30D6\u306B\u306A\u3063\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
Backupper_Message_FailedToFindSubTargetAvatar: "\u8868\u60C5\u30E1\u30CB\u30E5\u30FC\u540C\u6642\u9069\u7528\u5148\u306E\u30A2\u30D0\u30BF\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30A2\u30D0\u30BF\u30FC\u304C\u30A2\u30AF\u30C6\u30A3\u30D6\u306B\u306A\u3063\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
Backupper_Message_FailedToFindSkinnedMesh: "\u8FFD\u52A0\u8868\u60C5\u30E1\u30C3\u30B7\u30E5\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"
Backupper_Message_FailedToFindToggleObject: "\u8FFD\u52A0\u8868\u60C5\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8
(Toggle) \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002"
Backupper_Message_FailedToFindTransformObject: "\u8FFD\u52A0\u8868\u60C5\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class AV3Setting : ScriptableObject

public string TargetAvatarPath;
public List<string> SubTargetAvatarPaths = new List<string>();
public List<string> AdditionalSkinnedMeshPaths = new List<string>();
public List<string> AdditionalToggleObjectPaths = new List<string>();
public List<string> AdditionalTransformObjectPaths = new List<string>();

Expand Down