add component Warp and Cloth

This commit is contained in:
ousttrue 2024-11-15 00:10:15 +09:00
parent 9cca2a3c99
commit c2b398f0e4
16 changed files with 216 additions and 1 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78593d828a6c64142bffa9e5b8e514dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,52 @@
using UnityEditor;
using UnityEngine;
using UniVRM10;
namespace RotateParticle.Components
{
public static class Converter
{
const string FROM_VRM10_MENU = "GameObject/CreateRotateParticleFromVrm10";
[MenuItem(FROM_VRM10_MENU, true)]
public static bool IsFromVrm10()
{
var go = Selection.activeGameObject;
if (go == null)
{
return false;
}
return go.GetComponent<Vrm10Instance>() != null;
}
[MenuItem(FROM_VRM10_MENU, false)]
public static void FromVrm10()
{
var go = Selection.activeGameObject;
var instance = go.GetComponent<Vrm10Instance>();
foreach (var spring in instance.SpringBone.Springs)
{
if (spring.Joints == null || spring.Joints[0] == null)
{
continue;
}
var root = spring.Joints[0].gameObject;
if (root == null)
{
continue;
}
if (root.GetComponent<Warp>() != null)
{
continue;
}
UnityEditor.Undo.IncrementCurrentGroup();
UnityEditor.Undo.SetCurrentGroupName("VRM10SpringBoneColliderGroup.Separate");
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80a9e5abcd0197a46b50bcd2a1c62561
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
{
"name": "RotateParticle.Editor",
"rootNamespace": "",
"references": [
"GUID:308b348fb80d89d42a9620951b0f60db",
"GUID:e47c917724578cc43b5506c17a27e9a0"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a3dafcb1fb23ff148bbc17714d01144c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
# cloth 実装メモ
## component
設定置き場。布を構成する縦糸(Warp)と、縦糸を横に連結した四角格子(Cloth)の2段階とする
### Warp

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c501aa9d3818bf419f0bcb53c59e91d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a8d83c5cee1b1349a818b15bfe48c35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RotateParticle.Components
{
[AddComponentMenu("RotateParticle/Cloth")]
[DisallowMultipleComponent]
public class Cloth : MonoBehaviour
{
[SerializeField]
public bool Loop = false;
[SerializeField]
public List<Warp> Warps = new();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb08bedf8ccf007488d5907f401f289d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace RotateParticle.Components
{
[AddComponentMenu("RotateParticle/Warp")]
[DisallowMultipleComponent]
public class Warp : MonoBehaviour
{
[Serializable]
public class ParticleSettings
{
}
/// <summary>
/// VRM10SpringBoneJoint に相当する
/// </summary>
[Serializable]
public class Particle
{
public bool useInheritSettings;
public ParticleSettings OverrideSettings;
}
[SerializeField]
ParticleSettings BaseSettings;
/// <summary>
/// null のときは world root ではなく model root で処理
/// </summary>
[SerializeField]
Transform Center;
/// <summary>
/// 枝分かれ不可
/// </summary>
[SerializeField]
List<Particle> Particles = new List<Particle>();
void Reset()
{
Debug.Log("Warp.Reset");
}
void OnValidate()
{
// 枝分かれを削除
Debug.Log("Warp.OnValidate");
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d9e9d5010d025b4c9cdfb03eb8b1b0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -274,5 +274,9 @@ namespace RotateParticle
public void SetModelLevel(Transform modelRoot, BlittableModelLevel modelSettings)
{
}
public void DrawGizmos()
{
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cfa6b58a8a8571e478cf6bac4a00a23d
guid: d81d1a51508391a468106bec0350d41b
folderAsset: yes
DefaultImporter:
externalObjects: {}