mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-09 12:29:23 -05:00
VisualElement
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UniVRM10;
|
||||
|
||||
namespace RotateParticle.Components
|
||||
@@ -20,24 +22,44 @@ namespace RotateParticle.Components
|
||||
m_vrm = m_target.GetComponentInParent<Vrm10Instance>();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
// public override void OnInspectorGUI()
|
||||
// {
|
||||
// var n = EditorUtility.GetDirtyCount(m_target.GetInstanceID());
|
||||
// base.OnInspectorGUI();
|
||||
// if (n != EditorUtility.GetDirtyCount(m_target.GetInstanceID()))
|
||||
// {
|
||||
// if (m_vrm != null)
|
||||
// {
|
||||
// if (Application.isPlaying)
|
||||
// {
|
||||
// m_vrm.Runtime.SpringBone.SetJointLevel(m_target.transform, m_target.BaseSettings);
|
||||
// foreach (var p in m_target.Particles)
|
||||
// {
|
||||
// m_vrm.Runtime.SpringBone.SetJointLevel(p.Transform, p.GetSettings(m_target.BaseSettings));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public override VisualElement CreateInspectorGUI()
|
||||
{
|
||||
var n = EditorUtility.GetDirtyCount(m_target.GetInstanceID());
|
||||
base.OnInspectorGUI();
|
||||
if (n != EditorUtility.GetDirtyCount(m_target.GetInstanceID()))
|
||||
{
|
||||
if (m_vrm != null)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
m_vrm.Runtime.SpringBone.SetJointLevel(m_target.transform, m_target.BaseSettings);
|
||||
foreach (var p in m_target.Particles)
|
||||
{
|
||||
m_vrm.Runtime.SpringBone.SetJointLevel(p.Transform, p.GetSettings(m_target.BaseSettings));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var root = new VisualElement();
|
||||
|
||||
// var container = new IMGUIContainer(OnInspectorGUI);
|
||||
// root.Add(container);
|
||||
|
||||
root.Bind(serializedObject);
|
||||
|
||||
var s = new PropertyField { bindingPath = "m_Script" };
|
||||
s.SetEnabled(false);
|
||||
root.Add(s);
|
||||
root.Add(new PropertyField { bindingPath = nameof(Warp.BaseSettings) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(Warp.Center) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(Warp.Particles) });
|
||||
root.Add(new PropertyField { bindingPath = nameof(Warp.ColliderGroups) });
|
||||
|
||||
return root;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ namespace RotateParticle.Jobs
|
||||
Warps = _warps,
|
||||
Info = _info,
|
||||
NextPositions = _nextPositions,
|
||||
}.Schedule(_warps.Length, 1, handle);
|
||||
}.Schedule(_warps.Length, 16, handle);
|
||||
|
||||
// collision
|
||||
handle = new CollisionJob
|
||||
@@ -244,7 +244,7 @@ namespace RotateParticle.Jobs
|
||||
CurrentTransforms = _inputData,
|
||||
NextPositions = _nextPositions,
|
||||
NextRotations = _nextRotations,
|
||||
}.Schedule(_warps.Length, 1, handle);
|
||||
}.Schedule(_warps.Length, 16, handle);
|
||||
|
||||
// output
|
||||
handle = new OutputTransformJob
|
||||
|
||||
Reference in New Issue
Block a user