VisualElement

This commit is contained in:
ousttrue
2024-11-21 02:18:46 +09:00
parent e2674dda41
commit 2ad810d27d
2 changed files with 41 additions and 19 deletions

View File

@@ -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;
}
}
}

View File

@@ -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