parent
e651039032
commit
1879ac8c53
|
@ -62,6 +62,7 @@ namespace Coffee.UIExtensions
|
||||||
private SerializedProperty m_MeshSharing;
|
private SerializedProperty m_MeshSharing;
|
||||||
private SerializedProperty m_GroupId;
|
private SerializedProperty m_GroupId;
|
||||||
private SerializedProperty m_GroupMaxId;
|
private SerializedProperty m_GroupMaxId;
|
||||||
|
private SerializedProperty m_AbsoluteMode;
|
||||||
|
|
||||||
|
|
||||||
private ReorderableList _ro;
|
private ReorderableList _ro;
|
||||||
|
@ -150,6 +151,7 @@ namespace Coffee.UIExtensions
|
||||||
m_MeshSharing = serializedObject.FindProperty("m_MeshSharing");
|
m_MeshSharing = serializedObject.FindProperty("m_MeshSharing");
|
||||||
m_GroupId = serializedObject.FindProperty("m_GroupId");
|
m_GroupId = serializedObject.FindProperty("m_GroupId");
|
||||||
m_GroupMaxId = serializedObject.FindProperty("m_GroupMaxId");
|
m_GroupMaxId = serializedObject.FindProperty("m_GroupMaxId");
|
||||||
|
m_AbsoluteMode = serializedObject.FindProperty("m_AbsoluteMode");
|
||||||
|
|
||||||
var sp = serializedObject.FindProperty("m_Particles");
|
var sp = serializedObject.FindProperty("m_Particles");
|
||||||
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
|
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
|
||||||
|
@ -265,6 +267,9 @@ namespace Coffee.UIExtensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Absolute Mode
|
||||||
|
EditorGUILayout.PropertyField(m_AbsoluteMode);
|
||||||
|
|
||||||
// Target ParticleSystems.
|
// Target ParticleSystems.
|
||||||
_ro.DoLayoutList();
|
_ro.DoLayoutList();
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,10 @@ namespace Coffee.UIExtensions
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int m_GroupMaxId = 0;
|
private int m_GroupMaxId = 0;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
[Tooltip("The particles will be emitted at the ParticleSystem position.\nMove the UIParticle/ParticleSystem to move the particle.")]
|
||||||
|
private bool m_AbsoluteMode = false;
|
||||||
|
|
||||||
private List<UIParticleRenderer> m_Renderers = new List<UIParticleRenderer>();
|
private List<UIParticleRenderer> m_Renderers = new List<UIParticleRenderer>();
|
||||||
|
|
||||||
#if !SERIALIZE_FIELD_MASKABLE
|
#if !SERIALIZE_FIELD_MASKABLE
|
||||||
|
@ -112,6 +116,17 @@ namespace Coffee.UIExtensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Absolute particle position mode.
|
||||||
|
/// The particles will be emitted at the ParticleSystem position.
|
||||||
|
/// Move the UIParticle/ParticleSystem to move the particle.
|
||||||
|
/// </summary>
|
||||||
|
public bool absoluteMode
|
||||||
|
{
|
||||||
|
get { return m_AbsoluteMode; }
|
||||||
|
set { m_AbsoluteMode = value; }
|
||||||
|
}
|
||||||
|
|
||||||
internal bool useMeshSharing
|
internal bool useMeshSharing
|
||||||
{
|
{
|
||||||
get { return m_MeshSharing != MeshSharing.None; }
|
get { return m_MeshSharing != MeshSharing.None; }
|
||||||
|
|
|
@ -248,8 +248,16 @@ namespace Coffee.UIExtensions
|
||||||
// Combine mesh to transform. ([ParticleSystem local ->] world -> renderer local)
|
// Combine mesh to transform. ([ParticleSystem local ->] world -> renderer local)
|
||||||
Profiler.BeginSample("[UIParticleRenderer] Combine Mesh");
|
Profiler.BeginSample("[UIParticleRenderer] Combine Mesh");
|
||||||
if (_parent.canSimulate)
|
if (_parent.canSimulate)
|
||||||
|
{
|
||||||
|
if (_parent.absoluteMode)
|
||||||
{
|
{
|
||||||
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * GetWorldMatrix(psPos, scale);
|
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * GetWorldMatrix(psPos, scale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var diff = _particleSystem.transform.position - _parent.transform.position;
|
||||||
|
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * Matrix4x4.Translate(diff.GetScaled(scale - Vector3.one)) * GetWorldMatrix(psPos, scale);
|
||||||
|
}
|
||||||
workerMesh.CombineMeshes(s_CombineInstances, true, true);
|
workerMesh.CombineMeshes(s_CombineInstances, true, true);
|
||||||
|
|
||||||
workerMesh.RecalculateBounds();
|
workerMesh.RecalculateBounds();
|
||||||
|
|
Loading…
Reference in New Issue