-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from amamagi/update/v0.33.1
update to v0.33.1
- Loading branch information
Showing
68 changed files
with
1,685 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Assets/VCI/UniVCI/Editor/IO/ComponentImporters/EditorPhysicsColliderImporter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using UniGLTF; | ||
using UnityEngine; | ||
|
||
namespace VCI | ||
{ | ||
public sealed class EditorPhysicsColliderImporter | ||
{ | ||
private readonly VciData _data; | ||
private readonly VCIImporter _context; | ||
private readonly UnityPath _prefabFilePath; | ||
|
||
private UnityPath AssetDir => _prefabFilePath.GetAssetFolder(".ColliderMeshes"); | ||
|
||
public EditorPhysicsColliderImporter(VciData vciData, VCIImporter context, UnityPath prefabFilePath) | ||
{ | ||
_data = vciData; | ||
_context = context; | ||
_prefabFilePath = prefabFilePath; | ||
} | ||
|
||
public void ExtractAssetFiles() | ||
{ | ||
// NOTE: MeshCollider の Mesh オブジェクトを保存する. | ||
foreach (var node in _context.Nodes) | ||
{ | ||
var meshCollider = node.gameObject.GetComponent<MeshCollider>(); | ||
if (meshCollider == null || meshCollider.sharedMesh == null) continue; | ||
|
||
AssetDir.EnsureFolder(); | ||
// NOTE: Collider Mesh の名前が VCI 内で一意であることを前提とする. | ||
var filePath = AssetDir.Child($"{meshCollider.sharedMesh.name}.asset"); | ||
if (filePath.LoadAsset<Mesh>() == null) | ||
{ | ||
filePath.CreateAsset(meshCollider.sharedMesh); | ||
} | ||
} | ||
} | ||
|
||
public void SetupAfterEditorDelayCall() | ||
{ | ||
// NOTE: MeshCollider の Mesh オブジェクトを、アセット下のものに差し替える. | ||
foreach (var node in _context.Nodes) | ||
{ | ||
var meshCollider = node.gameObject.GetComponent<MeshCollider>(); | ||
if (meshCollider == null || meshCollider.sharedMesh == null) continue; | ||
|
||
var filePath = AssetDir.Child($"{meshCollider.sharedMesh.name}.asset"); | ||
var mesh = filePath.LoadAsset<Mesh>(); | ||
meshCollider.sharedMesh = mesh; | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Assets/VCI/UniVCI/Editor/IO/ComponentImporters/EditorPhysicsColliderImporter.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.