mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-01 15:22:53 -05:00
ClothWarpLib.Components.ClothWarp to ClothWarpRoot
This commit is contained in:
@@ -111,7 +111,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
static bool TryAddGroupChildChild(
|
||||
Animator animator, HumanBodyBones humanBone,
|
||||
string[] targets, string[] excludes,
|
||||
out List<ClothWarpLib.Components.ClothWarp> group)
|
||||
out List<ClothWarpLib.Components.ClothWarpRoot> group)
|
||||
{
|
||||
var bone = animator.GetBoneTransform(humanBone);
|
||||
if (bone == null)
|
||||
@@ -121,7 +121,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ClothWarp> transforms = new();
|
||||
List<ClothWarpRoot> transforms = new();
|
||||
foreach (Transform child in bone)
|
||||
{
|
||||
foreach (Transform childchild in child)
|
||||
@@ -135,7 +135,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
{
|
||||
if (childchild.name.ToLower().Contains(target.ToLower()))
|
||||
{
|
||||
var warp = childchild.gameObject.AddComponent<ClothWarp>();
|
||||
var warp = childchild.gameObject.AddComponent<ClothWarpRoot>();
|
||||
// Name = name,
|
||||
// CollisionMask = mask,
|
||||
warp.BaseSettings.radius = 0.02f;
|
||||
@@ -158,7 +158,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
}
|
||||
|
||||
static bool TryAddGroup(Animator animator, HumanBodyBones humanBone, string[] targets,
|
||||
out List<ClothWarpLib.Components.ClothWarp> group)
|
||||
out List<ClothWarpLib.Components.ClothWarpRoot> group)
|
||||
{
|
||||
var bone = animator.GetBoneTransform(humanBone);
|
||||
if (bone == null)
|
||||
@@ -168,14 +168,14 @@ namespace UniVRM10.Cloth.Viewer
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ClothWarpLib.Components.ClothWarp> transforms = new();
|
||||
List<ClothWarpLib.Components.ClothWarpRoot> transforms = new();
|
||||
foreach (Transform child in bone)
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
if (child.name.ToLower().Contains(target.ToLower()))
|
||||
{
|
||||
var warp = child.gameObject.AddComponent<ClothWarp>();
|
||||
var warp = child.gameObject.AddComponent<ClothWarpRoot>();
|
||||
if (warp != null)
|
||||
{
|
||||
// CollisionMask = mask,
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
if (vrm.SpringBone.ColliderGroups.Count == 0)
|
||||
{
|
||||
HumanoidCollider.AddColliders(animator);
|
||||
var warps = animator.GetComponentsInChildren<ClothWarp>();
|
||||
var warps = animator.GetComponentsInChildren<ClothWarpRoot>();
|
||||
var colliderGroups = animator.GetComponentsInChildren<VRM10SpringBoneColliderGroup>();
|
||||
foreach (var warp in warps)
|
||||
{
|
||||
@@ -403,7 +403,7 @@ namespace UniVRM10.Cloth.Viewer
|
||||
else
|
||||
{
|
||||
ClothWarpRuntimeProvider.FromVrm10(vrm,
|
||||
go => go.AddComponent<ClothWarp>(),
|
||||
go => go.AddComponent<ClothWarpRoot>(),
|
||||
o => GameObject.DestroyImmediate(o));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ClothWarpLib.Components
|
||||
var undo = Undo.GetCurrentGroup();
|
||||
|
||||
Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo");
|
||||
ClothWarpRuntimeProvider.FromVrm10(instance, Undo.AddComponent<ClothWarp>, Undo.DestroyObjectImmediate);
|
||||
ClothWarpRuntimeProvider.FromVrm10(instance, Undo.AddComponent<ClothWarpRoot>, Undo.DestroyObjectImmediate);
|
||||
Undo.RegisterFullObjectHierarchyUndo(instance.gameObject, "RegisterFullObjectHierarchyUndo");
|
||||
|
||||
Undo.RegisterCompleteObjectUndo(provider, "RegisterCompleteObjectUndo");
|
||||
|
||||
@@ -9,10 +9,10 @@ using UniVRM10;
|
||||
|
||||
namespace ClothWarpLib.Components
|
||||
{
|
||||
[CustomEditor(typeof(ClothWarp))]
|
||||
[CustomEditor(typeof(ClothWarpRoot))]
|
||||
class WarpRootEditor : Editor
|
||||
{
|
||||
private ClothWarp m_target;
|
||||
private ClothWarpRoot m_target;
|
||||
private Vrm10Instance m_vrm;
|
||||
private MultiColumnTreeView m_treeview;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ClothWarpLib.Components
|
||||
return;
|
||||
}
|
||||
|
||||
m_target = (ClothWarp)target;
|
||||
m_target = (ClothWarpRoot)target;
|
||||
m_vrm = m_target.GetComponentInParent<Vrm10Instance>();
|
||||
}
|
||||
|
||||
@@ -85,14 +85,14 @@ namespace ClothWarpLib.Components
|
||||
s.SetEnabled(false);
|
||||
root.Add(s);
|
||||
}
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarp.BaseSettings) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarp.Center) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarpRoot.BaseSettings) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarpRoot.Center) });
|
||||
|
||||
// root.Add(new PropertyField { bindingPath = "m_particles" });
|
||||
{
|
||||
Func<int, bool> isCustom = (i) =>
|
||||
{
|
||||
return m_target.Particles[i].Mode == ClothWarp.ParticleMode.Custom;
|
||||
return m_target.Particles[i].Mode == ClothWarpRoot.ParticleMode.Custom;
|
||||
};
|
||||
|
||||
m_treeview = new MultiColumnTreeView();
|
||||
@@ -109,7 +109,7 @@ namespace ClothWarpLib.Components
|
||||
root.Add(m_treeview);
|
||||
}
|
||||
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarp.ColliderGroups) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(ClothWarpRoot.ColliderGroups) });
|
||||
|
||||
return root;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace ClothWarpLib.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (item is ClothWarp.Particle p)
|
||||
if (item is ClothWarpRoot.Particle p)
|
||||
{
|
||||
p = m_target.GetParticleFromTransform(p.Transform);
|
||||
var t = p.Transform;
|
||||
|
||||
@@ -71,8 +71,8 @@ namespace ClothWarpLib
|
||||
}
|
||||
|
||||
_initialized = false;
|
||||
var strandMap = new Dictionary<Components.ClothWarp, Strand>();
|
||||
var warps = vrm.GetComponentsInChildren<Components.ClothWarp>();
|
||||
var strandMap = new Dictionary<Components.ClothWarpRoot, Strand>();
|
||||
var warps = vrm.GetComponentsInChildren<Components.ClothWarpRoot>();
|
||||
foreach (var warp in warps)
|
||||
{
|
||||
var strands = new List<Strand>();
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace ClothWarpLib.Components
|
||||
public bool LoopIsClosed = false;
|
||||
|
||||
[SerializeField]
|
||||
public List<ClothWarp> Warps = new();
|
||||
public List<ClothWarpRoot> Warps = new();
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
for (int i = 0; i < transform.childCount; ++i)
|
||||
{
|
||||
var child = transform.GetChild(i);
|
||||
if (child.TryGetComponent<ClothWarp>(out var warp))
|
||||
if (child.TryGetComponent<ClothWarpRoot>(out var warp))
|
||||
{
|
||||
Warps.Add(warp);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace ClothWarpLib.Components
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWeft(ClothWarp w0, ClothWarp w1)
|
||||
void DrawWeft(ClothWarpRoot w0, ClothWarpRoot w1)
|
||||
{
|
||||
if (w0 == null || w1 == null)
|
||||
{
|
||||
|
||||
@@ -9,13 +9,13 @@ using UniVRM10;
|
||||
|
||||
namespace ClothWarpLib.Components
|
||||
{
|
||||
[AddComponentMenu("ClothWarp/ClothWarp")]
|
||||
[AddComponentMenu("ClothWarp/ClothWarpRoot")]
|
||||
[DisallowMultipleComponent]
|
||||
/// <summary>
|
||||
/// Warp の root にアタッチする。
|
||||
/// 子孫の Transform がすべて登録される。
|
||||
/// </summary>
|
||||
public class ClothWarp : MonoBehaviour
|
||||
public class ClothWarpRoot : MonoBehaviour
|
||||
{
|
||||
public static BlittableJointMutable DefaultSetting()
|
||||
{
|
||||
@@ -11,7 +11,7 @@ namespace ClothWarpLib.Components
|
||||
public class ClothWarpRuntimeProvider : MonoBehaviour, IVrm10SpringBoneRuntimeProvider
|
||||
{
|
||||
[SerializeField]
|
||||
public List<ClothWarp> Warps = new();
|
||||
public List<ClothWarpRoot> Warps = new();
|
||||
|
||||
[SerializeField]
|
||||
public List<ClothGrid> Cloths = new();
|
||||
@@ -31,7 +31,7 @@ namespace ClothWarpLib.Components
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Warps = GetComponentsInChildren<ClothWarp>().ToList();
|
||||
Warps = GetComponentsInChildren<ClothWarpRoot>().ToList();
|
||||
Cloths = GetComponentsInChildren<ClothGrid>().ToList();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace ClothWarpLib.Components
|
||||
}
|
||||
|
||||
public static void FromVrm10(Vrm10Instance instance,
|
||||
Func<GameObject, ClothWarp> addWarp,
|
||||
Func<GameObject, ClothWarpRoot> addWarp,
|
||||
Action<UnityEngine.Object> deleteObject)
|
||||
{
|
||||
foreach (var spring in instance.SpringBone.Springs)
|
||||
@@ -61,7 +61,7 @@ namespace ClothWarpLib.Components
|
||||
continue;
|
||||
}
|
||||
|
||||
var warp = root_joint.GetComponent<ClothWarp>();
|
||||
var warp = root_joint.GetComponent<ClothWarpRoot>();
|
||||
if (warp == null)
|
||||
{
|
||||
// var warp = Undo.AddComponent<Warp>(root_joint);
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace ClothWarpLib.Jobs
|
||||
List<TransformInfo> info = new();
|
||||
List<Vector3> positions = new();
|
||||
List<WarpInfo> warps = new();
|
||||
var warpSrcs = vrm.GetComponentsInChildren<Components.ClothWarp>();
|
||||
var warpSrcs = vrm.GetComponentsInChildren<Components.ClothWarpRoot>();
|
||||
for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex)
|
||||
{
|
||||
var warp = warpSrcs[warpIndex];
|
||||
@@ -173,7 +173,7 @@ namespace ClothWarpLib.Jobs
|
||||
var parentIndex = warpRootTransformIndex.index;
|
||||
foreach (var particle in warp.Particles)
|
||||
{
|
||||
if (particle.Transform != null && particle.Mode != Components.ClothWarp.ParticleMode.Disabled)
|
||||
if (particle.Transform != null && particle.Mode != Components.ClothWarpRoot.ParticleMode.Disabled)
|
||||
{
|
||||
var outputParticleTransformIndex = GetTransformIndex((Transform)particle.Transform, new TransformInfo
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace ClothWarpLib
|
||||
public List<ClothWarpNode> _particles = new();
|
||||
public List<Transform> _particleTransforms = new();
|
||||
|
||||
public Strand MakeParticleStrand(SimulationEnv env, Components.ClothWarp warp)
|
||||
public Strand MakeParticleStrand(SimulationEnv env, Components.ClothWarpRoot warp)
|
||||
{
|
||||
var strand = new Strand();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user