You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-06-30 12:43:52 +00:00
Compare commits
6 Commits
64a050f17c
...
0441238cc5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0441238cc5 | ||
|
|
639bc9c342 | ||
|
|
b3d42a2478 | ||
|
|
418b257ae2 | ||
|
|
664c7963ea | ||
|
|
7363f7497c |
@@ -49,6 +49,7 @@ namespace Coffee.UIExtensions
|
|||||||
private static readonly GUIContent s_ContentRandom = new GUIContent("Random");
|
private static readonly GUIContent s_ContentRandom = new GUIContent("Random");
|
||||||
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
||||||
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
||||||
|
private static readonly GUIContent s_Remove = new GUIContent("Remove");
|
||||||
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
||||||
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
||||||
|
|
||||||
@@ -82,18 +83,6 @@ namespace Coffee.UIExtensions
|
|||||||
"_ColorMask"
|
"_ColorMask"
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ドメインリロード無効化対応:静的キャッシュをクリア
|
|
||||||
/// </summary>
|
|
||||||
[InitializeOnLoadMethod]
|
|
||||||
private static void OnDomainReload()
|
|
||||||
{
|
|
||||||
s_Shaders.Clear();
|
|
||||||
#if UNITY_2018 || UNITY_2019
|
|
||||||
s_Streams.Clear();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
// Public/Protected Members.
|
// Public/Protected Members.
|
||||||
//################################
|
//################################
|
||||||
|
|||||||
@@ -195,13 +195,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
private static T s_Instance;
|
private static T s_Instance;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
#if UNITY_2019_3_OR_NEWER
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnDomainReload()
|
|
||||||
{
|
|
||||||
s_Instance = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
private string _jsonText;
|
private string _jsonText;
|
||||||
|
|
||||||
public static bool hasInstance => s_Instance != null;
|
public static bool hasInstance => s_Instance != null;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
private static void Clear()
|
private static void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
public static Func<string, Shader> onShaderFind = Shader.Find;
|
public static Func<string, Shader> onShaderFind = Shader.Find;
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
public static void Clear()
|
public static void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,22 +82,14 @@ namespace Coffee.UIParticleInternal
|
|||||||
message: "InitializeAfterCanvasRebuild");
|
message: "InitializeAfterCanvasRebuild");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
#if UNITY_EDITOR
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
#elif UNITY_EDITOR
|
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
#else
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
|
||||||
#endif
|
#endif
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||||
s_IsInitializedAfterCanvasRebuild = false;
|
s_IsInitializedAfterCanvasRebuild = false;
|
||||||
s_AfterCanvasRebuildAction.Clear();
|
|
||||||
s_LateAfterCanvasRebuildAction.Clear();
|
|
||||||
s_BeforeCanvasRebuildAction.Clear();
|
|
||||||
s_OnScreenSizeChangedAction.Clear();
|
|
||||||
s_LastScreenSize = default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
_gameObjects = targets.OfType<ParticleSystemPreviewer>().Select(x => x.gameObject).ToArray();
|
_gameObjects = targets.OfType<ParticleSystemPreviewer>().Select(x => x.gameObject).ToArray();
|
||||||
ParticleSystemPreviewSystem.Register(_gameObjects);
|
ParticleSystemPreviewSystem.Register(_gameObjects);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
@@ -46,19 +47,6 @@ namespace Coffee.UIExtensions
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private List<GameObject> m_PreviewObjects = new List<GameObject>();
|
private List<GameObject> m_PreviewObjects = new List<GameObject>();
|
||||||
|
|
||||||
#if UNITY_2019_3_OR_NEWER
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
#else
|
|
||||||
[InitializeOnLoadMethod]
|
|
||||||
#endif
|
|
||||||
public static void Initialize()
|
|
||||||
{
|
|
||||||
instance.OnSelectionChanged();
|
|
||||||
|
|
||||||
Selection.selectionChanged -= instance.OnSelectionChanged;
|
|
||||||
Selection.selectionChanged += instance.OnSelectionChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a temporary ParticleSystem to the specified GameObject for preview purposes.
|
/// Adds a temporary ParticleSystem to the specified GameObject for preview purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -78,18 +66,25 @@ namespace Coffee.UIExtensions
|
|||||||
if (!target) return;
|
if (!target) return;
|
||||||
if (EditorApplication.isPlaying) return;
|
if (EditorApplication.isPlaying) return;
|
||||||
if (instance.m_PreviewObjects.Contains(target)) return;
|
if (instance.m_PreviewObjects.Contains(target)) return;
|
||||||
if (target.TryGetComponent<ParticleSystem>(out var ps))
|
if (target.TryGetComponent<ParticleSystem>(out var _)) return;
|
||||||
{
|
|
||||||
if (ps.hideFlags == k_TemporaryHideFlags)
|
|
||||||
{
|
|
||||||
RegisterParticleSystem(ps);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create temporary ParticleSystem for preview.
|
// Create temporary ParticleSystem for preview.
|
||||||
RegisterParticleSystem(target.AddComponent<ParticleSystem>());
|
var ps = target.AddComponent<ParticleSystem>();
|
||||||
|
ps.hideFlags = k_TemporaryHideFlags;
|
||||||
|
|
||||||
|
var emission = ps.emission;
|
||||||
|
emission.enabled = false;
|
||||||
|
var shape = ps.shape;
|
||||||
|
shape.enabled = false;
|
||||||
|
|
||||||
|
if (target.TryGetComponent<ParticleSystemRenderer>(out var psr))
|
||||||
|
{
|
||||||
|
psr.enabled = false;
|
||||||
|
psr.hideFlags = k_TemporaryHideFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.m_PreviewObjects.Add(target);
|
||||||
|
EditorUtility.SetDirty(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -110,26 +105,6 @@ namespace Coffee.UIExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterParticleSystem(ParticleSystem ps)
|
|
||||||
{
|
|
||||||
if (!ps) return;
|
|
||||||
ps.hideFlags = k_TemporaryHideFlags;
|
|
||||||
|
|
||||||
var emission = ps.emission;
|
|
||||||
emission.enabled = false;
|
|
||||||
var shape = ps.shape;
|
|
||||||
shape.enabled = false;
|
|
||||||
|
|
||||||
if (ps.TryGetComponent<ParticleSystemRenderer>(out var psr))
|
|
||||||
{
|
|
||||||
psr.enabled = false;
|
|
||||||
psr.hideFlags = k_TemporaryHideFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
instance.m_PreviewObjects.Add(ps.gameObject);
|
|
||||||
EditorUtility.SetDirty(ps.gameObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the temporary ParticleSystem associated with the specified GameObject.
|
/// Removes the temporary ParticleSystem associated with the specified GameObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -170,6 +145,17 @@ namespace Coffee.UIExtensions
|
|||||||
&& ps.hideFlags != k_TemporaryHideFlags;
|
&& ps.hideFlags != k_TemporaryHideFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
Selection.selectionChanged -= OnSelectionChanged;
|
||||||
|
Selection.selectionChanged += OnSelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
Selection.selectionChanged -= OnSelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSelectionChanged()
|
private void OnSelectionChanged()
|
||||||
{
|
{
|
||||||
var selectedGameObjects = Selection.gameObjects;
|
var selectedGameObjects = Selection.gameObjects;
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ namespace Coffee.UIExtensions
|
|||||||
var ps = particles[i];
|
var ps = particles[i];
|
||||||
if (!ps
|
if (!ps
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|| (ps.hideFlags & HideFlags.DontSave) != 0 // Dummy ParticleSystems for preview.
|
|| ps.hideFlags == HideFlags.HideAndDontSave // Dummy ParticleSystems for preview.
|
||||||
|| ps.gameObject.CompareTag("EditorOnly") // Ignore "EditorOnly" tagged ParticleSystems.
|
|| ps.gameObject.CompareTag("EditorOnly") // Ignore "EditorOnly" tagged ParticleSystems.
|
||||||
#endif
|
#endif
|
||||||
|| ps.GetComponentInParent<UIParticle>(true) != this) // Ignore ParticleSystems that are not under this UIParticle.
|
|| ps.GetComponentInParent<UIParticle>(true) != this) // Ignore ParticleSystems that are not under this UIParticle.
|
||||||
|
|||||||
@@ -39,17 +39,6 @@ namespace Coffee.UIExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
#if UNITY_2019_3_OR_NEWER
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnDomainReload()
|
|
||||||
{
|
|
||||||
s_ActiveParticles.Clear();
|
|
||||||
s_ActiveAttractors.Clear();
|
|
||||||
s_UpdatedGroupIds.Clear();
|
|
||||||
s_FrameCount = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user